len_len
Writeup for len_len (Web) - Tsuku CTF (2025) π
Description
"length".lengthis 6?
Solution
Site functionality
The challenge description suggests we run a curl command.
curl http://challs.tsukuctf.org:28888
How to use -> curl -X POST -d 'array=[1,2,3,4]' http://challs.tsukuctf.org:28888Now we have a new curl command to try.
curl -X POST -d 'array=[1,2,3,4]' http://challs.tsukuctf.org:28888
error: no flag for you. sanitized string is [1,2,3,4], length is 9Wait, do we just make the numbers add up to 6?
curl -X POST -d 'array=[1,2,3,0]' http://challs.tsukuctf.org:28888
error: no flag for you. sanitized string is [1,2,3,0], length is 9I guess not. Let's check the source code π
Source code
Breaking it down
The spaces are removed from our array (string)
The resulting string length must be >= 10
The string is parsed into an array with
JSON.parseThe resulting array length must be < 0
Crafting a JSON object
We can easily get around the first check by increasing the array (string) length, but we fail the second test.
The trick here is to enter a string that is 10+ characters, but that when parsed as JSON will return a length less than 0. Since array is a JSON object and the code checks the length property of that object, why don't we try injecting a length property ourselves?
It works, we get the flag! π©
Flag: TsukuCTF25{l4n_l1n_lun_l4n_l0n}
Last updated
