GSocket on your Linux servers: attackers keep access after you patch. How to find it and remove it
Microsoft Threat Intelligence reported on November 11 that several unrelated attackers are installing GSocket, an open-source remote-access tool, on Linux servers they’ve broken into, and BleepingComputer picked it up. Devices with GSocket detections in Microsoft Defender rose 356% from March to August 2026. 87% of the incidents were on web applications and hosting: PHP apps and cPanel made up 64% of those, and Apache 24%. Education and research was the biggest sector at 31%.
The attacker gets code execution through a web app, runs a curl one-liner that fetches GSocket’s deploy script, and the script installs the gs-netcat binary under a harmless-looking name with several ways to start again after a reboot, so it stays after the web app is patched.
The infected server and the attacker both connect out to the public Global Socket Relay Network (gs.thc.org, port 443), which pairs them up by a shared secret. Inbound firewall rules never see it, and there’s no attacker IP or domain to block. Microsoft also saw some attackers try Dirty Frag (CVE-2026-43284) to get from the web server account to root.
Where the installer puts things
I read GSocket’s deploy/deploy.sh to see what it writes, then checked it against Microsoft’s indicators. As root it installs system-wide. As any other user, including the web server account, it installs into that account’s home folder.
| What | Where |
|---|---|
| Binary | /usr/bin/defunct as root, ~/.config/htop/defunct otherwise. Older versions used gs-dbus or gs-db, and ~/.config/dbus |
| Secret | The same name plus .dat, next to the binary, in the systemd folder, or in /etc |
| Fallback folders | /tmp/.gsusr-<uid> and /dev/shm when nothing else is writable |
| Persistence | A defunct.service described as “D-Bus System Connection Bus”, a line in /etc/rc.local, a crontab line that runs every hour, and a line in .bashrc or .profile |
| Process name | A fake kernel thread picked at random: [kaluad], [kworker], [kswapd0], [watchdogd] and eight more |
Microsoft’s intrusions also used /dev/shm/.gs-0/gs-netcat_mini-linux-x86_64, /tmp/.gsn_ora and a binary renamed systemd-remount-d in /tmp and /usr/bin, and published four SHA-256 hashes (in Sources below).
The name and folder are whatever the attacker wants. The installer takes GS_HIDDEN_NAME and GS_DSTDIR from the environment, so don’t count on finding defunct. The systemd unit’s ExecStart contains GS_ARGS=. The rc.local, crontab and startup-file lines contain it too, unless base64 or xxd is on the box, in which case they’re encoded and end in a tag: #1b5b324a50524e47 >/dev/random # seed prng defunct-kernel. Each of those also gets a comment above it, # DO NOT REMOVE THIS LINE. SEED PRNG..
Check one server
As root. Persistence lines first:
grep -rlE 'GS_ARGS=|1b5b324a50524e47|seed prng' /etc/rc.local /etc/rc.d /etc/systemd/system \
/lib/systemd/system /usr/lib/systemd/system /etc/cron.d /var/spool/cron /etc/profile.d \
/root /home/*/.bashrc /home/*/.profile 2>/dev/null
Then running processes. The first command lists processes started with GS_ARGS in their environment. The loop lists anything showing a [kernel thread] name with a real binary behind it (a real kernel thread has an empty command line and no binary):
grep -las 'GS_ARGS=' /proc/[0-9]*/environ
for p in /proc/[0-9]*; do
a=$(tr '\0' ' ' < $p/cmdline 2>/dev/null)
case "$a" in "["*) echo "${p#/proc/} $a-> $(readlink $p/exe)";; esac
done 2>/dev/null
Then files:
ls -la /usr/bin/defunct* /usr/bin/gs-db* /dev/shm/.gs-* /tmp/.gsusr-* /tmp/.gsn_ora \
/root/.config/htop /home/*/.config/htop 2>/dev/null
~/.config/htop is also where htop keeps its settings. Look for a defunct or defunct.dat inside it.
Look in the web server account’s home too. That’s the account a PHP exploit runs as, and its home is usually /var/www, /usr/share/httpd or a cPanel user’s folder under /home. Add those paths to the commands above.
On my lab VMs with a stand-in install, the first one listed seven files, the second found both fake kernel threads ([kaluad] running /usr/bin/defunct and [kworker] running /home/claude/.config/htop/defunct), and the third listed the binaries, secrets and /dev/shm/.gs-0.
If you find it
- Take the server off the network, or at least block outbound to
gs.thc.org, before you clean up. - Remove the persistence first, or something starts it again while you work:
systemctl disable --nowthe service and delete the unit file, then delete only the marked lines fromrc.local, the crontabs and the shell startup files. - Kill the processes, then delete the binary, the
.datsecret files and the staging folders. - Rotate every credential on that server: SSH keys, database passwords, API keys in the web app’s config.
- Find the way in and patch it. Microsoft’s alerts point at shells started by PHP, Java and Node web apps. Patch the kernel for Dirty Frag while you’re there.
- Limit outbound traffic from web servers to the destinations they need.
GSocket’s installer has an uninstall mode, GS_UNDO=1. It only cleans the names and paths that version of the script knows about, for the account that runs it, and its own comments say it leaves the running process alone.
Doing it with RFF
The RFF Script Library has two new Linux entries. “GSocket Backdoor - Compromise Check (Linux)” is read-only. It covers root and every account with a home folder, web server accounts included, and looks for everything above: processes started with GS_ARGS or disguised as kernel threads, the installer’s binaries and secrets under all three names, Microsoft’s paths and hashes, and the marked persistence lines in shell startup files, rc.local, every crontab, /etc/cron.d and systemd units, whatever the binary was renamed to. A gs-netcat that someone installed in plain sight comes back as “installed openly”, so you can confirm it’s yours. It does no DNS lookups, because resolving the relay from a server can set off that server’s own egress alerts. “Remove GSocket Backdoor (Linux)” removes persistence first, deletes only the marked lines (owner, mode and SELinux label stay as they were), never deletes a file a package owns, re-checks at the end, and has a dry run.
I didn’t install the real GSocket in the lab. I built a stand-in from the installer’s code on a Rocky Linux 9.8 VM and an Ubuntu 26.04.1 VM: the same files, unit, encoded and plain persistence lines, root and user installs, and fake kernel threads, with a copy of bash in place of gs-netcat. The check found all of it on both (26 findings), the removal took 5 to 10 seconds, and the cron jobs and .bashrc lines I’d planted next to the attacker’s were still there afterwards. My first version of the check got two things wrong on Rocky. It listed every systemd file twice, because /lib is a link to /usr/lib there. It also missed a gs-netcat in /usr/local/bin, because it searched with command -v and sudo on RHEL-family systems drops /usr/local/bin from PATH. The check now looks in those folders by path.
RFF is free for your first 100 endpoints: getrff.com.
Sources
- Microsoft Threat Intelligence: The global socket, how threat actors are weaponizing GSocket for stealthy C2 (telemetry numbers, attack chain, file paths,
[kaluad], the four SHA-256 hashes, hunting queries) - BleepingComputer: Hackers plant GSocket on Linux servers for persistent access (summary of Microsoft’s findings)
- GSocket on GitHub (
deploy/deploy.sh: install paths, names, persistence lines,GS_UNDO;gs.thc.organd port 443 from the source) - Sansec: Found defunct.dat on your site? (cited in Microsoft’s references)
- SHA-256 from Microsoft:
d94f75a70b5cabaf786ac57177ed841732e62bdcc9a29e06e5b41d9be567bcfa(x86-64 mini binary),f95c4d029e6784e3849b4d1e2e2ae1a661187236ef7c5d487c71158a290a03b5(AArch64),55d141bb2f62c527c3fea3413b8429fed7d52633d0b123b5e611bfa42165229f(systemd-remount-d),12450bafc7a4398040e1ad3a16dbf4dbc79b6a8f83ef306c4f0f73f59886f06c(/tmp/.gsn_ora)
Comments
Comments use GitHub Discussions, so you'll need a GitHub account to post. Corrections are especially welcome.