HawkScan Test Info for XML External Entity Attack

XML External Entity Attack


Plugin Id: 90023 | CWE: 611


To mitigate the risks associated with XML External Entity (XXE) attacks, the following measures can be taken:

  1. Disable external entity processing: By disabling the processing of external entities, the vulnerability can be mitigated. This can be achieved by configuring the XML parser to disallow the use of external entities. For example, in Java, you can set the FEATURE_SECURE_PROCESSING property to true to disable external entity processing:

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
  2. Input validation: Implement strict input validation to ensure that only trusted and expected XML data is accepted. This includes validating the structure, content, and format of the XML input. Use XML schema validation or a similar mechanism to enforce strict validation rules.

  3. Use whitelisting: Maintain a whitelist of allowed XML entities and reject any input that references external entities not present in the whitelist. This approach ensures that only trusted entities are processed.

  4. Use safe XML parsing libraries: Some XML parsing libraries have built-in protections against XXE attacks. It is recommended to use these libraries instead of custom or outdated parsers. For example, in Java, consider using libraries like OWASP’s ESAPI or Apache’s XML Security for Java.

  5. Secure configuration: Ensure that the XML parser is configured securely. Disable unnecessary features and limit the resources available to the parser to prevent denial-of-service attacks. Regularly update and patch the XML processing libraries to benefit from the latest security enhancements.


XML External Entity (XXE) attack is a technique that exploits the ability of XML to dynamically build documents during processing. By manipulating the entity values in an XML message, an attacker can inject malicious data, alter referrals, or compromise the security of the server or XML application. This vulnerability can be used to download and execute malicious code on the server, leading to further attacks.


The risks associated with XML External Entity (XXE) attacks include:

  1. Confidentiality breach: Attackers can access sensitive information by exploiting XXE vulnerabilities. This includes reading files on the server, accessing internal resources, or retrieving data from external systems.

  2. Server compromise: XXE attacks can lead to the compromise of the server hosting the XML application. Attackers can execute arbitrary code, escalate privileges, or launch secondary attacks from the compromised server.

  3. Denial-of-Service (DoS): By exploiting XXE vulnerabilities, attackers can consume excessive resources on the server, leading to a DoS condition. This can result in service disruption and impact the availability of the XML application.

  4. Data integrity compromise: XXE attacks can manipulate the data processed by the XML application, leading to data integrity issues. Attackers can modify or delete critical data, inject malicious content, or tamper with the application’s functionality.

It is crucial to address and mitigate XXE vulnerabilities to protect the confidentiality, integrity, and availability of XML-based applications and systems.