What Microsoft found
Global Socket (GSocket) is a public, open-source remote-access tool. Its main program, gs-netcat, gives a remote shell through a free public relay network. Microsoft's threat intelligence team published what they saw in their customers' telemetry:
- Detections rose 356% from March to August 2026, though not evenly month to month.
- 87% of the incidents were web applications and hosting. PHP apps and cPanel hosting were 64%, Apache 24%.
- The intruder was already in. GSocket is what they install after a web app bug gives them a shell, so they can come back after you fix the bug.
- Some tried to get root with Dirty Frag, the Linux kernel bug CVE-2026-43284.
Microsoft's own advice is blunt: "Do not treat application patching as complete remediation."
Why most people miss it
A classic back door listens on a port and waits. You can find that with ss -tlnp, a port scan or a firewall rule. GSocket works the other way round:
| What happens | Connection | What your firewall sees |
|---|---|---|
| The compromised server connects to the public relay and waits there, named only by a shared secret | Outbound | One encrypted connection out, like any app calling an API |
| The intruder, anywhere in the world, connects to the same relay with the same secret | Elsewhere | Nothing |
| The relay joins the two, and the intruder gets a shell, encrypted end to end | Through the relay | The same outbound connection as before |
The server needs no open port and no public address, and the intruder needs no server of their own. Microsoft puts it this way: "The host needs no inbound listener or public IP address, and network address translation does not prevent the connection." An inbound firewall has nothing to block. Blocking the intruder's address doesn't help either, because you never see it.
So don't look for a door. Look for what the installer did to put one there.
What the installer leaves behind
From Microsoft's write-up, a typical install goes like this. The intruder uses the web app to run curl, which fetches the installer script from gsocket.io/y and pipes it to bash. The script picks a build for the CPU, stages it in a hidden folder such as /dev/shm/.gs-0/, copies it under a harmless name (/tmp/systemd-remount-d, /usr/bin/defunct), starts it with a name that looks like a kernel thread ([kaluad]), adds a systemd unit, cron entry or shell profile line so it comes back after a reboot, and copies old timestamps onto the new files.
Every one of those steps is something a Linux host can notice. This is what Stack Snack raises for each:
| Trace on the server | Exec capture | Stack Snack rule |
|---|---|---|
A PHP worker or the web server starts sh, curl or wget | Not needed | SEC-059 Web server, PHP or app server spawned a shell or downloader (high) |
curl … gsocket.io/y piped to bash | Needed | SEC-194 Relay or tunnel tool started, installer class (high). SEC-163 Download-and-execute (medium) |
Hidden folder /dev/shm/.gs-0/ | Not needed | SEC-033 Hidden file or directory in a system path (medium) |
The program runs from /dev/shm or /tmp | SEC-102 only | SEC-019 Execution from a suspicious location. SEC-102 Execution from scratch or deleted path |
| …and holds an outbound connection from there | Not needed | SEC-127 Scratch or hidden-path execution with an established outbound connection |
gs-netcat runs under its own name | Needed | SEC-194 Relay or tunnel tool started (high) |
A copy in /usr/bin/defunct that no package owns | Not needed | SEC-199 Unpackaged program in a system binary directory (medium; high while it runs) |
The process calls itself [kaluad] | Not needed | SEC-018 Kernel-thread imposter (high) |
defunct.service and its multi-user.target.wants link | Not needed | SEC-002 Cron or systemd persistence configuration changed (high) |
A new line in a user's crontab, /etc/profile or a shell rc file | Not needed | SEC-029 New or changed persistence mechanism (high). SEC-026 Persistence content indicator (high) when the line has a download pipe or a /tmp path |
| The staged copy is deleted while it runs | Not needed | SEC-004 Running process executable deleted (low) |
Copying old timestamps onto the files doesn't hide them from SEC-002 or SEC-029. A unit file that wasn't there yesterday is new, whatever date it carries.
SEC-194 is the rule that names the tool. It knows the Global Socket programs (gsocket, gs-netcat and its platform builds such as gs-netcat_mini-linux-x86_64, gs-sftp, gs-mount), other outbound tunnels such as Chisel, frp, ngrok and ligolo, and any curl, wget or shell line that fetches from gsocket.io or a name under it. It leaves ssh, Tailscale, cloudflared and WireGuard alone, because people run those on purpose every day.
Turn on exec capture first
Rules marked "Needed" above read the stream of programs as they start. Stack Snack calls this exec capture, and it is off by default. Without it those rules can't fire. A short curl | bash can start and finish between two process snapshots (every 30 seconds by default), so the snapshot rules may never see it either.
Turn it on when you install the agent, with install.sh --with-exec-capture or the "Turn on exec capture" box on Add hosts. On a host that already runs the agent, add this to /etc/observer-agent/config.toml and restart the agent:
[telemetry]
enabled = true
Kernels older than 6.6 also need CAP_NET_ADMIN in the agent's systemd unit. The host page shows whether exec capture is on, and the rule catalog marks every rule that needs it.
Where the built-in rules stop
A careful intruder can slip past each rule on its own:
- A renamed copy isn't matched by name. Once the program runs as
/usr/bin/defunct, SEC-194 has nothing to match. That is why the rename itself raises SEC-199, the fake kernel-thread name raises SEC-018, and the restart entry raises SEC-002 or SEC-029. - SEC-194 knows one installer host. Microsoft also lists
gsgg.b-cdn.netas a place the binaries are downloaded from. A fetch from there, or from a copied script on any other host, doesn't fire it. - Stack Snack sees addresses, not names. It reads each connection's addresses and ports, not DNS lookups. After the copy leaves
/dev/shm, its relay connection looks like any other outbound HTTPS. - SEC-199 needs a Debian-family package database. It asks dpkg who owns a file, so it covers Debian and Ubuntu.
None of these gaps is big when the rules work together. But they show where your own alarms help most: the outbound side, and the download hosts you learn about from the news.
Add your own layer
Stack Snack lets an admin add three kinds of alarm without waiting for us to ship a rule: custom rules, your own threat indicators and log monitors. For GSocket the first two do the work. All values below are synthetic; adjust the account names and paths to your server.
Alarm 1: the web account holds an outbound connection
GSocket started through a hacked web app usually runs as the web server's account. On most web servers that account (www-data, uid 33 on Debian and Ubuntu) should only make outbound connections from the web server or PHP itself. Anything else running as www-data with an open connection out is worth a look, whatever it calls itself and wherever it lives.
A custom rule over the connections inventory says that. Create it under Custom rules in the console, or with the API:
curl -X POST -H "Authorization: Bearer $LSS_API_TOKEN" \
-H 'Content-Type: application/json' \
https://app.stacksnack.app/api/v1/custom-rules -d @- <<'JSON'
{
"name": "Web account holds an outbound connection",
"description": "A program running as www-data, other than Apache or PHP-FPM, has an established outbound TCP connection.",
"collector": "connections",
"severity": "high",
"when": "entity.uid == 33 && entity.state == 'ESTABLISHED' && entity.local_port_is_listener == false && entity.process_comm != null && !(entity.process_comm in ['apache2', 'php-fpm8.2'])",
"tests": {
"match": {"uid": 33, "state": "ESTABLISHED", "local_port_is_listener": false, "process_comm": "defunct"},
"benign": {"uid": 33, "state": "ESTABLISHED", "local_port_is_listener": false, "process_comm": "php-fpm8.2"}
},
"dry_run": true
}
JSON
- The
testspair is a proof. Stack Snack refuses to save the rule unless thematchsample fires and thebenignsample doesn't, so a typo or a flipped condition never reaches your hosts. dry_runcounts without alerting. Leave it on for a few days and watch the rule's fired count. If your app calls out through a helper program (an image converter, a mail sender), add its name to the list. Then setdry_runto false.- It also finds a back door that is already running. Once
dry_runis off, every inventory snapshot is checked in full, so a relay connection that was open before you wrote the rule fires too. Only a brand-new host's very first snapshot stays quiet. - The
!= nullline keeps unknown owners quiet. Without the agent's optional root helper, the program behind another account's socket can be unknown. Turn the helper on for the full picture.
The limit: inventory is a snapshot. A connection that opens and closes between two snapshots is missed. GSocket holds its relay connection open, which is what this alarm waits for.
Alarm 2: the download host SEC-194 doesn't know
A second custom rule, over exec events, covers the extra download host from Microsoft's report. It needs exec capture.
{
"name": "Download from a Global Socket binary host",
"collector": "exec_events",
"severity": "high",
"when": "entity.comm in ['curl', 'wget'] && entity.cmdline contains 'gsgg.b-cdn.net'",
"dry_run": true
}
When the next report names another host, add it to the same rule with || entity.cmdline contains '…'. The agent keeps the scheme and host of a URL on a curl or wget command line, so matching on the host name works.
Alarm 3: one finding becomes a fleet-wide alarm
Say alarm 1 fires on one web server. The evidence shows the remote address the program was talking to. Add that address as your own indicator on the Threat intel page, or by API:
curl -X POST -H "Authorization: Bearer $LSS_API_TOKEN" \
-H 'Content-Type: application/json' \
https://app.stacksnack.app/api/v1/threat-intel/indicators \
-d '{"ip":"203.0.113.40","label":"Relay seen on web server, 2026-11-16","severity":"high","expires":"2026-12-16T00:00:00Z"}'
From then on SEC-078, Connection with a known malicious IP, fires on any of your hosts with a connection to that address, whatever the program is called. Relays are shared and their addresses change, so give the indicator an expiry date. A match is a reason to look, not proof of a break-in.
What about log monitors?
Log monitors count lines in your shipped logs that contain a phrase, and alert above a threshold. They're the right tool when your web server or app logs the attack itself, for example a burst of requests to an upload path you never use. GSocket writes nothing useful to the logs once it runs, so for this threat the two custom rules and the indicator do more.
If you find it
- Treat the server as compromised. The intruder had a shell before they installed GSocket.
- Look at outbound connections and the programs behind them, as root:
ss -tnp state established - Look for user processes with a bracketed name. Real kernel threads have parent PID 2:
ps -eo pid,ppid,user,args | awk '$2 != 2 && $2 != 0 && $4 ~ /^\[/' - Check the places it uses to come back:
/etc/systemd/system,crontab -l -u www-data,/etc/cron.d,/etc/profileand the web account's shell files. Ask dpkg about anything odd in/usr/bin:dpkg -S /usr/bin/defunctsays "no path found" for a file no package owns. - Remove the program, its restart entries and the staged files, then confirm the relay connection has stopped, as Microsoft advises. Rotate every secret the web app could read.
- Patch the web app and the kernel, and think about limiting outbound traffic from web servers to the places they really need to reach.
Sources
- Microsoft Security Blog: The global socket, how threat actors are weaponizing GSocket for stealthy C2 (11 November 2026)
- BleepingComputer: Hackers plant GSocket on Linux servers for persistent access (12 November 2026)
- The Global Socket project
Related posts
- NGINX2Root: from a web request to root on the host, and the module load that gives it away: Two nginx HTTP/2 bugs, an unpatched kernel flaw, and the rules that see each step.
- When ps and ls lie: catching an ld.so.preload rootkit like QLNX: Why the host's own tools came up clean, and what Stack Snack raised instead.
- Plex2Shell: what it looks like on your Linux box: Patch first, then work back from a CPU spike to the process that caused it.