OpenSource

Recon

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

PORT   STATE SERVICE REASON  VERSION
22/tcp open  ssh     syn-ack OpenSSH 7.6p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 1e:59:05:7c:a9:58:c9:23:90:0f:75:23:82:3d:05:5f (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOm3Ocn3qQzvKFsAf8u2wdkpi0XryPX5W33bER74CfZxc4QPasF+hGBNSaCanZpccGuPffJ9YenksdoTNdf35cvhamsBUq6TD88Cyv9Qs68kWPJD71MkSDgoyMFIe7NTdzyWJJjmUcNHRvwfo6KQsVXjwC4MN+SkL6dLfAY4UawSNhJZGTiKu0snAV6TZ5ZYnmDpnKIEZzf/dOK6bBu4SCu9DRjPknuZkl7sKp3VCoI9CRIu1tihqs1NPhFa+XnHSRsULWtQqtmxZP5UXbmgwETxmpfw8M9XcMH0QXr8JSAdDkg2NtIapmPX/a3hVFATYg+idaEEQNlZHPUKLbCTyJ
|   256 48:a8:53:e7:e0:08:aa:1d:96:86:52:bb:88:56:a0:b7 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLA9ak8TUAPl/F77SPc1ut/8B+eOukyC/0lof4IrqJoPJLYusbXk+9u/OgSGp6bJZhotkJUvhC7k0rsA7WX19Y8=
|   256 02:1f:97:9e:3c:8e:7a:1c:7c:af:9d:5a:25:4b:b8:c8 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINxEEb33GC5nT5IJ/YY+yDpTKQGLOK1HPsEzM99H4KKA
80/tcp open  http    syn-ack Werkzeug httpd 2.1.2 (Python 3.10.3)
|_http-title: upcloud - Upload files for Free!
| http-methods: 
|_  Supported Methods: OPTIONS GET HEAD
|_http-server-header: Werkzeug/2.1.2 Python/3.10.3
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

HTTP (80)

Writeup.png

Git

Download the source

Source code contains the credentials for the user

Credentials don't work..

RCE

Because the application is running in Debug mode we can overwrite the source files it's using and debug mode will reload those files. Meaning we can add something like custom path and make it act as a webshell.

Writeup-1.png

/bin/bash doesn't exist, so we can use /bin/sh. Since we are inside container busybox also exists and it supports nc.

Note: which <program> to find if it exists.

Reverse Shell

There's another host on the network

Upgrade shell: https://book.hacktricks.xyz/sw/generic-methodologies-and-resources/reverse-shells/full-ttys#pythonarrow-up-right

Port 600{x} is odd, but it seems to be the same application as port 80.

3000 is different

It seems to be Gitea instance

Let's port forward it with Chisel. Odd thing during testing was that any request going to 80 was going to main server?? My ip, but it was still going to it's 80 and like wtf? Changing port got callback.

We can create account, but nothing

Writeup-2.png

Previously found credentials work.

Creds: dev01:Soulless_Developer#2022

Writeup-3.png

SSH (22)

Using the SSH key works.

User.txt

Privilege Escalation

No sudo privs.

Git status shows the changes made inside home directory (because of .git), but the above bash script is wrong and condition is always true and repo is getting updated.

We can observe the change with ps or pspy, but it's most probably a cronjob script.

https://gtfobins.github.io/gtfobins/git/arrow-up-right (d)

After some time

User.txt

Last updated