Giter Site home page Giter Site logo

privilege_escalator's Introduction

Project

  1. With nmap we scan for open hosts in 192.168.1.0, as this is the broadcast channel for our network:
nmap -sn 192.168.1.0/24

For me it reveals that there is an host up - 192.168.1.2

  1. We scan the host with nmap for open ports
   nmap 192.168.1.2

We can see that the host has open ports for FTP, SSH, HTTP - 21, 22, 80 respectively

  1. We open the host in browser and can confirm that this host is for our exercise, as it contains HTML markup, that says something like "HackMe Please!."
  2. We connect to host through FTP:
   ftp 192.169.1.2

It asks for a user so we try anonymous login -

  • username: anonymous
  • password is empty We get access.
  1. We see what files the ftp server contains:
   ls

There is life.c and template.html

  1. We download both files and see that they contain nothing useful But we now know that the ftp server may be exploited to upload a reverse shell.

  2. As we want to connect to the server via reverse shell, then we have to know, where the file is located on a http server. We can use a Web Content Scannner like DIRB to launch a dictionary based attack against the http server.

   dirb http://192.168.1.2

We have this line in the output:

   ---- Entering directory: http://192.168.1.2/files/ ----

When we access this address in our browser, we can see that it contains all of the files, that are also in ftp server.

Before this step, be sure that whatever port we use for our reverse shell (1234 in this instance) is allowed through our firewall.

  1. Now it's time for our reverse shell. We upload our reverse shell and shell.py through ftp. Then we connect to 192.168.1.2/files through our browser client. We should see that our uploaded reverse shell is listed there. We click on it and browser should hang.

  2. We connect to the port with netcat.

   nc -v 192.168.1.2 1234
  1. We look around for a bit and see that /home folder contains file important.txt
   ls -l /home

When we cat important.txt, we can see that it wants us to run a script /.runme.sh

cat /home/important.txt

We don't want to run foreign scripts so we cat /.runme.sh

cat /.runme.sh

We see that this file contains an hash

  1. When we decode the hash (you can use any free online MD5 decoder), we get the string youaresmart We assume that this is the password.

  2. We try to login to virtual machine with: username: shrek password: youaresmart

    It works :)

  3. We navigate to /var/www/html/files and run shell.py that we uploaded before:

    sudo python3.5 shell.py
That spawns a root shell for us.

14. Now we navigate to /root and cat root.txt
    This file contains the flag and the exercise is finished.

-------------------
EXPLOITS

Anonymous login on FTP server should'nt be allowed.
Users shouldn't have access to execute python etc., as it could very easily be used to access root.

privilege_escalator's People

Contributors

kasparpartel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.