Before all
Team: QnQSec
Rank: 14/759
I participated in this CTF with team QnQSec, and I was assigned to solve those web challenges… which I don’t like them (in this CTF) as well.
They are easy but some are quite guessy, and I also encountered serveral infra issues…
Write Up
Knight Connect
An under maintainence live-chat app which only it’s login function was well implemented.
Take a close look at the loginUsingLink
function in /app/Http/Controllers/AuthController.php
:
1 | public function loginUsingLink(Request $request) { |
It’s verification based on the bcrypt value of email|time
, which is 200% can be self modified and spoof…
But the part is what’s the bcrypt salt round?
Well… the result is that the round number is ten, WTF?
1 | ┌──(kali🐳kali)-[~/ctf/KightCTF/Knight-Connect] |
Just sign my token with bcrypt(10 rounds), or easier just simply use online generator (link)
Btw, these are all possible admin emails … ?
Baby Injection
A black box challenge, url: http://172.105.121.246:5990/eWFtbDogSXRzIHlhbWwgYnJvLCBoYWNrIG1lIGlmIHlvdSBjYW4hISE=
Base64 decoded: yaml: Its yaml bro, hack me if you can!!!
Also, it’s a Flask web app
So my idea comes to the classic PyYaml deserialization vulneravility:
Info: https://net-square.com/yaml-deserialization-attack-in-python.html
Payload: yaml: !!python/object/apply:subprocess.getoutput ["ls -al"]
(ofc, base64 encoded)
aha … WT …
Exceeding Knight
Another Laravel PHP application
After some observations, I found out that:
- The flag is inside .env file
- Debug mode on
Base on the challenge souce code, there are serveral methods to trigger an error message with .env leakage, I used the one in the calculator function:/app/Http/Controllers/CalculatorController.php
1 |
|
If the interger I input is greater than env('MAX_CALC_LIMIT', 100000);
, an error response with environment variables would pop out.
Admin Access
A blackbox challenge with a password reset function, login to admin’s account to get flag!
I found that there’s an email address: wrapped with html comment below every response
1 | <!-- kctf2025@knightctf.com --> |
So kctf2025 and the email addr probably be the admin’s credential, and after some trial and error, if I self modified the Host Header in my reset request, my listener can get the password reset link
PortSwigger Host Header Attack (link)
Post to http://45.56.68.122:7474
Listener:
Flag: