Self-Hosted Code Hosting Server Flooded with Invalid Account Registrations: Attack Chain and Hardening Guide

    This article walks through a real incident in which a self-hosted code hosting service was flooded with junk accounts holding empty repositories, which turned out to be a side effect of a cryptomining intrusion involving replaced system binaries, an SSH backdoor, and a remote code execution flaw. It explains how to tell resource exhaustion from malicious usage, detect filtered process listings by comparing command output with the kernel view, recover deleted payloads from file descriptors, and then apply a prioritized hardening checklist covering registration controls, patching, least privilege, monitoring, and post-compromise response.

    1. Where It Started: A Small Server That Seemed to “Lag”

    A developer logged into a low-spec cloud host and found memory almost fully consumed, with a load average in the teens and an interactive session that was nearly unresponsive. The initial goal was simple: find out what was eating the memory. Following that thread led not to a single misbehaving business process, but to a full combination attack — a cryptomining program, replaced system commands, an SSH backdoor, and a remote code execution vulnerability in a self-hosted code hosting service on another machine that automated scripts were exploiting repeatedly.

    The most visible symptom was that the database process that should have been using memory had been pushed into swap, leaving only single-digit megabytes available. Meanwhile, the top resource consumers were all suspicious processes running under the data directory of the self-hosted code hosting service: a mining proxy with outbound connections, a mining binary located in a shared memory directory, and a dozen or so mutually guarding watchdog scripts. The real objective was never “register a pile of empty accounts” itself, but to turn the server into a resource node that generates revenue over the long term. The invalid accounts were merely a byproduct of gaining an initial foothold and persistence.

    2. Why So Many Users Appear With Nothing but One Empty Repository

    Abstracted from the incident, mass invalid accounts typically come from a combination of three paths:

    1. Open registration with no verification constraints: the service allows anyone to self-register by default, with no email verification, CAPTCHA, rate limiting, or invite-only mode, so a script can complete hundreds or thousands of registrations in minutes.
    2. A known remote code execution vulnerability: older versions of self-hosted code hosting services contain remote execution flaws that automated tooling can exploit, letting an attacker run commands without an account, then bulk-create accounts and initialize empty repositories — either to obscure the real objective or to serve as landing directories for later payloads.
    3. An automated black-market pipeline: registration, repository creation, payload delivery, and log cleanup are all scripted end to end. Empty repositories are just an intermediate state in the pipeline; the attacker does not care about content, which is why it looks purely destructive with no benefit.

    Put differently, the abnormal account count is the result, not the motive. Delete the accounts without fixing the entry point, and they will grow back the next day.

    3. Attack Chain Recap: From Exposure Surface to Rootkit

    3.1 Layer One: Resources Squeezed, Not Used

    To judge whether memory is being maliciously consumed, look at where two classes of processes sit: legitimate services swapped out to the swap area, and suspicious processes resident in physical memory that keep growing. System-mode CPU usage running abnormally high is also a signal — often not the mining itself (mining consumes user-mode time) but a large number of short-lived scripts traversing system directories at high frequency and checking on each other, burning CPU on system calls.

    3.2 Layer Two: The Process List You See Is the One You Are Allowed to See

    When system commands behave unexpectedly, suspect that the commands themselves have been replaced. A typical technique is to rename and keep the original binary, place a script at the original path, and filter the output by keyword so that any process matching specific names is hidden. A common giveaway is a filter list that no longer matches the current payload names — the attacker swapped the payload naming but forgot to update the filter rules, so the anomalous processes end up exposed after all.

    An illustrative triage approach (method only, no specific third-party commands):

    1. # Check the real type of suspicious system commands
    2. file /usr/bin/ps /usr/bin/top
    3. # Cross-check process information from the kernel's view in a read-only way
    4. ls /proc | grep -E '^[0-9]+$' | sort -n
    5. cat /proc/<pid>/cmdline | tr '\0' ' '

    If the same process appears in a different count in the “command output” versus the “kernel directory”, output filtering is almost certainly in play.

    3.3 Layer Three: Self-Deleting Dropper and Memory Forensics

    Persistence is usually hooked into a scheduled task pointing at a script path that no longer exists on disk: the script deletes itself after running, so nothing is visible on the filesystem. But the script interpreter holds a file descriptor open for the duration of execution, and even after the directory entry is removed, the content can be fully recovered from the process’s file descriptor directory as long as the process is alive. This is the value of “forensics from memory and file descriptors” during an intrusion investigation: do not stare only at the disk.

    3.4 Layer Four: Lateral Movement and Backdoors

    Once an attacker has code execution, they generally do three things: write in a public key for passwordless login, add a stealthy scheduled task, and scan other internal and public-facing ports to spread further. A single compromised host therefore often means other hosts under the same account system are at high risk too.

    4. Hardening Checklist, in Priority Order

    Priority 1: Close unnecessary entry points

    • Disable open self-registration; switch to administrator approval or invite-only. If it must stay open, enable email verification, CAPTCHA, and registration rate limiting.
    • Pull service ports back from the public internet; allow only necessary sources through a reverse proxy or security group, and restrict the admin console to specific source addresses.

    Priority 2: Versions and patches

    • Upgrade to a supported stable release promptly and follow official security advisories; for instances that cannot be upgraded immediately, use network-layer policies to temporarily block exploitable paths.

    Priority 3: Least privilege and isolation

    • Run the service under a dedicated low-privilege account, with the data directory strictly separated from system directories; with containerized deployment, restrict privileged mode and mount scope.
    • Keep databases, caches, and similar components off the public internet, reachable only locally or from the internal network.

    Priority 4: Observability and alerting

    • Use a centralized logging service plus monitoring and alerting to cover registration failure rates, anomalous logins, process creation, and scheduled task changes; set threshold alerts for “large numbers of registrations in a short window”.
    • On cloud platforms, combine host security protection, intrusion detection, and vulnerability scanning for baseline checks instead of relying solely on manually logging into the machine.

    Priority 5: Response order after a compromise

    1. Cut network access or tighten the security group, and preserve the scene;
    2. Collect evidence from the kernel view and file descriptors, and fix it in place;
    3. Remove persistence items (scheduled tasks, startup entries, public keys, replaced system commands);
    4. Rotate all credentials and keys; reinstalling the system and restoring clean data is often more reliable than “cleaning it by hand”;
    5. Review the entry point and close the gaps in registration and exposure-surface policy.

    5. Conclusion

    A flood of invalid accounts is never an isolated phenomenon; it is the visible fragment of exposure surface, an old-version vulnerability, and automated attack tooling stacking together. For operators of self-hosted services, the most effective order of investment is: close the entry points first, then patch versions, then handle isolation and alerting. Answer two questions clearly — “can it be registered automatically?” and “can it be reached directly from the public internet?” — and the vast majority of automated abuse is already kept outside the door.