{"id":"CVE-2026-54155","aliases":["CVE-2026-54155","GHSA-mq36-523m-x7vv"],"related":[],"kind":"vulnerability","state":"published","title":"node-opcua: Missing nonce verification in UserNameIdentityToken authentication","summary":"node-opcua is an OPC UA implementation for TypeScript and Node.js. Prior to 2.166.0, the UserNameIdentityToken authentication handler in packages/node-opcua-server/source/opcua_server.ts decrypts an RSA-OAEP password blob but does not verify that the trailing bytes match the current session serverNonce. An unauthenticated remote attacker can obtain the server public key through GetEndpoints and forge a blob whose little-endian length produces an empty password passed to isValidUser, compromising accounts that accept an empty password. Missing nonce binding also allows a captured UserNameIdentityToken ciphertext to be replayed in another session, and SecurityMode=None removes the separate client-signature safeguard. This issue is fixed in version 2.166.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"node-opcua is an OPC UA implementation for TypeScript and Node.js. Prior to 2.166.0, the UserNameIdentityToken authentication handler in packages/node-opcua-server/source/opcua_server.ts decrypts an RSA-OAEP password blob but does not verify that the trailing bytes match the current session serverNonce. An unauthenticated remote attacker can obtain the server public key through GetEndpoints and forge a blob whose little-endian length produces an empty password passed to isValidUser, compromising accounts that accept an empty password. Missing nonce binding also allows a captured UserNameIdentityToken ciphertext to be replayed in another session, and SecurityMode=None removes the separate client-signature safeguard. This issue is fixed in version 2.166.0.","source":"cvelist"},{"lang":"en","text":"**Summary**\nA missing nonce verification in the UserNameIdentityToken authentication handler allows an unauthenticated remote attacker to forge a password token that extracts as an empty string, and to replay captured authentication tokens across sessions.\n\n**Affected versions:** <= 2.165.0\n**Tested version:** 2.165.0\n**CVSS Score:** 8.1 (High)\n**CVSS Vector:** CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L\n**CWE:** CWE-347 Improper Verification of Cryptographic Signature\n\n---\n\n**Root Cause**\n\nIn `packages/node-opcua-server/source/opcua_server.ts` at line 1886-1887, after RSA-OAEP decrypting the UserNameIdentityToken password blob, the server reads a 4-byte little-endian length field and extracts `buff[4 : 4+length]` as the password. It never verifies that the trailing bytes equal `session.nonce`.\n\nThis has two consequences:\n\n1. **Forged empty password:** An attacker who retrieves the server's public key via an unauthenticated `GetEndpoints` call can craft a token where the 4-byte length field equals `serverNonce.length` (32). The server computes `length = 32 - 32 = 0` and calls `isValidUser(username, \"\")`. Any account that accepts an empty password is compromised.\n\n2. **Unconditional replay attack:** Because nonce binding is structurally absent, any captured UserNameIdentityToken ciphertext can be replayed in a different session unconditionally.\n\nThe impact is compounded by a second issue: when the channel uses `SecurityMode=None`, `verifyClientSignature` returns `true` unconditionally (security_policy.ts:697-700), bypassing the channel-level signature check entirely.\n\n---\n\n**Proof of Concept (logic, no exploit code)**\n\n```\n1. GetEndpoints (unauthenticated) → retrieve server public key and RSA token policy\n2. OpenSecureChannel (SecurityMode=None)\n3. CreateSession\n4. Craft plaintext: [0x20, 0x00, 0x00, 0x00]  (readUInt32LE = 32 = serverNonce.length)\n5. RSA-OAEP encrypt with server public key → 256-byte ciphertext\n6. ActivateSession with crafted UserNameIdentityToken\n7. Server decrypts → length = 32 - 32 = 0 → password = \"\"\n8. isValidUser(username, \"\") is called\n```\n\nDynamically confirmed: decryption produces `password = \"\"` with no error and no nonce verification.\n\n---\n\n**Suggested Fix**\n\nAfter decrypting the password blob, verify that `buff.slice(4 + passwordLength)` equals `session.nonce` before extracting the password. Reject the token if verification fails.\n\n---\n\nI am following a 90-day responsible disclosure policy. I am happy to provide additional technical details under embargo. Please confirm receipt at your earliest convenience.\n\nReporter: Stanley Tobias\nDiscovery date: 2026-03-23","format":"markdown","source":"ghsa"}],"published":"2026-08-20T18:35:33.000Z","modified":"2026-09-30T19:38:27.293Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L","score":7.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L","score":7.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L","score":7.7,"rating":"HIGH"}],"cwes":["CWE-347"],"affected":[{"ranges":[{"version":"< 2.166.0","status":"affected"}],"vendor":"node-opcua","product":"node-opcua","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"2.165.0"}],"ecosystem":"npm","package":"node-opcua","purl":"pkg:npm/node-opcua","source":"ghsa"}],"references":[{"url":"https://github.com/node-opcua/node-opcua/security/advisories/GHSA-mq36-523m-x7vv","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/node-opcua/node-opcua/commit/c6b05738682f5c8d70b1ea275c881f01a1cd9787","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/node-opcua/node-opcua/releases/tag/v2.166.0","tags":["x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/node-opcua/node-opcua","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-09-14T16:39:00.556Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-54155","url":"https://www.cve.org/CVERecord?id=CVE-2026-54155","licence":"CVE Terms of Use","modified":"2026-09-14T16:39:35.824Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mq36-523m-x7vv","url":"https://github.com/advisories/GHSA-mq36-523m-x7vv","licence":"CC-BY-4.0","modified":"2026-08-20T18:48:09.721Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-54155","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54155","licence":"Public domain","modified":"2026-09-30T19:38:27.293Z"}],"updatedAt":"2026-11-25T22:59:38.306Z","epss":{"score":0.00327,"percentile":0.27834,"date":"2026-12-01T12:00:22.000Z"}}