GSocket Backdoor: Detections Up 356% via a Free Relay

By 12 min read
GSocket backdoor explained: how attackers abuse the gs-netcat relay tool for C2 and how to detect it

A free relay service built so hobbyists can reach their own machines behind a firewall has become one of the fastest-growing backdoors on hacked Linux web servers. Microsoft reported on 11 November 2026 that GSocket detections in its Defender for Endpoint telemetry rose 356.2% between March and August 2026.

The short answer to why: a GSocket backdoor needs no attacker server, no open port and no public IP. The hacked host and the attacker both dial out to a third-party relay and meet there using a shared secret, so the usual “block the C2 address” response has nothing to block. The good news is that the install leaves plenty of traces on the host, and this article walks through where to find them.

What is GSocket?

GSocket, short for Global Socket, is an open-source toolkit that lets two computers open an encrypted TCP connection to each other even when both sit behind NAT or a firewall. It is published at github.com/hackerschoice/gsocket under the BSD-2-Clause licence, with the tagline “Connect like there is no firewall. Securely.”

According to the GitHub API on 30 November 2026, the repository was created on 18 September 2020, has 1,991 stars and 203 forks, and was last pushed to on 12 November 2026. Its latest tagged release is v1.4.43 from 22 May 2024.

The toolkit ships several programs. The one attackers care about is gs-netcat, a netcat-style client that can give an interactive shell (a PTY, meaning a full terminal session), transfer files, act as a SOCKS proxy and forward ports. Other tools in the kit include gs-sftp, gs-mount and a wrapper called gsocket that makes an existing program reachable through the relay.

Why defenders call it dual-use

Dual-use means a tool built for legitimate work that is equally useful to an intruder. The GSocket README itself documents features that suit a backdoor: running gs-netcat as a daemon that restarts itself, starting it from rc.local or systemd, renaming the process so it looks like a system service, and an option to route through Tor. Microsoft Defender detects the client as HackTool:Linux/GsNetcat, a “hacktool” label rather than a malware family name.

How does the GSocket relay work?

GSocket identifies endpoints by a shared secret instead of an IP address or hostname. Both programs derive temporary session keys and IDs from that secret, connect outbound to the Global Socket Relay Network (GSRN), and the relay pairs them up.

Once paired, the two ends negotiate an end-to-end encrypted session. The README says the secret never leaves the user’s machine and the relay sees only encrypted traffic. It describes the encryption as OpenSSL SRP (Secure Remote Password, RFC 5054) with AES-256 and perfect forward secrecy, and no certificate infrastructure.

Diagram showing two hosts sharing a secret, dialling out to the GSocket relay and getting an encrypted session.
Neither end listens for connections: both dial out and the relay matches them, which is what makes the channel hard to block. Source: GSocket README, Microsoft.

Why that matters for C2

Command and control (C2) is the channel an attacker uses to send commands to a compromised machine. Microsoft points out three properties that make GSocket attractive for it:

  • No inbound listener. The compromised server never opens a port, so external scans and inbound firewall rules see nothing.
  • No attacker infrastructure. The relay belongs to a third party, so there is no actor-owned IP or domain to take down or block.
  • Encrypted content. Network monitoring can see that a host talks to the relay, but not what is said.

This is the same idea as the C2 hidden inside trusted services covered in GitDoor and GraphDoor, which used GitHub and SharePoint as C2: attackers borrow infrastructure that defenders cannot simply blocklist.

What did Microsoft find?

Microsoft’s report, “The global socket: how threat actors are weaponizing GSocket for stealthy C2”, was published on 11 November 2026 by Yash Gund and Sumith Maniath of Microsoft Security Research. It is based on Microsoft Defender for Endpoint (MDE) telemetry.

Four GSocket backdoor figures from Microsoft: 356% detection rise, 87.1% web hosting incidents, sector shares.
Most GSocket incidents in Microsoft's data started on web servers, and education and research was the most affected sector. Data: Microsoft Defender for Endpoint.

The key figures, as Microsoft reports them:

