Posts Lazy Admin
Post
Cancel

Lazy Admin

Description

Easy linux machine to practice your skills.

RoomLazy Admin
OSLinux
DifficultyEasy
CreatorMrSeth6797

After deploying machine, we’ll start with enumerating it with nmap.

1
nmap -sC -sT -sV -O -p- 10.10.127.130

image

there are 2 open ports found.

let’ visit http://10.10.127.130,

image

it’s a simple apache2 server webpage. So from here, we’ll do directory busting in order to find something interesting,

1
gobuster dir -u http://10.10.127.130/ -w /usr/share/seclists/Discovery/Web-Content/common.txt -x php,txt 2>/dev/null

image

there’s a directory called /content. We’ll visit this path,

image

It says about SweetRice. Never heard of that. Let’s search it on searchsploit,

1
searchsploit sweetrice

image

it has many exploit or vulnerability but there are 2 interesting vulnerability:

  • Arbitrary File Upload
  • Backup Disclosure

Let’s see content of vulnerability,

1
searchsploit -x php/webapps/40718.txt

image

there’s a /inc directory within url. So let’s check if it’s there or not

Again using gobuster to do internal directory busting,

1
gobuster dir -u http://10.10.127.130/content -w /usr/share/seclists/Discovery/Web-Content/common.txt -x php,txt 2>/dev/null

image

this result in many path where we can visit.

visit http://10.10.127.130/content/as/,

image

there’s a login page and we’ve to know the username and password to login to it.

And with internal dir-busting, I know that there’s a /inc directory, so let’s visit http://10.10.127.130/content/inc,

image

after scrolling down, there’s a mysql_backup folder present. So I go into that folder,

image

looks like this contains some information regarding login page. Let’s download this.

when I opened this, many things we’re found. So I tried to narrow result using grep command,

1
cat mysql_bakup_20191129023059-1.5.1.sql | grep passwd

image

AAHA!! There a username manager and a hashed password.

Let’s first identify what is this hash using hash-identifier,

image

It’s MD5. Great, now we’ll use hashcat to crack this password.

1
hashcat -m 0 42f749ade7f9e195bf475f37a44cafcb /usr/share/wordlists/rockyou.txt

image

We now have username and password to login.

Let’s login using manager:Password123,

image

We got in. Now we’ll look where we can upload files, if we can.

And there I found where we can upload files,

image

looks like we can upload our php reverse shell here to get a reverse connection from machine.

When we upload php reverse shell downloaded from https://github.com/pentestmonkey/php-reverse-shell it won’t show file which is uploaded. Now edit this downloaded file,

image

change the ip to tun0 ip and port to specific one.

When uploading the file, it seems that it’s blacklisting .php extension, so we’ll try to fuzz other php extension using burp.

Intercept the request and send it to intercept,

image

adding mark where we’ll fuzz and setting payload,

image

these are different php extensions that we’re going to fuzz on request to check which extension is able to bypass blacklist filters.

we got to know that php5 extension is allowed. So let’s upload reverse shell with php5 ext.

image

the file appears here.

Now while our netcat listener is listening for connection using nc -nvlp 1234, let’s click on this file,

image

we got user www-data connection. Let’s see if we can access home directory content,

And now, we have an unprivileged shell. In many CTFs, you need to escalate privilege from www-data to a regular user account in order to obtain the user flag, but in this case we can simply cd /home,

image

itguy was a directory we found inside home directory. Going in there and listing everything,

image

there’s a user flag.

Now, taking look again at all files present in itguy directory, there’s a backup.pl file. Let’s take a look inside of it,

image

seems like this is script for system shell. Let’s took at a look of copy.sh file content,

image

this is reverse shell to elevate privilege. Now we only have to change IP and desired port.

After enumeration I found that this file is writeable, so we’ll put content into this file,

image

and now checking for binaries which we can run as sudo.

image

we can run perl binary as sudo to elevate our privilege.

Now that we’ve echoed the reverse shell in copy.sh file, start netcat listener on new terminal window on 4444 port and let’s run the backup.pl file,

1
sudo /usr/bin/perl /home/itguy/backup.pl

image

as soon as this netcat got connection, we gain elevated shell, meaning system shell, image

This post is licensed under CC BY 4.0 by the author.