/

CVE-2026-58066

Severity:

CRITICAL RISK

(9.8)

SAML Signature Wrapping Auth Bypass (CWE-287) in Rocket.Chat

CVE-2026-58066

Awaiting Analysis

Vulnerability type

Category:

Authentication Bypass via SAML Signature Wrapping

CWE:

CWE-287

Impact:

Full account takeover via SSO authentication bypass

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.0

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Rocket.Chat's SAML SSO implementation accepted signed XML responses without correctly binding the verified signature to the specific SAML Response or Assertion element.

This allows an attacker to craft a wrapped SAML document that includes forged identity attributes alongside any valid signature from the trusted IdP, potentially logging in as arbitrary users when SSO is enabled.

Rocket.Chat's SAML SSO implementation accepted signed XML responses without correctly binding the verified signature to the specific SAML Response or Assertion element.

This allows an attacker to craft a wrapped SAML document that includes forged identity attributes alongside any valid signature from the trusted IdP, potentially logging in as arbitrary users when SSO is enabled.

Affected context

This vulnerability occurs in Rocket.Chat deployments that:

  • Use SAML-based Single Sign-On (SSO) with a trusted Identity Provider (IdP)
  • Rely on XML signature verification without strict binding to the samlp:Response or saml:Assertion
  • Accept SAML responses from the IdP and treat them as authoritative for user identity and attributes

It becomes relevant wherever the application trusts signed SAML assertions to establish authenticated sessions.

This vulnerability occurs in Rocket.Chat deployments that:

  • Use SAML-based Single Sign-On (SSO) with a trusted Identity Provider (IdP)
  • Rely on XML signature verification without strict binding to the samlp:Response or saml:Assertion
  • Accept SAML responses from the IdP and treat them as authoritative for user identity and attributes

It becomes relevant wherever the application trusts signed SAML assertions to establish authenticated sessions.

Exploit preconditions

  • Attack surface: The SAML SSO login endpoint receiving IdP responses
  • Required access: Ability to submit crafted SAML responses to the application (e.g., control over the browser flow or a malicious IdP / proxy in the SSO chain)
  • Trigger point: Processing of a signed SAML Response where the application verifies the XML signature but does not ensure that the signed element is the one used for authentication
  • Why exploitation is possible: The implementation validates the signature but fails to bind it to the exact Response / Assertion element that is consumed, enabling a signature-wrapping attack with forged identity attributes inside an unsigned portion of the document.
  • Attack surface: The SAML SSO login endpoint receiving IdP responses
  • Required access: Ability to submit crafted SAML responses to the application (e.g., control over the browser flow or a malicious IdP / proxy in the SSO chain)
  • Trigger point: Processing of a signed SAML Response where the application verifies the XML signature but does not ensure that the signed element is the one used for authentication
  • Why exploitation is possible: The implementation validates the signature but fails to bind it to the exact Response / Assertion element that is consumed, enabling a signature-wrapping attack with forged identity attributes inside an unsigned portion of the document.

Why this happens

The underlying bug class is a signature-validation logic flaw in SAML processing. The code correctly verifies that a signature originates from a trusted IdP certificate, but does not enforce that the authenticated data (the samlp:Response or saml:Assertion actually used to map identity) is the element covered by that signature.

This pattern aligns with authentication bypass under CWE-287, where the authentication mechanism does not adequately enforce identity verification. Conceptually, the parser is susceptible to XML Signature Wrapping: it can be tricked into using an unsigned or differently signed assertion carrying attacker-chosen attributes, while still considering the overall message "trusted" because some valid signature is present elsewhere in the XML.

The underlying bug class is a signature-validation logic flaw in SAML processing. The code correctly verifies that a signature originates from a trusted IdP certificate, but does not enforce that the authenticated data (the samlp:Response or saml:Assertion actually used to map identity) is the element covered by that signature.

This pattern aligns with authentication bypass under CWE-287, where the authentication mechanism does not adequately enforce identity verification. Conceptually, the parser is susceptible to XML Signature Wrapping: it can be tricked into using an unsigned or differently signed assertion carrying attacker-chosen attributes, while still considering the overall message "trusted" because some valid signature is present elsewhere in the XML.

Potential impact

  • Attackers can log in as arbitrary users within the Rocket.Chat instance
  • Potential takeover of privileged or administrator accounts if targeted identities are forged
  • Unauthorized access to private channels, direct messages, and internal communications
  • Escalation from external attacker or rogue IdP to full control over a collaboration environment
  • Lateral movement within an organization leveraging compromised chat accounts
  • Attackers can log in as arbitrary users within the Rocket.Chat instance
  • Potential takeover of privileged or administrator accounts if targeted identities are forged
  • Unauthorized access to private channels, direct messages, and internal communications
  • Escalation from external attacker or rogue IdP to full control over a collaboration environment
  • Lateral movement within an organization leveraging compromised chat accounts

