Join our Newsletter — 33% off our NHI Course

WebSocket Rat

Malware that uses WebSocket connections as a persistent remote command channel. The protocol choice can make control traffic look like ordinary application communication while still allowing the attacker to issue commands, stage exfiltration, and maintain live access.

What WebSocket Rat Means in Practice

WebSocket Rat is not just malware that “uses WebSockets.” The defining issue is that the malware turns a normally legitimate, long-lived browser or application protocol into a covert command channel, which helps it stay connected, issue instructions, and blend into routine traffic patterns.

That matters because defenders often treat WebSocket activity as ordinary application chatter unless they correlate it with session behavior, unusual destinations, or suspicious command-and-control timing. A rat that rides this protocol can maintain interactive control without relying on obvious, separate beaconing.

How WebSocket Command Channels Work

WebSockets begin as an HTTP-based handshake and then upgrade to a persistent, bidirectional channel. For malware, that makes the traffic attractive: it can look like standard app communication at first, then continue as a live, stateful session that supports real-time tasking.

The attacker does not need a new protocol for every action. Once the channel is established, commands, status updates, exfiltration requests, and operator responses can flow over the same session, often with less noise than repeated short-lived connections.

That persistence also changes detection expectations. Network tools tuned to short bursts, known malware ports, or rigid request patterns may miss a WebSocket-based channel if they do not inspect upgrade behavior, endpoint reputation, or the surrounding application context.

Why It Blends in With Legitimate Application Traffic

WebSocket traffic can be difficult to separate from normal modern web application use because many legitimate services depend on the same protocol for chat, notifications, collaboration, live dashboards, and other interactive features. The malware benefits from that ambiguity by hiding in a channel defenders are already conditioned to allow.

Protocol legitimacy does not imply trustworthiness. The security question is not whether WebSockets are malicious, but whether the specific session, origin, endpoint, and behavior match what the environment should be using.

For defenders, the key issue is that the protocol can obscure malicious intent while still preserving the operational advantages of a remote access tool. That makes WebSocket Rat closer to covert remote administration than to simple data theft tooling.

Security Implications for Detection and Containment

WebSocket Rat creates a monitoring problem because the same channel can support command-and-control, interactive operator actions, and staged exfiltration. Tools that only look for signature-based malware or suspicious file transfer events may miss the control plane entirely.

Defensive analysis should therefore focus on session patterns, unusual destinations, abnormal handshake origins, and process-to-network relationships rather than on protocol labels alone. Techniques cataloged in MITRE ATT&CK Enterprise Matrix remain useful for mapping the surrounding tradecraft, especially when credential access, persistence, or lateral movement follow the initial foothold.

Hardening guidance from NIST Cybersecurity Framework 2.0 and NIST SP 800-53 Rev 5 Security and Privacy Controls is relevant here because containment depends on visibility, boundary control, and monitoring of anomalous communications.

Risk and Threat Considerations

WebSocket Rat is risky because it uses a trusted protocol as a covert remote access path, which can delay detection and extend attacker dwell time. That creates a practical exposure to live command execution, data staging, and continued operator control even when other obvious malware signals are absent.

Failure mechanism: Security tooling may treat WebSocket sessions as benign application traffic, especially when the channel begins with a normal-looking upgrade handshake and then persists as a routine interactive session.

Impact: An attacker can retain a stable command channel, coordinate follow-on actions, and move stolen data out through traffic that is harder to distinguish from ordinary application use.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

MITRE ATT&CK addresses the attack and risk surface, while NIST CSF 2.0 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
MITRE ATT&CK T1071.001 — Web Protocols WebSocket Rat is a web-protocol C2 pattern that fits web-based command channels.
Recommendation — Map suspicious WebSocket sessions to T1071.001 and hunt for covert command traffic.
NIST CSF 2.0 DE.CM-01 — Networks and network services are monitored to detect potential cybersecurity events Persistent WebSocket C2 requires network monitoring for anomalous service behavior.
Recommendation — Monitor WebSocket traffic for unusual endpoints, durations, and session patterns.
NIST SP 800-53 Rev 5 AU-6 — Audit Record Review, Analysis, and Reporting WebSocket Rat detection depends on reviewing logs and correlating session behavior.
SI-4 — System Monitoring Persistent remote control over WebSockets is a monitoring and anomaly-detection problem.
Recommendation — Correlate proxy, application, and endpoint logs to surface covert WebSocket control channels. Use system monitoring to flag unexpected long-lived WebSocket communications.

Practitioner Guidance

What to watch for: Treat unexplained WebSocket sessions as investigative leads when the endpoint, origin, timing, or destination does not match the application’s expected behavior. Look for long-lived sessions that originate from unusual processes, external infrastructure that is not part of the normal application stack, or traffic patterns that continue after the user-facing application activity has ended.

Practitioner takeaway: The protocol is not the threat by itself, the mismatch between expected application use and observed session behavior is what should drive response.