Menu

XXE is a parser setting: how to test it and how to actually fix it
📰

XXE is a parser setting: how to test it and how to actually fix it

DEV Community: appsec·Rocky·1 day ago
#1aeCE7GE
#devtoappsec#devto#dev#parser#entity
Long article (494 words) — no AI summary yet.
Reading 0:00
15s threshold

An application has an "import from XML" feature. Someone uploads a file, the server parses it and shows the result. If the parser is on default settings, that feature may be vulnerable to XML External Entity injection.

The mechanism

XML lets a document declare entities in a DOCTYPE. Some entities point outward, to a file or a URL. If the parser resolves them and the application returns parsed content, whatever the entity pointed at ends up in the response.

A safe way to test it

Run this only against a lab or a system you are authorised to test. The document declares an entity for a harmless local file and references it in a field the page echoes back:

<?xml version="1.0"?> <!DOCTYPE item [ <!ENTITY probe SYSTEM "file:///etc/hostname"> ]> <item><name> &probe; </name></item>

Enter fullscreen mode

Exit fullscreen mode

If the hostname appears where the name should be, the parser resolved the external entity. That is the finding.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.