General mitigation guidance

Mitigation focuses on hardening SAML validation logic and reducing trust in loosely bound signatures:

  • Ensure that XML signature verification is tightly bound to the specific samlp:Response or saml:Assertion element that will be used for authentication and attribute mapping
  • Use well-tested SAML libraries and security profiles that explicitly protect against signature wrapping attacks (e.g., validating IDs and reference URIs, rejecting unexpected extra assertions)
  • Enforce strict schema validation to reject SAML responses containing multiple or nested assertions in unusual structures
  • Minimize reliance on complex, custom SAML parsing code and adopt defense-in-depth with robust session management and role assignment checks
  • Apply least privilege to high-value accounts and enable monitoring for unusual SSO login patterns to limit damage if mis-validation occurs

Mitigation focuses on hardening SAML validation logic and reducing trust in loosely bound signatures:

  • Ensure that XML signature verification is tightly bound to the specific samlp:Response or saml:Assertion element that will be used for authentication and attribute mapping
  • Use well-tested SAML libraries and security profiles that explicitly protect against signature wrapping attacks (e.g., validating IDs and reference URIs, rejecting unexpected extra assertions)
  • Enforce strict schema validation to reject SAML responses containing multiple or nested assertions in unusual structures
  • Minimize reliance on complex, custom SAML parsing code and adopt defense-in-depth with robust session management and role assignment checks
  • Apply least privilege to high-value accounts and enable monitoring for unusual SSO login patterns to limit damage if mis-validation occurs

How teams detect issues like this

Effective detection approaches typically combine code-level analysis with runtime signals:

  • Use static analysis and security code reviews to identify SAML handling code that:
  • Verifies signatures without binding them to the exact element consumed
  • Accepts multiple assertions or responses without strict reference checking
  • Depends on generic XML DOM traversal rather than ID-based resolution
  • Review authentication pipelines for any custom XML parsing or manual handling of SAML assertions, especially where the signed element is selected by tag name or position instead of verified identifiers
  • Apply security testing (including SAML-specific penetration tests) that exercise signature wrapping scenarios and malformed responses
  • Consider automated SSO validation tools or integration tests that simulate attacker-controlled SAML messages and confirm that only signed and expected elements are honored

Effective detection approaches typically combine code-level analysis with runtime signals:

  • Use static analysis and security code reviews to identify SAML handling code that:
  • Verifies signatures without binding them to the exact element consumed
  • Accepts multiple assertions or responses without strict reference checking
  • Depends on generic XML DOM traversal rather than ID-based resolution
  • Review authentication pipelines for any custom XML parsing or manual handling of SAML assertions, especially where the signed element is selected by tag name or position instead of verified identifiers
  • Apply security testing (including SAML-specific penetration tests) that exercise signature wrapping scenarios and malformed responses
  • Consider automated SSO validation tools or integration tests that simulate attacker-controlled SAML messages and confirm that only signed and expected elements are honored

Sources

SourceLink
github.comgithub.com/RocketChat/Rocket.Chat/pull/41233
hackerone.comhackerone.com/reports/3827674

Frequently asked

questions

Yes. An attacker who can interact with the SAML SSO endpoint and craft or relay SAML responses can exploit this issue remotely without needing local access to the Rocket.Chat server.

The attacker needs the ability to supply SAML responses into the SSO flow—this could be achieved by operating a malicious IdP, manipulating the SSO configuration, or intercepting and modifying responses if other weaknesses exist in the SSO environment.

The robust fix is to enforce strict binding between the validated XML signature and the exact SAML Response or Assertion that is used to authenticate the user, typically by relying on hardened SAML libraries that correctly implement ID-based reference checks and reject wrapped documents.

Prefer mature SAML frameworks with established security profiles, avoid custom XML signature handling, require thorough security testing of SSO integrations, and include explicit review steps for signature validation logic and handling of multiple or nested assertions in the authentication pipeline.

Yes. An attacker who can interact with the SAML SSO endpoint and craft or relay SAML responses can exploit this issue remotely without needing local access to the Rocket.Chat server.

The attacker needs the ability to supply SAML responses into the SSO flow—this could be achieved by operating a malicious IdP, manipulating the SSO configuration, or intercepting and modifying responses if other weaknesses exist in the SSO environment.

The robust fix is to enforce strict binding between the validated XML signature and the exact SAML Response or Assertion that is used to authenticate the user, typically by relying on hardened SAML libraries that correctly implement ID-based reference checks and reject wrapped documents.

Prefer mature SAML frameworks with established security profiles, avoid custom XML signature handling, require thorough security testing of SSO integrations, and include explicit review steps for signature validation logic and handling of multiple or nested assertions in the authentication pipeline.

Find out what's already
exploitable in your codebase.