Health
Recon
nmap_scan.log
Open 10.129.72.190:22
Open 10.129.72.190:80
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} {{ip}} -sV -sC -Pn" on ip 10.129.72.190
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 32:b7:f4:d4:2f:45:d3:30:ee:12:3b:03:67:bb:e6:31 (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChNRnKkpENG89qQHjD+2Kt9H7EDTMkQpzin70Rok0geRogbYVckxywChDv3yYhaDWQ9RrsOcWLs3uGzZR9nCfXOE3uTENbSWV5GdCd3wQNmWcSlkTD4dRcZshaAoMjs1bwzhK+cOy3ZU/ywbIXdHvAz3+Xvyz5yoEnboWYdWtBNFniZ7y/mZtA/XN19sCt5PcmeY40YFSuaVy/PUQnozplBVBIN6W5gnSE0Y+3J1MLBUkvf4+5zKvC+WLqA394Y1M+/UcVcPAjo6maik1JZNAmquWWo+y+28PdXSm9F2p2HAvwJjXc96f+Fl80+P4j1yxrhWC5AZM8fNCX8FjD7Jl7
| 256 86:e1:5d:8c:29:39:ac:d7:e8:15:e6:49:e2:35:ed:0c (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOR0vwVJwhe/5A7dkomT/li2XC2nvv6/4J6Oe8Xeyi/YQspx3RQGz3aG1sWTPstLu7yno0Z+Lk/GotRdyivSdLA=
| 256 ef:6b:ad:64:d5:e4:5b:3e:66:79:49:f4:ec:4c:23:9f (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINgiR3y8U+HenhKVoN1EFipbmC6EjO3fWwWPUqa8EeJh
80/tcp open http syn-ack Apache httpd 2.4.29 ((Ubuntu))
|_http-title: HTTP Monitoring Tool
|_http-favicon: Unknown favicon MD5: D41D8CD98F00B204E9800998ECF8427E
|_http-server-header: Apache/2.4.29 (Ubuntu)
| http-methods:
|_ Supported Methods: GET HEAD OPTIONS
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
└─$ nmap -T5 --min-rate 1000 10.129.72.190
Not shown: 997 closed tcp ports (conn-refused)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
3000/tcp filtered pppHTTP (80)

I first tested the functionality and for payload MY_IP:80, for monitor MY_IP:81, interval */1 * * * * (every minute) and Always to be sent. The application crashed because of Allowed memory size of 134217728 bytes exhausted (tried to allocate 67108872 bytes). Backend is Laravel, it's in Debug mode and some code is leaked. The callback is done by file_get_contents function, which in a nutshell is like curl~~

nmap showed port 3000, but it's filtered from outside. This functionality can lead to SSRF, but using the health.htb domain as parameters we get denied that host is not allowed.

Create simple server that also handles POST requests

Port 3000 is running Gogs, which is self deployed Github instance~~

Gogs - 'users'/'repos' '?q' SQL Injectionhttps://pentest-tools.com/vulnerabilities-exploits/gogs-go-git-service-sql-injection_3068
Vulnerability is using string concatenation instead of prepared statements.

Exploit DB payloads failed, but exploit notes has simpler payload: https://exploit-notes.hdks.org/exploit/version-control/git/gogs-pentesting/
Get users and password
The hash is not crackable, if we go to actual model for this version we see it has salt https://github.com/gogs/gogs/blob/0c5ba4573aecc9eaed669e9431a70a5d9f184b8d/models/user.go
Get salt:
Password is PBKDF2 encrypted
I wanted to crack this with john, but it got too complicated and went with hashcat.
Hash format: https://hashcat.net/wiki/doku.php?id=example_hashes - 10900 PBKDF2-HMAC-SHA256
SSH (22)
User.txt
Privilege Escalation
Database is empty?... (I thought this was Gogs db)
Git shows some modification have not been committed to this application and most likely some cronjob is running in background.
Easiest way to observe what's running is pspy
Just download the source....
We already leaked the code with Debug mode, but monitoredUrl is read by file_get_contents which supports both files and urls. The issue from outside was middleware filter which disallows localhost and just files, but since we have access to database itself we can inject rows without frontend and read files.

When we do Create from frontend new task gets added to tasks table.
First let's test /etc/passwd
After some time it returns the callback.

Grab the SSH key
Root.txt
Last updated