CVE-2021-39239: Jena core XML External Entity Reference Vulnerability
HIGHCVE-2021-39239 is a HIGH xml external entity reference vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Jena core libraries in the Maven ecosystem. The issue involves xml external entity reference in apache jena. Remediation is available by upgrading affected packages to version 4.2.0.
CVE-2021-39239 at a Glance
How to Fix CVE-2021-39239
To remediate this vulnerability, upgrade all affected Jena core dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-core</artifactId>
<version>4.2.0</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.apache.jena
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-39239, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.apache.jena
Analyze the terminal output to locate any version of Jena core in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.2.0), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.apache.jena command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where 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. In Jena core, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-39239 Affected Jena core Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.apache.jena:jena-core
|
Maven |
< 4.2.0
|
4.2.0
|
References
Frequently Asked Questions
What is CVE-2021-39239?
Which Jena core versions are affected?
What version fixes CVE-2021-39239?
Is jena-core affected?
What CWE is associated with CVE-2021-39239?
How can I check Maven dependencies for CVE-2021-39239?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7rp6-w7mg-h8rw",
"modified" : "2021-09-17T18:29:23Z",
"published" : "2021-09-20T20:22:05Z",
"aliases" : [ "CVE-2021-39239" ],
"summary" : "XML External Entity Reference in Apache Jena",
"details" : "A vulnerability in XML processing in Apache Jena, in versions up to 4.1.0, may allow an attacker to execute XML External Entities (XXE), including exposing the contents of local files to a remote server.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.apache.jena:jena-core"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.2.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-39239"
}, {
"type" : "PACKAGE",
"url" : "https://gitbox.apache.org/repos/asf?p=jena.git"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/r0f03ae7e102c3e8587fdd36531fc167309335738156dfbd7d9c1bf45@%3Cdev.jena.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/rce5241b228a1f0e5880f6b2bfdb7ae9ee420e94cb692738a0bbfed9d@%3Cdev.jena.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/rf44d529c54ef1d0097e813f576a0823a727e1669a9f610d3221d493d%40%3Cusers.jena.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/rf44d529c54ef1d0097e813f576a0823a727e1669a9f610d3221d493d@%3Cannounce.apache.org%3E"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-611" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-09-17T18:29:23Z",
"nvd_published_at" : "2021-09-16T15:15:00Z"
}
}