Security weakness
CWE-611 XML external entity (XXE)
An XML file your server processes can instruct it to read local files or contact other systems.
- Senior security engineers
- 540+ projects delivered
- Reply within one business day
Quick answer
What is CWE-611?
Improper Restriction of XML External Entity Reference: The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.
Business impact
What CWE-611 could cost your business
MITRE documents what this weakness can do. Here is what that means for a website, store or app.
Confidentiality
Private data exposed
Customer records, credentials, orders or internal files can be read by people who should never see them.
- Read Application Data
- Read Files or Directories
Integrity
Data, pages or code changed
Prices, orders, content or the code your site runs can be altered without your approval.
- Bypass Protection Mechanism
Availability
Downtime and lost sales
Crashes, slowdowns or exhausted resources can take your site, store or app offline.
- DoS: Resource Consumption (CPU)
- DoS: Resource Consumption (Memory)
In plain English
What XML external entity (XXE) means for your business
- 540+projects delivered
- 9+years in business
- 23+certified experts
A senior engineer replies within one business day.
XML is a text format used for data feeds, documents and messages between systems. The XML standard includes a feature called external entities, which lets a document pull in content from another file or web address. XXE happens when your software reads XML from an untrusted source with that feature switched on. The document can then tell the parser to fetch things its author should never be able to reach.
For a business, the main risk is data theft from the server itself. A malicious XML file can cause the application to read configuration files, including ones that hold database passwords and API keys, and return their contents. It can also make your server send requests to internal systems behind the firewall, or overload it with a document that expands to an enormous size. Many sites handle XML without realizing it.
Where it shows up
- Product, inventory and price feed importers on stores that accept XML files from suppliers, marketplaces or logged-in users and parse them on the server.
- Upload features for office documents and SVG images, which are XML inside and are often parsed for previews, thumbnails or text extraction.
- SOAP web services, XML-RPC endpoints and older integrations with payment, shipping or accounting systems that exchange XML messages with outside parties.
- Single sign-on logins based on SAML, where the server parses an XML response before it has verified who sent it.
Free security check
Is CWE-611 hiding in your site?
A senior engineer checks your site, store or app for this weakness and the rest of the CWE Top 25, then sends a prioritized fix plan within one business day. No obligation.
Official definition
How MITRE defines CWE-611
Improper Restriction of XML External Entity Reference
The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.
Also known as: XXE
Fix it
How to fix XML external entity (XXE)
Practical steps in priority order. Share them with your developer or agency.
Disable external entities and DTDs
Configure every XML parser to disallow document type definitions, or DTDs, and external entity resolution. Settings differ by language and library, so check each parser you use instead of trusting its defaults.
Update parsers and their dependencies
Keep your XML libraries, language runtime and frameworks current, since newer releases often ship safer defaults. Include indirect users of XML, such as document converters, SVG handlers and SAML libraries, in your update routine.
Prefer simpler data formats
Where you control both ends of an integration, exchange JSON instead of XML. Where XML is required, validate documents against a strict local schema and reject anything containing a document type declaration.
Limit size and processing effort
Cap upload size, entity expansion and parsing time so an oversized or self-expanding document cannot exhaust memory. Process untrusted files in a background worker with strict resource limits, not in the web request.
Restrict what the parser can reach
Run XML processing under an account with minimal file permissions, and block outbound network access from that service where possible. Keep error messages generic so parser output is never echoed back to the sender.
Signs you may be affected
- Your site imports or accepts XML, SVG or office documents from users or third parties.
- XML parsing code uses library defaults and nobody has reviewed its entity settings.
- The server makes unexpected outbound requests or slows sharply while processing an uploaded file.
Questions to ask your developer
- Where does our site parse XML, including SVG, office files and SAML?
- Are external entities and DTDs disabled in every XML parser we use?
- Can the service that processes uploads read sensitive files or reach internal systems?
Prevention
What MITRE recommends, phase by phase
Every mitigation from the CWE entry, in the order a project runs: plan, build, test, operate.
- 01
Implementation
- Many XML parsers and validators can be configured to disable external entity expansion.
Detection and evidence
How CWE-611 is found, and where it has hit
The testing methods MITRE recommends, and real vulnerabilities this weakness has caused.
How it is detected
- Automated Static AnalysisAutomated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then.
Real vulnerabilities it caused
- CVE-2022-42745Recruiter software allows reading arbitrary files using XXE
- CVE-2005-1306A browser control can allow remote attackers to determine the existence of files via Javascript containing XML script.
- CVE-2012-5656XXE during SVG image conversion
- CVE-2012-2239XXE in PHP application allows reading the application’s configuration file.
- CVE-2012-3489XXE in database server
- CVE-2012-4399XXE in rapid web application development framework allows reading arbitrary files.
How we fix it
From finding to fixed: how Codefreex closes CWE-611
Scan and confirm
We test your site, store or app for this weakness and the rest of the CWE Top 25 with automated scanning and manual review, and confirm what is actually exploitable.
Fix at the source
We change the code, configuration or dependency that causes it, not just the symptom, and plan the changes to avoid downtime.
Verify the fix
We retest every finding, check that nothing else broke and hand you a short report you can share with your team, client or auditor.
Keep it fixed
Updates, monitoring and maintenance so the weakness does not return with the next plugin, theme, app or code change.
Website SecurityPenetration TestingMalware Removal & Hack RepairWordPress Maintenance
Related weaknesses
Weaknesses related to CWE-611
FAQ
CWE-611: FAQs
Short answers for owners and developers. Not sure whether your site is affected? Ask us to check.
How serious is an XXE vulnerability?
It can be serious. The typical outcome is disclosure of files on the server, which may include passwords and keys that unlock much more. It can also be used to reach internal systems or to make the server unresponsive. The actual impact depends on what the parsing process is allowed to read and connect to.
How do I prevent XXE?
Turn off external entities and document type definitions in every XML parser, and confirm the setting with a test. Keep parsing libraries up to date. Use JSON for new integrations where you have the choice. Remember the hidden XML in SVG images, office documents and SAML logins, and apply the same settings there.
My site does not use XML. Could I still be affected?
Possibly. XML is often present without being obvious. SVG images, word processor and spreadsheet files, RSS feeds, sitemaps, SAML single sign-on and some payment or shipping integrations all rely on it. If your site accepts any of these from users or outside systems and processes them on the server, ask your developer to check the parser settings.
What is CWE-611?
CWE-611, “Improper Restriction of XML External Entity Reference”, is a software weakness catalogued by MITRE in the Common Weakness Enumeration. The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.
How serious is CWE-611?
It can affect confidentiality, integrity, availability, with impacts such as read application data, read files or directories, bypass protection mechanism. The real risk depends on where the weakness sits and what data or functions it exposes.
How do you prevent CWE-611?
Many XML parsers and validators can be configured to disable external entity expansion.
Can Codefreex check my site for CWE-611?
Yes. A senior engineer reviews your site, store or app for CWE-611 and the rest of the CWE Top 25, confirms what is exploitable and sends a prioritized fix plan within one business day. Start with the free security check form on this page.
Free security check
Find out if CWE-611 affects your site
Send your URL. A senior engineer checks for this weakness and the rest of the CWE Top 25, and replies within one business day with what to fix first.
- A senior strategist reviews your request, not a sales bot
- Clear scope, timeline and estimate within one business day
- Free 30-minute discovery call, no obligation
- NDA available on request
- Emailhello@codefreex.com
- CallUSA +1 (209) 375-3475 · India +91 790 3375 530
- Prefer to talk?Book a 30-minute call
Weakness data from the Common Weakness Enumeration (CWE®) version 5.0, Copyright © 2006–2026, The MITRE Corporation. CWE is free to use by any organization or individual for any research, development, and/or commercial purposes under the CWE Terms of Use. CWE is a registered trademark of The MITRE Corporation. The business impact, risk profile and plain-English guidance on this page are written by Codefreex and are general information, not a security assessment of your system.