High severityJavaXML External Entities (XXE)MEDIUM confidence
XXE Documentbuilderfactory
A DocumentBuilderFactory is created without disabling DOCTYPE/external entity processing, exposing XML External Entity injection (CWE-611).
Standards mapping
- OWASP Top 10
- A05:2021 - Security Misconfiguration
- OWASP ASVS
- V5.5.2 (L1)
Vulnerable vs. safe
Flagged by this check
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();Passes - the safe pattern
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();Why it matters & how to fix it
A DocumentBuilderFactory is created without disabling DOCTYPE/external entity processing, exposing XML External Entity injection (CWE-611). Harden it before parsing untrusted XML: setFeature("http://apache.org/xml/features/disallow-doctype-decl", true), disable external-general/parameter-entities, and setXIncludeAware(false)/setExpandEntityReferences(false).
References
Rule ID integsec-java-xxe-documentbuilderfactory - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- Python - XML External Entities (XXE)Lxml XXE Resolve Entities
- Python - XML External Entities (XXE)XML Etree Parse Untrusted
- Java - XML External Entities (XXE)XXE Saxparserfactory
- Java - XML External Entities (XXE)XXE Transformerfactory
- Java - XML External Entities (XXE)XXE Xmlinputfactory
- C# - XML External Entities (XXE)Dtdprocessing Parse