eclipse-ee4j / eclipse-ee4j/angus-mail

Security: TransformerFactory without secure XML processing enabled (XXE / CWE-611)

Open Beginner friendly
#203 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
87
Forks
23
PR merge metrics
No merged PRs in 30d

Description

## Summary
The `text/xml` MIME handler creates a `TransformerFactory` without enabling secure processing features, leaving it potentially vulnerable to XML External Entity (XXE) expansion attacks.

## Location
`core/src/main/java/org/eclipse/angus/mail/handlers/text_xml.java` — line 90

```java
TransformerFactory tf = TransformerFactory.newInstance();
// Missing: tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
Transformer transformer = tf.newTransformer();
```

## Risk
- CWE-611: Improper Restriction of XML External Entity Reference
- CWE-776: Improper Restriction of Recursive XML Entity References (Billion Laughs)
- An attacker who can supply a crafted XML mail body could potentially trigger XXE or entity-expansion if this handler is used to parse/transform untrusted content
- Severity depends on whether the transformer is used to parse attacker-controlled XML vs. to serialize

## Suggested fix
```java
TransformerFactory tf = TransformerFactory.newInstance();
tf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer transformer = tf.newTransformer();
```

## Discovered by
Automated security scan (cognium-ai) of the OSS-Fuzz Java corpus, June 2026.

Contributor guide

Open the contributing guide

Research direction

Start at core/src/main/java/org/eclipse/angus/mail/handlers/text_xml.java around line 90 and inspect how the TransformerFactory is configured before transformation. Enable the secure XML-processing settings described in the issue, then verify that the text/xml handler still transforms content without permitting external DTDs or stylesheets.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.