Marmalade 5

Writeup for Marmalade 5 (Web) - Nahamcon CTF (2023) πŸ’œ

Video Walkthrough

VIDEO

Description

Enjoy some of our delicious home made marmalade!

Recon

Can't register as admin.

Login as the admin has been disabled

Register as cat and it says only admin can get flag!

Check the JWT in session cookies.

eyJhbGciOiJNRDVfSE1BQyJ9.eyJ1c2VybmFtZSI6ImNhdCJ9.C3Z8QcoVXXFa-LAzFZbZ1w

Decode it with jwt.io

{
  "alg": "MD5_HMAC"
}
{
  "username": "cat"
}

First attempts

Tried null and none algorithm attacks with jwt_tool.

When trying to use the tokens, get an error.

So we know the first 11 characters of the key fsrwjcfszeg, let's try to brute force the last 5.

Tried jwt_tool but it doesn't work with the MD5_HMAC algorithm.

Same goes for hashcat.

Solve script #1 (brute-force)

Let's (me and chatGPT) make a custom script to crack the signature.

Got the key!

Solve script #2 (forge token)

Now another custom script to forge a token with user admin.

Receive a new token, signed with MD5_HMAC using the secret key fsrwjcfszegvsyfa.

We replace the cookie and receive a flag!

Flag: flag{a249dff54655158c25ddd3584e295c3b}

Last updated