{"id":"CVE-2026-54156","aliases":["CVE-2026-54156","GHSA-6wvw-vrw4-363w"],"related":[],"kind":"vulnerability","state":"published","title":"node-opcua: Unbounded nonce cache enables unauthenticated heap exhaustion DoS","summary":"node-opcua is an OPC UA implementation for TypeScript and Node.js. Prior to 2.166.0, the process-global g_alreadyUsedNonce cache used by nonceAlreadyBeenUsed in packages/node-opcua-secure-channel/source/server/server_secure_channel_layer.ts records nonces from OpenSecureChannelRequest and CreateSession without expiration or a size limit. An unauthenticated remote attacker can repeatedly create sessions with unique nonces, causing entries to persist after session expiry and accumulate across connection cycles even when maxSessions=10 limits concurrent sessions. The resulting unbounded heap growth can exhaust the default Node.js heap and crash the node-opcua server process. 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 process-global g_alreadyUsedNonce cache used by nonceAlreadyBeenUsed in packages/node-opcua-secure-channel/source/server/server_secure_channel_layer.ts records nonces from OpenSecureChannelRequest and CreateSession without expiration or a size limit. An unauthenticated remote attacker can repeatedly create sessions with unique nonces, causing entries to persist after session expiry and accumulate across connection cycles even when maxSessions=10 limits concurrent sessions. The resulting unbounded heap growth can exhaust the default Node.js heap and crash the node-opcua server process. This issue is fixed in version 2.166.0.","source":"cvelist"},{"lang":"en","text":"**Summary**\nA process-global nonce cache with no eviction policy allows an unauthenticated remote attacker to exhaust server heap memory by repeatedly opening sessions, causing the node-opcua server process to crash.\n\n**Affected versions:** <= 2.165.0\n**Tested version:** 2.165.0\n**CVSS Score:** 7.5 (High)\n**CVSS Vector:** CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H\n**CWE:** CWE-770 Allocation of Resources Without Limits or Throttling\n\n---\n\n**Root Cause**\n\nIn `packages/node-opcua-secure-channel/source/server/server_secure_channel_layer.ts` at line 156, `g_alreadyUsedNonce` is a process-global object used to track previously seen nonces for replay detection. Entries are added on every `OpenSecureChannelRequest` and every `CreateSession` request but are never removed or expired.\n\nAn unauthenticated attacker can exploit the `CreateSession` path (which requires no certificate) to accumulate nonce entries indefinitely. Even with `maxSessions=10` limiting concurrent sessions, nonces persist after session expiry, allowing slow but reliable heap exhaustion across repeated connection cycles.\n\n---\n\n**Measured Impact**\n\nDynamically confirmed heap growth:\n- 5,000 unique nonces → +1.23 MB resident heap, no eviction after explicit GC\n- Projected: 10^6 nonces → ~246 MB resident heap\n- Achievable OOM on default Node.js heap limits\n\n---\n\n**Suggested Fix**\n\nAdd a TTL-based eviction policy to `g_alreadyUsedNonce`. Nonces should be expired after the maximum session timeout (or a reasonable fixed window, e.g. 1 hour). A Map with timestamp entries and periodic cleanup is sufficient.\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:41.000Z","modified":"2026-09-30T19:38:27.293Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-770"],"affected":[{"ranges":[{"version":"< 2.166.0","status":"affected"}],"vendor":"node-opcua","product":"node-opcua","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.166.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-6wvw-vrw4-363w","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/node-opcua/node-opcua/commit/b82c2939fe9c658de58da993f2798ec5481d7313","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/node-opcua/node-opcua/releases/tag/v2.166.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/node-opcua/node-opcua","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-09-14T16:35:36.222Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-54156","url":"https://www.cve.org/CVERecord?id=CVE-2026-54156","licence":"CVE Terms of Use","modified":"2026-09-14T16:35:48.958Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-6wvw-vrw4-363w","url":"https://github.com/advisories/GHSA-6wvw-vrw4-363w","licence":"CC-BY-4.0","modified":"2026-08-27T19:15:07.090Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-54156","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-54156","licence":"Public domain","modified":"2026-09-30T19:38:27.293Z"}],"updatedAt":"2026-11-25T22:59:38.307Z","epss":{"score":0.00548,"percentile":0.47327,"date":"2026-12-01T12:00:22.000Z"}}