Skip to main content
ACTIVELY MONITORED//Verified: Nov 16, 2026
Threat IntelligenceCloud DefenseMalware & Botnets
4 min read

GSocket: How to Detect Stealthy Linux C2 Relay Malware

••By Rutvij Khatri•VERIFIED INTEL
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

Attack Chain Flow
// Attack Chain Flow

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_SECRET or GS_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.service pointing 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-d or [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)

MITRE ATT&CK • OPERATIONAL TTP MAPPING
TacticTechnique IDTechnique NameOperational Context
Initial AccessT1190Exploit Public-Facing ApplicationRemote code execution on unpatched PHP, cPanel, or Apache services.
Defense EvasionT1027Obfuscated Files or InformationStaging executables in memory-backed /dev/shm directories and wiping installer scripts.
Defense EvasionT1036.004Masquerade Task or ServiceDisguising GSocket processes under names like systemd-remount-d.
PersistenceT1543.002Systemd ServiceInstalling rogue systemd service units (defunct.service) for automatic restart.
Privilege EscalationT1068Exploitation for Privilege EscalationExploiting Linux kernel vulnerabilities (Dirty Frag CVE-2026-43284) to gain root.
Command and ControlT1090.002External ProxyRouting 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 as defunct.service).
  • [ ] Verify Web Account Shell Access: Ensure service accounts (www-data, apache, nobody) have their default shell set to /usr/sbin/nologin or /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)

QUERY / DETECTION_RULE
SIGMA / YAML
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.002

3. Microsoft Sentinel & Defender Hunting Query (KQL)

QUERY / DETECTION_RULE
SENTINEL / 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 TypeValueContext / Telemetry
Relay Domaingsocket[.]ioGlobal Socket Relay Network Infrastructure
CDN Endpointgsgg.b-cdn.netTool Distribution Endpoint
File Artifact/dev/shm/.gs-Memory-backed GSocket Staging Path
Service Filedefunct.serviceRogue Systemd Persistence Unit
Binary Namegs-netcatGSocket Client Executable

---

Related Topic Cluster Intelligence

Indicators of Compromise (IOCs)
4 Identified
DOMAINgsocket.io
DOMAINgsgg.b-cdn.net
FILE PATH/dev/shm/.gs-
FILE PATHgs-netcat

// VERIFIED_SOURCES_&_REFERENCES

SHARE INTEL:Reddit