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

Pyrat

Reconnaissance

I used RustScan to identify open ports. 2024-11-11_01-01.png

Two ports were open.

Service identification

I used Nmap to identify services and versions.

2024-11-11_01-06.png

The results showed SSH and a Python HTTP service on port 8000.

Enumeration

I opened the service on port 8000.

2024-11-11_01-11.png

Path discovery did not return a useful result.

Burp Suite inspection exposed service details. Research led to a public discussion and proof of concept.

2024-11-11_01-57.png

I attempted to reproduce the public proof of concept, but that route did not yield access.

2024-11-11_02-00.png

The attempted write failed because the path was a directory. Reading a known SSH file and traversing to another path did return content, though this did not produce credentials.2024-11-11_02-01.png

The traversal response confirmed file-read behavior.

I also requested an SSH private-key path. The response was “try a basic connection,” rather than key material.

2024-11-11_02-08.png

I consulted another lab write-up for a different approach. The earlier file-read path remained inconclusive.

Initial access

I connected to the service with Netcat and supplied the Python reverse-shell input indicated by that reference.

2024-11-11_03-08.png

I started a listener for the callback.

2024-11-11_03-09.png

The target connected back, providing a shell.

LinPEAS and manual inspection led me to a development directory under /opt.

2024-11-11_03-19.png

A configuration file in a hidden directory contained user credentials.

2024-11-11_03-22.png

SSH access

I used the recovered credentials for a stable SSH session. 2024-11-11_03-33.png

I retrieved the user flag.

2024-11-11_03-36.png

Privilege escalation

I inspected the local Git repository and observed a deleted file.

2024-11-11_03-54.png

git log exposed the relevant commit. 2024-11-11_04-02.png

git show <commit> revealed command-dispatch logic, including a branch that could invoke a shell.

I tested the dispatch behavior.

2024-11-11_04-15.png

A guessed endpoint name did not match a valid command. 2024-11-11_04-15_1.png

I used a custom script to test candidate command names, as suggested by the room description.

2024-11-11_04-23.png

The script identified admin as a valid input.

2024-11-11_05-29.png

I submitted admin to the service.

2024-11-11_05-32.png

The service then required a password, which I tested with an adapted script.

The modified script is shown below.

2024-11-11_05-47.png

After finding a valid password, I authenticated as admin and invoked shell. The resulting shell ran as root.

Outcome

A service-level reverse shell exposed credentials for SSH. Git history and command enumeration then revealed an admin path to a root shell.