Chaining Self Blind XSS with Broken Access Control To Make it Non Self Blind XSS
A stored cross-site scripting flaw existed in the comment section of reports, but it was self-only because each user saw only their own reports. By changing the report name in the request path, a lower-privileged user could access an admin's report, inject a blind XSS payload into its comments, and have it execute when the admin later opened that report.
sudhanshu Kumar kashyap Follow
Published on sudhanshukashyap123.medium.com
okay so the first thing it is not gonna be a fancy write up as i am running out of time, but definitely excited for this vulnerability so dropping the write up here.
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 is a multi-role web application that manages reports. Each report has a comment section, and the application serves different reports to different users: the set of reports a user sees is not the same for everyone. The researcher had already found and exploited several issues in the application, including reflected XSS and HTML injection, before turning to the report and comment functionality.
The write-up focuses on two roles: one higher-privileged role (referred to as the admin account) and one lower-privileged role (the normal user account). The researcher held credentials for both.
Setup
- Two accounts: a normal user account and an admin account.
- A blind XSS payload hosted through an XSS reporting service (referred to in the write-up as "xss dot report"), used to receive callbacks.
- An intercepting proxy, used to capture requests and send them to a repeater, where the path of a report-fetching request could be edited before forwarding.
- No versions, endpoints, parameter names or hostnames are given in the report.
Finding it
While testing the comment section of a report, the researcher found stored XSS. A simple onerror payload worked. A blind XSS payload from the reporting service also triggered, but because the payload executed in the researcher's own session, it was self-XSS and had no practical value on its own.
The next idea was to chain the stored XSS with CSRF, but the application uses a CSRF token in the request body together with validation, so that chain did not work.
The obstacle to making the blind XSS useful was the per-user separation of reports: each user only sees their own reports, so a payload stored in the researcher's own report would only ever fire for the researcher. The researcher recalled a similar case exploited roughly two years earlier, a vertical privilege escalation, and reasoned that if the reports of another user could be reached, the payload could be planted where a higher-privileged user would open it.
Exploitation
Step 1: Observe how a report is fetched as admin
Logged in as the admin account, the researcher opened one of the reports and sent the request to the repeater. The path used to fetch the report contained the report name, and the report name was the only part of the path that differed between reports. That made the report name the candidate to tamper with.
Step 2: Repeat the request as the lower-privileged user with a changed report name
- Logged out of the admin account and logged into the normal user account.
- Clicked one of the reports and captured the request.
- Noted the path, did not forward the request, and changed the report name in the path.
- The response returned the admin's report inside the normal user's account.
The researcher then confirmed that the report could be browsed through, not just fetched.
Step 3: Plant the blind XSS payload in the admin's report
Still in the normal user account, the researcher went to the comment section of the accessed report and added the blind XSS payload there, then saved it.
Step 4: Trigger the payload from the admin account
Logged out of the normal user account, logged back into the admin account, and opened the same report. The payload triggered from the admin account. The researcher checked the XSS reporting service account and confirmed that the admin's cookies and DOM had been captured.
In short: a vertical privilege escalation gave access to the admin's report, the blind XSS payload was stored in that report's comments, and the payload fired when the admin opened the same report.
Root cause
The report-fetching request carried the report name in the path, and changing that name in a lower-privileged session returned the admin's report. Changing the name in the path returned another user's report to a lower-privileged account. This is a broken access control (insecure direct object reference) issue: the object identifier is user-controlled and authorisation is missing or insufficient on the server side.
The stored XSS in the comment section is a separate defect. The onerror payload executed in the comment section, so comment content could carry script. The CSRF token in the body with validation blocked the CSRF chain, but it did nothing against either the access control flaw or the stored XSS.
Impact
The privilege escalation alone was limited: as the researcher puts it, it was only for reports and not much more could be done with it. Chained with the stored XSS, the impact is larger. An attacker with a low-privileged account can read another user's report, including a higher-privileged user's report, and can write a comment into it. When the higher-privileged user opens that report, the payload executes in their session, and the researcher confirmed capture of the admin's cookies and DOM.
Fix
The report does not state what was changed. A server-side ownership or role check on each report fetch would address the access control flaw. Encoding comment content on output would address the stored XSS.
Variants to test
- Change the object identifier in paths that fetch reports, documents, invoices or tickets, using a second low-privileged account. A positive result is the full content of another user's object returned to the lower-privileged session.
- Try identifiers that are names rather than numeric IDs, as in this report. A positive result is a successful fetch after substituting a name observed in a higher-privileged session.
- After gaining read access, test whether write operations on the same object (comments, notes, status changes) are also missing authorisation. A positive result is a stored comment appearing in the victim's view of the object.
- Test stored XSS in comment fields with a simple
onerrorpayload, then with a blind payload from a reporting service. A positive result is execution in your own session first, and a callback from another user's session after the access control step. - Attempt CSRF against the same state-changing requests. A positive result is a request accepted without the body CSRF token; if the token is present and validated, as here, the chain is blocked.
What happened, in plain words
A security researcher found a way to read other people's private reports in a web application, and then used that to plant a small piece of malicious code in an administrator's report. When the administrator later opened that report, the code ran inside the administrator's browser and sent the administrator's session data back to the researcher.
Two separate weaknesses made this possible. The first is that changing the report name in the web address returned another user's report. The second is that a simple onerror payload worked in the comment section, so a comment could contain code the browser would run.
Neither weakness is very useful on its own. Together they let a low-privileged user reach into a high-privileged user's account.
The application and the two roles
The target is a web application that manages reports. Think of it like a shared filing cabinet in an office: people log in, and each person sees a list of reports that belong to them. Every report has a comment section underneath it, like the comments under a blog post, where people can leave notes.
The application has multiple roles. A role is simply a label attached to an account that says what that account is allowed to do. A receptionist and a manager might both use the same office system, but the manager can open the safe and the receptionist cannot. In this application the researcher focused on two roles:
- A higher-privileged role, which the write-up calls the admin account.
- A lower-privileged role, which the write-up calls the normal user account.
The researcher already had login credentials for both accounts. Credentials here means a username and password, the same thing you type into any login form.
Before this particular finding, the researcher had already found and exploited several other issues in the same application, including reflected XSS and HTML injection. Those are not the subject of this write-up, but they show the researcher already knew the application well.
One detail matters a lot for the story: the set of reports a user sees is not the same for everyone. Each user only sees their own reports. If you log in as Alice, you see Alice's reports. If you log in as Bob, you see Bob's reports. This separation is what makes the whole chain interesting, and it is also the obstacle the researcher had to get around.
The tools used
To follow the steps you need to understand three tools the researcher used.
- An intercepting proxy. When your browser talks to a website, it sends a request ("please give me this page") and receives a response (the page). A proxy sits between the browser and the website and lets you pause each request, look at it, change it, and then send it on. Think of it like a postal worker who opens every letter you send, lets you rewrite it, and then seals it and delivers it. The researcher used a proxy to capture requests and send them to a repeater, which is a feature of the proxy that lets you resend the same request over and over with small edits.
- A blind XSS payload hosted through an XSS reporting service. XSS stands for cross-site scripting: it means getting a website to run code (usually JavaScript, the language browsers use for interactivity) that the website's owners did not intend. A blind XSS is one where you cannot see the result yourself, because the code runs in someone else's browser. To find out whether it ran, you make the code send a message back to a server you control. The researcher used a service (referred to in the write-up as "xss dot report") that provides such a server and shows you the messages that arrive. Think of it like a security camera pointed at a door you cannot see: you only know someone walked through when the camera sends you an alert.
- Two accounts. One normal user account and one admin account, both with valid credentials.
The write-up does not give any versions, endpoint paths, parameter names or hostnames. Everything below is described in general terms, exactly as the researcher described it.
Finding the stored XSS in the comment section
While testing the comment section of a report, the researcher found stored XSS. Stored XSS means the malicious input is saved on the server (in this case, as a comment) and then served back to anyone who views it. The browser of whoever views the comment runs the code as if the website itself had written it.
The researcher tried a simple onerror payload and it worked. An onerror payload is a small piece of HTML that abuses an image tag. Normally an image tag tells the browser to load a picture. If the picture fails to load, the browser fires an onerror event, and if the tag has an onerror attribute, the browser runs whatever is in that attribute. By pointing the image at something that will never load and putting code in the onerror attribute, you get the browser to run your code. The write-up does not reproduce the exact payload, so it is not shown here.
The researcher then tried a blind XSS payload from the reporting service. That triggered too. But because the payload ran in the researcher's own browser session, it was self-XSS: the researcher was attacking themselves. Self-XSS has no practical value on its own, because the only person who can be tricked into running it is the person who typed it in.
Trying to chain it with CSRF, and failing
The next idea was to combine the stored XSS with CSRF. CSRF stands for cross-site request forgery. It is a trick where a malicious website makes your browser send a request to another website where you are already logged in, without you realising. Because your browser automatically attaches your login cookie (a small piece of data the site gave you when you logged in, so it can recognise you on each request), the other website thinks the request came from you.
If the stored XSS could be combined with CSRF, the researcher might have been able to make a victim's browser perform actions on the researcher's behalf. But the application uses a CSRF token in the request body, together with validation. A CSRF token is a random value the server puts into each form; the server checks that the value coming back matches what it issued. A malicious site cannot guess it, so the forged request is rejected. The write-up says the researcher could not chain the stored XSS with CSRF because of this.
So the researcher was stuck with a self-XSS that only fired for themselves. The write-up says this became a personal challenge: the researcher had to find a way to make it useful.
The obstacle: reports are per-user
The core problem is the per-user separation of reports. Because each user only sees their own reports, a payload stored in the researcher's own report would only ever fire for the researcher. To make the blind XSS fire for someone else, the payload had to be stored somewhere that someone else would open.
The researcher remembered a similar case exploited roughly two years earlier: a vertical privilege escalation. Privilege escalation means getting access to something you should not have access to. Vertical means going from a lower role to a higher one, like a normal employee finding a way to open the manager's filing cabinet. The researcher reasoned: if the reports of another user could be reached, the payload could be planted where a higher-privileged user would open it.
Step 1: Watching how a report is fetched as admin
Logged in as the admin account, the researcher opened one of the reports and sent the request to the repeater. The path used to fetch the report contained the report name, and the report name was the only part of the path that differed between reports.
A path here means the part of the web address after the domain name, the bit that tells the server which page or item you want. For example, in https://example.com/reports/quarterly-summary, the path is /reports/quarterly-summary. If the only thing that changes between two reports is the name at the end, then that name is the obvious thing to tamper with. It is like noticing that the only difference between two locker keys is the number stamped on them: the number is what you would try changing.
Step 2: Repeating the request as the lower-privileged user with a changed report name
The researcher then did the following:
- Logged out of the admin account and logged into the normal user account.
- Clicked one of the reports and captured the request.
- Noted the path, did not forward the request, and changed the report name in the path.
- The response returned the admin's report inside the normal user's account.
Why each step matters:
- Logging out and back in as the lower-privileged user is what makes the test meaningful. If you send the request while still logged in as admin, the server will happily return the report because you are allowed to see it. The question is whether a lower-privileged user can see it.
- Capturing the request and not forwarding it is the key move. The proxy holds the request in your hands. You edit the report name in the path, then send it. This is exactly what an attacker with a normal account would do.
- The response returning the admin's report inside the normal user's account is the proof: the normal user was not stopped from seeing that report.
The researcher then confirmed that the report could be browsed through, not just fetched. In other words, it was not a one-off fluke: the normal user could click around inside the admin's report as if it were their own.
This is a broken access control issue, and specifically an insecure direct object reference (IDOR). An object is any item the application stores: a report, a document, an invoice, a ticket. A direct object reference means the application identifies the object by something the user supplies, such as a name or a number in the path. If the server does not check that the requesting user is entitled to that object, changing the reference gives you someone else's data.
Step 3: Planting the blind XSS payload in the admin's report
Still in the normal user account, the researcher went to the comment section of the accessed report and added the blind XSS payload there, then saved it.
This is the moment the two weaknesses combine. The access control flaw let the researcher read the admin's report. The stored XSS flaw let the researcher write a comment into it. The comment is saved on the server, so it will be served to anyone who opens the report, including the admin.
Step 4: Triggering the payload from the admin account
The researcher logged out of the normal user account, logged back into the admin account, and opened the same report. The payload triggered from the admin account. The researcher then checked the XSS reporting service account and confirmed that the admin's cookies and DOM had been captured.
A cookie is a small piece of data a website stores in your browser after you log in, so it can recognise you on the next request. If an attacker can steal your session cookie, they can often impersonate you without knowing your password. The DOM (Document Object Model) is the browser's in-memory representation of the page: the structure of elements, text and attributes that the browser has built from the HTML. Capturing the DOM means the payload could read what was on the admin's page.
In short: a vertical privilege escalation gave access to the admin's report, the blind XSS payload was stored in that report's comments, and the payload fired when the admin opened the same report.
Why the chain matters
The researcher asks the obvious question: if you already have privilege escalation, why bother with the blind XSS? The answer is that the privilege escalation alone was limited. As the researcher puts it, it was only for reports, and not much more could be done with it. You could read a report you should not see, but you could not, for example, take over the admin's account.
With the blind XSS, the impact is much larger. The payload runs in the admin's browser, in the admin's session, and can read the admin's cookies and DOM. That is a step from "I can read one report" to "I can act as the admin".
Root cause
There are two separate defects.
- Broken access control on the report-fetching endpoint. The request identified the report by its name in the path, and changing that name in a lower-privileged session returned the admin's report. Changing the name in the path returned another user's report to a lower-privileged account. The object identifier is user-controlled, and authorisation is missing or insufficient on the server side.
- Stored XSS in the comment section. The
onerrorpayload executed in the comment section, so comment content could carry script. Output encoding means converting characters like<and>into harmless text so the browser shows them instead of treating them as HTML. Without it, anything a user types can become code.
The CSRF token in the body with validation blocked the CSRF chain, but it did nothing against either the access control flaw or the stored XSS. A CSRF token protects against forged requests from other sites; it does not check who is allowed to see which report, and it does not clean up comment content.
Impact
The privilege escalation alone was limited: as the researcher puts it, it was only for reports and not much more could be done with it. Chained with the stored XSS, the impact is larger. An attacker with a low-privileged account can read another user's report, including a higher-privileged user's report, and can write a comment into it. When the higher-privileged user opens that report, the payload executes in their session, and the researcher confirmed capture of the admin's cookies and DOM.
- The attacker holds a valid low-privileged account.
- The victim opens the tampered report.
- The comment section remains injectable.
Fix
The write-up does not state what was changed. A server-side ownership or role check on each report fetch would address the access control flaw. In plain terms: before handing over a report, the server should check "does this logged-in user own this report, or have a role that allows seeing it?" If not, refuse. Encoding comment content on output would address the stored XSS.
Variants to test
If you want to look for similar issues in an application you are allowed to test, here are the same ideas written as things to try:
- Change the object identifier in paths that fetch reports, documents, invoices or tickets, using a second low-privileged account. A positive result is the full content of another user's object returned to the lower-privileged session.
- Try identifiers that are names rather than numeric IDs, as in this report. A positive result is a successful fetch after substituting a name observed in a higher-privileged session.
- After gaining read access, test whether write operations on the same object (comments, notes, status changes) are also missing authorisation. A positive result is a stored comment appearing in the victim's view of the object.
- Test stored XSS in comment fields with a simple
onerrorpayload, then with a blind payload from a reporting service. A positive result is execution in your own session first, and a callback from another user's session after the access control step. - Attempt CSRF against the same state-changing requests. A positive result is a request accepted without the body CSRF token; if the token is present and validated, as here, the chain is blocked.
Glossary
- Access control: the rules that decide which user is allowed to do what. Broken access control means those rules are missing or can be bypassed.
- Admin account: an account with a higher-privileged role, allowed to do more than a normal user.
- Blind XSS: cross-site scripting where the attacker cannot see the result directly, because the code runs in someone else's browser. The attacker learns it ran by receiving a callback on a server they control.
- Broken access control: a class of vulnerability where the application fails to check whether the user is allowed to perform an action or see an object.
- Callback: a message sent from the victim's browser to a server the attacker controls, used to confirm that code ran.
- Cookie: a small piece of data a website stores in your browser, often used to keep you logged in between requests.
- Credentials: a username and password (or similar) used to log in.
- CSRF (cross-site request forgery): a trick where a malicious site makes your browser send a request to another site where you are logged in, without your knowledge.
- CSRF token: a random value the server puts into each form and checks on submission, so a forged request from another site cannot succeed.
- DOM (Document Object Model): the browser's in-memory representation of a page: its elements, text and attributes.
- Endpoint: a specific address on a server that handles a particular kind of request, such as fetching a report.
- HTML injection: getting HTML markup into a page where it should not be, so the browser renders it as part of the page.
- IDOR (insecure direct object reference): a broken access control issue where the application identifies an object by a value the user supplies (a name, a number) and does not check that the user is entitled to it.
- Intercepting proxy: a tool that sits between your browser and a website, letting you pause, inspect and edit requests and responses.
- JavaScript: the programming language browsers run to make pages interactive.
- Object: any item the application stores, such as a report, document, invoice or ticket.
onerrorpayload: an HTML image tag whoseonerrorattribute contains code, so the code runs when the image fails to load.- Output encoding: converting characters like
<and>into harmless text so the browser displays them instead of treating them as HTML. - Path: the part of a web address after the domain name, telling the server which page or item you want.
- Payload: the piece of code or input an attacker uses to exploit a vulnerability.
- Privilege escalation: getting access to something you should not have access to. Vertical means going from a lower role to a higher one.
- Reflected XSS: cross-site scripting where the malicious input is immediately echoed back in the response, rather than stored on the server.
- Repeater: a feature of an intercepting proxy that lets you resend the same request repeatedly with small edits.
- Request / response: the message your browser sends to a server (request) and the message the server sends back (response).
- Role: a label attached to an account that says what that account is allowed to do.
- Self-XSS: cross-site scripting that only runs in the attacker's own session, because the attacker typed the payload themselves. It has no practical value on its own.
- Session: the period during which a website remembers you as logged in, usually tracked by a cookie.
- Stored XSS: cross-site scripting where the malicious input is saved on the server and served back to anyone who views it.
- Validation: checks the server performs on incoming data to make sure it is well-formed and acceptable.
- XSS (cross-site scripting): getting a website to run code in a visitor's browser that the website's owners did not intend.
- XSS reporting service: a service that provides a server to receive callbacks from blind XSS payloads and shows you the messages that arrive.