High severity7.5NVD Advisory· Published Aug 10, 2017· Updated May 13, 2026
CVE-2016-8739
CVE-2016-8739
Description
The JAX-RS module in Apache CXF prior to 3.0.12 and 3.1.x prior to 3.1.9 provides a number of Atom JAX-RS MessageBodyReaders. These readers use Apache Abdera Parser which expands XML entities by default which represents a major XXE risk.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
org.apache.cxf:cxf-coreMaven | < 3.0.12 | 3.0.12 |
org.apache.cxf:cxf-coreMaven | >= 3.1.0, < 3.1.9 | 3.1.9 |
Affected products
1- Apache Software Foundation/Apache CXFv5Range: prior to 3.0.12
Patches
28e4970d9Letting CXF StaxUtils prepare XMLStreamReader for Atom reads
2 files changed · +41 −2
rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AbstractAtomProvider.java+4 −2 modified@@ -30,6 +30,7 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; +import javax.xml.stream.XMLStreamReader; import org.apache.abdera.Abdera; import org.apache.abdera.model.Document; @@ -39,6 +40,7 @@ import org.apache.abdera.writer.Writer; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.jaxrs.utils.ExceptionUtils; +import org.apache.cxf.staxutils.StaxUtils; public abstract class AbstractAtomProvider<T extends Element> implements MessageBodyWriter<T>, MessageBodyReader<T> { @@ -89,10 +91,10 @@ public T readFrom(Class<T> clazz, Type t, Annotation[] a, MediaType mt, ParserOptions options = parser.getDefaultParserOptions(); if (options != null) { options.setAutodetectCharset(autodetectCharset); - options.setResolveEntities(false); } } - Document<T> doc = parser.parse(is); + XMLStreamReader reader = StaxUtils.createXMLStreamReader(is); + Document<T> doc = parser.parse(reader); return doc.getRoot(); }
rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProviderTest.java+37 −0 modified@@ -145,6 +145,25 @@ private void doTestReadEntry(AtomPojoProvider provider) throws Exception { new Annotation[]{}, mt, null, bis); assertEquals("a", book.getName()); } + @Test + public void testReadEntryNoBuilders2() throws Exception { + final String entry = + "<!DOCTYPE entry SYSTEM \"entry://entry\"><entry xmlns=\"http://www.w3.org/2005/Atom\">" + + "<title type=\"text\">a</title>" + + "<content type=\"application/xml\">" + + "<book xmlns=\"\">" + + "<name>a</name>" + + "</book>" + + "</content>" + + "</entry>"; + AtomPojoProvider provider = new AtomPojoProvider(); + ByteArrayInputStream bis = new ByteArrayInputStream(entry.getBytes()); + MediaType mt = MediaType.valueOf("application/atom+xml;type=entry"); + @SuppressWarnings({"unchecked", "rawtypes" }) + Book book = (Book)provider.readFrom((Class)Book.class, Book.class, + new Annotation[]{}, mt, null, bis); + assertEquals("a", book.getName()); + } @Test @@ -179,6 +198,24 @@ private void doTestReadFeed(AtomPojoProvider provider) throws Exception { assertTrue("b".equals(list.get(0).getName()) || "b".equals(list.get(1).getName())); } + @Test + public void testReadFeedWithoutBuilders2() throws Exception { + AtomPojoProvider provider = new AtomPojoProvider(); + final String feed = + "<!DOCTYPE feed SYSTEM \"feed://feed\"><feed xmlns=\"http://www.w3.org/2005/Atom\">" + + "<entry><content type=\"application/xml\"><book xmlns=\"\"><name>a</name></book></content></entry>" + + "<entry><content type=\"application/xml\"><book xmlns=\"\"><name>b</name></book></content></entry>" + + "</feed>"; + MediaType mt = MediaType.valueOf("application/atom+xml;type=feed"); + ByteArrayInputStream bis = new ByteArrayInputStream(feed.getBytes()); + @SuppressWarnings({"unchecked", "rawtypes" }) + Books books2 = (Books)provider.readFrom((Class)Books.class, Books.class, + new Annotation[]{}, mt, null, bis); + List<Book> list = books2.getBooks(); + assertEquals(2, list.size()); + assertTrue("a".equals(list.get(0).getName()) || "a".equals(list.get(1).getName())); + assertTrue("b".equals(list.get(0).getName()) || "b".equals(list.get(1).getName())); + } @Test public void testReadEntryNoContent() throws Exception { /** A sample entry without content. */
9deb2d17Letting CXF StaxUtils prepare XMLStreamReader for Atom reads
2 files changed · +41 −2
rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/atom/AbstractAtomProvider.java+4 −2 modified@@ -30,6 +30,7 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; +import javax.xml.stream.XMLStreamReader; import org.apache.abdera.Abdera; import org.apache.abdera.model.Document; @@ -39,6 +40,7 @@ import org.apache.abdera.writer.Writer; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.jaxrs.utils.ExceptionUtils; +import org.apache.cxf.staxutils.StaxUtils; public abstract class AbstractAtomProvider<T extends Element> implements MessageBodyWriter<T>, MessageBodyReader<T> { @@ -89,10 +91,10 @@ public T readFrom(Class<T> clazz, Type t, Annotation[] a, MediaType mt, ParserOptions options = parser.getDefaultParserOptions(); if (options != null) { options.setAutodetectCharset(autodetectCharset); - options.setResolveEntities(false); } } - Document<T> doc = parser.parse(is); + XMLStreamReader reader = StaxUtils.createXMLStreamReader(is); + Document<T> doc = parser.parse(reader); return doc.getRoot(); }
rt/rs/extensions/providers/src/test/java/org/apache/cxf/jaxrs/provider/atom/AtomPojoProviderTest.java+37 −0 modified@@ -145,6 +145,25 @@ private void doTestReadEntry(AtomPojoProvider provider) throws Exception { new Annotation[]{}, mt, null, bis); assertEquals("a", book.getName()); } + @Test + public void testReadEntryNoBuilders2() throws Exception { + final String entry = + "<!DOCTYPE entry SYSTEM \"entry://entry\"><entry xmlns=\"http://www.w3.org/2005/Atom\">" + + "<title type=\"text\">a</title>" + + "<content type=\"application/xml\">" + + "<book xmlns=\"\">" + + "<name>a</name>" + + "</book>" + + "</content>" + + "</entry>"; + AtomPojoProvider provider = new AtomPojoProvider(); + ByteArrayInputStream bis = new ByteArrayInputStream(entry.getBytes()); + MediaType mt = MediaType.valueOf("application/atom+xml;type=entry"); + @SuppressWarnings({"unchecked", "rawtypes" }) + Book book = (Book)provider.readFrom((Class)Book.class, Book.class, + new Annotation[]{}, mt, null, bis); + assertEquals("a", book.getName()); + } @Test @@ -179,6 +198,24 @@ private void doTestReadFeed(AtomPojoProvider provider) throws Exception { assertTrue("b".equals(list.get(0).getName()) || "b".equals(list.get(1).getName())); } + @Test + public void testReadFeedWithoutBuilders2() throws Exception { + AtomPojoProvider provider = new AtomPojoProvider(); + final String feed = + "<!DOCTYPE feed SYSTEM \"feed://feed\"><feed xmlns=\"http://www.w3.org/2005/Atom\">" + + "<entry><content type=\"application/xml\"><book xmlns=\"\"><name>a</name></book></content></entry>" + + "<entry><content type=\"application/xml\"><book xmlns=\"\"><name>b</name></book></content></entry>" + + "</feed>"; + MediaType mt = MediaType.valueOf("application/atom+xml;type=feed"); + ByteArrayInputStream bis = new ByteArrayInputStream(feed.getBytes()); + @SuppressWarnings({"unchecked", "rawtypes" }) + Books books2 = (Books)provider.readFrom((Class)Books.class, Books.class, + new Annotation[]{}, mt, null, bis); + List<Book> list = books2.getBooks(); + assertEquals(2, list.size()); + assertTrue("a".equals(list.get(0).getName()) || "a".equals(list.get(1).getName())); + assertTrue("b".equals(list.get(0).getName()) || "b".equals(list.get(1).getName())); + } @Test public void testReadEntryNoContent() throws Exception { /** A sample entry without content. */
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
20- cxf.apache.org/security-advisories.data/CVE-2016-8739.txt.ascnvdPatchVendor AdvisoryWEB
- www.securityfocus.com/bid/97579nvdThird Party AdvisoryVDB Entry
- www.securitytracker.com/id/1037544nvdThird Party AdvisoryVDB Entry
- github.com/advisories/GHSA-x7xf-253v-x3w8ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2016-8739ghsaADVISORY
- access.redhat.com/errata/RHSA-2017:0868nvdWEB
- github.com/apache/cxf/commit/8e4970d9ghsaWEB
- github.com/apache/cxf/commit/9deb2d17ghsaWEB
- lists.apache.org/thread.html/r36e44ffc1a9b365327df62cdfaabe85b9a5637de102cea07d79b2dbf@%3Ccommits.cxf.apache.org%3EghsaWEB
- lists.apache.org/thread.html/rc774278135816e7afc943dc9fc78eb0764f2c84a2b96470a0187315c@%3Ccommits.cxf.apache.org%3EghsaWEB
- lists.apache.org/thread.html/rd49aabd984ed540c8ff7916d4d79405f3fa311d2fdbcf9ed307839a6@%3Ccommits.cxf.apache.org%3EghsaWEB
- lists.apache.org/thread.html/rec7160382badd3ef4ad017a22f64a266c7188b9ba71394f0d321e2d4@%3Ccommits.cxf.apache.org%3EghsaWEB
- lists.apache.org/thread.html/rfb87e0bf3995e7d560afeed750fac9329ff5f1ad49da365129b7f89e@%3Ccommits.cxf.apache.org%3EghsaWEB
- lists.apache.org/thread.html/rff42cfa5e7d75b7c1af0e37589140a8f1999e578a75738740b244bd4@%3Ccommits.cxf.apache.org%3EghsaWEB
- lists.apache.org/thread.html/r36e44ffc1a9b365327df62cdfaabe85b9a5637de102cea07d79b2dbf%40%3Ccommits.cxf.apache.org%3Envd
- lists.apache.org/thread.html/rc774278135816e7afc943dc9fc78eb0764f2c84a2b96470a0187315c%40%3Ccommits.cxf.apache.org%3Envd
- lists.apache.org/thread.html/rd49aabd984ed540c8ff7916d4d79405f3fa311d2fdbcf9ed307839a6%40%3Ccommits.cxf.apache.org%3Envd
- lists.apache.org/thread.html/rec7160382badd3ef4ad017a22f64a266c7188b9ba71394f0d321e2d4%40%3Ccommits.cxf.apache.org%3Envd
- lists.apache.org/thread.html/rfb87e0bf3995e7d560afeed750fac9329ff5f1ad49da365129b7f89e%40%3Ccommits.cxf.apache.org%3Envd
- lists.apache.org/thread.html/rff42cfa5e7d75b7c1af0e37589140a8f1999e578a75738740b244bd4%40%3Ccommits.cxf.apache.org%3Envd
News mentions
0No linked articles in our index yet.