Steps to Uninstall and Remediate a Rootkit in Linux Systems

Linux rootkits are rarely one removable package. They may replace system binaries, preload shared libraries, alter boot components, conceal processes, or run an unauthorised kernel module. The first objective is therefore to regain control of the host and establish what was trusted before the breach, not merely to delete the file whose name appears suspicious. Evidence collection and recovery decisions should be handled as one operation.

Start with a known-clean administration device, document the host’s role and owner, and avoid using production credentials on the affected machine. Isolate affected systems from networks and management planes while preserving volatile evidence where feasible. Contact the incident lead, legal team, cyber insurer and relevant sector authority early. Do not patch, reboot or run ordinary cleanup scripts until an approved forensic snapshot or memory capture has been taken.

Contain the system and preserve evidence

Containment should follow the active risk. If the machine is beaconing, scanning other systems or modifying accounts, block its traffic at switches, hypervisor firewalls or cloud security controls. If activity appears dormant, preserve connectivity long enough to collect volatile data, but restrict it to an isolated management segment. Record every action with an Australian timestamp, including AEST/AEDT or AWST, and normalise the timeline to UTC.

Do not power off a potentially compromised server unless continued operation creates greater danger, because a reboot can erase memory and rootkit artefacts. If the initial alert arrived by email, have a responder verify an unknown domain using approved intelligence before anyone follows its instructions. That check helps distinguish a phishing message from a genuine security notification; it does not prove the Linux host is clean.

Capture disk images, memory, process lists, network sockets, kernel logs, authentication records and recent command histories. Keep the image hash and chain of custody in the incident record. For fleets, add the host to an EDR containment group, but confirm that the control plane itself was not compromised before relying on it to enforce isolation.

Identify rootkit behaviour and persistence

Treat every finding on the affected host as a lead rather than proof. A rootkit can alter ps, package databases and file timestamps to hide itself. Compare package manifests and critical file hashes with a known-good Debian, Ubuntu, Red Hat or SUSE source, using dpkg --verify, debsums, RPM verification and signed repository metadata where available. Commands such as ss, lsof, journalctl and ausearch may expose behaviour, yet their output can still be incomplete.

Endpoint history can help establish the route in. A visit to a New Zealand casino page does not itself indicate compromise, but DNS, proxy and browser records can reveal whether a risky download or redirect occurred before credentials were abused. Correlate those timestamps with VPN logs, identity-provider events and cloud console activity. This matters in Australian organisations whose remote staff move between home offices, customer sites and international travel, often reusing the same laptop across trust zones.

Map persistence across userspace and the kernel. Review systemd units and timers, cron jobs, init scripts, shell profiles, PAM modules, SSH keys, sudoers rules, setuid files, file capabilities, /etc/ld.so.preload, LD_PRELOAD, loaded modules and altered kernel symbols. Look for services, accounts or certificates with no legitimate owner. Hidden listening ports and unexplained outbound DNS deserve immediate attention, as do recently changed files outside normal deployment windows.

Remove userspace and kernel components

For a userspace rootkit with a confidently identified package and a complete artefact inventory, uninstall the offending package and restore every modified file from a signed, known-good source. Reinstall rather than trust a package when its scripts, maintainer files or shared libraries may have been replaced. Remove unauthorised cron entries, systemd units, accounts, keys and preload directives, then reload the affected services. Keep a forensic copy before each change and log the command, operator and result.

Kernel-level compromise changes the risk. An unsigned or unexpected module, modified syscall table, patched boot image or hidden process may make live cleanup unreliable. Quarantine the host, preserve a memory image and compare the running kernel with vendor hashes. Removing a module does not undo every hook, so use a trusted rescue environment or known-good kernel and treat rebuild as the default when kernel integrity cannot be established.

