Medium severity5.3NVD Advisory· Published Apr 18, 2017· Updated May 13, 2026
CVE-2017-5653
CVE-2017-5653
Description
JAX-RS XML Security streaming clients in Apache CXF before 3.1.11 and 3.0.13 do not validate that the service response was signed or encrypted, which allows remote attackers to spoof servers.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
org.apache.cxf:cxf-coreMaven | >= 3.1.0, < 3.1.11 | 3.1.11 |
org.apache.cxf:cxf-coreMaven | < 3.0.13 | 3.0.13 |
Affected products
2- Apache Software Foundation/Apache CXFv5Range: prior to 3.0.13
Patches
120d0fa3ec41cFinalizing XmlSecInInterceptor updates
2 files changed · +35 −62
rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/ClientXmlSecInInterceptor.java+0 −46 removed@@ -1,46 +0,0 @@ -/** - * 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.xml; - -import java.io.IOException; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.ext.ReaderInterceptor; -import javax.ws.rs.ext.ReaderInterceptorContext; - -import org.apache.cxf.jaxrs.utils.JAXRSUtils; -import org.apache.cxf.message.Message; - -public class ClientXmlSecInInterceptor extends XmlSecInInterceptor implements ReaderInterceptor { - - @Override - public Object aroundReadFrom(ReaderInterceptorContext ctx) throws IOException, WebApplicationException { - Message message = JAXRSUtils.getCurrentMessage(); - handleMessage(message); - Object object = ctx.proceed(); - new StaxActionInInterceptor(super.isRequireSignature(), - super.isRequireEncryption()).handleMessage(message); - return object; - } - - @Override - protected void registerStaxActionInInterceptor(Message inMsg) { - // complete - } -}
rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecInInterceptor.java+35 −16 modified@@ -34,7 +34,10 @@ import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; +import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ReaderInterceptor; +import javax.ws.rs.ext.ReaderInterceptorContext; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; @@ -44,6 +47,7 @@ import org.apache.cxf.jaxrs.utils.ExceptionUtils; import org.apache.cxf.jaxrs.utils.JAXRSUtils; import org.apache.cxf.message.Message; +import org.apache.cxf.message.MessageUtils; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.rs.security.common.CryptoLoader; @@ -72,8 +76,8 @@ /** * A new StAX-based interceptor for processing messages with XML Signature + Encryption content. */ -public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> { - +public class XmlSecInInterceptor extends AbstractPhaseInterceptor<Message> implements ReaderInterceptor { + private static final Logger LOG = LogUtils.getL7dLogger(XmlSecInInterceptor.class); private EncryptionProperties encryptionProperties; @@ -94,13 +98,15 @@ public XmlSecInInterceptor() { } public void handleMessage(Message message) throws Fault { - String method = (String)message.get(Message.HTTP_REQUEST_METHOD); - if ("GET".equals(method)) { + if (isServerGet(message)) { return; } - - Message outMs = message.getExchange().getOutMessage(); - Message inMsg = outMs == null ? message : outMs.getExchange().getInMessage(); + prepareMessage(message); + message.getInterceptorChain().add( + new StaxActionInInterceptor(requireSignature, requireEncryption)); + } + + private void prepareMessage(Message inMsg) throws Fault { XMLStreamReader originalXmlStreamReader = inMsg.getContent(XMLStreamReader.class); if (originalXmlStreamReader == null) { @@ -110,8 +116,6 @@ public void handleMessage(Message message) throws Fault { } } - registerStaxActionInInterceptor(inMsg); - try { XMLSecurityProperties properties = new XMLSecurityProperties(); configureDecryptionKeys(inMsg, properties); @@ -137,12 +141,12 @@ public void handleMessage(Message message) throws Fault { } } - protected void registerStaxActionInInterceptor(Message inMsg) { - inMsg.getInterceptorChain().add( - new StaxActionInInterceptor(requireSignature, requireEncryption)); - + private boolean isServerGet(Message message) { + String method = (String)message.get(Message.HTTP_REQUEST_METHOD); + return "GET".equals(method) && !MessageUtils.isRequestor(message); } + private void configureDecryptionKeys(Message message, XMLSecurityProperties properties) throws IOException, UnsupportedCallbackException, WSSecurityException { @@ -399,14 +403,29 @@ private Collection<Pattern> getSubjectContraints(Message msg) throws PatternSynt } return subjectDNPatterns; } + + @Override + public Object aroundReadFrom(ReaderInterceptorContext ctx) throws IOException, WebApplicationException { + Message message = JAXRSUtils.getCurrentMessage(); + if (isServerGet(message)) { + return ctx.proceed(); + } else { + prepareMessage(message); + Object object = ctx.proceed(); + new StaxActionInInterceptor(requireSignature, + requireEncryption).handleMessage(message); + return object; + } + + } /** * This interceptor handles parsing the StaX results (events) + checks to see whether the * required (if any) Actions (signature or encryption) were fulfilled. */ - protected static class StaxActionInInterceptor extends AbstractPhaseInterceptor<Message> { - - private static final Logger LOG = + private static class StaxActionInInterceptor extends AbstractPhaseInterceptor<Message> { + + private static final Logger LOG = LogUtils.getL7dLogger(StaxActionInInterceptor.class); private final boolean signatureRequired;
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
19- cxf.apache.org/security-advisories.data/CVE-2017-5653.txt.ascnvdPatchVendor AdvisoryWEB
- www.securityfocus.com/bid/97968nvdThird Party AdvisoryVDB Entry
- www.securitytracker.com/id/1038279nvdThird Party AdvisoryVDB Entry
- github.com/advisories/GHSA-hgg6-8x62-m9gfghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2017-5653ghsaADVISORY
- access.redhat.com/errata/RHSA-2017:1832nvdIssue TrackingWEB
- github.com/apache/cxf/commit/20d0fa3ec41c16c52b74dcc006f9d9ea212fa80fghsaWEB
- 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.