Stored XSS on zendesk via macros
A stored cross-site scripting vulnerability existed in the macro description field of Zendesk Support. An attacker could inject a script that executes when the homepage is viewed, potentially stealing cookies.
Published on medium.com
#### Hariharan.s
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
Zendesk Support is a helpdesk product where agents handle tickets and can automate parts of that work with macros. A macro is a saved set of actions and text that an agent applies to a ticket, and it carries a description field written by the agent.
This write-up is the second part of a series. The first part covered stored XSS through the alternate text of a URL at Zendesk Support. This part covers a second, separate stored XSS sink in the macro description field, and a way around the web application firewall that guarded it.
Setup
The report does not describe the account type, plan, role or tooling used beyond the Zendesk Support agent interface itself. The precondition is the ability to create and later edit a macro, which is normal agent functionality. The payload used throughout is:
<img src=x onerror=alert(document.cookie)>
Finding it
While investigating the XSS issue from the first report, the researcher noticed that the XSS popup triggered two times on the homepage. That suggested a second endpoint was also rendering a stored payload. Searching for the endpoint directly gave no result, so the researcher removed the payload from the first vulnerable endpoint, the alternate URL text, and reloaded the homepage. The popup still fired, but this time only once.
That narrowed it down: the remaining trigger had to come from somewhere else the payload had been entered. Checking the macros showed a payload had also been placed in the macro description field. That was the second vulnerable endpoint.

Exploitation
Step 1: Confirm the second sink
Create a fresh macro and put the payload in the macro description field, then save. The save is rejected by a web application firewall, which says the user has been blocked.
Step 2: Work out the WAF behaviour
After studying how the WAF behaved, the researcher found a simple bypass: the filter only inspects content at the moment it is first submitted. Content entered later, through an edit, is not scanned.
Step 3: Create the macro with benign content
Create the macro with random, harmless text in the description field and save it. This passes the WAF because the payload is not present yet.
Step 4: Edit the description and insert the payload
Edit the macro that already exists and put the payload into the description field, then save again. The WAF does not re-scan the edited content, so the payload is stored successfully.
Step 5: Trigger
The stored payload executes on the homepage, and the popup fires there.

