GSocket: How to Detect Stealthy Linux C2 Relay Malware

SOC Briefing Summary :: Executive Key Takeaways
- [01]Threat summary: Threat actors deploy GSocket on compromised Linux web servers to establish persistent, encrypted C2 via the Global Socket Relay Network.
- [02]Root cause vector: Exploitation of web applications followed by staging GSocket in memory-backed paths (/dev/shm) using shared secrets to evade IP blocks.
- [03]Immediate action: Audit /dev/shm and systemd for gsocket services, inspect outbound connections to gsocket.io, and hunt using provided KQL rules.
Executive Summary
Microsoft Threat Intelligence has published an in-depth threat advisory detailing how multiple independent threat actors are weaponizing GSocket, an open-source remote access utility, to maintain persistent, encrypted command-and-control (C2) channels across compromised Linux enterprise servers. According to telemetry from Microsoft Defender for Endpoint, GSocket-related intrusions have escalated sharply, with 87.1% of attributable compromises concentrated in web applications and shared hosting environments—predominantly PHP web applications and cPanel deployments (63.9%) and Apache web servers (24.3%).
Traditionally, patching a web application vulnerability or restarting a compromised web daemon severing an adversary's reverse shell. GSocket fundamentally alters this operational dynamic: by staging a lightweight relay client in temporary memory-backed directories (/dev/shm) and connecting outbound to the public Global Socket Relay Network (GSRN), the malware establishes an end-to-end encrypted session paired via a random shared secret. Because communications traverse legitimate public relay infrastructure, there are no static threat-actor IP addresses or domains for perimeter firewalls to block, allowing adversaries to retain total system access long after the initial vulnerability has been remediated.
---
Technical Vulnerability Analysis & Attack Chain

