The lab
here is how portswigger describes it
The blog page for this lab contains a hidden blog post that has a secret password. To solve the lab, find the hidden blog post and enter the password.
the new pieces in this lab#
since this is our first GraphQL lab, a short introduction.
- GraphQL is an alternative to REST for building APIs. instead of many endpoints (
/posts,/users/1, …), a GraphQL API usually has one endpoint (here/graphql/v1) that accepts queries, and the client asks for exactly the data and fields it wants. - a query names a type and lists the fields to return, for example "give me the blog post with id 1, and its title, author, and content". crucially, the server only returns the fields you ask for, so a sensitive field that exists on a type but isn't in the default query is simply not fetched, not necessarily protected.
- the schema defines the available types and their fields (e.g. a
BlogPosttype withid,title,postPassword). introspection is a built-in GraphQL feature that lets a client query the schema itself, asking the API to list all its types and fields. if introspection is left enabled, it hands an attacker a complete map of the API, including fields the front-end never uses. - the vulnerability here is twofold: access control by obscurity (the hidden post is just omitted from the list rather than access-restricted) and an overexposed field (
postPasswordexists onBlogPostand can be requested directly). introspection reveals the field; querying the hidden id with that field returns the secret. the method: notice a blog-post id is missing from the list (the hidden post), run an introspection query to discover thepostPasswordfield, then query the hidden post's id asking forpostPassword.
why the hidden post leaks its password#
the flaw is that "hidden" here means "not shown in the default query", not "access controlled". the blog post still exists, has a sequential id, and sits behind the same GraphQL endpoint as the public posts; it's only absent from the list the front-end renders. GraphQL lets the client choose which fields to retrieve, so the server returns whatever we ask for as long as the schema allows it, and the schema exposes a postPassword field that the UI simply never requests. introspection makes this trivial by listing every field on BlogPost, so we don't even have to guess. with the field name and the hidden post's id in hand, we ask the single endpoint for exactly that post and that field, and it obliges, there's no authorization check gating the hidden post or the password field. obscurity was doing all the "protecting", and querying directly removes it.
Step 1 - spot the hidden post#
we access the blog page. in Proxy > HTTP history we notice the blog posts are retrieved with a GraphQL query, and in the response each post has its own sequential id. post id 3 is missing from the list, indicating a hidden blog post.

Step 2 - run an introspection query#
we find the POST /graphql/v1 request and Send to Repeater. in the Request panel we right-click and choose GraphQL > Set introspection query to insert an introspection query into the body, then send it. in the response, the BlogPost type has a postPassword field available, a field the normal query never asks for.

Step 3 - query the hidden post's password#
we click the GraphQL tab. in the Variables panel we set the id variable to 3 (the hidden post). in the Query panel we add the postPassword field to the query. we send the request.

Step 4 - submit the password#
the response's postPassword field contains the secret. we copy it and submit it to solve the lab.

with this, the lab is solved!