Root cause
The macro description field accepted the payload and it was stored and triggered on the homepage. The WAF that was meant to compensate for this only inspected the content on the initial create request and did not inspect subsequent edit requests, so a two-step create-then-edit sequence placed the payload into storage unchecked. The report does not describe the server-side encoding or the WAF rule configuration, so the exact implementation gap is not stated.
Impact
The payload runs on the Zendesk Support homepage, and the popup shows document.cookie. The practical requirement is the ability to create and edit a macro.
Fix
It records that the issue was resolved on Aug 26 and listed on the vendor hall of fame. The defensive lesson from the bypass is that input filtering has to apply consistently to every write path, including updates to existing records, and that output encoding at render time is what actually stops stored XSS.
Report timeline
| Date | Event |
|---|---|
| Aug 10 | Report submitted |
| Aug 11 | Closed as duplicate of the first report |
| Aug 17 | Reopened after providing information that the two XSS issues are different |
| Aug 23 | Bounty paid |
| Aug 26 | Resolved and listed on the vendor hall of fame |
Variants to test
- Count the XSS triggers on a page after removing one known payload. If the count drops but does not reach zero, another sink is rendering the same input. A positive result is a popup that persists after the first sink is cleaned.
- Create a record with benign content, then edit it to add the payload. A positive result is that the edit is accepted where the create was blocked, and the payload later executes.
- Apply the same create-then-edit sequence to other free-text fields that are rendered back to users, such as descriptions, signatures and canned responses. A positive result is stored script execution on a page other users load.
- Compare WAF responses across create, update and bulk-import paths for the same field. A positive result is any write path that stores the payload without a block.
MAY THE BUGS BE WITH YOU,
P5YCH0(@DJHARIZ1)
What happened, in plain words
Zendesk Support is a helpdesk product: companies use it so that support agents can read customer messages (called tickets) and reply to them. Agents are the staff who answer those tickets. To save time, Zendesk lets an agent build a macro: a saved bundle of actions and ready-made text that the agent can apply to a ticket with one click, instead of typing the same reply again and again. Each macro has a description field, a short note written by the agent that explains what the macro is for. Zendesk shows that description back to agents inside the product.
This write-up is the second part of a series. The first part described a stored XSS bug that abused the alternate text of a URL in Zendesk Support. This part describes a second, separate place where the same kind of bug existed: the macro description field. It also describes how the researcher got past the web application firewall that was supposed to stop it.
Stored XSS (cross-site scripting) means this: a website accepts text from a user, saves it, and later shows that text to other users without making it safe. If the text contains HTML or JavaScript, the browser of the next person who views the page treats it as part of the page and runs it. "Stored" is the key word: the harmful text sits in the site's database and fires every time the page is loaded, not just once. A simple everyday comparison: imagine a noticeboard where visitors can pin notes. If the person who runs the board never checks the notes, someone can pin a note that says "whoever reads this, hand me your wallet", and every visitor who reads it follows the instruction. The note is the stored payload, and the visitors are the victims.
JavaScript is the programming language that browsers run to make pages interactive. alert() is a built-in browser function that opens a small popup box with a message. Researchers use it as a harmless visible signal: if the popup appears, the browser really did run their code.
A cookie is a small piece of text that a website asks the browser to keep and send back on every later request to that site. Sites commonly use a cookie to remember that you are logged in, so the cookie acts like a wristband at an event: show it and you are let in without proving who you are again. document.cookie is the browser command that reads the cookies of the current page. If an attacker can run JavaScript on a site, reading document.cookie is often the first thing they try, because a session cookie can let them act as the logged-in user.
A web application firewall (WAF) is a filter that sits in front of a website and inspects what users send, blocking requests that look malicious. Think of a security guard at the door who checks bags: the guard looks at what you carry in, but here the guard only checked the first time the researcher walked in.
Setup
The report does not describe the account type, plan, role or tooling used beyond the Zendesk Support agent interface itself. The only precondition is the ability to create a macro and later edit it, which is normal agent functionality.
The payload used throughout is:
<img src=x onerror=alert(document.cookie)>
Line by line, in plain words:
<img ...>is the HTML tag for displaying an image.src=xtells the browser to load the image from a location calledx. No such image exists, so the load fails.onerror=...is an attribute that tells the browser: when the image fails to load, run the code that follows. The failure is deliberate; it is the trigger.alert(document.cookie)opens a popup showing the cookies of the current page. Seeing that popup proves the browser executed the researcher's JavaScript in the context of the Zendesk page.
Finding it
While investigating the XSS issue from the first report, the researcher noticed that the XSS popup triggered two times on the homepage. Two popups suggested a second place was also rendering a stored payload. That suggested a second endpoint was also affected. An endpoint is simply a specific address on a server that accepts a request and does something with it, like a counter in a shop where you hand in a form; each counter handles one kind of form.
Searching for the endpoint directly gave no result, so the researcher took a different approach: remove the payload from the first vulnerable endpoint, the alternate URL text, and reload the homepage. The popup still fired, but this time only once. That narrowed it down: one trigger was gone, so the remaining trigger had to come from somewhere else the payload had been entered. Checking the macros showed a payload had also been placed in the macro description field. That was the second vulnerable endpoint.

Exploitation
Step 1: Confirm the second sink
A sink is the place in a program where data finally gets used, here the place where the macro description is turned into part of the web page. To confirm it, create a fresh macro and put the payload in the macro description field, then save. The save is rejected by a web application firewall, which says the user has been blocked. So the field was indeed a sink, but the guard at the door was catching the payload on the way in.
Step 2: Work out the WAF behaviour
After studying how the WAF behaved, the researcher found a simple bypass: the filter only inspects content at the moment it is first submitted. Content entered later, through an edit, is not scanned. This is the core of the whole bug: the guard checked the bag on the way in, but not on the way back in with a second visit.
Step 3: Create the macro with benign content
Create the macro with random, harmless text in the description field and save it. This passes the WAF because the payload is not present yet. Nothing suspicious is in the request, so there is nothing for the filter to block.
Step 4: Edit the description and insert the payload
Edit the macro that already exists and put the payload into the description field, then save again. The WAF does not re-scan the edited content, so the payload is stored successfully. In the researcher's own words: WAF only scans the content that is entered the first time and does not care what you enter afterwards.
Step 5: Trigger
The stored payload executes on the homepage, and the popup fires there. The researcher's summary of this moment: after this, bye bye WAF; the payload got saved successfully and also got triggered on the homepage.

