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
  • IDOR Vulnerability
  • Script w/ SetSUID Cap
  1. Boxes: Easy

Cap

Personal Rating: Easy

PreviousBuffNextCozyHosting

Last updated 1 year ago

Enumeration

A first nmap scan:

sudo nmap -sV <IP>

21/tcp open  ftp     vsftpd 3.0.3
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.2
80/tcp open  http    gunicorn
  • gunicorn webserver, uses popper

  • shows ip info

  • shows netstat output

An os command injection was my first idea here.

IDOR Vulnerability

You can start a download here at . The files 2, 02, 002 etc are the same. Fuzzing for the number, you find some more between 0 and 9 that have a certain size, indicating interesting contents.

I downloaded them with wget and will inspect them with wireshark.

  • 1: empty

  • 6: empty

  • 8: empty

  • 0: “ftp login successful”, RETR notes.txt, got nathan:Buck3tH4TF0RM3!

  • 8: not so interesting

  • 7: looks like a bruteforce on php files, but not interesting

  • 9: looks like a bruteforce, but also not interesting

You could ssh onto the server with nathans credentials

Script w/ SetSUID Cap

In /var/www/html there was a file called app.py, which was owned by nathan. It contained os.setuid(0) among some other stuff, which revealed, that you could start a root shell. I did so in Python:

import os; os.setuid(0); os.system("/bin/bash");

The file /usr/bin/python3.8 is owned by root, but it is not an SUID binary. However, if you scan the device with LinPEASS, you find out, that the cap_setuid option is enabled in the Python config.

This also explains the name of the box “cap”, as the privesc uses Linux capabilities, which is a way to allow certain caps as root. capsh is a ultitity related to it.

http://10.10.10.245/ip
http://10.10.10.245/netstat
http://10.10.10.245/download/02