GHSA-r2pf-9cw4-5j65 is a high-severity (CVSS 7) Uncontrolled Resource Consumption vulnerability in node-opcua-transport. A fix is available for node-opcua-transport — see the affected versions and patch details below.
node-opcua: TCP Socket Leak (FIN-WAIT-2) via keepalive reconnection cycle - Resource Exhaustion
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-r2pf-9cw4-5j65.
EPSS Exploitation Probability
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
How urgent is this, really
GHSA-r2pf-9cw4-5j65 plotted by exploitation likelihood (EPSS) against impact (CVSS). The shaded corner — EPSS 50%+ and CVSS 7.0+ — is where this CVE doesn't sit, though severity or exploitability alone can still warrant action.
Where this sits among everything scored
Of 374,847 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Real counts from FIRST.org, not a sample — log-scaled since the landscape is heavily right-skewed.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
node-opcua-clientnpmDescription
SUMMARY
A combination of bugs in node-opcua causes unlimited TCP socket accumulation (FIN-WAIT-2 state) during automatic reconnection, leading to memory exhaustion and eventual container/process crash (OOM kill). The issue is triggered by the default configuration (keepSessionAlive: true) when the OPC UA server has clock skew relative to the client.
Affected version: Tested on 2.169.0 (latest as of April 2026).
ENVIRONMENT
- Node.js: v24.11.0
- node-opcua: 2.169.0
- OS: Linux (containerized via Podman, slirp4netns networking)
- OPC UA Server: Industrial PLC (opc.tcp endpoint), clock skew of ~50 minutes ahead of client
- Client config: keepSessionAlive: true (default), keepAliveInterval: 3000, securityMode: None, securityPolicy: None
ROOT CAUSE ANALYSIS
Bug #1 - ClientTCP_transport._on_ACK_response() uses socket.end() instead of socket.destroy()
File: node-opcua-transport/src/client_tcp_transport.ts, _on_ACK_response() method
When the HEL/ACK handshake fails during a reconnection attempt, the error handler calls socket.end():
if (err || !data) {
externalCallback(err || new Error("no data"));
if (this._socket) {
this._socket.end(); // <- sends TCP FIN, leaves socket in FIN-WAIT-2
}
}
socket.end() sends a TCP FIN and waits for the peer to close its side. If the peer doesn't respond (common with PLCs), the socket remains in FIN-WAIT-2 state indefinitely, leaking file descriptors and memory. During rapid reconnection cycles (triggered by Bug #2 below), every failed HEL/ACK creates a new leaked socket.
Bug #2 - ClientSessionKeepAliveManager._ping_server() treats BadInvalidTimestamp as network outage
File: node-opcua-client/src/client_session_keepalive_manager.ts, _ping_server() method
The keepalive manager reads Server.ServerStatus.CurrentTime on each ping cycle. If the server responds with BadInvalidTimestamp (because the client's RequestHeader.timestamp falls outside the server's tolerance window due to clock skew), the manager treats this as a fatal network error:
// Any error -> emit("failure") -> terminateConnection() -> forceConnectionBreak()
This triggers a full transport-level reconnection on every keepalive cycle (every keepAliveInterval ms). Combined with Bug #1, each reconnection attempt leaks one TCP socket in FIN-WAIT-2. Impact amplification: With keepAliveInterval: 3000 (3 seconds), the client leaks ~20 sockets/minute, ~1200/hour, exhausting resources in hours.
REPRODUCTION STEPS
- Set up an OPC UA server with a clock skewed more than the server's timestamp tolerance ahead of the client.
- Connect using node-opcua with default settings (keepSessionAlive: true).
- Monitor TCP sockets: ss -antp | grep FIN-WAIT-2 | wc -l
- Observe FIN-WAIT-2 count growing continuously (approximately one per keepalive interval).
- Eventually the process runs out of file descriptors or memory and crashes.
SUGGESTED FIXES
For Bug #1 (_on_ACK_response):
// Replace socket.end() with socket.destroy()
if (this._socket) {
this._socket.destroy();
}
For Bug #2 (_ping_server): Distinguish between transport-level errors (actual network outage) and application-level OPC UA status codes like BadInvalidTimestamp. The latter indicates the server is reachable and the session is alive - only the timestamp validation failed. The keepalive should not trigger reconnection.
REPORTER
Marco Velluso @Velluso [email protected] Requesting CVE assignment and credit as reporter upon fix publication.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | node-opcua-transport | ≥ 2.0.0&&< 2.170.0 | 2.170.0npm install node-opcua-transport@2.170.0 |
| 📦npm | node-opcua-client | ≥ 2.0.0&&< 2.170.0 | 2.170.0npm install node-opcua-client@2.170.0 |
| 📦npm | node-opcua | ≥ 2.0.0&&< 2.170.0 | 2.170.0npm install node-opcua@2.170.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for node-opcua-transport, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update node-opcua-transport to 2.170.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-r2pf-9cw4-5j65 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-r2pf-9cw4-5j65 can be triaged on real exposure rather than presence alone.
Tailored to GHSA-r2pf-9cw4-5j65. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-r2pf-9cw4-5j65 in your dependencies?
O3 Security finds GHSA-r2pf-9cw4-5j65 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.