Open the page's source (Ctrl+U): an HTML comment holds part 1. The page loads mycss.css and myjs.js; each ends with a comment holding parts 2 and 3. Concatenate them in that order.
- Platform: picoGym (picoCTF 2019)
- Category: Web Exploitation
- Difficulty: Beginner
- Tools: browsercurl
Challenge description
A tiny site with two tabs, "How" and "What", that describe how it was made with HTML, CSS and JS — which is exactly where to look.
"Kishor Balan tipped us off that the following code may need inspection: ..." — provided: a link to the site
Step 1 — Read the HTML source
Open the page and press Ctrl+U (View page source). Near the bottom, there's a comment:
<!-- Html is neat. ... 1/3 of the flag: picoCTF{... -->
The source also shows the two files the page loads:
<link rel="stylesheet" type="text/css" href="mycss.css">
<script type="application/javascript" src="myjs.js"></script>
Step 2 — Open the stylesheet
Click mycss.css in the source view (or request it directly). The last line is a CSS comment with the second part:
$ curl -s http://CHALLENGE/mycss.css | tail -n 3
/* ... part 2/3 of the flag: ... */
Step 3 — Open the script
Same for myjs.js — the final comment holds the last part, ending with }:
$ curl -s http://CHALLENGE/myjs.js | tail -n 3
/* ... part 3/3 of the flag: ...} */
Join parts 1, 2 and 3 with no spaces to get the complete picoCTF{...}.
🚩 picoCTF{ flag intentionally hidden }
The flag is deliberately hidden — follow the method, you've earned it. 💪
Key takeaways
Everything a website sends to your browser can be read — including what isn't displayed:
- View source shows the raw HTML, comments included
- Linked CSS and JS files are just as readable — open every one
- The browser's DevTools Sources/Debugger tab lists all loaded files in one place
Originally published on CTFdojo — join the CTFdojo Discord to discuss writeups and get notified about new ones.
Top comments (0)