CVE-2026-18092 in Net::SAML2
Summary
by MITRE • 08/03/2026
Net::SAML2 versions before 0.86 for Perl allow SAML authentication bypass via XML signature wrapping because new_from_xml reads assertion identity with document-wide XPath instead of the signed subtree.
new_from_xml reads the NameID, attribute values, SessionIndex, audience and other identity fields with document-wide XPath, such as //saml:Assertion/saml:AttributeStatement/saml:Attribute and //saml:Subject/saml:NameID, which select the first matching element in document order rather than the element covered by the verified signature. handle_response confirms that a signature is present and, when a cacert is configured, that it chains to the CA, but XML::Sig verifies only the element named by the signature's Reference URI, so unsigned sibling assertions in the same document are not covered. An attacker who holds any one IdP-signed assertion can add an unsigned attacker-authored assertion earlier in document order; the signature still verifies and the document-order XPath returns the attacker's NameID and attributes.
Any caller that passes an untrusted Response to new_from_xml can accept identity fields from an assertion the IdP never signed, even when a cacert trust anchor is configured, so a party holding one valid IdP-signed assertion can authenticate as an arbitrary user.
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 08/03/2026
This vulnerability represents a critical authentication bypass flaw in Net::SAML2 Perl library versions prior to 086 where XML signature wrapping attacks can be executed through improper XPath evaluation during SAML assertion processing. The core technical issue stems from how the new_from_xml function processes identity fields within SAML assertions, specifically utilizing document-wide XPath expressions rather than scoped XPath queries that would limit selection to the signed subtree. This design flaw creates a fundamental mismatch between the signature verification process and the data extraction mechanism, allowing attackers to manipulate assertion content while maintaining valid signatures.
The vulnerability operates through a specific pattern where document-wide XPath expressions such as //saml:Assertion/saml:AttributeStatement/saml:Attribute and //saml:Subject/saml:NameID select elements based on document order rather than cryptographic scope. When XML::Sig performs signature validation, it only verifies the element referenced by the signature's URI, leaving sibling assertions unsigned and therefore unconstrained. This creates an exploitable condition where an attacker can insert their own unsigned assertion ahead of a legitimate IdP-signed assertion in the document order, enabling the system to extract identity information from the attacker-controlled assertion rather than the intended signed one.
The operational impact of this vulnerability extends beyond simple authentication bypass to represent a complete breakdown of trust model within SAML-based authentication systems. Even when proper certificate validation is configured through cacert parameters, the vulnerability allows attackers to effectively impersonate any user by crafting malicious assertions that appear to originate from trusted identity providers. This represents a significant compromise of the principle of least privilege and can lead to unauthorized access to protected resources, data breaches, and complete system compromise depending on the privileges associated with the targeted identities.
Security implications align with CWE-347 vulnerability classification for improper certificate validation and relate to ATT&CK technique T1586 for credential harvesting through forged authentication tokens. The vulnerability essentially allows attackers to perform identity spoofing attacks that bypass both cryptographic signature validation and certificate chain verification mechanisms, creating a false sense of security around the SAML authentication process. Organizations implementing Net::SAML2 libraries without proper mitigation measures face risk of complete authorization system compromise, as demonstrated by the ability to authenticate as arbitrary users with no additional credentials required beyond possession of a single valid assertion from an identity provider.
The recommended mitigation strategy involves updating to Net::SAML2 version 0.86 or later where proper scoped XPath evaluation is implemented to ensure that identity fields are extracted only from the signed subtree rather than the entire document. Additionally, administrators should implement defensive programming practices such as validating that assertions are processed in the correct order and implementing additional checks beyond signature validation to ensure that all required assertion elements are properly authenticated. Organizations should also consider implementing runtime monitoring for suspicious assertion patterns and potentially adding explicit verification steps that cross-reference extracted identity information with expected cryptographic signatures to prevent similar XPath-based attacks from occurring in other components of their SAML infrastructure.