Backend

Recon

chevron-rightnmap_scan.loghashtag
Open 10.129.227.148:22
Open 10.129.227.148:80
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} {{ip}} -sV -sC -Pn" on ip 10.129.227.148

PORT   STATE SERVICE REASON  VERSION
22/tcp open  ssh     syn-ack OpenSSH 8.2p1 Ubuntu 4ubuntu0.4 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 ea:84:21:a3:22:4a:7d:f9:b5:25:51:79:83:a4:f5:f2 (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDZBURYGCLr4lZI1F55bUh/6vKCfmeGumtAhhNrg9lH4UNDB/wCjPbD+xovPp3UdbrOgNdqTCdZcOk5rQDyRK2YH6tq8NlP59myIQV/zXC9WQnhxn131jf/KlW78vzWaLfMU+m52e1k+YpomT5PuSMG8EhGwE5bL4o0Jb8Unafn13CJKZ1oj3awp31fRJDzYGhTjl910PROJAzlOQinxRYdUkc4ZT0qZRohNlecGVsKPpP+2Ql+gVuusUEQt7gPFPBNKw3aLtbLVTlgEW09RB9KZe6Fuh8JszZhlRpIXDf9b2O0rINAyek8etQyFFfxkDBVueZA50wjBjtgOtxLRkvfqlxWS8R75Urz8AR2Nr23AcAGheIfYPgG8HzBsUuSN5fI8jsBCekYf/ZjPA/YDM4aiyHbUWfCyjTqtAVTf3P4iqbEkw9DONGeohBlyTtEIN7pY3YM5X3UuEFIgCjlqyjLw6QTL4cGC5zBbrZml7eZQTcmgzfU6pu220wRo5GtQ3U=
|   256 b8:39:9e:f4:88:be:aa:01:73:2d:10:fb:44:7f:84:61 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJZPKXFj3JfSmJZFAHDyqUDFHLHBRBRvlesLRVAqq0WwRFbeYdKwVIVv0DBufhYXHHcUSsBRw3/on9QM24kymD0=
|   256 22:21:e9:f4:85:90:87:45:16:1f:73:36:41:ee:3b:32 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEDIBMvrXLaYc6DXKPZaypaAv4yZ3DNLe1YaBpbpB8aY
80/tcp open  http    syn-ack Uvicorn
| http-methods: 
|_  Supported Methods: GET
|_http-title: Site doesn't have a title (application/json).
|_http-server-header: uvicorn
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

HTTP (80)

Writeup.png

No frontend/landing page probably means we are dealing with API itself.

For user it returns nothing, but if we search by id inside path it returns objects.

TIL: A 422 status codearrow-up-right indicates that the server was unable to process the request because it contains invalid data.

For some reason login endpoint didn't like the json data?

We can't access admin endpoints, but we can access the /docs. We get access denied, but most probably because we need this header everywhere we go on /docs and with curl we only have it on this http request.

Using Match And Replace Rules add this header to every request from Burp.

Writeup-1.png

Now the docs are properly loaded

Writeup-2.png

User.txt

Writeup-3.png

Privilege Escalation (admin)

We can update passwords. If we try to update admin's password it's a success.

Writeup-4.png

We can re authorize from Swagger API and we should probably turn that Match And Replace Rule off.

Writeup-5.png

/api/v1/admin/exec/{command} route allows executing commands, but requires "Debug Key"?

Writeup-6.png

We can query the files via /api/v1/admin/file

There's 2 users

Dump environment for this application:

PWD denotes the root directory, APP_MODULE denotes path to application from root

Get config:

We have the JWT secret, but we don't know what application is looking for when we want to execute commands.

We just need debug to exist in our JWT session.

Update debug to be anything, it just has to exist.

Writeup-7.png
Writeup-8.png

In the URL we are passing commands via path and / is not handled well, to avoid that we can use base64 or curl over bash.

Note: Normal base64 contains + and that's not good for URLs, basenc --base64url fixes that.

Writeup-9.png

Reverse Shell

auth.log in application directory is somewhat odd

Tr0ub4dor&3 looks like a password?

Privilege Escalation

Root.txt

Last updated