Skip to content

Report 6 - Flora - picoCTF Java Code Analysis!?!#92

Open
florayq wants to merge 6 commits intoCUCTF:mainfrom
florayq:javacodeanalysis
Open

Report 6 - Flora - picoCTF Java Code Analysis!?!#92
florayq wants to merge 6 commits intoCUCTF:mainfrom
florayq:javacodeanalysis

Conversation

@florayq
Copy link
Copy Markdown
Contributor

@florayq florayq commented Apr 29, 2026

Flora's sixth writeup - web challenge from picoCTF

Copy link
Copy Markdown
Contributor

@mmstoic mmstoic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall great writeup! Just address the comments and you'll be good!

## Context & Vulnerability
This code creates an extensive reading application where a user can read pdfs/books that they are given the jurisdiction to access. According to the challenge description, we need to read the 'Flag' book which is only accessible by a user with admin authority whereas the user account provided to us only has the free tier authority.

In the security folder of the challenge, specifically SecretGenerator.java, we following code:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we HAVE the following code:

return "1234";
}
```
This is clearly a security concern as JWT (JSON Web Tokens) depends on this generateRandomString function for its secret key.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we concerned about secret keys? Why are we talking about JWT? Explain the relevance to the challenge context!

This is clearly a security concern as JWT (JSON Web Tokens) depends on this generateRandomString function for its secret key.

## Exploitation
JWT's auth-token and token-payload can be found in Applications > Local Storage through the Inspect tool. Using the website jwt.io (JWT Debugger), one can decode this string:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An image of this could be nice!


eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiQWRtaW4iLCJpc3MiOiJib29rc2hlbGYiLCJleHAiOjE3NzgwMjIwNjksImlhdCI6MTc3NzQxNzI2OSwidXNlcklkIjoyLCJlbWFpbCI6InVzZXIifQ.fh9qdjkyYO50o_Vfri7LsvdhSvSuqpOF9NEd5W5Ouyc

we can replace the previous auth-token and token-payload.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe an image of how you replaced the value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants