Writeup by wook413

Enumeration

Nmap

Like always, I started with a comprehensive TCP scan on all 65,535 ports followed by a targeted scan on the discovered ports and a UDP scan on the top 10 ports.

Initial Access

SMB 12445

The SMB server appeared to be allowing null authentication. I found Commander share which contained considerable amount of files.

 

I am able to upload to the share.

Since there are considerable number of files, I mounted the share into my local Kali.

Looking through the files, I found what appeared to be usernames, so I took a note of them.

image-20260201191256486

HTTP 8080 18030

Whenever I see an HTTP server running, the first thing I do is to run the Nmap script below which found /api directory.

The server returned the ‘Whitelabel Error Page’ when I visited /robots.txt which indicates Spring Boot is being used.

image-20260201191309346

image-20260201191318664

I visited /api and it returned the following JSON objects.

image-20260201191324383

I found a few credentials in /api/article and /api/user

dademola is the only user that has a readable password, so I’m going to prioritize the user for authentication.

Shell as dademola

SSH 43022

I was able to login to SSH with dademola ’s credentials.

Found local.txt

Privilege Escalation

cat /etc/passwd command revealed there’s git user and it’s using git-shell for default shell.

As expected, under the /home directory, there was git user.

Also public key and private key are present.

Transferred the private key to my local Kali and I successfully authenticated to SSH, but the shell was very limited not allowing me to execute any commands.

git-shell-commands directory is empty, which probably is the reason why none of the commands were recognized.

There is git-server

git log showed me there have been multiple commits.

There’s this particular commit I’m interested: The user Dademola created backups.sh that contains nothing but the placeholder for now.

There’s one interesting cron job named crontab.bak running under root. Typically, the file extension .bak represents a backup file.

I think I’ve just identified a privilege escalation vector via cronjobs running as root. It appears that /root/pull.sh (every 2 minutes) fetches updates from the Git server, while /root/git-server/backups.sh (every 3 minutes) runs them. If I modify backups.sh with a reverse shell and push it to server, the automated sync will pull my code into the root environment and trigger it, granting me root access.

Since the SSH service is running on a non-standard port (43022) and I need to authenticate to the server using a private key, I used the GIT_SSH_COMMAND environment variable to authenticate and clone the repository to my local machine.

Now I modified the backups.sh file to include a bash reverse shell payload. Don’t forget to make it executable.

After configuring a dummy git identity, I committed the changes and pushed them back to the server.

Shell as root

After waiting for a few moments, I got the shell as root.

Found proof.txt