Moderate severityNVD Advisory· Published Oct 30, 2014· Updated May 6, 2026
CVE-2014-3584
CVE-2014-3584
Description
The SamlHeaderInHandler in Apache CXF before 2.6.11, 2.7.x before 2.7.8, and 3.0.x before 3.0.1 allows remote attackers to cause a denial of service (infinite loop) via a crafted SAML token in the authorization header of a request to a JAX-RS service.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
org.apache.cxf:cxf-rt-frontend-jaxrsMaven | >= 2.5.0, < 2.6.11 | 2.6.11 |
org.apache.cxf:cxf-rt-frontend-jaxrsMaven | >= 2.7.0, < 2.7.8 | 2.7.8 |
org.apache.cxf:cxf-rt-frontend-jaxrsMaven | >= 3.0.0, < 3.0.1 | 3.0.1 |
Affected products
11cpe:2.3:a:apache:cxf:*:*:*:*:*:*:*:*+ 10 more
- cpe:2.3:a:apache:cxf:*:*:*:*:*:*:*:*range: <=2.6.10
- cpe:2.3:a:apache:cxf:2.6.1:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:2.7.0:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:2.7.1:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:2.7.2:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:2.7.3:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:2.7.4:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:2.7.5:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:2.7.6:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:2.7.7:*:*:*:*:*:*:*
- cpe:2.3:a:apache:cxf:3.0.0:*:*:*:*:*:*:*
Patches
20b3894f57388[CXF-5390] DeflaterEncoderDecoder needs to throw the exception if the inflator can not finish the process
3 files changed · +96 −1
rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoder.java+11 −1 modified@@ -38,6 +38,15 @@ public InputStream inflateToken(byte[] deflatedToken) while (!inflater.finished()) { inputLen = inflater.inflate(input); if (!inflater.finished()) { + + if (inputLen == 0) { + if (inflater.needsInput()) { + throw new DataFormatException("Inflater can not inflate all the token bytes"); + } else { + break; + } + } + inflatedToken = new byte[input.length + inflatedLen]; System.arraycopy(input, 0, inflatedToken, inflatedLen, inputLen); inflatedLen += inputLen; @@ -57,9 +66,10 @@ public byte[] deflateToken(byte[] tokenBytes) { compresser.setInput(tokenBytes); compresser.finish(); - byte[] output = new byte[tokenBytes.length]; + byte[] output = new byte[tokenBytes.length * 2]; int compressedDataLength = compresser.deflate(output); + byte[] result = new byte[compressedDataLength]; System.arraycopy(output, 0, result, 0, compressedDataLength); return result;
rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoderTest.java+66 −0 added@@ -0,0 +1,66 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.rs.security.saml; + +import java.io.InputStream; +import java.util.zip.DataFormatException; + +import org.apache.cxf.common.util.Base64Utility; +import org.apache.cxf.helpers.IOUtils; + +import org.junit.Assert; +import org.junit.Test; + + +public class DeflateEncoderDecoderTest extends Assert { + + @Test(expected = DataFormatException.class) + public void testInvalidContent() throws Exception { + DeflateEncoderDecoder inflater = new DeflateEncoderDecoder(); + inflater.inflateToken("invalid_grant".getBytes()); + } + + @Test(expected = DataFormatException.class) + public void testInvalidContentAfterBase64() throws Exception { + DeflateEncoderDecoder inflater = new DeflateEncoderDecoder(); + byte[] base64decoded = Base64Utility.decode("invalid_grant"); + inflater.inflateToken(base64decoded); + } + + @Test + public void testInflateDeflate() throws Exception { + DeflateEncoderDecoder inflater = new DeflateEncoderDecoder(); + byte[] deflated = inflater.deflateToken("valid_grant".getBytes()); + InputStream is = inflater.inflateToken(deflated); + assertNotNull(is); + assertEquals("valid_grant", IOUtils.readStringFromStream(is)); + } + + @Test + public void testInflateDeflateBase64() throws Exception { + DeflateEncoderDecoder inflater = new DeflateEncoderDecoder(); + byte[] deflated = inflater.deflateToken("valid_grant".getBytes()); + String base64String = Base64Utility.encode(deflated); + byte[] base64decoded = Base64Utility.decode(base64String); + InputStream is = inflater.inflateToken(base64decoded); + assertNotNull(is); + assertEquals("valid_grant", IOUtils.readStringFromStream(is)); + } + +}
systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlTest.java+19 −0 modified@@ -27,6 +27,7 @@ import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Form; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.apache.cxf.Bus; import org.apache.cxf.bus.spring.SpringBusFactory; @@ -76,6 +77,24 @@ public void testGetBookSAMLTokenAsHeader() throws Exception { } + @Test + public void testInvalidSAMLTokenAsHeader() throws Exception { + String address = "https://localhost:" + PORT + "/samlheader/bookstore/books/123"; + + JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); + bean.setAddress(address); + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = JAXRSSamlTest.class.getResource("client.xml"); + Bus springBus = bf.createBus(busFile.toString()); + bean.setBus(springBus); + + WebClient wc = bean.createWebClient(); + wc.header("Authorization", "SAML invalid_grant"); + Response r = wc.get(); + assertEquals(401, r.getStatus()); + } + @Test public void testGetBookSAMLTokenInForm() throws Exception { String address = "https://localhost:" + PORT + "/samlform/bookstore/books";
47b127dbdb4a[CXF-5390] DeflaterEncoderDecoder needs to throw the exception if the inflator can not finish the process
3 files changed · +96 −1
rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoder.java+11 −1 modified@@ -38,6 +38,15 @@ public InputStream inflateToken(byte[] deflatedToken) while (!inflater.finished()) { inputLen = inflater.inflate(input); if (!inflater.finished()) { + + if (inputLen == 0) { + if (inflater.needsInput()) { + throw new DataFormatException("Inflater can not inflate all the token bytes"); + } else { + break; + } + } + inflatedToken = new byte[input.length + inflatedLen]; System.arraycopy(input, 0, inflatedToken, inflatedLen, inputLen); inflatedLen += inputLen; @@ -57,9 +66,10 @@ public byte[] deflateToken(byte[] tokenBytes) { compresser.setInput(tokenBytes); compresser.finish(); - byte[] output = new byte[tokenBytes.length]; + byte[] output = new byte[tokenBytes.length * 2]; int compressedDataLength = compresser.deflate(output); + byte[] result = new byte[compressedDataLength]; System.arraycopy(output, 0, result, 0, compressedDataLength); return result;
rt/rs/security/xml/src/test/java/org/apache/cxf/rs/security/saml/DeflateEncoderDecoderTest.java+66 −0 added@@ -0,0 +1,66 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.rs.security.saml; + +import java.io.InputStream; +import java.util.zip.DataFormatException; + +import org.apache.cxf.common.util.Base64Utility; +import org.apache.cxf.helpers.IOUtils; + +import org.junit.Assert; +import org.junit.Test; + + +public class DeflateEncoderDecoderTest extends Assert { + + @Test(expected = DataFormatException.class) + public void testInvalidContent() throws Exception { + DeflateEncoderDecoder inflater = new DeflateEncoderDecoder(); + inflater.inflateToken("invalid_grant".getBytes()); + } + + @Test(expected = DataFormatException.class) + public void testInvalidContentAfterBase64() throws Exception { + DeflateEncoderDecoder inflater = new DeflateEncoderDecoder(); + byte[] base64decoded = Base64Utility.decode("invalid_grant"); + inflater.inflateToken(base64decoded); + } + + @Test + public void testInflateDeflate() throws Exception { + DeflateEncoderDecoder inflater = new DeflateEncoderDecoder(); + byte[] deflated = inflater.deflateToken("valid_grant".getBytes()); + InputStream is = inflater.inflateToken(deflated); + assertNotNull(is); + assertEquals("valid_grant", IOUtils.readStringFromStream(is)); + } + + @Test + public void testInflateDeflateBase64() throws Exception { + DeflateEncoderDecoder inflater = new DeflateEncoderDecoder(); + byte[] deflated = inflater.deflateToken("valid_grant".getBytes()); + String base64String = Base64Utility.encode(deflated); + byte[] base64decoded = Base64Utility.decode(base64String); + InputStream is = inflater.inflateToken(base64decoded); + assertNotNull(is); + assertEquals("valid_grant", IOUtils.readStringFromStream(is)); + } + +}
systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlTest.java+19 −0 modified@@ -26,6 +26,7 @@ import javax.ws.rs.WebApplicationException; import javax.ws.rs.client.ClientException; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.apache.cxf.Bus; import org.apache.cxf.bus.spring.SpringBusFactory; @@ -74,6 +75,24 @@ public void testGetBookSAMLTokenAsHeader() throws Exception { } + @Test + public void testInvalidSAMLTokenAsHeader() throws Exception { + String address = "https://localhost:" + PORT + "/samlheader/bookstore/books/123"; + + JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); + bean.setAddress(address); + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = JAXRSSamlTest.class.getResource("client.xml"); + Bus springBus = bf.createBus(busFile.toString()); + bean.setBus(springBus); + + WebClient wc = bean.createWebClient(); + wc.header("Authorization", "SAML invalid_grant"); + Response r = wc.get(); + assertEquals(401, r.getStatus()); + } + @Test public void testGetBookSAMLTokenInForm() throws Exception { String address = "https://localhost:" + PORT + "/samlform/bookstore/books";
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
22- cxf.apache.org/security-advisories.data/CVE-2014-3584.txt.ascnvdVendor AdvisoryWEB
- github.com/advisories/GHSA-gw5j-77f9-v2g2ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2014-3584ghsaADVISORY
- seclists.org/oss-sec/2014/q4/437nvdWEB
- exchange.xforce.ibmcloud.com/vulnerabilities/97753nvdWEB
- github.com/apache/cxf/commit/0b3894f57388b9955f2c33b2295223f2835cd7b3ghsaWEB
- github.com/apache/cxf/commit/47b127dbdb4a10d282be92f2ebbe646f8cf6b03eghsaWEB
- issues.apache.org/jira/browse/CXF-5390ghsaWEB
- 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
- secunia.com/advisories/61909nvd
- www.securityfocus.com/bid/70738nvd
- 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.