Cloud workloads need special care because an attacker may have planted persistence in instance user data, startup scripts, container images, CI/CD variables or management identities. Revoke the host’s role assumptions only after evidence is preserved, and hunt for recreated workloads, tokens and keys. Deleting a suspected binary is ineffective if the control plane can reinstall it on the next boot. Record affected repositories, clusters and identities so the response team can search beyond the first endpoint.

Rebuild systems from known-good media

Repaired systems are appropriate only when the rootkit’s scope is bounded and independent comparison shows that the operating system, boot chain and management path are trustworthy. A practical threshold includes a verified package set, no unexplained kernel changes, complete coverage of persistence mechanisms and a clean account and credential inventory. If any uncertainty remains, rebuilding gives a stronger assurance than continuing to hunt inside an environment that may be designed to mislead the defender.

For a confirmed compromise, reimage the host from trusted installation media or a validated golden image, then restore application data selectively. Do not restore the entire writable system volume because it may carry the original malicious state. Rebuild virtual machines, containers and edge appliances from signed templates. For remote mining, energy and water sites in Western Australia and Queensland, pre-stage offline recovery media, current configuration and out-of-band communications because constrained satellite or terrestrial links can make remote reinstallation impractical.

Rotate secrets from a clean device after the rebuild is isolated and monitoring is active. This includes SSH keys, passwords, API tokens, service-account keys, database credentials, signing certificates and secrets held in vaults or CI systems. Review cloud identity assignments and MFA resets, then invalidate active sessions. If personal information may have been exposed, assess notification duties under the Privacy Act 1988 and applicable state and territory privacy laws; significant cyber incidents should also be reported through the Australian Signals Directorate’s ReportCyber service.

Validate recovery and monitor recurrence

Validation must be independent of the compromised system’s own tools. Compare rebuilt files against signed sources, confirm the kernel and boot chain, inspect expected services and scheduled tasks, and test network behaviour from a clean console. Check account inventories, authorised keys and privileged group membership. Rebuild the host into a restricted monitoring segment first, watch for beaconing and policy changes, and permit production traffic only after the baseline matches the approved build.

Choose the recovery path according to the evidence available and the assurance each option can provide:

Recovery approach Rootkit removal confidence Evidence retained Operational impact Appropriate use
In-place removal Low to moderate Moderate Low Bounded userspace compromise with a complete artefact inventory
Reinstall affected packages Moderate Low to moderate Medium Known packages and configuration with verified unmodified files
Reimage from known-good media High Low unless separately captured Medium to high Confirmed rootkit, kernel tampering or uncertain host integrity
Replace and rebuild the workload Very high Low unless separately captured High Compromised management path, cloud persistence or repeated reinfection

Keep the original evidence separate from the replacement system, and attach validation results to the incident record. Enhanced monitoring should cover package changes, new systemd units, module loads, privilege changes, DNS anomalies and outbound connections. In regulated or operational-technology environments, involve the asset owner and safety team before returning the device to service. A clean scan alone is not closure when the rootkit may have concealed itself from that same scanner.

Coordinate response and sustain resilience

For Australian organisations that need coordinated post-breach support, CARM Security, developed by Exclusive Networks, provides an ecosystem approach that combines vendor capabilities for identifying, containing, responding to and remediating attacks. It can complement an internal team or managed service provider in markets such as Sydney and Melbourne, where hybrid work, cloud services and multiple managed suppliers are common. The operating model should still define who authorises isolation, who preserves evidence, who communicates with regulators and who validates recovery.

The following safeguards reduce the chance that rootkit cleanup becomes a recurring incident:

CARM’s broader threat-response model also reflects a practical need visible across Australian enterprises: containment, eradication and recovery should draw on shared intelligence, specialised tooling and clear coordination rather than isolated cleanup by each administrator. Review findings against the ASD Essential Eight, relevant sector playbooks and contractual notification duties. The practical takeaway is to treat any confirmed Linux rootkit as a failure of trust, preserve evidence, rebuild from known-good sources, rotate exposed credentials and watch for recurrence from clean systems.