tuxCTFV2
TuxGallery
to start the challenge, in a terminal run: docker run -p 8000:8000 h0t0/tuxgallery:latest
then go to http://localhost:8000/. at the bottom of the page you can find Visit The Tux Gallery
. if you click on any of the buttons on the left you can see the url changing, for example: http://127.0.0.1:8000/gallery?file=img/tux3.jpg
it indicates that there is an lfi vulnerability! example payload: http://127.0.0.1:8000/gallery?file=../../../../etc/passwd
but the challenge doesnt end here, if we check the website backend tech:
search for werkzeug vulnerabilities
we can find : https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/werkzeug in hacktricks:
we go to http://localhost:8000/console ,indeed its protcted by a pin and we have lfi vulnerability. to get the pin: public bits:
private bits: http://127.0.0.1:8000/gallery?file=../../../../proc/sys/kernel/random/boot_id --> machine id http://127.0.0.1:8000/gallery?file=../../../../sys/class/net/eth0/address -->
--> mac address
put your values in the script in the site: each pin is different to each user, and on each run it changes, mine was: 891-324-969
the flag was supposed to be tuxCTF{w$g1?_wH4t$_th@t?}
, but for bash problems it was changed to tuxCTF{w?_wH4t@t?}
Chatbot
This challenge mocks a 'sofisticated' AI chatbot, so we enter the url and we are greeted by this page:
we enter a username and start chatting with the bot.
we can notice the responses are in json format.
in the page source we find a file called script.js
we notice that it gets the message by sending it to an api!
so its sending it to another server on port 3001, we can go to /api
and try to send a request there.
this is not an ssrf but it acts like one, so we will use it to find if there is anyother server.
we can use burp intruder to brute-force the port:
response:
we can notice in the original request was sent the path was random-message
which indicates that the backend already added the slash for us!
request:
response:
twig is a template engine for php, in hacktricks we can find alot of payloads to exploit it.
request:
response:
to get the flag:
request:
response:
the flag: tuxCTF{avG_l@mE_D3V}
Terminal 1 & 2
in both you can list the directory usin dir, to solve the first one you will use more or less
more flag.txt
flag: tuxCTF{LE$S_i$_m0r3}
in termianal 2 you can use nl (intended) or tac (not indented)
nl flag.txt
flag: tuxCTF{n0_n3eD_foR_BIn@r1e5}
Pyjail
to access the challenge you have to use netcat:
pyjails are python sandboxes with restrictions, you have to find a way out to escape and achieve command execution.
in python we can access other classes by going back to the root of the object,
example payload:
()._class_._bases_[0]._subclasses_()
if we enter it in the pyjail and enter exit it will execute.
we get a list of all subclasses accessable, but only one of them is not blocked and useful, which is <class '_frozen_importlib_external.FileLoader'>
.
to find the subclass index you can use an ai tool do a python script or by sorting them in vim, for me it was number 100, index 99, ()._class_._bases_[0]._subclasses_()[99]
payload to get the flag:
flag: tuxCTF{yOU_woN7_35c@Pe_@g@iN}
Happy Pwning : )
Last updated