Epsilon

Recon

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

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 48:ad:d5:b8:3a:9f:bc:be:f7:e8:20:1e:f6:bf:de:ae (RSA)
| ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC82vTuN1hMqiqUfN+Lwih4g8rSJjaMjDQdhfdT8vEQ67urtQIyPszlNtkCDn6MNcBfibD/7Zz4r8lr1iNe/Afk6LJqTt3OWewzS2a1TpCrEbvoileYAl/Feya5PfbZ8mv77+MWEA+kT0pAw1xW9bpkhYCGkJQm9OYdcsEEg1i+kQ/ng3+GaFrGJjxqYaW1LXyXN1f7j9xG2f27rKEZoRO/9HOH9Y+5ru184QQXjW/ir+lEJ7xTwQA5U1GOW1m/AgpHIfI5j9aDfT/r4QMe+au+2yPotnOGBBJBz3ef+fQzj/Cq7OGRR96ZBfJ3i00B/Waw/RI19qd7+ybNXF/gBzptEYXujySQZSu92Dwi23itxJBolE6hpQ2uYVA8VBlF0KXESt3ZJVWSAsU3oguNCXtY7krjqPe6BZRy+lrbeska1bIGPZrqLEgptpKhz14UaOcH9/vpMYFdSKr24aMXvZBDK1GJg50yihZx8I9I367z0my8E89+TnjGFY2QTzxmbmU=
|   256 b7:89:6c:0b:20:ed:49:b2:c1:86:7c:29:92:74:1c:1f (ECDSA)
| ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBH2y17GUe6keBxOcBGNkWsliFwTRwUtQB3NXEhTAFLziGDfCgBV7B9Hp6GQMPGQXqMk7nnveA8vUz0D7ug5n04A=
|   256 18:cd:9d:08:a6:21:a8:b8:b6:f7:9f:8d:40:51:54:fb (ED25519)
|_ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKfXa+OM5/utlol5mJajysEsV4zb/L0BJ1lKxMPadPvR
80/tcp   open  http    syn-ack Apache httpd 2.4.41
|_http-title: 403 Forbidden
| http-methods: 
|_  Supported Methods: GET POST OPTIONS HEAD
|_http-server-header: Apache/2.4.41 (Ubuntu)
| http-git: 
|   10.129.96.151:80/.git/
|     Git repository found!
|     Repository description: Unnamed repository; edit this file 'description' to name the...
|_    Last commit message: Updating Tracking API  # Please enter the commit message for...
5000/tcp open  http    syn-ack Werkzeug httpd 2.0.2 (Python 3.8.10)
| http-methods: 
|_  Supported Methods: GET POST OPTIONS HEAD
|_http-title: Costume Shop
Service Info: Host: 127.0.1.1; OS: Linux; CPE: cpe:/o:linux:linux_kernel

HTTP (80)

└─$ feroxbuster -u 'http://10.129.96.151/' -w /usr/share/seclists/Discovery/Web-Content/common.txt --thorough -n
301      GET        9l       28w      313c http://10.129.96.151/.git => http://10.129.96.151/.git/
200      GET        1l        2w       23c http://10.129.96.151/.git/HEAD
200      GET        5l       13w       92c http://10.129.96.151/.git/config
200      GET        2l        8w      323c http://10.129.96.151/.git/index

Dump the git directory

└─$ git-dumper http://10.129.96.151/ port_80
└─$ ls --tree -lh port_80
Permissions Size User  Date Modified Name
drwxrwxr-x     - woyag 20 Dec 02:37   port_80
.rw-rw-r--  1.7k woyag 20 Dec 02:37  ├──  server.py
.rw-rw-r--  1.1k woyag 20 Dec 02:37  └──  track_api_CR_148.py

See the change logs

track_api_CR_148.py:

server.py:

AWS

https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-services/aws-lambda-enumarrow-up-right

Enumerate functions

HTTP (5000)

Writeup.png

We are able to access the /track, but any actions kicks us out to login page.

Writeup-1.png

We can forge the JWT token and login

Set the cookie and go to not / D:

Writeup-2.png

From source we can see that application is vulnerable to SSTI on /order endpoint (because of render_template_string)

Writeup-3.png

https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection#jinja2-pythonarrow-up-right

SSH (22)

We are user tom, so we can upgrade session to SSH. ls -lah /home/tom shows that user doesn't have .ssh directory, but we can make it for him.

User.txt

Privilege Escalation

There's definitely some kind of cronjob running in background, but it's not visible in ps aux output.

Writeup-4.png

We can use pspy to enumerate the running processes and detect cronjob

To create tar cf is enough, but second tar is using h flag too

Root.txt

Last updated