OnlyForYou
Recon
nmap_scan.log
Open 10.129.90.221:22
Open 10.129.90.221:80
[~] Starting Script(s)
[>] Running script "nmap -vvv -p {{port}} {{ip}} -vvv -sV -sC -Pn" on ip 10.129.90.221
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 e8:83:e0:a9:fd:43:df:38:19:8a:aa:35:43:84:11:ec (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDX7r34pmJ6U9KrHg0/WDdrofcOXqTr13Iix+3D5ChuYwY2fmqIBlfuDo0Cz0xLnb/jaT3ODuDtmAih6unQluWw3RAf03l/tHxXfvXlWBE3I7uDu+roHQM7+hyShn+559JweJlofiYKHjaErMp33DI22BjviMrCGabALgWALCwjqaV7Dt6ogSllj+09trFFwr2xzzrqhQVMdUdljle99R41Hzle7QTl4maonlUAdd2Ok41ACIu/N2G/iE61snOmAzYXGE8X6/7eqynhkC4AaWgV8h0CwLeCCMj4giBgOo6EvyJCBgoMp/wH/90U477WiJQZrjO9vgrh2/cjLDDowpKJDrDIcDWdh0aE42JVAWuu7IDrv0oKBLGlyznE1eZsX2u1FH8EGYXkl58GrmFbyIT83HsXjF1+rapAUtG0Zi9JskF/DPy5+1HDWJShfwhLsfqMuuyEdotL4Vzw8ZWCIQ4TVXMUwFfVkvf410tIFYEUaVk5f9pVVfYvQsCULQb+/uc=
| 256 83:f2:35:22:9b:03:86:0c:16:cf:b3:fa:9f:5a:cd:08 (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAz/tMC3s/5jKIZRgBD078k7/6DY8NBXEE8ytGQd9DjIIvZdSpwyOzeLABxydMR79kDrMyX+vTP0VY5132jMo5w=
| 256 44:5f:7a:a3:77:69:0a:77:78:9b:04:e0:9f:11:db:80 (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOqatISwZi/EOVbwqfFbhx22EEv6f+8YgmQFknTvg0wr
80/tcp open http syn-ack nginx 1.18.0 (Ubuntu)
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
|_http-title: Did not follow redirect to http://only4you.htb/
|_http-server-header: nginx/1.18.0 (Ubuntu)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelHTTP (80)

The application has no links going anywhere, so most probably nothing with dirbusting. Subdomain enumeration returns new domain:

We can download the source. From frontend we know that application allows to resize images and convert them.
In app.py the download functionality is vulnerable to LFI. RTFM, and Python's os.path.join
After some fuzzing we discover the path for application on server.
The piece of code is vulnerable to code execution, it's running as shell and it has no sanitization!
Regular expression is bypassable if we put our payload at the end:
There are some internal applications running.
The user www-data doesn't have shell, so no SSH upgrade. I decided to upgrade nc to pwncat-cs.
We can use chisel to port forward the applications
3000 is Gogs, which seems to be Gitea alternative. No creds... moving on.

8001 is server ONLY4YOU application, trying default credentials logs us in.

Creds:
admin:admin
The Tasks mentioned migrating to neo4j, we also saw this port with user. The /search most likely performs contains query for Name field.

https://book.hacktricks.xyz/pentesting-web/sql-injection/cypher-injection-neo4jhttps://www.varonis.com/blog/neo4jection-secrets-data-and-cloud-exploitshttps://hackmd.io/@Chivato/rkAN7Q9NY
Query is injectable, but it's not your typical SQL. Cypher has very different syntax compared to SQL.

Get the server version query works.
The page returns 500, but clearly the request with version information is made to us.

Get tables (or labels)
Get columns (or keys)

Creds:
admin:adminCreds:john:ThisIs4You
SSH (22)
We are now available to SSH as john in to the box.
User.txt
Privilege Escalation
We are able to login into Gogs on port 3000 with john's credentials, if we can create malicious python package we can get RCE.
Malicious Python Packages and Code Execution via pip download
Upload this tar.gz to new Public repository, or edit the existing Test project to be public. After uploading we need to provide raw url so file can be downloaded.
Root.txt
Last updated