1. Ingress & Automated Architecture Profiling
The intrusion begins when an attacker exploits a remote code execution vulnerability on an internet-facing Linux web application. Operating under the low-privileged web server account (www-data or nobody), the adversary issues a curl cradle that retrieves a deployment script from distribution infrastructure:
- The script profiles the target host's kernel version, architecture (x86_64, aarch64, armv7), and available write permissions.
- It downloads the corresponding pre-compiled GSocket client binary (
gs-netcat) directly into memory-backed or world-writable paths—most commonly/dev/shm/.gs-*or/tmp/.
2. The Shared Secret Relay Pairing Architecture
Unlike conventional reverse shells that connect to a hardcoded C2 IP address, GSocket relies on a cryptographic shared secret:
- During execution, the client generates a unique cryptographic token (or accepts one passed via the environment variables
GS_SECRETorGS_TG_TOKEN). - The client initiates an outbound connection over standard TLS ports to the Global Socket Relay Network (
gsocket.io). - The operator, operating from anywhere in the world, connects to the same relay network presenting the matching secret.
- The relay network matches the two connections and establishes a bidirectional, end-to-end encrypted terminal shell without requiring port forwarding, static NAT rules, or public IP addresses on the victim host.
- To retrieve the secret, threat actors frequently configure automated notification webhooks that transmit the credentials directly to private Telegram or Discord channels.
3. Persistence & Privilege Escalation
To guarantee persistence across server reboots, threat actors configure multiple redundant mechanisms:
- Systemd Units: Creating masked service definitions such as
defunct.servicepointing to disguised binaries in/dev/shm/. - Process Masquerading: Renaming the running binary to simulate legitimate kernel worker threads or system utilities (e.g.,
systemd-remount-dor[kworker/u:2]). - Kernel Exploitation: In several analyzed intrusions, threat actors subsequently attempted local privilege escalation by exploiting CVE-2026-43284 (Dirty Frag), elevating privileges from the web daemon directly to
root.
---
MITRE ATT&CK Tactics, Techniques & Procedures (TTPs)
| Tactic | Technique ID | Technique Name | Operational Context |
|---|---|---|---|
| Initial Access | T1190 | Exploit Public-Facing Application | Remote code execution on unpatched PHP, cPanel, or Apache services. |
| Defense Evasion | T1027 | Obfuscated Files or Information | Staging executables in memory-backed /dev/shm directories and wiping installer scripts. |
| Defense Evasion | T1036.004 | Masquerade Task or Service | Disguising GSocket processes under names like systemd-remount-d. |
| Persistence | T1543.002 | Systemd Service | Installing rogue systemd service units (defunct.service) for automatic restart. |
| Privilege Escalation | T1068 | Exploitation for Privilege Escalation | Exploiting Linux kernel vulnerabilities (Dirty Frag CVE-2026-43284) to gain root. |
| Command and Control | T1090.002 | External Proxy | Routing encrypted terminal traffic through the Global Socket Relay Network. |
---
Threat Actor Profile & Exploitation Telemetry
- Prevalence: Observed across hundreds of enterprise and academic hosting clusters; utilized opportunistically by multiple unrelated threat actor clusters.
- Sector Distribution: Education and Research (30.7%), Technology and Telecommunications (22.9%), followed by Retail and Manufacturing.
- Tool Provenance: Legitimate dual-use open-source software weaponized for malicious C2 continuity.
---
Detection & SOC Mitigation Playbook
1. Incident Response & Host Remediation Checklist
- [ ] Inspect Memory-Backed Directories: Audit
/dev/shm/and/tmp/for hidden directories matching.gs-*or containing executable binaries. - [ ] Audit Systemd Units: Review
/etc/systemd/system/and/lib/systemd/system/for recently modified or unrecognized service files (such asdefunct.service). - [ ] Verify Web Account Shell Access: Ensure service accounts (
www-data,apache,nobody) have their default shell set to/usr/sbin/nologinor/bin/false. - [ ] Network Egress Filtering: Restrict outbound connections from web servers to unauthorized external relay endpoints (
gsocket.io,*.b-cdn.net).
2. Sigma Detection Rule (GSocket Linux Process & File Artifacts)
title: GSocket Reverse Relay Execution on Linux
id: f1902841-419b-4e12-b901-3f9211d0a489
status: stable
description: Detects execution of GSocket netcat relay tooling or staging in temporary memory directories
references:
- https://www.microsoft.com/en-us/security/blog/2026/11/11/global-socket-how-threat-actors-weaponizing-gsocket-stealthy-c2/
author: CyberNewsAI Threat Research Team
date: 2026-11-14
logsource:
category: process_creation
product: linux
detection:
selection_process:
Image|endswith:
- '/gs-netcat'
- '/gsocket'
selection_cmd:
CommandLine|contains:
- 'gsocket.io'
- 'gs-netcat'
- 'gsnetcat'
- 'GS_TG_TOKEN'
- '/dev/shm/.gs-'
condition: selection_process or selection_cmd
falsepositives:
- Legitimate administrative use of GSocket for out-of-band server maintenance
level: high
tags:
- attack.command_and_control
- attack.t1090.002
- attack.persistence
- attack.t1543.0023. Microsoft Sentinel & Defender Hunting Query (KQL)
// Microsoft Defender for Endpoint - Hunt for GSocket execution and network relay staging
DeviceProcessEvents
| where Timestamp > ago(14d)
| where FileName has_any ("gs-netcat", "gsocket") or ProcessCommandLine has_any ("gsocket.io", "gs-netcat", "gsnetcat")
| project Timestamp, DeviceName, AccountName, FileName, FolderPath, ProcessCommandLine, InitiatingProcessFileName
| order by Timestamp desc---
| Indicator Type | Value | Context / Telemetry |
|---|---|---|
| Relay Domain | gsocket[.]io | Global Socket Relay Network Infrastructure |
| CDN Endpoint | gsgg.b-cdn.net | Tool Distribution Endpoint |
| File Artifact | /dev/shm/.gs- | Memory-backed GSocket Staging Path |
| Service File | defunct.service | Rogue Systemd Persistence Unit |
| Binary Name | gs-netcat | GSocket Client Executable |
---
Related Topic Cluster Intelligence
- AvisLoader: How to Detect & Block Tox P2P Malware Loader Attacks: Varonis discovers AvisLoader, a resilient Windows malware loader using Tox P2P C2, ClickFix lures, and LNK hijacking to evade takedowns and drop payloads.
- China's UAT-11587 Targets Asian Governments via Antino Backdoor: China-nexus UAT-11587 infiltrated 16+ Asian government bodies with the Antino Rust backdoor.
- DPRK Hackers Abuse Terraform Registry to Deliver Go Malware: North Korean hackers targeted Web3 developers by planting malicious Terraform providers and Go modules on the HashiCorp Registry to deploy dual-C2 malware.
gsocket.iogsgg.b-cdn.net/dev/shm/.gs-gs-netcat// VERIFIED_SOURCES_&_REFERENCES
Related Threat Intelligence
View Archive
ARTEX AI Agents: How to Detect & Counter Autonomous Attacks
FBI issues FLASH advisory warning that cybercriminals abuse ARTEX AI agents to achieve domain compromise in under 3 hours. Hunt rapid automated lateral moves.

AI Infostealer Market: How to Detect & Block Replay Attacks
Dark web shops deploy AI to parse infostealer logs into searchable corporate dossiers, targeting enterprise VPNs and AI tokens. Hunt token replay attacks.

Telegram Widgets: How to Detect & Block WebRAT Infiltration
Flaws in Telegram's newly launched widgets enable zero-click RCE to deliver WebRAT infostealer via PowerShell. Hunt Telegram child processes with KQL.