Cross-site scripting on dashboard2.omise.co
Originally disclosed on HackerOne
- Triaged in 8 hours
- Fixed in 18 days
- Paid in 18 days
- Disclosed after 48 days
Summary:
Cross-site scripting (XSS) is an attack vector that injects malicious code into a vulnerable web application. Stored XSS, also known as persistent XSS, is the more damaging of the two. It occurs when a malicious script is injected directly into a vulnerable web application.
Steps To Reproduce:
- Log in to your account.
- Visit https://dashboard.omise.co/test/settings
- Under Export - Specify the metadata that you want to include in your export option. Enter <script>alert(2)</script> in all four parameters including Charge, Transfer, Refund, Dispute.
- Click on Update settings.
- Click on Try our new dashboard, XSS will Trigger or log out and log in again, and XSS will Trigger.
POC: Attached Video.
Impact
Code injected into a vulnerable application can exfiltrate data or install malware on the user's machine. Attackers can masquerade as authorized users via session cookies, allowing them to perform any action allowed by the user account.
Context
Omise runs a dashboard at dashboard2.omise.co for merchants to manage their payment activity. The report concerns the settings page at https://dashboard.omise.co/test/settings, and specifically the Export feature. Export lets a user choose which metadata is included in an export of their records, with four separate parameters covering Charges, Transfers, Refunds and Disputes. The researcher entered a script tag into those four fields and the script executed when the settings were shown again, a stored cross-site scripting (XSS) issue.
The report opens with a short definition: XSS is an attack vector that injects malicious code into a vulnerable web application, and stored (persistent) XSS is the more damaging of the two because the malicious script is injected directly into the vulnerable application and persists there.
Setup
The only precondition stated is an authenticated account on the dashboard. The researcher logs in, navigates to the test settings page, and uses the Export configuration. No special role, tool or version is mentioned.
Finding it
The Export feature takes free-form input for the metadata to include in an export, across four parameters: Charge, Transfer, Refund and Dispute. The researcher entered a script tag as metadata and it executed when the settings were shown again. The report does not describe how the researcher first noticed the behaviour beyond the reproduction steps.
Exploitation
Step 1: Log in
Log in to the account on the dashboard. This establishes the session under which the settings are saved and later rendered.
Step 2: Open the settings page
https://dashboard.omise.co/test/settings
This is the page holding the Export configuration.
Step 3: Inject the payload into all four Export parameters
Under Export, in the option that specifies the metadata to include in the export, enter the following payload in all four parameters, Charge, Transfer, Refund and Dispute:
<script>alert(2)</script>
The payload is a plain script tag calling alert(2).
Step 4: Save the configuration
Click on Update settings. The report does not show the request or the response.
Step 5: Trigger the stored script
Click on Try our new dashboard, and the XSS triggers. Alternatively, log out and log in again, and the XSS triggers. The second path is to log out and log in again, after which the XSS triggers.
The report references an attached video as proof of concept; the video itself is not reproduced here.
Root cause
The report does not identify the specific code path or the cause of the defect. The report also does not say which defences, if any, were present and failed.
Impact
As the report puts it, code injected into a vulnerable application can exfiltrate data or install malware on the user's machine. Attackers can masquerade as authorised users via session cookies, allowing them to perform any action allowed by the user account. The report says attackers can masquerade as authorised users via session cookies and perform any action allowed by the user account.
Fix
Variants to test
- A positive result is the payload executing when the configuration page is reloaded.
- A positive result is execution where the plain script tag is blocked.
- The persistence path: save the payload, log out, log in again, and revisit the settings page. A positive result is execution in the fresh session, which confirms stored rather than reflected behaviour.
Hunting notes
The report's impact argument rests on session-cookie abuse and actions available to the account, which is the standard framing for a stored XSS in an authenticated dashboard; the program rated it critical and paid a 200.00 USD bounty, and the report was disclosed on 2022-05-24.
What happened, in plain words
Omise is a payment company. Merchants (shops and businesses that accept payments through Omise) use a website called a dashboard to look after their payment activity. The settings page in this report is at https://dashboard.omise.co/test/settings.
On that settings page there is a feature called Export. Export lets a merchant choose which extra information (called metadata) should be included when they export their records. There are four separate fields for this, one each for Charges, Transfers, Refunds and Disputes.
The researcher entered a script tag into those four fields and it ran when the settings were shown again. That means if you type a piece of computer code instead of ordinary text, the browser will run that code as if the website itself had put it there. This kind of flaw is called stored cross-site scripting, or stored XSS.
To understand XSS, imagine a noticeboard in an office where anyone can pin a note. If the office never checks what is pinned, someone can pin a note that says "please hand your keys to the person at the door", and other staff will believe it because it is on the official board. A web page is like that noticeboard: the browser trusts what the page tells it. XSS is when an attacker gets their own instructions onto the page, and the browser follows them because it cannot tell they did not come from the site.
Stored (also called persistent) XSS is the more damaging kind, because the malicious script is injected directly into the vulnerable application.
The report begins with exactly this definition: XSS is an attack vector that injects malicious code into a vulnerable web application, and stored XSS is the more damaging of the two because the malicious script is injected directly into the vulnerable application and persists there.
Setup
The only thing you need before starting is a working account on the dashboard, already logged in. The researcher logs in, opens the test settings page, and uses the Export configuration. No special role, no special tool and no particular software version is mentioned.
A quick word on logging in: when you log in, the website gives your browser a small piece of data called a session cookie. Your browser sends that cookie back with every request so the site knows who you are, a bit like a wristband at an event that proves you paid to get in. Everything you do in the dashboard happens under that wristband.
Finding it
The Export feature accepts free-form text for the metadata to include in an export, across four fields: Charge, Transfer, Refund and Dispute. The researcher entered a script tag as metadata and it ran when the settings were shown again. The report does not describe how the researcher first noticed the behaviour beyond the reproduction steps.
"Neutralised" here means made harmless. When a website shows text that a user typed, it should convert characters like < and > into a form the browser displays as plain text rather than treats as instructions. If it does not, the browser reads the typed text as part of the page's own code.
Exploitation
Step 1: Log in
Log in to the account on the dashboard. This establishes the session under which the settings are saved and later shown again.
Step 2: Open the settings page
https://dashboard.omise.co/test/settings
This is the address of the page that holds the Export configuration. Line by line, there is only one line: it is a web address. https means the connection is encrypted, dashboard.omise.co is the server, and /test/settings is the particular page on that server. Opening it in a browser takes you to the settings screen where the Export options live.
Step 3: Inject the payload into all four Export parameters
Under Export, in the option that specifies the metadata to include in the export, enter the following payload in all four parameters, Charge, Transfer, Refund and Dispute:
<script>alert(2)</script>
Line by line, this is a single piece of HTML, the language web pages are written in. <script> is an opening tag that tells the browser "everything until the closing tag is computer code, please run it". alert(2) is a very simple instruction that makes the browser pop up a small box showing the number 2. </script> closes the code block. On its own this payload does nothing harmful; it is a harmless test that proves code can run. If a box with 2 appears, the browser executed the attacker's code, and a real attacker would have put something more useful there.
Step 4: Save the configuration
Click on Update settings. The report does not show the request or the response.
Step 5: Trigger the stored script
Click on Try our new dashboard, and the XSS triggers. Alternatively, log out and log in again, and the XSS triggers. The second path is to log out and log in again, after which the XSS triggers. If it only worked until you refreshed, it would be the weaker reflected kind of XSS.
The report references an attached video as proof of concept; the video itself is not reproduced here.
Root cause
The Export metadata fields accept text supplied by the user and store it, and the stored value is later written into the dashboard page without being encoded or otherwise neutralised. So the browser reads the <script> tag as markup and runs it. The report does not identify the specific code path or the cause of the defect. The report also does not say which defences, if any, were present and failed.
"Encoding on output" means converting special characters at the moment the page is built, so that < becomes something the browser shows as a literal less-than sign instead of starting a tag. It is the difference between reading a recipe out loud and actually cooking it.
Impact
As the report puts it, code injected into a vulnerable application can exfiltrate data or install malware on the user's machine. Attackers can masquerade as authorised users via session cookies, allowing them to perform any action allowed by the user account.
The report says attackers can masquerade as authorised users via session cookies and perform any action allowed by the user account. "Exfiltrate" simply means steal and send away. "Malware" means harmful software. The practical reach therefore depends on who views the affected settings view.
Fix
Two locks on the same door are better than one.
Variants to test
- A positive result is the payload running when the configuration page is reloaded.
- A positive result is execution where the plain script tag is blocked. An event handler is code attached to something like a click or a page load, and an attribute-context breakout is a way of escaping from inside an HTML attribute to start new markup.
- The persistence path: save the payload, log out, log in again, and revisit the settings page. A positive result is execution in the fresh session, which confirms stored rather than reflected behaviour.
Hunting notes
The report's impact argument rests on session-cookie abuse and actions available to the account, which is the standard framing for a stored XSS in an authenticated dashboard. The program rated it critical and paid a 200.00 USD bounty, and the report was disclosed on 2022-05-24.
Glossary
- XSS (cross-site scripting): a flaw where an attacker gets their own code onto a web page and the browser runs it as if the site had put it there.
- Stored XSS: XSS where the malicious text is saved on the server and runs again every time the page is loaded, including in later sessions.
- Reflected XSS: the weaker kind, where the malicious text is only echoed back in the immediate response and does not persist.
- Payload: the piece of text or code an attacker enters to test or exploit a flaw.
- Script tag: the HTML element
<script>that tells the browser to run the code inside it. - HTML: the language web pages are written in, made of tags that describe structure and content.
- Encoding (output encoding): converting special characters when building a page so the browser shows them as text instead of treating them as instructions.
- Session cookie: a small piece of data your browser holds after you log in and sends with each request so the site knows who you are.
- Session: the period during which the site treats you as logged in.
- Dashboard: a website where a user manages their account and data.
- Merchant: a business that accepts payments through a payment provider.
- Metadata: extra descriptive information attached to a record, here the fields chosen for an export.
- Export: a feature that produces a file of your records, with options for what to include.
- Charge, Transfer, Refund, Dispute: a payment taken, money moved out, money returned, and a payment challenged by the customer.
- Exfiltrate: steal data and send it out to the attacker.
- Malware: harmful software.
- Event handler: code attached to an action such as a click or a page load.
- Attribute-context breakout: escaping from inside an HTML attribute to start new markup.
- Recon: the early stage of looking around a target to find features worth testing.
- Bounty: a reward paid by a company for a valid security report.
- CVSS: a standard scoring system for the severity of a vulnerability.