CSP Credential Theft Without JavaScript via Missing form-action or Allowed Same-Page Submissions, meta refresh, and Referer
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
-
Overview Article Title: Blind trust: stealing credentials through CSP Publisher: PortSwigger Research Publication Date: 2026-11-11T14:26:00Z Original: PortSwigger Research Updated Date: 2026-11-12T15:55:00Z Author’s Response Priority: High Priority Rationale: The research reproducibly demonstrates that credential exfiltration can succeed without JavaScript even under a policy containing default-src ‘none’, when form-action is omitted or allows submissions to the same page. These implementation conditions can be overlooked in CSP assessments. This is the report author’s prioritization, not an official vendor severity rating or CVSS score. Related Materials: None
-
概述 文章标题:盲目信任:通过 CSP 窃取凭据 发布者:PortSwigger Research 发布日期:2026-11-11T14:26:00Z 原文:PortSwigger Research 更新日期:2026-11-12T15:55:00Z 作者响应优先级:高 优先级理由:该研究可重复地证明,即使在包含 default-src ‘none’ 的策略下,当 form-action 被省略或允许提交到同一页面时,无需 JavaScript 也能成功进行凭据外泄。这些实施条件在 CSP 评估中容易被忽视。这是报告作者的优先级排序,而非官方供应商严重性评级或 CVSS 分数。 相关材料:无
-
Key Takeaways PortSwigger added a PoC to its Burp AT skill that uses reflected HTML injection and takes advantage of the fact that CSP’s form-action directive does not fall back to default-src. By leveraging settings where form-action is either unspecified or permits same-page submissions, the PoC uses only a form submission and a meta referrer/refresh to load credentials into the Referer header. The public demo page itself sets default-src ‘none’; form-action ‘self’, which permits GET submissions to the same page and enables the attack. The CSP form-action directive does not fall back to default-src. If form-action is unspecified, form submission destinations cannot be restricted solely by default-src ‘none’.
-
关键要点 PortSwigger 在其 Burp AT 技能中添加了一个概念验证(PoC),该 PoC 使用反射型 HTML 注入,并利用了 CSP 的 form-action 指令不会回退到 default-src 的事实。通过利用 form-action 未指定或允许同页面提交的设置,该 PoC 仅使用表单提交和 meta referrer/refresh 即可将凭据加载到 Referer 标头中。公开演示页面本身设置了 default-src ‘none’; form-action ‘self’,这允许向同一页面进行 GET 提交并促成了攻击。CSP 的 form-action 指令不会回退到 default-src。如果未指定 form-action,则无法仅通过 default-src ‘none’ 限制表单提交目标。
-
Research Objectives Determine whether credentials can be exfiltrated through directive fallback gaps even when script execution is blocked by CSP. Evaluate whether CSP bypass assessment and PoC generation can be automated using agent skills.
-
研究目标 确定即使在 CSP 阻止脚本执行的情况下,是否可以通过指令回退漏洞外泄凭据。评估是否可以使用代理技能实现 CSP 绕过评估和 PoC 生成的自动化。
-
Methodology and Workflow Parse policies and evaluate multiple policy intersections, fallbacks, and allow-list gadgets. Generate a PoC using two-stage HTML injection and meta navigation when form-action is unspecified or permits same-page submissions, even without script gadgets. Workflow: HTML injection -> injected form with credential input fields performing a GET request to the same-origin second stage -> second-stage payload in a textarea is reflected and interpreted as a meta element -> unsafe-url Referrer-Policy -> meta refresh -> Collaborator receipt.
-
方法与工作流程 解析策略并评估多个策略交集、回退和允许列表小工具。在 form-action 未指定或允许同页面提交时,即使没有脚本小工具,也通过两阶段 HTML 注入和 meta 导航生成 PoC。工作流程:HTML 注入 -> 带有凭据输入字段的注入表单执行到同源第二阶段的 GET 请求 -> textarea 中的第二阶段有效载荷被反射并解释为 meta 元素 -> unsafe-url Referrer-Policy -> meta refresh -> Collaborator 接收。
-
Inputs and Outputs Inputs: CSP headers, reflected HTML injection points, injected forms containing credential input fields with reflection parameters, and Burp requests/responses. Knowledge base of over 350 allow-list gadgets including JSONP and AngularJS. Outputs: Verdicts per directive, preconditions, and a PoC that sends a Referer containing credentials to Collaborator.
-
输入与输出 输入:CSP 标头、反射型 HTML 注入点、包含带有反射参数的凭据输入字段的注入表单,以及 Burp 请求/响应。包含超过 350 个允许列表小工具(包括 JSONP 和 AngularJS)的知识库。 输出:每个指令的结论、前提条件,以及一个将包含凭据的 Referer 发送到 Collaborator 的 PoC。
-
Evaluation Design Scope: PortSwigger’s controlled PoC and policy analysis using the Burp AT skill. Success Metric: The Referer of the Collaborator request contains the input credentials without using JavaScript. Human Role: A tester specifies the reflection parameter or verifies the skill’s estimation, and executes the PoC in a safe environment.
-
评估设计 范围:PortSwigger 的受控 PoC 以及使用 Burp AT 技能进行的策略分析。 成功指标:Collaborator 请求的 Referer 在不使用 JavaScript 的情况下包含输入的凭据。 人工角色:测试人员指定反射参数或验证技能的评估结果,并在安全环境中执行 PoC。
-
Results In the public demo, form-action ‘self’ permitted GET submissions to the same page, allowing Referer exfiltration via the second-stage meta element and external navigation. As per the specification, default-src does not apply when form-action is unspecified. Meta refresh is a navigation action, and this chain was not subject to CSP script restrictions. Collaborator received the full URL containing credentials via the Referer header.
-
结果 在公开演示中,form-action ‘self’ 允许向同一页面进行 GET 提交,从而允许通过第二阶段 meta 元素和外部导航进行 Referer 外泄。根据规范,当未指定 form-action 时,default-src 不适用。Meta refresh 是一种导航操作,此链条不受 CSP 脚本限制。Collaborator 通过 Referer 标头接收到了包含凭据的完整 URL。
-
Practical Implications Even default-src ‘none’ does not guarantee that unspecified directives are safe. CSP evaluations must examine page structures, fallbacks, navigation mechanisms, and Referrer-Policy settings rather than header strings alone.
-
实际影响 即使是 default-src ‘none’ 也不能保证未指定的指令是安全的。CSP 评估必须检查页面结构、回退、导航机制和 Referrer-Policy 设置,而不仅仅是检查标头字符串。
-
Preconditions, Limitations, and Application Preconditions: Presence of attacker-controlled HTML injection. form-action is either unspecified or configured to permit destinations such as the same page. Users enter credentials into the injected form and submit it. The second-stage payload within a textarea is reflected, interpreted as a meta element, and causes the browser to send the full URL Referer externally. Limitations: While JavaScript is not required, HTML injection and specific page structures are necessary. Real-world exploitation has not been observed. Results may vary depending on the browser, Referrer-Policy, and URL processing behavior. Application Guidance: Explicitly define destination allow-lists using form-action. However, settings like form-action ‘self’ or permissions allowing submissions to vulnerable same pages do not prevent this technique. Setting Referrer-Policy to no-referrer or strict-origin variants is a common mitigation, but it does not serve as a standalone defense because an injected meta referrer can override the document policy to unsafe-url. The primary countermeasure is fixing HTML injection vulnerabilities through context-aware output encoding and trusted templating. Validate multiple policies in real browsers.
-
前提条件、局限性与应用 前提条件:存在攻击者可控的 HTML 注入。form-action 未指定或配置为允许诸如同一页面之类的目标。用户将凭据输入到注入的表单中并提交。textarea 内的第二阶段有效载荷被反射、解释为 meta 元素,并导致浏览器在外部发送完整的 URL Referer。 局限性:虽然不需要 JavaScript,但需要 HTML 注入和特定的页面结构。尚未观察到现实世界的利用。结果可能因浏览器、Referrer-Policy 和 URL 处理行为而异。 应用指南:使用 form-action 明确定义目标允许列表。然而,诸如 form-action ‘self’ 或允许提交到易受攻击的同页面的权限设置并不能阻止此技术。将 Referrer-Policy 设置为 no-referrer 或 strict-origin 变体是一种常见的缓解措施,但它不能作为独立的防御手段,因为注入的 meta referrer 可以将文档策略覆盖为 unsafe-url。主要的对策是通过上下文感知输出编码和受信任的模板来修复 HTML 注入漏洞。在真实浏览器中验证多个策略。