Bagel

Enumeration

Rustscan

sudo rustscan -t 1500 -b 1500 --ulimit 65000 -a 10.10.11.201 -- -sV -sC -oA ./{{ip}}

Ports

Open 10.10.11.201:22
Open 10.10.11.201:5000
Open 10.10.11.201:8000

Services

22/tcp   open  ssh      syn-ack ttl 63 OpenSSH 8.8 (protocol 2.0)
5000/tcp open  upnp?    syn-ack ttl 63
| fingerprint-strings: 
|   GetRequest: 
|     HTTP/1.1 400 Bad Request
|     Server: Microsoft-NetCore/2.0
|_    Date: Tue, 07 Mar 2023 21:32:03 GMT
8000/tcp open  http-alt syn-ack ttl 63 Werkzeug/2.2.2 Python/3.10.9
|   GetRequest: 
|     HTTP/1.1 302 FOUND
|     Server: Werkzeug/2.2.2 Python/3.10.9
|     Date: Tue, 07 Mar 2023 21:31:58 GMT
|     Content-Type: text/html; charset=utf-8
|     Content-Length: 263
|     Location: http://bagel.htb:8000/?page=index.html
|     Connection: close
|     <!doctype html>
|     <html lang=en>
|     <title>Redirecting...</title>
|_    <h1>Redirecting...</h1>

Curl

Foothold

LFI

Checking the page I noticed the url http://bagel.htb:8000/?page=index.html which is a classic canditate for a local file inclusion

Verification

Expose currently running app

Source Code: app.py

Finding the WebSocket DLL

DLL Decompile & Deserialization

I used ILSpy to decompile the dll and check the source code

After digging deep into the code I realized that this could be a possible JSON .NET deserialization attack. That was something that is totally new to me and required a lot of research.

This article explained a lot and was helpful: Exploiting JSON serialization in .NET core

Identification

As you can see like mentioned in my linked article the TypeNameHandling is set to "4" instead of "None" which is safe and the default.

Value "4" can be linked to "Auto" as stated HERE

To keep the post short I won't go deeper into that, as I myself haven't fully understood the concept yet and just post the exploit code

Exploit

SSH-Access: Phil

Using my exploit I was able to get the private key of phil and access the server.

Password Reuse: Developer

That's an easy one. During enumeration of the application I was able to spot credentials for a database. Using that password I was able to become the user Developer.

Escalation

Local Enumeration

Since we were able to escalate from phil to developer without any problems it's time to enumerate.

Root

Used the method described here to become root gtfobins - dotnet

Last updated