Metric Value
Rise in GSocket detections, March to August 2026 356.2% (against the March baseline)
Share of attributable incidents on web apps and hosting 87.1%
PHP web applications and cPanel hosting 63.9%
Apache 24.3%
Affected organisations in education and research 30.7%
Affected organisations in technology and telecom 22.9%

Microsoft notes the growth was not steady from month to month. The sector figures are shares of affected organisations, not of incidents; one secondary write-up from Aviatrix blurs those units, so cite Microsoft directly if you reuse them.

Who is behind it?

Microsoft does not name a threat actor. It says multiple unrelated threat actors have adopted GSocket, which fits a free, public tool that anyone can download. Treat any claim that GSocket points to one specific group with suspicion.

How does a GSocket backdoor get installed?

In the cases Microsoft describes, the intrusion follows a consistent pattern. The steps below are conceptual, taken from the report, and leave out commands.

Six-stage GSocket backdoor attack chain from web app exploit to operator shell over the relay.
The backdoor arrives after the web compromise, so fixing the original bug leaves stages three to six untouched. Data: Microsoft Security Research.

1. Web application compromise

Attackers exploit an internet-facing web application to run commands as the web server account. Microsoft shows encoded commands run through a vulnerable PHP application but does not name the web vulnerability used for initial access.

2. Download and staging

The attacker uses curl to fetch a remote install script and pipes it to bash. The script profiles the host, picks the gs-netcat build for its CPU architecture and stages it in /dev/shm, a memory-backed directory, for example under /dev/shm/.gs-0/.

3. Persistence

Microsoft describes layered persistence: cron jobs, a systemd unit named defunct.service pointing at /usr/bin/defunct, lines added to shell profiles, watchdogs that restart the client, and redundant copies of the binary. Staging files are deleted afterwards.

4. Disguise

The process is renamed to look like a kernel thread or a system service. Microsoft cites names such as systemd-remount-d and a bracketed [kaluad]. Bracketed names imitate kernel worker threads, which administrators are used to ignoring in process lists.

5. Handing over the secret

The install script prints a random secret. Microsoft says the operator can read it from the console, write it to a temp file, or have it sent to a Telegram chat, a Discord channel or a webhook. Whoever holds that secret can connect to the backdoor through the relay.

6. Privilege escalation, sometimes

In a few incidents, Microsoft says attackers attempted to exploit CVE-2026-43284, a Linux kernel local privilege escalation known as Dirty Frag, to move from the web server account to root. Microsoft gives no CVSS score. Aviatrix lists a score of 8.8 and calls it exploited in the wild, but Microsoft only says “attempted”, so treat the stronger claim as unconfirmed.

Is this new? A short history of GSocket abuse

No. GSocket has appeared in intrusion reports for at least two years. What Microsoft adds is scale and a clear rise in 2026.

Timeline of public GSocket backdoor reports from Elastic in 2024 to Microsoft in November 2026.
Four independent research teams have documented the same tool used as a backdoor since 2024. Data: Elastic, Sansec, SANS ISC, Microsoft.
Report Date Context What stood out
Elastic Security Labs, “Betting on Bots” 27 Sep 2024 REF6138 campaign: cryptomining and DDoS after an Apache2 compromise GSocket installed for persistence, key and binary hidden under /dev/shm and a user config folder, cron restarting it
Sansec, “Found defunct.dat on your site?” 3 Apr 2025 Magento and Adobe Commerce stores 45 of 80,000 scanned stores had running GSocket backdoors; some reinfected up to 7 times
SANS ISC diary 32816, Xavier Mertens 20 Mar 2026 Bash installer found on VirusTotal Fake SSH key file holding the secret, cron and .profile persistence, timestamp restoring
Microsoft Security Research 11 Nov 2026 MDE telemetry, many unrelated actors 356.2% rise, 87.1% web hosting, layered persistence and hunting queries

Recurring fingerprints

