Skip to the content.

đź”— Link to the Room

🏷️ Table of Contents

  1. Popularity of SSH
  2. Initial Access via SSH
    2.1 Risks with Key-Based Authentication
  3. Detecting SSH Attacks
    3.1 Common SSH Breach Scenario
    3.2 Distinguishing Legitimate vs Malicious Logins
    3.3 Detection Mindset
  4. Initial Access via Services
    4.1 Linux and Public Services
    4.2 Using Application Logs
    4.3 Web as Initial Access
    4.4 Example: Command Injection via Web App
    4.5 Indicators of Command Injection
  5. Detecting Service Breach
    5.1 Process Tree
    5.2 Typical SOC Scenario
    5.3 Auditd and Process Tree Analysis
  6. Advanced Initial Access
    6.1 Human-Led Attacks
    6.2 Supply Chain Compromise
    6.3 Detecting Human-Led and Supply Chain Attacks

📚 Study Notes

 

Popularity of SSH

 

 

[!CAUTION] Weak SSH configurations are a common target for brute-force attacks

 

Initial Access via SSH

 

Risks with Key-Based Authentication

 


❓When did the ubuntu user log in via SSH for the first time? Answer example: 2023-09-162024-10-22

❓Did the ubuntu user use SSH keys instead of a password for the above found date? (Yea/Nay)Yea

 

Detecting SSH Attacks

 

Common SSH Breach Scenario

 

Scenario: An IT administrator enables public SSH access to the server, allows password-based authentication, and sets a weak password for one of the support users. Combined, these three actions inevitably lead to an SSH breach, as it’s a matter of time before threat actors guess the password. The log sample below shows such a compromise: A brute force followed by a password breach.

image

There are three indicators of malicious logins to pay attention to:

 

Distinguishing Legitimate vs Malicious Logins

  1. Likely Legitimate Login (Ansible): Accepted publickey for ansible from 10.14.105.255
    • Why it looks benign: Uses public-key authentication, source IP is internal, login occurs at an exact, consistent time (14:00), matches typical automation behavior
    • Still required: Confirm the IP belongs to an Ansible server, review post-login activity for anomalies

Successful SSH Logins:
image

  1. Suspicious Password-Based Logins: Accepted password for jsmith from 54.155.224.201 Accepted password for jsmith from 196.251.118.184
    • Red flags: Password authentication used, external IP addresses, same user logging in from different countries / networks, login times may be unusual (e.g., early morning hours)
    • These strongly suggest: Credential compromise and successful brute-force or credential-stuffing attack

 

Detection Mindset

Even one suspicious successful login can be enough to justify an incident response.


❓When did the SSH password brute force start? Answer format: 2023-09-152025-08-21

❓Which four users did the botnet attempt to breach? Answer Format: Separate by a comma, in alphabetical order.root, roy, sol, user

❓Finally, which IP managed to breach to root user?91.224.92.79

 

Initial Access via Services

 

Linux and Public Services

• CVE in Zimbra Collaboration: Allowed the attackers to execute arbitrary OS commands • Exposed Docker API port: Acted as an entry point in a series of cloud infrastructure breaches • CVE in Palo Alto firewalls: Granted attackers full control over the Linux-based firewall’s OS • WordPress “plugins” feature: Often abused to upload malware like web shells to the system

image

Using Application Logs

 

Web as Initial Access

Example: Command Injection via Web App

image

 

Indicators of Command Injection

 


❓What is the path to the Python file the attacker attempted to open?/opt/trypingme/main.py

❓Looking inside the opened file, what's the flag you see there?THM{*_**_**********!}

 

Detecting Service Breach

 

Process Tree

Typical SOC Scenario

image

 

Auditd and Process Tree Analysis

 

Step 1: Locate the Suspicious Command

ubuntu@thm-vm:~$ ausearch -i -x whoami # -x filters the results by the command name
type=PROCTITLE msg=audit(08/25/25 16:28:18.107:985) : proctitle=whoami
type=SYSCALL msg=audit(08/25/25 16:28:18.107:985) : syscall=execve success=yes exit=0 items=2 ppid=3905 pid=3907 auid=unset uid=ubuntu tty=(none) exe=/usr/bin/whoami key=exec

ubuntu@thm-vm:~$ ausearch -i --pid 3905 # 3905 is a parent process ID of whoami
type=PROCTITLE msg=audit(08/25/25 16:28:17.101:983) : proctitle=/bin/sh -c whoami
type=SYSCALL msg=audit(08/25/25 16:28:17.101:983) : syscall=execve success=yes exit=0 items=2 ppid=3898 pid=3905 auid=unset uid=ubuntu tty=(none) exe=/usr/bin/dash key=exec

ubuntu@thm-vm:~$ ausearch -i --pid 3898 # 3898 is a grandparent process ID of whoami
type=PROCTITLE msg=audit(08/25/25 16:28:11.727:982) : proctitle=/usr/bin/python3 /opt/mywebapp/app.py
type=SYSCALL msg=audit(08/25/25 16:28:11.727:982) : syscall=execve success=yes exit=0 items=2 ppid=1 pid=3898 auid=unset uid=ubuntu tty=(none) exe=/usr/bin/python3.12 key=exec

Step 2: Walk Up the Process Tree (Parent)

Step 3: Identify the Grandparent Process

Step 4: Hunt for Stronger evidence

Clear Indicators of Compromise

 


❓What is the PPID of suspicious whoami command?1018

❓Moving up the tree, what is the PID of the TryPingMe app?577

❓Which program did the attacker use to open a reverse shell?Python

 

Advanced Initial Access

 

Human-Led Attacks

 

Supply Chain Compromise

 

Detecting Human-Led and Supply Chain Attacks

Detection Workflow

  1. Start with a trigger
    • Suspicious command execution
    • Connection to a known malicious IP
    • SIEM alert
  2. Build the process tree
    • Identify the parent process
    • Trace execution back to its origin
  3. Identify the source
    • Web server
    • Internal application
    • Package manager
    • Administrator SSH session
  4. Decide legitimacy
    • Expected behavior?
    • Human mistake?
    • Clear indicator of compromise?

image

 


❓Which Initial Access technique is likely used if a trusted app suddenly runs malicious commands?Supply Chain Compromise

❓Which detection method can you use to detect a variety of Initial Access techniques?Process Tree Analysis


Â