Blogodogo 1/2
Category: Web
Description
Try to see the content of the secret note of the administator user.
You can deploy an instance on : https://deploy.heroctf.fr
Format : Hero{flag}
Author : xanhacks
Attachments: blog.zip
Write-up
- After deploying an instance and accessing the provided URL, we discovered a blog interface displaying various posts.

- Upon further exploration, we came across the
admin's posts and noticed that the first post made was a secret draft.
- Unfortunately, we encountered an error message when attempting to access the draft, which stated,
You cannot see the draft of other users.. - To investigate further, we examined the source code, specifically the
./src/blogodogo/routes.pyfile, where we found an interesting post preview route. - Unlike the other routes, this particular route did not have a
@login_requireddecorator, indicating that it was accessible to anyone. - We realized that we could leverage this route to preview the
admin's secret draft post. - However, accessing the route required a value from the respective post's
hash_previewfield. - To understand how this value was generated, we examined the route responsible for adding a post.
- From the provided logic, we observed that
hash_previewwas derived from thegenerate_hash()function. The function's logic is shown below: - Since the
timestampparameter was alwaysNone, the seed was initialized asint(datetime.now().timestamp()). - By casting to an
int, the seed was consistently set to the nearest second. - Considering the draft was posted at
2:53 AM, we devised a brute-force strategy to determine the seed'stimestampfor the entire minute. We would iterate through each second within that minute and make requests to the post preview route to identify the successfultimestamp. - The script we developed for this purpose can be found here.
- After discovering the appropriate URL by identifying the successful
timestamp, we navigated to the page and successfully obtained the flag.
Flag: Hero{pr3333vi333wwwws_5973791}