Back to Skills

dangling-markup-injection

Dangling markup injection playbook. Use when HTML injection is possible but JavaScript execution is blocked (CSP, sanitizer strips event handlers, WAF blocks script tags) — exfiltrate CSRF tokens, session data, and page content by injecting unclosed HTML tags that capture subsequent page content.

1,297stars177forksUpdated 7/7/2026

Security Assessment

Safe(100/100)
Security Score100/100

About dangling-markup-injection

A web-security playbook for exfiltrating sensitive page data through HTML injection when JavaScript execution is blocked, for instance when a Content Security Policy forbids inline scripts and event handlers, a sanitizer strips script tags and handlers, or a WAF blocks known XSS patterns. The core insight is that stealing data does not require JavaScript; it only requires the browser to make a request whose URL contains the data. An unclosed tag attribute (a src, href, or action) 'consumes' subsequent page markup until a matching quote, sweeping content such as CSRF tokens and pre-filled form values into a request sent to an attacker-controlled server.

It enumerates the conditions under which the technique applies, then details exfiltration vectors: image tags (the most common), form-action hijacking, base-tag hijacking that reroutes relative URLs, meta-refresh redirects, link/stylesheet requests, legacy table backgrounds, and video/audio poster attributes, each annotated with the CSP directive that would block it. A table maps target data (CSRF tokens, pre-filled email, in-page API keys, session IDs, auto-filled passwords, OAuth state) to how it appears in the page and the corresponding steal technique. Browser-specific behavior is documented, including Chrome's blocking of dangling markup in img src values that contain '<' or newlines and the recommended fallback to form-action injection.

Use this when assessing an injection point that first appears unexploitable because scripts are blocked but sensitive data sits after the injection in the response. Advanced sections describe selective consumption by choosing the opposite quote type, a textarea-plus-form combination, comment and style dangling, and using an iframe name attribute together with window.name persistence across origins. The material is framed for authorized security testing and points to related skills for full XSS, CSP bypass, CSRF, CRLF injection, and web cache deception when dangling markup is combined into a larger chain.

FAQ

When is dangling markup the right technique?

When you have an HTML injection point, JavaScript execution is blocked (CSP, sanitizer, or WAF), and sensitive data such as CSRF tokens or form values appears after your injection point in the page.

What can be stolen this way?

CSRF tokens, pre-filled email or username values, in-page API keys, session IDs in hidden fields, auto-filled passwords, OAuth state/tokens, and internal URLs.

How does Chrome affect the attack?

Chrome blocks dangling markup in img src values containing a '<' character or newlines; the recommended workaround is form-action injection, which its block does not target.

Which CSP directives block these vectors?

Each vector notes its blocker, for example img-src blocks image and table-background exfiltration, form-action blocks form hijacking, base-uri blocks base-tag hijacking, and style-src blocks stylesheet exfiltration.

Does it require user interaction?

Often not; image and link requests fire automatically, and a form can auto-submit via an existing submit button or script, though form hijacking may otherwise depend on a click.

Install dangling-markup-injection

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill