Summar-AI-ze
Writeup for SummarAIze (Web) - CryptoCat CTF Challenge (2024) 💜
Last updated
Writeup for SummarAIze (Web) - CryptoCat CTF Challenge (2024) 💜
Last updated
Summar-AI-ze leverages advanced machine learning algorithms to provide concise and accurate summaries of large texts. Perfect for students, professionals, and anyone who needs to quickly grasp the essence of a document
This challenge was originally created for Defcon but postponed due to it's closed-source nature some infra requirements (image size). I think the Defcon challenge I made in the end was better anyway, but I still hoped to demo this one. Recently, I rewrote the first part of the challenge entirely, and various other elements were adjusted in order to make it playable.
I hosted it on my new domain: https://challenge.cryptocat.me but I can't afford to keep it up for long. If you want the source code, check out my discord server. It's a good place to be! In future, I'll pre-release challenges/hints there and provide [limited] technical support 😉
Players open the website to find a new AI service.
They register an account, login and request beta access
.
Revisiting /request
produces an error, indicating a real check (tied to the user account).
Players may notice the greyed out Grant Access
option in the navbar.
The most intuitive option is to try /grant
endpoint but there is a Method Not Allowed
error. That's a good sign; it just means we need to try a different HTTP method (POST in this case).
Checking the previous request in burp, players will see a JSON object containing the username.
Changing the endpoint to /grant
triggers a new error 403: Forbidden
One of the first common techniques we should try to bypass a 403 response is the using the X-Forwarded-For header. We can supply 127.0.0.1
(in various formats) or use the 403 Bypasser extension
We're granted beta access, onto part 2 of the challenge 😎
The AI feature is a real LLM, it's just weak 😂 Hey, I'm not spending money on GPU cycles.
Back to burp.
Notice the content type is JSON? Why not try and use the Content Type Converter extension to convert to XML? We are hackers after all, looking at a black box web app (a lot like bug bounty).
Now we get a 500 error: BentoML does not currently accept application/xml
💡 Changing the content-type to most values shows a similar error, but you could fuzz it if you like!
A smarter approach might involve looking around for vulnerabilities in the BentoML library. Players would quickly discover this pickle deserialisation bug (CVE-2024-2912) reported by PinkDraconian. Fun fact; I used to work with Pink but didn't notice his name here until after I made the challenge 😁
Anyway, the PoC listed above is all you need. Notice the content type is application/vnd.bentoml+pickle
?
Well, if we set that in our request we get yet another new error: Error during request to BentoML service
Don't worry, that's just because our command was invalid (we're doing this blind). Always remember an error does not mean a command wasn't successful! How about a script like this?
The web server gets a hit and a base64-encoded value is logged as a GET parameter.
Repeat above but with cat flag.txt
to solve the challenge 😌
Flag: FLAG{b3n70_ml_607_50m3_m4j0r_155u35}
The DB clears every 30 mins so why not wrap everything into a single PoC?
The challenge required players to bypass a 403 restriction, escalating their privileges and gaining access to a beta feature. From there they exploited CVE-2024-2912, a Python pickle deserialization vulnerability found in an open-source machine learning library, gaining RCE.
If you made it this far, here's some bonus trivia 😃 I mentioned we decided against this challenge for Defcon, here's some of the reasoning:
Closed-source
Players are more likely to fuzz/brute-force, adding strain on infrastructure
If the infra is down/unstable, players can't run a local instance or review the code
Intentional RCE
More likely to crash
Players may use shell to interfere with the environment
Infrastructure issues
We normally host challenges on kubernetes so need to separate DB etc for horizontal scaling, or run multiple (ideally per-team) instances for high-traffic
BentoML image is ~10gb, which often timed out on our deployment system
These were the primary reasons. It's better to save a complex challenge for when we aren't all running around a conference on the other side of the world 😅 I also really wanted to do a cool client-side path traversal (CSPT) demo for Defcon, which I struggled to make fit here. Originally there was a path traversal instead of 403 bypass to grant beta access but it wasn't a CSPT, more like a blind server-side API traversal that could exist, but wouldn't be common/make a lot of sense.
Check the walkthrough video (or discord livestream) if you want to see some extra tips/tricks, e.g. match/replace and session handling rules in burp!
Finally, join my discord server to:
Ask questions about the challenge
Download the source code
Gain early access to future challenges/tips
Hang out / share cat pics 🐈💜
Hope you had a nice Christmas! 🎅