ghostđź‘»sonofabot-sec:~#

I scan, I map, I exploit .... Ghost is in your shell!!!

View on GitHub

Cronos

Screenshot_20220523_025703

This is quite the box, honestly I’ve forgotten about a passive recon tool such as dig, cos for one I don’t use it everyday and all that but thanks to research I had o use it cos no, it made life so easy

Enough chatty chatty more hacky hacky 🥵

Enumeration

First things first, Enumeration - No matter what you’re doing you can’t do without proper recon So let’s fire up nmap to scan for ports to get open ports

Screenshot_20220521_020908

Running a quick nmap stealth scan and a udp scan shows us what ports are up and running

So enumerating for subdomains gets us an admin page (Using FFUF)

Screenshot_20220521_020829

(Using dig)

Screenshot_20220521_020838

Dig gives us way more information in this case

Initial foothold

Heading to the admin page we are faced with a simple login page that’s vulnerable to sqli login bypass

Screenshot_20220521_021748

Screenshot_20220521_021731

Logging in we are greeted with a net tool, and it functions like a web terminal xD

In linux terminal you can run multiple commands with some seperators such as ; , && So with that knowledge, adding ; id should run the traceroute and id, one after the other Let’s set up a listener then run a one liner revshell from payloadallthings

Screenshot_20220521_022024

Upon catching a shell we run id, ls id command in Linux is used to find out user and group names and numeric ID’s (UID or group ID) of the current user or any other user in the server. ls id used to list, lists files in a directory

Sometimes the config file contains password of a user but in our case it doesn’t

On Screenshot_20220521_022616

navigating the machine we see we can access the user flag with our current user

Privilege Escalation

After a series of enumeration we find out there’s a PHP cronjob running every minute

Screenshot_20220521_034128

Reading the script that runs every minute we see it runs other scripts too

Screenshot_20220521_034209

And the file it runs as root is editable by us so now what we do is, get a php rev shell to the machine then use it to replace the contents on app.php

Screenshot_20220521_034258

Run up a listener and wait for a minute and we are root

And we done



Back Home