This CTF happened during my midterms and I didn’t really have the luxury of time to look at some of the later challenges. I participated under team youtiaos, and we ended 97th place out of 5694 teams.
Lightning Round
TimeKORP - Trivial command injection in format parameter KORP terminal - SQLmap + bcrypt hash cracking
Labyrinth Linguist
We’re given a Java application using the Apache Velocity templating engine. We have user controlled input via textString that we can inject Velocity templates into.
context.put("name", "World"); is the key here. Exclusion of this line would make RCE a lot harder, but since we have this object in our context we can simply access the Java Class object through .getClass(). We can therefore inject:
http-request deny if { path_beg,url_dec -i /api/v1/get_ticket }
Looking at the dockerfile however, we can see that a specific version of HAProxy is being used:
1
RUN wget https://www.haproxy.org/download/2.8/src/haproxy-2.8.1.tar.gz
Simply using CVE-2023-45539 will allow us to bypass the firewall.
Second is the JWT verification. Unfortunately, looking at requirements.txt, they’re install a specific version of python_jwt:
1
python_jwt==3.3.3
Using CVE-2022-39227 will allow us to bypass authentication and masquerade as an administrator.
Testimonial
We’re given a golang application with file upload using gRPC. Flag is in the root directory. Both the application and the gRPC Ricky server are exposed. Air is used to live-reload the application.
Intuitively, if the file upload is insecure, we can overwrite an application file with a malicious script that reads the flag file and reload the application to reflect our changes.
The client filters the uploaded file name on the client:
We now need to reload the application and submit a new testimonial, thereby calling the malicious home handler. Looking at air.toml:
1
include_ext = ["tpl", "tmpl", "templ", "html"]
All we need to do is create a new file with one of these extensions and we can retrieve the flag.
SerialFlow
I had no time to solve this one, but I took a quick look at the challenge. It uses a vulnerable version of py-memcached to store the session cookie, which uses unsafe pickle deserialization methods. I tried a few encoding methods to upload a simple payload during the last hour of the CTF, but none of them worked.
After the CTF, I read a few writeups and apparently octal works. Unfortunate.