> For the complete documentation index, see [llms.txt](https://docs.sec1.io/user-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sec1.io/user-docs/4-sast/3-javascript/unsanitized-user-input-in-xml-parsing-method.md).

# Unsanitized user input in XML parsing method

## Overview

* **Rule ID**: `javascript_express_xml_external_entity_vulnerability`
* **Applicable Languages**: Javascript
* **Weakness ID**: CWE-611

## Description

Unsanitized user input in XML parsing can lead to XML External Entity (XXE) injection. This vulnerability occurs when XML input containing a reference to an external entity is processed by an XML parser. The external entity can reference a file URI or network resource, potentially allowing an attacker to access sensitive data or interact with internal systems.

## Remediation Guidelines

* **Do not** parse XML input containing untrusted data without proper sanitization. External entities within the XML should be treated with caution.

  ```javascript
  var libxml = require("libxmljs");
  libxml.parseXmlString(xml, { noent: false, noblanks: true });


  ```
* **Do not** enable the parsing of external entities in XML parsers. **Ensure** the `noent` option is set to `false` to prevent XXE attacks.

## References

* [**OWASP XML External Entity (XXE) prevention cheat sheet**](https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html)
* [**CWE-611: Improper Restriction of XML External Entity Reference**](https://cwe.mitre.org/data/definitions/611.html)
* [**OWASP Top 10: A05:2021 - Security Misconfiguration**](https://owasp.org/Top10/A05_2021-Security_Misconfiguration/)

## Configuration

To omit this rule during a scan, and to provide you with continuous 24/7 code-level scanning, you can employ our [**SAST TOOL**](https://scopy.sec1.io/login)