The same artefacts show up across reports, which is useful for hunting. Sansec and Microsoft both mention the name defunct (Sansec found key files named defunct.dat). Elastic, Sansec and Microsoft all describe bracketed kernel-thread names. Sansec also observed criminals scanning stores for each other’s key files, a sign that a leaked secret lets anyone take over the backdoor.

Compared with other “living off trusted services” C2

  GSocket backdoor Webworm with SoftEther VPN NotC2
Tool Public gs-netcat client Public SoftEther VPN software Custom, built on AWS services
Infrastructure Free third-party relay Attacker-controlled VPN servers Victim-reachable AWS services
Main detection point Host artefacts and relay traffic VPN software on servers Cloud API logs

See the Webworm SoftEther VPN case and the NotC2 channel built on AWS services for those comparisons.

Who is affected and how to check exposure

The highest-risk systems are internet-facing Linux servers that run PHP applications, cPanel or Apache, especially shared hosting, university and research servers, and e-commerce platforms. Sansec’s note that GSocket can run from a memory file descriptor shows why read-only code directories alone do not stop it.

Quick exposure checks:

  • List internet-facing Linux web servers and confirm each one has EDR or at least process and file auditing.
  • Check egress. Can a web server open arbitrary outbound connections? If yes, a GSocket client will reach its relay.
  • Review recent web compromises. Any server that had a webshell or RCE in 2026 and was only patched, not rebuilt, deserves a GSocket hunt.

How to detect a GSocket backdoor

Detection works best on the host, because the network side shows only encrypted traffic to a legitimate relay.

Log sources to use

  • EDR process events on Linux (in MDE, DeviceProcessEvents), or auditd execve records.
  • File creation events for /dev/shm, /tmp, /usr/bin, cron directories and systemd unit folders.
  • DNS and proxy logs from web servers.
  • Web server access logs around the time a suspicious process first ran.

Behaviours worth alerting on

  1. A web server account (www-data, apache, nobody) spawning a shell that runs curl piped to bash.
  2. Any executable launched from /dev/shm or /tmp, especially from hidden folders such as .gs-0.
  3. New cron entries or systemd units created by the web server account or with names like defunct.
  4. Processes with bracketed kernel-style names that have a real executable path and a parent other than kthreadd.
  5. Process names or command lines containing gs-netcat, gsocket or gsnetcat.
  6. DNS lookups or connections to gsocket.io, cdn.gsocket.io or gsgg.b-cdn.net.

Microsoft publishes Defender Advanced Hunting queries for each of these, plus four SHA-256 hashes and file paths. Use the original report for the full indicator list rather than copying it from secondary coverage. Elastic also published an EQL query and a YARA rule in its 2024 write-up. Microsoft adds a caution worth repeating: a single alert does not confirm how the attacker got in or whether they succeeded.

Kernel-level evasion makes host telemetry harder on Linux; see io_uring EDR evasion for one blind spot to keep in mind.

MITRE ATT&CK techniques

Microsoft maps the activity to these techniques:

ID Technique
T1190 Exploit Public-Facing Application
T1059.004 Command and Scripting Interpreter: Unix Shell
T1105 Ingress Tool Transfer
T1053.003 Scheduled Task/Job: Cron
T1543.002 Create or Modify System Process: Systemd Service
T1036 Masquerading
T1564.001 Hide Artifacts: Hidden Files and Directories
T1222.002 File and Directory Permissions Modification: Linux
T1070.004 Indicator Removal: File Deletion
T1070.006 Indicator Removal: Timestomp
T1090.002 Proxy: External Proxy

How to remove and prevent it

