Hacking GraphQL Zero to One Part-2

Hacking GraphQL Zero to One Part-2

In the last article on this series, I covered basics of GraphQL. We learned about introspection, also tried a lab on parameter tampering. Let's continue from where we left off.

Lets's start with a lab. To solve it, we need to sign in as the administrator and delete the user Carlos.

Here the issue is in authentication flow.

Article content

Let's check the login API in repeater tab.

Article content

Run the introspection query to find all the parameters and schema involved.

In the repeater response, select GraphQL > Save GraphQL queries to sitemap.

This will add GraphQL endpoints into the scope, pretty useful feature.

Article content

Let's try out the getUser query in the repeater. Set the id =1 for the admin credential.

Article content

Now access the admin page and delete Carlos to solve the lab.

Usually, developers try to block the introspection by blocking the _Schema using a regex. To bypass we can use newline in the introspection query to bypass the regex. Another way is to change the request method form POST to GET. Or you can use x-www-form-urlencoded in the content-type header in a GET request. Eg:

  GET /graphql?query=query%7B__schema%0A%7BqueryType%7Bname%7D%7D%7D        

Let's try another lab which has some defenses against introspection.

Lab: Finding a hidden GraphQL endpoint

At a single look,

we cannot see any GraphQL endpoints in any request.

Article content

We cannot run introspection because all APIs look like rest. There is no query used. Lets try common API endpoints. /api returns query not found. Its likely an GraphQL endpoint.

Article content

Lets verify with a simple query:

Article content
?query=query%7B__schema%0A%7BqueryType%7Bname%7D%7D%7D        

There is a GraphQL tab, just realized now !

Article content

Introspection query fails as expected.

Article content

Add a newline after __schema to bypass the protection.

Article content

Send the results to the scope, you will see a delete API, try different user ID until you delete Carlos id =3 to solve the lab.

Article content

I hope you liked today's article. Will try my best to post daily. My team is currently working on a tool called Live Review.

With LiveReview, you get fast, AI-powered code reviews that improve quality without slowing you down.

If you're tired of waiting for your peer to review your code or not confident that they'll provide valid feedback, here's LiveReview for you.


To view or add a comment, sign in

More articles by Sreedeep CV

  • Path Traversal Attacks: A Practical Guide with Real-World Case Studies Attacks

    We will be looking at different methods of path traversal attacks. We will solve a basic challenge from razzify and…

    3 Comments
  • Homes CTF 2025 Write-up

    Recently participated in Homes CTF conducted by HTB. It was focused on the forensic malware analysis, log analysis and…

  • Hacking GraphQL Zero to One - Conclusion

    Let’s summarize what we covered in the last two editions. We learned about basics of GraphQL query, finding GraphQL…

  • Defcon Bug Bounty Village CTF 2025 Writeup

    Got a great opportunity to take part in Defcon Bug Bounty Village CTF. This was not like common Jeopardy style CTF.

  • New Series: Hacking GraphQL Zero to One

    Learning a new thing is always rewarding in security. It will broaden your understanding on something, broaden your…

  • HTB Sea

    It's good time to get back to boxes in hackthebox which was challenging to me earlier. This is such a box.

  • WWCTF 2025 Writeup

    Last weekend, our team participated on WWCTF. This was a proper CTF I have participated after a long time.

    2 Comments
  • PicoCTF Client Side Again

    This is a client-side web challenge, we need to exploit a client-side misconfiguration in JavaScript to solve this. The…

  • PicoCTF Some Assembly Required 4

    This is the last and the most difficult challenge in the series of web Assembly from Picoctfs. The name of the…

  • PicoCTF Reversing WebAssembly Part-2

    Today's challenge is similar to yesterdays. A site uses WebAssembly to verify a key that we pass.

Others also viewed

Explore content categories