Another Admin panel
The GraphQL endpoint returned an isAdmin field that the client trusted to decide whether to show the admin panel. By intercepting the response and changing the value from false to true, the author could access admin features such as adding lectures and viewing the student list.
Published on rizwansiddiqu1.medium.com
I am back with another writeup I hope you Guys are hunting and earning bounty. This Time I was able to access Admin panel with the help of graphql. let’s start.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
The target described here is a subdomain, education.target.com, of a larger site the author calls target.com. The subdomain hosts an education page where students log in and watch lectures. A normal student account is enough to reach the application; the interesting part is what the front end asks the backend about that account.
The application talks to its backend through a GraphQL endpoint at /api/graphql. One of the operations the page runs on load is a query called isAdmin, which returns a boolean telling the front end whether the logged-in user is an administrator. Changing that answer in transit was enough to make the browser show the admin panel.
Setup
- A regular student account on
education.target.com. - Burp Suite as an intercepting proxy, with the browser sending traffic through it.
- No special role, no elevated privileges and no prior knowledge of the backend were needed.
The only precondition is being able to log in as an ordinary user and observe the requests the page makes after login.
Finding it
After logging in as a normal user, the author opened Burp Suite and refreshed the page to see which requests the browser sent to the server. Among them was a GraphQL request to the API endpoint. The request carried the session cookie and a single operation, isAdmin, whose query body asks the server for the isAdmin field and nothing else.
That response is a plain JSON document with one boolean. Because the value is delivered to the client and the client is what decides whether to show the admin panel, the response is worth intercepting: if the browser trusts the value it receives, the value can be changed in flight.
Exploitation
Step 1: Log in and capture the GraphQL request
Log in at education.target.com with the student credentials, refresh the page, and forward requests in Burp until the isAdmin operation appears. The captured request looks like this:
POST /api/graphql HTTP/1.1Host: education.target.com User-Agent: Mozilla/5.0 Gecko/20100101 Firefox/91.0Accept: */*Cookie: a0:state=YOUR Cookie{"operationName":"isAdmin","variables":{},"query":"query isAdmin {\n isAdmin\n}\n"}
The request is a POST to /api/graphql on the education host. The Cookie header carries the session (a0:state=YOUR Cookie in the write-up, redacted here). The JSON body names the operation isAdmin, sends no variables, and contains the query text query isAdmin { isAdmin }, which asks for exactly one field.
Step 2: Intercept the response
Right-click the request in Burp, choose Do intercept, then Response to this request. The server's reply is:
HTTP/1.1 200 OKServer: nginx/1.19.1Date: Sat, 04 Sep 2021 04:47:05 GMTContent-Type: application/json; charset=utf-8Content-Length: 27Connection: closeaccess-control-allow-origin: *access-control-allow-credentials: trueetag: W/"1b-fPOq3WJkZQ0rkaalpPwLwZziKSQ"Vary: Accept-EncodingStrict-Transport-Security: max-age=15724800; includeSubDomains{"data":{"isAdmin":false}}
The status is 200 OK, the body is JSON, and the payload is {"data":{"isAdmin":false}}. The response also sets access-control-allow-origin: * together with access-control-allow-credentials: true, and includes HSTS with a max-age of 15724800 and includeSubDomains.
Step 3: Flip the boolean and forward
Change isAdmin: false to isAdmin: true in the intercepted response and send it on to the browser. The author's note on the response line is that the value {"data":{"isAdmin":false}} is simply changed to isAdmin":true.
Step 4: Observe the admin panel
Back in the browser, the home page now shows the admin panel. Inside it the author could add lectures and view the list of all students.
Root cause
The author attributes the issue to a misconfiguration in the GraphQL implementation: the client-side decision about administrative access is driven by a boolean that the client receives and acts on, rather than by an authorisation check enforced on the server for each privileged action. Changing the value in transit was enough to make the front end render the admin interface.
What the write-up does not establish is whether the privileged operations behind that interface (adding lectures, listing students) were themselves authorised on the server. The author reached the panel and used it, but the report does not show the requests those actions generated or how the server answered them. The report does not show whether the underlying operations were authorised on the server.
Impact
With a normal student account and the ability to intercept and modify responses, an attacker could reach the administrative interface of the education subdomain. According to the write-up, that interface allowed adding lectures and viewing the full student list. The author could also see the list of all students.
The write-up does not attach a screenshot of the admin panel, citing company privacy, and gives no bounty or severity figures.
Fix
Based on the root cause, the change needed is to stop treating a client-supplied boolean as the authorisation decision: every privileged operation behind the admin panel should verify the caller's role on the server, so that a modified isAdmin response only affects what the browser draws and not what the backend permits.
Variants to test
- Look for GraphQL operations whose names suggest privilege, such as
isAdmin,me,viewerorpermissions, in the requests a page makes after login. A positive result is a response whose body contains a role or boolean field that the UI uses to reveal restricted screens. - Intercept the response and flip the value, then reload the page. A positive result is a restricted interface appearing without any change to the account.
- After the interface appears, capture the requests it makes (adding content, listing users) and replay them with the original, unmodified session. If those requests succeed on their own, the server-side authorisation is missing rather than merely the UI gate.
- Repeat the same interception on other JSON APIs that return role flags, not just GraphQL. A positive result is any response where a client-side role value controls access to data or actions.
What happened, in plain words
A student logged into a learning website with an ordinary student account. The page sent its backend a GraphQL query called isAdmin, and the server answered false. The student caught that answer in a tool called Burp Suite, changed the "no" to "yes" before it reached the browser, and the browser then showed the admin panel. From that panel the student could add lectures and see the list of all students.
Nothing was guessed, no password was cracked and no special account was needed. The whole trick was changing one boolean value in a reply that was already travelling to the browser.
Background: the pieces involved
Before walking through the steps, here are the things you need to recognise.
- Subdomain: a smaller site that belongs to a bigger one. If the big site is
target.com, theneducation.target.comis a subdomain of it. The author usestarget.comas a stand-in name for the real company, so treat it as an example. - The product:
education.target.comis an education page. Students log in and watch lectures. That is all a normal user is meant to do. - API: the part of a website that the page talks to behind the scenes, like a waiter in a restaurant. You (the browser) do not walk into the kitchen (the server); you tell the waiter what you want and the waiter brings it back. An API is that waiter.
- GraphQL: a way of asking an API for exactly the pieces of information you want, and nothing more. Instead of the server deciding what to send, you send a small description of the fields you want, and the server sends back just those. The endpoint here is
/api/graphql. - Query: the description you send to a GraphQL API. Here the query is called
isAdminand it asks for one field, also calledisAdmin. - Boolean: a value that is either true or false. The
isAdminfield is a boolean: true means "this user is an administrator", false means "this user is not". - JSON: a plain text format for structured data, made of names and values in curly braces.
{"isAdmin":false}is JSON. - Cookie: a small piece of text the browser stores for a site and sends back with every request, so the server can recognise who you are. The session cookie is what proves you are logged in. If someone else had your cookie, they could act as you, which is why cookies are treated as secrets.
- Burp Suite: a tool that sits between your browser and the website. Every request your browser sends passes through it, and every reply coming back passes through it too. Because it sits in the middle, it can pause a message, let you edit it, and then send it on. This position is called an intercepting proxy.
- Intercepting a response: pausing the server's reply on its way back to the browser, so you can look at it and change it before the browser sees it.
- HTTP response: the server's reply to a request. It has a status line (such as
200 OK, meaning "here you go"), some headers (extra information about the reply) and usually a body (the actual data). - Header: a labelled line of extra information attached to a request or a response, such as which browser was used or what type of content is being returned.
- The vulnerability class: this is an authentication bypass achieved through HTTP response manipulation. In plain terms, the website decided whether you were an admin based on a value that travelled to your browser, and your browser believed whatever value it was given. If you can edit that value on the way, you can change the decision. The everyday comparison: a bouncer who asks head office "is this person on the list?", and then believes whatever answer is written on the piece of paper handed to him, even if the person handed it over already altered.
What the author needed
- A normal student account on
education.target.com. - Burp Suite running as an intercepting proxy, with the browser sending its traffic through it.
No admin role, no special permissions and no knowledge of the server's internals were required. The only precondition is being able to log in as an ordinary user and watch the requests the page makes afterwards.
Finding it
The author logged in as a normal student, opened Burp Suite, and refreshed the page. Refreshing is a deliberate move: it makes the browser repeat everything the page does when it loads, so all the requests are easy to see in one go.
Among those requests was a GraphQL request to the API endpoint. It carried the session cookie and contained a single operation, isAdmin, whose query body asks the server for the isAdmin field and nothing else.
The reply is a small JSON document containing one boolean. That is the interesting part: the value is sent to the browser, and the browser is what decides whether to draw the admin panel. So the reply is worth pausing and inspecting. If the browser simply trusts the value it receives, then the value can be changed while it is in transit.
Exploitation
Step 1: Log in and capture the GraphQL request
Log in at education.target.com with the student credentials, refresh the page, and forward requests in Burp until the isAdmin operation appears. The captured request looks like this:
POST /api/graphql HTTP/1.1Host: education.target.com User-Agent: Mozilla/5.0 Gecko/20100101 Firefox/91.0Accept: */*Cookie: a0:state=YOUR Cookie{"operationName":"isAdmin","variables":{},"query":"query isAdmin {\n isAdmin\n}\n"}
Line by line, in plain words:
POST /api/graphql HTTP/1.1says the browser is sending data (POST) to the address/api/graphqlon the site, using version 1.1 of the HTTP protocol.Host: education.target.comsays which site the request is for. One server can host many sites, so this tells it which one is meant.User-Agent: Mozilla/5.0 Gecko/20100101 Firefox/91.0identifies the browser that sent the request. Here it is Firefox.Accept: */*says the browser will accept any type of reply.Cookie: a0:state=YOUR Cookieis the session cookie. This is the proof that the request comes from a logged-in user. In this write-up the value is a placeholder; a real cookie value is a secret and should never be published.- The last part is the JSON body.
"operationName":"isAdmin"names the operation being run."variables":{}means no extra inputs are being passed."query":"query isAdmin {\n isAdmin\n}\n"is the GraphQL query itself: it asks for a query calledisAdminthat returns the single fieldisAdmin. The\nsequences are newline characters inside the JSON string.
Why this step matters: you cannot tamper with a reply until you have found the request that produces it. Refreshing the page and forwarding requests one by one is how you locate that request among all the others.
Step 2: Intercept the response
Right-click the request in Burp, choose Do intercept, then Response to this request. The server's reply is:
HTTP/1.1 200 OKServer: nginx/1.19.1Date: Sat, 04 Sep 2021 04:47:05 GMTContent-Type: application/json; charset=utf-8Content-Length: 27Connection: closeaccess-control-allow-origin: *access-control-allow-credentials: trueetag: W/"1b-fPOq3WJkZQ0rkaalpPwLwZziKSQ"Vary: Accept-EncodingStrict-Transport-Security: max-age=15724800; includeSubDomains{"data":{"isAdmin":false}}
Line by line:
HTTP/1.1 200 OKis the status line.200means the request succeeded and here is the answer.Server: nginx/1.19.1says which web server software produced the reply.Date: Sat, 04 Sep 2021 04:47:05 GMTis when the reply was generated.Content-Type: application/json; charset=utf-8says the body is JSON text.Content-Length: 27says the body is 27 bytes long.Connection: closesays the connection will be closed after this reply.access-control-allow-origin: *andaccess-control-allow-credentials: trueare CORS headers. CORS is the set of rules that decides which other websites a browser is allowed to read this reply from.*means any origin, andallow-credentials: truemeans cookies may be included.etag: W/"1b-fPOq3WJkZQ0rkaalpPwLwZziKSQ"is an identifier for this particular version of the content, used for caching.Vary: Accept-Encodingtells caches that the reply can differ depending on the compression the client accepts.Strict-Transport-Security: max-age=15724800; includeSubDomainsis HSTS. It tells the browser to keep using HTTPS for this site for the given number of seconds, and to apply that to subdomains too.- The body is
{"data":{"isAdmin":false}}: the answer to the query, saying this user is not an admin.
Why this step matters: the reply is the thing you are going to change. Pausing it before the browser receives it is what makes the change possible.
Step 3: Flip the boolean and forward
Change isAdmin: false to isAdmin: true in the intercepted response and send it on to the browser. The author's note on the response line is that the value {"data":{"isAdmin":false}} is simply changed to isAdmin":true.
In other words, the body that leaves Burp towards the browser now says the user is an administrator. The server never said that; the browser is simply being told it.
Step 4: Observe the admin panel
Back in the browser, the home page now shows the admin panel. Inside it the author could add lectures and view the list of all students.
This is the moment the bypass becomes visible: the same account, the same cookie, the same server, but a different interface, because the browser was handed a different answer.
Why it worked
The author attributes the issue to a misconfiguration in the GraphQL implementation. Changing the value in transit was enough to make the front end render the admin interface.
What the write-up does not establish is whether the privileged operations behind that interface, adding lectures and listing students, were themselves authorised on the server. The author reached the panel and used it, but the report does not show the requests those actions generated or how the server answered them. The report does not show whether the underlying operations were authorised on the server.
Impact
With a normal student account and the ability to intercept and modify responses, an attacker could reach the administrative interface of the education subdomain. According to the write-up, that interface allowed adding lectures and viewing the full student list. The author could also see the list of all students.
The write-up does not attach a screenshot of the admin panel, citing company privacy, and gives no bounty or severity figures.
Fix
Based on the root cause, the change needed is to stop treating a client-supplied boolean as the authorisation decision: every privileged operation behind the admin panel should verify the caller's role on the server, so that a modified isAdmin response only affects what the browser draws and not what the backend permits.
Variants to test
- Look for GraphQL operations whose names suggest privilege, such as
isAdmin,me,viewerorpermissions, in the requests a page makes after login. A positive result is a response whose body contains a role or boolean field that the UI uses to reveal restricted screens. - Intercept the response and flip the value, then reload the page. A positive result is a restricted interface appearing without any change to the account.
- After the interface appears, capture the requests it makes (adding content, listing users) and replay them with the original, unmodified session. If those requests succeed on their own, the server-side authorisation is missing rather than merely the UI gate.
- Repeat the same interception on other JSON APIs that return role flags, not just GraphQL. A positive result is any response where a client-side role value controls access to data or actions.
Glossary
- API: the part of a website that the page talks to behind the scenes to fetch or send data, like a waiter carrying orders between you and the kitchen.
- Authentication bypass: getting past a login or permission check without having the credentials or role that check is meant to require.
- Authorisation: the decision about what a logged-in user is allowed to do, as opposed to whether they are logged in at all.
- Burp Suite: a tool that sits between your browser and a website, letting you pause, inspect and edit requests and responses.
- Cookie: a small piece of text stored by the browser and sent with requests so the server can recognise the logged-in user. Session cookies are secrets.
- CORS: the browser rules that decide which other websites may read a reply; expressed through
access-control-*headers. - Endpoint: a specific address on a server that accepts requests, such as
/api/graphql. - GraphQL: a way of asking an API for exactly the fields you want, by sending a query that names them.
- Header: a labelled line of extra information attached to an HTTP request or response.
- HSTS: a header that tells the browser to keep using HTTPS for a site, optionally including its subdomains, for a set period.
- HTTP response: the server's reply to a request, made of a status line, headers and usually a body.
- HTTP response manipulation: editing a server's reply while it is in transit, before the browser acts on it.
- Intercepting proxy: a tool positioned between browser and server that can pause and alter the traffic passing through it.
- JSON: a plain text format for structured data, built from names and values in curly braces.
- Query: in GraphQL, the description of the fields you want the server to return.
- Session: the state of being logged in, usually represented by a cookie the server can recognise.
- Status code: the number at the start of an HTTP response saying how the request went, such as
200for success. - Subdomain: a smaller site under a larger one, such as
education.target.comundertarget.com.