Format
Recon
nmap_scan.log
Open 10.129.111.68:22
Open 10.129.111.68:80
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} {{ip}} -vvv -sV -sC -Pn" on ip 10.129.111.68
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0)
| ssh-hostkey:
| 3072 c3:97:ce:83:7d:25:5d:5d:ed:b5:45:cd:f2:0b:05:4f (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC58JQV36v8AqpQB6tJC5upH5YdXw4LMaUJ4Exx+H6PjPZDab5MSx7Zm1oA1DWewM8tmU8fcprIxykYA8Z66Sd5ll/M1WntYO1b3LxxA0kI9F3yXQU+D2LMV6dGsqalJ80WWYcowlt3hZie6gnz4qEDj7ijCFi5h8K4R2rKtA16sH4FC9EQQU7qgN4WkE7uJSJS/6tWREtV/PspxsiMSBhUE0BreHurM6eaTZGa0VHOyNpbsZ3KXDro0fIOlfovRJVdAwWXF740M+X3aVngS9p1+XrnsVIqcL9T7GdU6H2Tyl5JvnGLdOr2Etd9NW41f+g+RYl7QY6WYbX+30racRmcTUtH4DODyeDXazi6fRUiXBI8pXkD3oLMBSxXsbeGT8Ja3LECPTybIl/jH3KRfl46P7TIUYZ2kqTZqxJ1B6klyZY+woh24UPDrZu/rW9JMaBz2tg97tAiLR8pLZxLrpVH7YmV8vXk2Sgo1rEuqKhBAK98bQuAsbocbjiyrKYAACc=
| 256 b3:aa:30:35:2b:99:7d:20:fe:b6:75:88:40:a5:17:c1 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAxL4FuxiK0hKkwexmffoZfwAs+0TzHjqgv3sbokWQzlt+YGLBXHmGuLjgjfi9Ir49zbxEL6iAOv8/Mj8hUPQVk=
| 256 fa:b3:7d:6e:1a:bc:d1:4b:68:ed:d6:e8:97:67:27:d7 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK9eUks4+f4DtePOKRJYzDggTf1cOpMhtAxXHGSqr5ng
80/tcp open http syn-ack nginx 1.18.0
| http-methods:
|_ Supported Methods: GET HEAD
|_http-title: Site doesn't have a title (text/html).
|_http-server-header: nginx/1.18.0
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelHTTP (80)

We are allowed to register and then add new domain. I tried injecting PHP code inside, but it got replaced by comments.

Gitea
Going back to home page for enumeration I noticed Contribute here! link leading to port 3000, which wasn't discovered by RustScan

Application lives in /var/www/microblob

order.txt records all the files that are in content directory.

File Write
microblog/microblog-template/edit/index.php contains some dangerous login, it opens any file given by id parameter and writes any content wrapped in html.
We are able to write to any file, but no code execution.

bulletproof.php is being included by the code itself so we might achieve RCE this way. But to do that we need to have the file, and for that we need to be pro.
LFI
The code is also vulnerable to file read, because the file we write to is added in order.txt which on page render includes and displays all the fles.
We can't write to the file, but because it's added in orders.txt that's why we get LFI.

To pretty print:
Controlling Proxied Host
/etc/nginx/nginx.conf is not helpful, but /etc/nginx/sites-enabled/default was
This clearly smells like SSRF, but I wasn't able to get it to work with domain name in the URL.
Google to the rescue: Middleware, middleware everywhere – and lots of misconfigurations to fix
Turns our nginx allows sending requests to endpoints with that structure even if it has http:// prefix and fixed suffix.
Properly urlencode the parts and send like shown in blog. recipe
Note: The space at the end of Redis command is very important as it's the delimiter for proper HTTP request!

The server returns 502, but as we can see the username on dashboard is changed, meaning Redis was overwritten!
Redis (Update Pro)
Make yourself pro
Pro user's have third option of uploading images.

Reverse Shell
The image upload functionality is not useful for us, but provisionProUser function created new folder /uploads where we can try to write php and see what happens

Current user can't do much, root owns most of the stuff. .git has same stuff as Gitea.
We might as well check Redis as that was the database.
Reverse Shell (Automated)
The shell died 💀 automated the process...
Redis Enumeration
SSH (22)
Creds:
cooper:zooperdoopercooper
User.txt
Privilege Escalation
The script is vulnerable to Format String Injection, because we are able to control fstring we are allowed to make modifications. Like using license.created field and not the raw string itself.


Creds:
root:unCR4ckaBL3Pa$$w0rd
Root.txt
Last updated