DEV Community

Ioneyrezende
Ioneyrezende

Posted on

soapbar BSP verification trusted the certificate inside the message

soapbar BSP verification trusted the certificate inside the message

soapbar's verify_envelope_bsp() read an X.509 certificate from the SOAP message it was verifying. It checked the certificate's validity dates, then verified the signature against that same certificate. There was no CA-chain validation, issuer allowlist or pinned signer.

The result could look correct while proving the wrong thing. The signature was valid for a certificate the sender supplied. It did not show that the sender was trusted by the relying party.

The flaw is CVE-2026-64855. All versions before 0.13.0 are affected, and 0.13.0 contains the patched behavior. GitHub rates it High with a CVSS score of 8.2.

Trust anchors cannot travel with the claim

A verifier needs a trust anchor obtained from somewhere other than the untrusted message. That can be a pinned signer certificate, a configured CA bundle, a subject allowlist, or a policy that maps a validated certificate to an application identity.

The BSP variant failed that rule. It treated the message's wsse:BinarySecurityToken as both evidence and authority. An attacker could mint a certificate, sign a forged envelope and place the same certificate in the token. The verifier would then accept a signature made by the attacker.

The fixed API now requires trusted_certs or ca_certs. If neither is supplied, verification fails closed. verify_envelope(), which accepts a caller-supplied certificate, was not affected.

Where applications inherit the problem

A successful library call is often treated as an authentication decision. That becomes dangerous when the call's semantics are not understood by the application team. Review code that calls verify_envelope_bsp() and then maps the certificate subject, issuer or token to a service account.

The application should first validate the signer against its own trust policy, then derive identity from the validated result. Do not trust a certificate's subject merely because the SOAP signature verified. The certificate itself must be authorized for the intended service and purpose.

Upgrade to soapbar 0.13.0 or later. Replace the affected call with the pinned verify_envelope() path where possible. If BSP is required, supply a trust store from configuration or the application's protected key material and test that a self-signed attacker certificate is rejected.

Deployment checks

Search for callers that pass verify_cert_trust=False. That option restores the insecure behavior and should be treated as a temporary diagnostic setting, not a production control. Confirm that the trust store is loaded from an immutable path and that certificate rotation includes a period where both the old and new signer are accepted without widening trust to arbitrary issuers.

Log the certificate fingerprint, issuer, subject and validation result, but not the complete token. Alert when a valid signature is anchored to a newly seen certificate. A caller that used to work with unrestricted embedded certificates may fail after the upgrade; that failure is a useful signal to review the integration rather than a reason to disable trust checking.

The patch is small, but the review should cover every consumer that treated a successful signature as proof of identity. Cryptographic verification must terminate at a trust anchor the attacker cannot choose.

References

Top comments (0)