Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 0 ๐Ÿ“– 3 min read

Holder-of-key SAML assertions reduce replay only when the proof key is checked

Holder-of-key SAML assertions reduce replay only when the proof key is checked A SAML bearer assertion is a credential. Anyone who obtains it can usually present it before it expires. The SAML V2.0 Holder-of-Key Assert

Holder-of-key SAML assertions reduce replay only when the proof key is checked

A SAML bearer assertion is a credential. Anyone who obtains it can usually present it before it expires. The SAML V2.0 Holder-of-Key Assertion Profile adds a different subject confirmation method: the relying party must also verify possession of a private key corresponding to X.509 data bound into the assertion. The profile can reduce replay risk, but only if the service performs the key proof and certificate comparison correctly.

The profile requires a <saml:SubjectConfirmation> element with the method urn:oasis:names:tc:SAML:2.0:cm:holder-of-key. Its SubjectConfirmationData contains a <ds:KeyInfo> with exactly one <ds:X509Data> element. That data can identify the attesting entity through an X.509 certificate, a subject key identifier, a subject name, or an issuer and serial pair. The profile defines how the issuer binds that data and how the relying party compares it with the certificate presented later.

The key proof itself is outside the profile. A deployment must choose a protocol that proves possession of the private key, such as a signed request over a mutually authenticated TLS session. A SAML response that merely contains the holder-of-key confirmation method does not prove that the presenter owns the key. Treating the method name as sufficient gives the organization the administration cost of a stronger profile without the replay resistance.

Match the right certificate data

The relying party must compare the same X.509 data the issuer signed. A subject-name comparison may be easier to implement, but it can also produce collisions when certificate policy is weak. An issuer-and-serial comparison requires trusting the certificate issuer, while a subject key identifier depends on a correctly generated SKI extension. The application should document which form it accepts and reject ambiguous KeyInfo content.

Certificate rollover needs explicit handling. If the identity provider signs a certificate reference that the service no longer accepts, the login fails even though the user and assertion are valid. If the service accepts a broad issuer and subject match to avoid those failures, an unrelated certificate may satisfy the check. Pin the allowed certificate source, validate the chain when the selected identifier form requires it, and keep the rollover window in metadata rather than in ad hoc exceptions.

Enforce the normal assertion controls

Holder-of-key confirmation does not replace audience restriction, NotBefore, NotOnOrAfter, recipient checks, issuer signature validation, or replay state. An assertion can be bound to a key and still be sent to the wrong service. Each relying party should require its own audience value, a current response recipient, and a one-time assertion identifier.

The browser profile adds another consideration. The client may not expose arbitrary private-key operations to a web application, so a deployment needs a supported proof mechanism rather than a custom JavaScript signature. Test the complete path with the browser, reverse proxy, identity provider, and relying party. A service that works with a command-line client may fail when the same assertion reaches a browser session.

Review the trust model

The issuer must know that the certificate used in the assertion belongs to the attesting entity. The relying party must know how to obtain and validate the corresponding certificate. Those are separate trust decisions. Record the certificate authority, the allowed key usage, the identifier form, the proof mechanism, and the certificate lifetime in the integration documentation.

Monitor failures by cause: unknown certificate, identifier mismatch, invalid proof, expired assertion, audience mismatch, and duplicate assertion ID. A single generic "SAML login failed" metric hides the difference between a certificate rollover and a replay attempt. Holder-of-key assertions are useful when the proof is mandatory, the key binding is narrow, and the relying party can explain exactly which certificate bytes it compared.

References

๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.