DEV Community

Cover image for Nahamsec's 30K CTF

Posted on

Nahamsec's 30K CTF

tldr: The CTF was hosted at, there were some credentials leaked in this repo which also disclosed the /swagger endpoint, using findomain I was able to get the subdomain which had a swagger instance running with a /api/getflag endpoint which accepted the username & password we found and gave us the flag.


Everything needed to complete the CTF was given in the blogpost

  • No cheating or sharing answers
  • / or any of the boxes I have used during my streams are not used for this CTF.
  • This is a recon CTF! Think recon and check out the tips or ideas I have shared while streaming for inspo.
  • Please don’t ask for help or hint on Twitter. If I have anything to share, they’ll be posted directly on my Twitter so it’s fair and available for everyone.
  • If you want to solve this to become a part of my mentorship program, send your submissions in with “[NMP]” in the beginning of the title. (i.e.: [NMP] Recon Submission)

Full Report

The image in the blog was being loaded from a different domain: I did a google search for and noticed the title said Welcome To Nahamsec Giveaway CTF. After this I also did the same in GitHub, the search query was search?q="" which took me to a repo that got uploaded recently with some interesting information ;) it's important to note this from the CTF announcement "Also, a big thank you to...Yasser Ali" who is the owner of the mentioned GitHub repo.

After having this information I looked for subdomains and found:

# used findomain to find the subdomains

The one subdomain that stood out was api-admin but I wanted to look at all of them to cover the bases, from the GitHub repo above I knew there would be a swagger instance, which makes sense since Nahamsec has talked about how he likes seeing those, I tried the /swagger route on the 3 subdomains I found and the only one to give me a response back was so now I can see a swagger UI.

Alt Text

Cool now we have can see 2 routes: /api/getFlag & /api/tokens.

The /api/getFlag route looks like it's a post request, so I tried to do execute from within the swagger ui but it gives me a 500 error, so then I go straight to the route and get an http username & password prompt - hmm let's try the credentials from the GitHub repo:

Alt Text

This is the response:

Alt Text

I stopped here and sent an email to the email included in the response.

After going back and trying to hit the token route I received the following JWT - I forgot to check this route after using the username/password.

# response from `/api/token`
  "duration": 600, 
  "token": "eyJhbGciOiJIUzI1NiIsImV4cCI6MTU3ODc3ODA4NiwiaWF0IjoxNTc4Nzc3NDg2fQ.eyJpZCI6Mn0.Bk1enMme_sQlEdWoMizDAFJwK8HEaVgubk9nVbz-Was"


I had a lot of fun, finding the smallest things that looked off, like the CTF image coming from and then looking in GitHub for anything related to that domain (shout out to @jhaddix I watched his latest stream and he did some github dorking), the rest are usual steps that Nahamsec has done in his streams and presentations like subdomain enumeration and directory bruteforcing (once I found the GitHub repo I focused on swagger stuff). It was really cool seeing that everything I learned this past year can be used and applied. I hope everyone else had as much fun as I did!


Discussion (0)