VYPR
High severity7.5NVD Advisory· Published Apr 18, 2017· Updated May 13, 2026

CVE-2017-5656

CVE-2017-5656

Description

Apache CXF's STSClient before 3.1.11 and 3.0.13 uses a flawed way of caching tokens that are associated with delegation tokens, which means that an attacker could craft a token which would return an identifer corresponding to a cached token for another user.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
org.apache.cxf:cxf-coreMaven
>= 3.1.0, < 3.1.113.1.11
org.apache.cxf:cxf-coreMaven
< 3.0.133.0.13

Affected products

2
  • cpe:2.3:a:apache:cxf:*:*:*:*:*:*:*:*
    Range: >=3.0.0,<3.0.13
  • Apache Software Foundation/Apache CXFv5
    Range: 3.1.x before 3.1.11

Patches

1
1a4fe22fc297

Refactor how we extract "IDs" from delegation tokens when used for caching

https://github.com/apache/cxfColm O hEigeartaighApr 5, 2017via ghsa
1 file changed · +35 5
  • rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/DefaultSTSTokenCacher.java+35 5 modified
    @@ -19,6 +19,9 @@
     
     package org.apache.cxf.ws.security.trust;
     
    +import java.security.MessageDigest;
    +import java.security.NoSuchAlgorithmException;
    +import java.util.Base64;
     import java.util.HashMap;
     import java.util.Map;
     
    @@ -33,6 +36,7 @@
     import org.apache.cxf.ws.security.tokenstore.TokenStoreUtils;
     import org.apache.wss4j.common.ext.WSSecurityException;
     import org.apache.wss4j.common.saml.SamlAssertionWrapper;
    +import org.apache.wss4j.common.util.XMLUtils;
     import org.apache.wss4j.dom.WSConstants;
     
     public class DefaultSTSTokenCacher implements STSTokenCacher {
    @@ -163,16 +167,42 @@ private static boolean isOneTimeUse(SecurityToken issuedToken) {
             return false;
         }
     
    +    // Get an id from the token that is unique to that token
         private static String getIdFromToken(Element token) {
             if (token != null) {
    -            // Try to find the "Id" on the token.
    -            if (token.hasAttributeNS(WSConstants.WSU_NS, "Id")) {
    -                return token.getAttributeNS(WSConstants.WSU_NS, "Id");
    -            } else if (token.hasAttributeNS(null, "ID")) {
    +            // For SAML tokens get the ID/AssertionID
    +            if ("Assertion".equals(token.getLocalName())
    +                && WSConstants.SAML2_NS.equals(token.getNamespaceURI())) {
                     return token.getAttributeNS(null, "ID");
    -            } else if (token.hasAttributeNS(null, "AssertionID")) {
    +            } else if ("Assertion".equals(token.getLocalName())
    +                && WSConstants.SAML_NS.equals(token.getNamespaceURI())) {
                     return token.getAttributeNS(null, "AssertionID");
                 }
    +
    +            // For UsernameTokens get the username
    +            if (WSConstants.USERNAME_TOKEN_LN.equals(token.getLocalName())
    +                && WSConstants.WSSE_NS.equals(token.getNamespaceURI())) {
    +                Element usernameElement =
    +                    XMLUtils.getDirectChildElement(token, WSConstants.USERNAME_LN, WSConstants.WSSE_NS);
    +                if (usernameElement != null) {
    +                    return XMLUtils.getElementText(usernameElement);
    +                }
    +            }
    +
    +            // For BinarySecurityTokens take the hash of the value
    +            if (WSConstants.BINARY_TOKEN_LN.equals(token.getLocalName())
    +                && WSConstants.WSSE_NS.equals(token.getNamespaceURI())) {
    +                String text = XMLUtils.getElementText(token);
    +                if (text != null && !"".equals(text)) {
    +                    try {
    +                        MessageDigest digest = MessageDigest.getInstance("SHA-256");
    +                        byte[] bytes = digest.digest(text.getBytes());
    +                        return Base64.getMimeEncoder().encodeToString(bytes);
    +                    } catch (NoSuchAlgorithmException e) {
    +                        // SHA-256 must be supported so not going to happen...
    +                    }
    +                }
    +            }
             }
             return "";
         }
    

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

News mentions

0

No linked articles in our index yet.