cwe-91-xml-injection

Remediate CWE-91 XML Injection vulnerabilities in Java code.

3|1|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/DevelopersCoffee/java-cwe-security-skills --skill cwe-91-xml-injection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cwe-91-xml-injection
Source: https://github.com/DevelopersCoffee/java-cwe-security-skills/tree/main/cwe-91-xml-injection
Command: npx skills add https://github.com/DevelopersCoffee/java-cwe-security-skills --skill cwe-91-xml-injection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical security vulnerability of XML Injection in Java applications, preventing malicious data from being interpreted as XML commands.

Core Features & Use Cases

  • Vulnerability Remediation: Provides deterministic fixes for CWE-91 XML Injection.
  • Secure Code Generation: Offers examples of using XML libraries and proper escaping techniques.
  • Use Case: When a SAST tool flags an XML Injection vulnerability in your Java code, use this Skill to apply the correct fix and ensure secure XML processing.

Quick Start

Use the cwe-91-xml-injection skill to secure the provided Java code snippet against XML injection.

Frequently Asked Questions about cwe-91-xml-injection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix CWE-91 XML Injection vulnerabilities flagged by a SAST tool in my Java code?

To fix CWE-91 XML Injection vulnerabilities in Java, you must remediate direct user input concatenation into XML strings by implementing secure XML parsing and proper data escaping.

What is XML injection and how does it affect Java applications?

XML injection occurs when malicious user input is concatenated directly into XML strings, allowing attackers to interpret malicious data as XML commands and manipulate application logic in Java applications.

How do I prevent XML injection when concatenating user input into XML strings?

Prevent XML injection during user input concatenation by using XML libraries like JAXB or DOM for secure parsing, or apply proper data escaping using utilities like StringEscapeUtils.

Does this remediation approach work with JAXB and DOM XML libraries in Java?

Yes, this remediation approach works with JAXB and DOM XML libraries in Java, providing deterministic fixes and secure code generation to ensure proper XML processing against injection attacks.

What is the best way to secure Java XML parsing against malicious data interpretation?

The best way to secure Java XML parsing is to implement data escaping with StringEscapeUtils or use secure XML libraries, preventing malicious data from being interpreted as XML commands.