Unveiling Threats: How to Spot and Investigate Suspicious Processes on Linux

Mar 09, 202522 minutes to read

In today’s cybersecurity landscape, Linux systems, despite their robustness, remain a target for attackers. Unauthorized processes can jeopardize system integrity, compromise sensitive data, and degrade performance. Understanding how to detect and investigate these processes is an essential skill for system administrators and security professionals.

Below are two unique, SEO-optimized blog articles—one in English and one in Bosnian—for the amilma.digital blog. These articles provide professional, actionable advice on detecting and analyzing suspicious processes

The foundation of securing a Linux environment lies in active monitoring. Detecting irregularities early minimizes the risk of a full-scale attack. Suspicious processes often manifest through unexpected spikes in CPU or memory usage, execution under non-standard user accounts, or the presence of obfuscated binaries.

A robust monitoring strategy incorporates various tools and techniques:

  • top – Provides a continuously updated, real-time overview of system resource consumption, helping administrators identify high-impact processes.
  • htop – An enhanced alternative to top, featuring an intuitive interface with sorting and filtering options.
  • ps aux – Delivers a detailed snapshot of all running processes, including process owners, PIDs, and resource consumption.
  • pidstat – Captures per-process CPU, I/O, and memory usage over time, making it easier to detect anomalies that occur intermittently.
  • iotop – Monitors disk utilization by individual processes, assisting in detecting unexpected read/write operations.
  • systemd-analyze blame – Displays system services that take the longest to initialize, aiding in the identification of unauthorized or sluggish processes.
Practical Example:

If a process suddenly spikes to 100% CPU usage, runs under a generic or newly created user account, and does not correlate with any known service, it should be investigated immediately.


In-Depth Process Investigation

Upon identifying an anomalous process, gathering detailed forensic data is the next crucial step. The /procfilesystem in Linux provides a wealth of process-specific information, allowing administrators to analyze a process’s origin, behavior, and interactions with the system.

  • /proc/[PID]/status– Displays runtime information, including memory utilization and process state.
  • /proc/[PID]/cmdline– Reveals the exact command and arguments used to initiate the process.
  • /proc/[PID]/fd– Lists open file descriptors, showing whether the process is accessing critical system files or unauthorized locations.
  • /proc/[PID]/environ– Provides environment variables associated with the process, which can offer insights into its source or purpose.
  • ls -l /proc/[PID]/exe– Identifies the executable file linked to the process, helping detect cases where an attacker replaces legitimate binaries.
  • ls -l /proc/[PID]/cwd– Shows the current working directory of the process, which can reveal if it is executing from an uncommon or temporary location, such as /tmpor /dev/shm.
Investigative Command Example:
cat /proc/1234/cmdline

If this command reveals a script or binary stored in an unauthorized location, further scrutiny is warranted.


Analyzing Network Connections and Communication Patterns

Malicious processes often establish external connections to download payloads, transmit stolen data, or receive remote commands. A thorough examination of network activity is crucial to determining whether a process is acting as a conduit for cyber threats.

Effective tools for network inspection include:

  • netstat -tulnp – Displays all active listening ports, connections, and associated processes.
  • ss -tulnp – A faster alternative to netstat, providing detailed socket statistics.
  • lsof -i – Identifies open internet connections and the processes responsible for them.
  • tcpdump – Captures and analyzes real-time network traffic.
  • nethogs – Monitors per-process bandwidth usage, helping detect unexpected data transfers.
  • iptables -L -v -n – Reviews firewall rules to identify unauthorized or unusual outbound connections.
Example Scenario:

If a previously unknown process is found communicating with an unfamiliar external IP address over a non-standard port, it should be analyzed for signs of command-and-control activity.


Capturing and Examining Process Memory

Capturing a process’s memory space provides deeper insights into its execution. A memory dump allows analysts to identify embedded payloads, obfuscated scripts, and injected malicious code.

Steps for Memory Capture:
  1. Install the necessary debugging utilities:

    sudo apt install gdb
  2. Create a core dump of the process:

    gcore -o /path/to/output 1234
  3. For a deeper examination, extract memory contents using dd:

    sudo dd if=/proc/1234/mem of=/home/user/mem_dump bs=1024
  4. Utilize vmmapto map memory regions and identify anomalous code injections.
Example:
gcore -o /home/user/core_dump 1234

This command generates a core dump of process 1234for forensic review.


Conducting a Memory Dump Analysis

Once memory is captured, analysis tools help extract meaningful intelligence:

  • strings core_dump.1234 | grep -i "http" – Searches for embedded URLs, which may indicate remote control activity.
  • hexdump -C core_dump.1234 – Provides a hex representation of the dump, assisting in low-level analysis.
  • Volatility – A sophisticated memory forensic framework that uncovers hidden processes, injected libraries, and rootkits.
  • radare2 – A powerful reverse-engineering tool for binary analysis within memory dumps.
Example Output:

If stringsreveals API keys, encrypted payloads, or connections to malicious domains, immediate remediation is required.


Strengthening Security and Preventing Future Threats

Proactively defending against suspicious processes requires a multi-layered approach:

  • Regular System Updates – Ensure all software and packages are up to date to mitigate known vulnerabilities.
  • Application Whitelisting – Restrict execution privileges to approved binaries and scripts.
  • Process and User Monitoring – Deploy continuous monitoring tools like AuditD to track process activity and privilege escalations.
  • Host-Based Intrusion Detection Systems (HIDS) – Utilize solutions like OSSEC or Tripwire to detect unauthorized system modifications.
  • Automated Threat Response – Configure security frameworks like SELinux and AppArmor to enforce strict execution policies.
  • Incident Response Plan – Establish predefined protocols for isolating and mitigating security breaches.

Maintaining a secure Linux environment requires vigilance, continuous monitoring, and proactive investigation of anomalies. Attackers continuously refine their tactics, making it imperative for security professionals to stay ahead through advanced detection techniques and forensic analysis. By leveraging tools like top, ps, netstat, gcore, and Volatility, administrators can effectively identify, analyze, and neutralize suspicious processes before they escalate into serious security incidents.

With the right strategies in place, organizations can bolster their defenses, minimize risks, and ensure system integrity against evolving threats.

Image NewsLetter
Icon primary
Newsletter

Subscribe to the Newsletter

Enter your e-mail address and subscribe to our newsletter to send you the best offers and news directly to your inbox. Don't worry, we don't spam.