Lab: Accessing private GraphQL posts

Identify the vulnerability

After starting the exercise, a blog should appear in your browser that looks similar to the one shown in the following figure. If your blog contains other posts, this is not a problem, as the Web Security Academy exercises are regenerated each time.

We now switch to the Burp Suite and open the Burp Proxy and the HTTP history. There we search for the request POST /graphql/v1.

If we take a closer look at this request, we see that each post has an id and that the id 3 is missing. This could be a post that is not intended for public viewing. The following code snippet shows an excerpt from the response.

We now send the request POST /graphql/v1 to Burp Repeater. To do this, we move the mouse over the request and select the option "Send to Repeater" from the context menu.

In the Burp Repeater, we move the mouse over the request and press the right mouse button. In the context menu, select GraphQL and then Set introspection query.

After inserting the query, the request looks like the following code snippet.

After the request has been sent, we receive a very long response. In this response, we look for the field called postPassword in the BlogPost section. It is located in the upper third of the response.

Exploit the vulnerability to find the password

From the HTTP history in the Burp Proxy we send the request POST /graphql/v1 again to the Burp Repeater. How exactly the request is sent to Burp Repeater is described above. In Burp Repeater we now click on the GraphQL tab.

In the Request section, we now see two subsections, Query and Variables. In the Query subsection, we see the following query.

There is nothing in the Variables subsection so far. If we send this request, we receive the following response (output is abbreviated).

However, we want the field postPassword to be displayed. To do this, we add this to the query.

After sending, we receive the output of the field postPassword. However, the value of the field is null (output is truncated).

We now insert {"id":3} in the Variables subsection and send the request again.

We see no change in the Response section. Why? The query getAllBlogPost returns all entries and does not offer the possibility to select individual entries, therefore there is no possibility to call the entry with the id 3. If we look at the request with the IntrospectionQuery again and scroll down to the bottom third of the Response section, we see the query getBlogPost.

We now insert the following code in the Query subsection.

The query returns the id, summary and postPassword. We now send the request to the application and receive the following response.

We have now received the value for the postPassword field. We now copy this and click on the Submit solution button in the browser.

We insert the code in the window and click on Ok. The exercise is now successfully completed.

Video Solution

Last updated