OverPass

Target Details

  • IP: 10.10.60.248

Nmap Scan

  • Scan

    nmap -sV -sC -Pn -oN scan.txt 10.10.60.248
  • Output

    # Nmap 7.92 scan initiated Wed Jun 29 11:11:57 2022 as: nmap -sV -sC -Pn -oN scan.txt 10.10.60.248
    Nmap scan report for 10.10.60.248
    Host is up (0.42s latency).
    Not shown: 998 closed tcp ports (conn-refused)
    PORT   STATE SERVICE VERSION
    22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
    | ssh-hostkey:
    |   2048 37:96:85:98:d1:00:9c:14:63:d9:b0:34:75:b1:f9:57 (RSA)
    |   256 53:75:fa:c0:65:da:dd:b1:e8:dd:40:b8:f6:82:39:24 (ECDSA)
    |_  256 1c:4a:da:1f:36:54:6d:a6:c6:17:00:27:2e:67:75:9c (ED25519)
    80/tcp open  http    Golang net/http server (Go-IPFS json-rpc or InfluxDB API)
    |_http-title: Overpass
    Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
    
    Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
    # Nmap done at Wed Jun 29 11:13:04 2022 -- 1 IP address (1 host up) scanned in 66.68 seconds

    SSH and HTTP services are open

Find Directories using GoBuster

  • scan for directories

    useful link: /admin

Admin Page

  • visit Admin Page

  • View Source

  • Interesting finding was /login.js file, which consists of login logic for client side

  • Javascript Function for client side login

    From the above piece of code, we can observe that, we can bypass login by setting a cookie from web-browser console (Ctrl+Shift+I -> console tab) and using below method then reload the page

  • On reloading, we'll get private ssh key id_rsa on the page

  • save the ssh key to a file id_rsa

  • provide read and write access to user only

Cracking id_rsa using John The Ripper

  • Copy ssh2john.py script to current directory

  • Using the scipt convert into crackable hash for john

  • Crack using john the ripper

    Cracked password: james13

Accessing Target Machine via SSH

  • Since, the message was for james, assuming the username to be james, try logging in with the id_rsa file

    password: james13

  • We'll get access to the shell

  • On listing directory contents, we'll find the first user.txt flag in james's home directory

Privilege Escalation

  • There's another file todo.txt, read file contents

    james has stored password in their password manager

  • Download and Read source code of the Overpass Project from the target's HTTP server

  • We can make below observations:

    • data is encrypted in ROT47 format in a file

    • data file is located in home directory named .overpass

  • Reading contents of ~/.overpass

  • We can crack this encryption using online tools CyberChef

  • Unencrypted text

  • Download and Upload Linpeas to Target machine

    • Attacker Machine

    • Target Machine

  • Linpeas juicy findings

    it's a cronjob which will run

  • Generating attack surface

    • Change overpass.thm ip to attacker's ip

    • Create an evil bash script with path downloads/src/buildscript.sh which will be executed every minute

    • Start HTTP server using python on attacker's machine to serve the file on port 80

    • Get root priviliges

  • Executing Attack

    • Target Machine

    • Attacker's Machine

    • After running the job, we'll get reverse shell

  • Get Root Flag

    Output: thm{7f336f8c359dbac18d54fdd64ea753bb}

Answers

  • Q. Hack the machine and get the flag in user.txt

  • Q. Escalate your privileges and get the flag in root.txt

Last updated

Was this helpful?