The list below follows Microsoft’s guidance, ordered by priority. Steps 1 (the rebuild advice) and 2 are standard incident response practice added here, not part of Microsoft’s list.

  1. Remediate the host, not just the bug. Remove the GSocket client, every cron, systemd and shell profile entry, and staged files, then confirm relay connections have stopped. If the attacker reached root, rebuild.
  2. Rotate anything the web account could read. Database credentials, API keys and SSH keys on a backdoored server should be treated as exposed.
  3. Apply deny-by-default egress for web servers and alert on connections to relay services.
  4. Patch and harden internet-facing apps. Remove unused components and restrict upload and admin paths.
  5. Mount /dev/shm and /tmp noexec where the application allows it, and alert on execution from hidden or world-writable paths.
  6. Audit cron, systemd units and shell startup files on a schedule, looking for plausible-sounding names.
  7. Patch kernel privilege escalation bugs including CVE-2026-43284, and enable EDR with behaviour monitoring on Linux servers.

The catch: what GSocket abuse does not tell you

GSocket is not a vulnerability and not malware in itself. Blocking the project or its domains is a reasonable control, but it does not fix the web compromise that came first, and determined attackers can host their own copies of the binary.

The 356% figure is a rise in Microsoft detections, not a measure of all intrusions. Detection growth can reflect better signatures as well as more attacks, and Microsoft’s sample covers only organisations running its EDR.

Open questions

  • Which web vulnerabilities were used? Microsoft does not name the initial-access CVEs, so defenders cannot tie the activity to specific patches.
  • How often did privilege escalation succeed? Microsoft says Dirty Frag was attempted in a few incidents; it does not say how often it worked.
  • Who are the operators? No actor is named, and the reports describe both cryptominers and store skimmers, so motives likely vary.
  • What will the relay operators do? None of the sources describe any action by the GSocket project against abuse of its public relay.

The bottom line

GSocket turns a free relay into a backdoor that has no C2 server to block and no open port to scan. Microsoft’s data shows it spreading fast across PHP, cPanel and Apache servers in 2026. The fix is host hygiene: hunt for /dev/shm execution, odd cron and systemd entries and disguised process names, lock down web server egress, and never assume a patched web app is a clean one.

Sources

This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.

Frequently asked questions

What is GSocket?

GSocket (Global Socket) is an open-source toolkit from the hackerschoice project on GitHub that lets two hosts behind NAT or firewalls open an encrypted TCP connection to each other through a free relay network, using only a shared secret instead of IP addresses.

Is GSocket malware?

No. GSocket is a public BSD-2-Clause project with about 2,000 GitHub stars. Microsoft Defender flags its client as HackTool:Linux/GsNetcat because criminals install it on compromised servers as a backdoor, but the tool itself is dual-use.

What is gs-netcat?

gs-netcat is the netcat-style client in the GSocket toolkit. It can provide an interactive shell, file transfer, a SOCKS proxy and port forwarding over the GSocket relay, which is why attackers use it as a remote access backdoor.

How do attackers install a GSocket backdoor?

In the cases Microsoft describes, attackers first get command execution through a vulnerable internet-facing web application, then download an install script with curl, stage gs-netcat in /dev/shm and add persistence through cron, systemd units and shell profiles.

How do I detect a GSocket backdoor on Linux?

Look for processes or command lines containing gs-netcat or gsocket, executables running from /dev/shm or /tmp, cron jobs and systemd units with odd names such as defunct, bracketed kernel-style process names owned by the web server user, and DNS or network traffic to gsocket.io or gsgg.b-cdn.net.

Can I block GSocket at the firewall?

Partly. Deny-by-default egress from web servers stops the client reaching the relay, and blocking the GSocket distribution domains stops the usual installer. Microsoft notes those domains are distribution hosts, not attacker C2, so a block is a control, not proof of compromise.

Does patching the web application remove a GSocket backdoor?

No. Microsoft stresses that the backdoor and its persistence stay in place after the original bug is fixed. You have to remove the client, its cron, systemd and profile entries and its staged files, then confirm that relay connections have stopped.

Which threat actor uses GSocket?

Microsoft does not name one. It says multiple unrelated threat actors have adopted GSocket. Earlier reports tie it to a cryptomining campaign Elastic tracks as REF6138 and to criminals backdooring Magento stores, but none of these is a single group.

Keep reading

GSocket backdoorgs-netcatcommand and controlLinux securityweb server securitythreat huntingMicrosoft Defender