Root cause
The macro description field accepted the payload and it was stored and triggered on the homepage. Output encoding means converting special characters into harmless text before putting them on a page, so that < becomes something the browser displays as a character instead of treating as the start of a tag. Without it, whatever the user typed becomes part of the page's instructions.
The WAF that was meant to compensate for this only inspected the content on the initial create request and did not inspect subsequent edit requests, so a two-step create-then-edit sequence placed the payload into storage unchecked. The report does not describe the server-side encoding or the WAF rule configuration, so the exact implementation gap is not stated.
Impact
The payload runs on the Zendesk Support homepage, and the popup shows document.cookie. Origin here means the site the page belongs to; code running on a page can read that page's cookies, which is why a session cookie is the usual target. The practical requirement is the ability to create and edit a macro.
Fix
It records that the issue was resolved on Aug 26 and listed on the vendor hall of fame. The defensive lesson from the bypass is that input filtering has to apply consistently to every write path, including updates to existing records, and that output encoding at render time is what actually stops stored XSS. A write path is any route through which data can get into the system: creating a record, editing it, importing many records at once, and so on. If one route is left unguarded, the guard on the others does not help.
Report timeline
| Date | Event |
|---|---|
| Aug 10 | Report submitted |
| Aug 11 | Closed as duplicate of the first report |
| Aug 17 | Reopened after providing information that the two XSS issues are different |
| Aug 23 | Bounty paid |
| Aug 26 | Resolved and listed on the vendor hall of fame |
A duplicate is a report that the vendor considers the same issue as one already reported. Here the researcher argued that the two XSS issues were different, and the report was reopened. A bounty is the money a vendor pays for a valid security report, and a hall of fame is the vendor's public list of researchers who reported issues.
Variants to test
These are the general lessons the researcher drew, written as things to try on other targets:
- Count the XSS triggers on a page after removing one known payload. If the count drops but does not reach zero, another sink is rendering the same input. A positive result is a popup that persists after the first sink is cleaned. This is how the second bug here was found: two popups, then one after removing the first payload.
- Create a record with benign content, then edit it to add the payload. A positive result is that the edit is accepted where the create was blocked, and the payload later executes.
- Apply the same create-then-edit sequence to other free-text fields that are rendered back to users, such as descriptions, signatures and canned responses. A positive result is stored script execution on a page other users load.
- Compare WAF responses across create, update and bulk-import paths for the same field. A positive result is any write path that stores the payload without a block.
The researcher's closing note: check the number of XSS triggers, because the number of triggers equals the number of vulnerable endpoints, and try to bypass the WAF by changing more than just the payload.
MAY THE BUGS BE WITH YOU,
P5YCH0(@DJHARIZ1)
Glossary
- Zendesk Support: a helpdesk product where support agents handle customer tickets.
- Ticket: a customer message or request that an agent works on inside the helpdesk.
- Agent: the support staff member who reads and answers tickets.
- Macro: a saved set of actions and ready-made text that an agent applies to a ticket with one click.
- Description field: the short note attached to a macro, written by the agent and shown back in the interface.
- Payload: the piece of text an attacker submits that is meant to be interpreted as code by the browser.
- JavaScript: the programming language browsers run to make pages interactive.
alert(): a browser function that opens a popup with a message, used here as a visible sign that code ran.- Cookie: a small piece of text a site asks the browser to keep and send back on later requests, often used to remember that you are logged in.
document.cookie: the browser command that reads the cookies of the current page.- Session cookie: a cookie that proves you are logged in, so whoever holds it can act as you.
- Web application firewall (WAF): a filter in front of a website that inspects incoming requests and blocks ones that look malicious.
- Endpoint: a specific address on a server that accepts a request and does something with it.
- Sink: the place in a program where data is finally used, such as where a stored description is turned into part of a web page.
- Output encoding: converting special characters into harmless text before showing them on a page, so the browser displays them instead of treating them as instructions.
- Origin: the site a page belongs to; code running on a page can read that page's cookies.
- Write path: any route through which data can get into a system, such as creating, editing or bulk-importing records.
- Duplicate: a report the vendor considers the same issue as one already reported.
- Bounty: money a vendor pays for a valid security report.
- Hall of fame: a vendor's public list of researchers who reported issues.