Encrypted Payload -> Decrypted Execution ($600) : Stored XSS
A support-ticket system decrypted encrypted messages into a textarea without sanitising the content, so a crafted encrypted reply could break out of the textarea and run script when a support agent clicked to decrypt it. An attacker could run script in the browsers of admins and support staff who viewed the ticket.
Published on shrirangdiwakar.medium.com
Hello Hunters, This is a Tale of how I used an Application’s feature against itself to give rise to a Stored Cross Site Scripting Vulnerability. So relax and Enjoy the article ❤
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 was a web application described as a Server Hosting Management System offering 24x7 support and datacentre facilities. The relevant feature was its support ticket system: customers could open tickets for technical support, server hosting support, billing support and similar categories, and admins, technical support team members and the application's own support team would take part in the conversation. The flow worked much like a chat, with questions raised in the ticket and answered by support staff.
Because customers sometimes need to send sensitive information such as passwords through a ticket, the application included an encryption feature. Any member of the conversation could encrypt a message and send it as a reply to the support ticket. The encrypted message appeared in the thread, and when it was clicked it was decrypted so the reader could see the original content.
That decrypt-on-click behaviour is the part worth looking at. A message that is stored encrypted and rendered later, on demand, gives the application a second chance to get output encoding wrong, and it is exactly where this stored cross site scripting vulnerability lived.
Setup
The report does not describe any special tooling, accounts or versions. The researcher worked with the application as a normal user who could create support tickets, and the attack depended on other people in the ticket thread: admins, technical support team members and the backend support team. The one precondition that mattered for impact was that the technical team had to be added to the ticket by the admin, a point that later shaped the severity rating.
Finding it
After creating a support ticket, the researcher analysed the "Encrypt Message" feature and found that the encrypted message was decrypted on click inside a <textarea> tag. That is the classic place to look: content placed inside a textarea is not executed as markup, so the interesting question is what happens when the content contains characters that close the tag.
A second observation made the exploitation more interesting. The application did not allow the alert, prompt or confirm functions, but it did allow the uppercased versions of them. So a payload that used ALERT(...) would pass whatever check was in place, and the researcher crafted the payload so that it was processed as alert(...) at execution time.
Exploitation
Step 1: Create a support ticket
The researcher created a support ticket, which put them in a conversation with the support side of the application. This is the delivery channel: the payload would be sent as a reply in that thread.
Step 2: Analyse the decrypt behaviour
The "Encrypt Message" feature encrypted the message before sending. When a reader clicked the encrypted message, it was decrypted and rendered inside a <textarea> tag. Because the decrypted content was placed into that tag, a payload beginning with a closing </textarea> could break out of it and introduce new markup.
Step 3: Work around the function filter
The application blocked alert, prompt and confirm, but allowed the uppercased forms. The payload used the uppercased ALERT(document.cookie) and lowercased it at runtime with eval(pop.toLowerCase()).
Step 4: Craft the payload
The payload was:
</textarea><img src=x onerror=”var pop=’ALERT(document.cookie);’; eval(pop.toLowerCase());”
The first part, </textarea>, closes the textarea the decrypted message is rendered into. The <img src=x> then creates an element whose load fails, firing the onerror handler. Inside the handler, var pop=’ALERT(document.cookie);’ stores the call in a variable using the uppercased name, and eval(pop.toLowerCase()) converts it to alert(document.cookie); and executes it. The handler builds alert(document.cookie); and executes it.
Step 5: Encrypt and send
Using the "Encrypt Message" feature, the researcher encrypted the payload and sent it as a reply to the support ticket. The researcher encrypted the payload and sent it as a reply to the support ticket, where it waited for a reader.
Step 6: The victim clicks
Anyone from the support team, technical team or admin who clicked the message to check the original content would trigger decryption, and the payload would then execute in their session. The researcher notes that support staff would obviously click it, since checking the decrypted content is the whole point of the feature.

Step 7: Scope of the victims
All the parties involved in the application, admins, technical support team and backend support, were vulnerable to XSS when they decrypted the message.

Root cause
The decrypted message was inserted into a <textarea> without neutralising the characters that end the tag, so a </textarea> sequence in the plaintext broke out of the element and the rest of the content was parsed as HTML. Because the payload carried the uppercased ALERT and lowercased it at runtime with eval, the filter never saw the string it was looking for.
Impact
The payload executed in the session of any admin, technical support team member or backend support member who decrypted the message in the ticket, and it read document.cookie. The submission was triaged and rewarded with a $600 bounty under the P3 category. The rating reflected the affected actors, the Admins, Technical Support Team and the backend support, but also the fact that the technical team had to be added by the admin, which lowered the possible impact.
Fix
The report does not say what change was made.
Variants to test
- Any feature that decrypts or decodes stored content on click and renders it into a form field or preview pane. A positive result is a
</textarea>or similar closing sequence in the plaintext producing new markup in the page. - Blocklists that match lowercase function names only. Try uppercased names combined with
eval(...toLowerCase()), as here, or other case transformations. A positive result is the handler firing despite the filter. - Other tags that fire without user interaction, such as
<img src=x onerror=...>,<svg onload=...>or<details open ontoggle=...>, in the same decrypt-on-click context. A positive result is script execution when the message is opened. - Encrypted or encoded messages sent to different roles in a ticket or chat thread, to see which roles decrypt them and therefore which sessions are exposed. A positive result is execution in a higher-privileged session than the sender's.
What happened, in plain words
A security researcher found a way to sneak a small piece of JavaScript (a program that runs in your browser) into a support ticket system. The trick was to use the system's own encryption feature: the researcher wrote a malicious message, encrypted it, and sent it as a reply in a support ticket. When support staff, admins or technical team members clicked the encrypted message to read it, the message was decrypted and the hidden JavaScript ran in their browser. The payload called alert(document.cookie), which displays the victim's cookies. The researcher reported the bug and received a $600 bounty. The bug was a type of security flaw called Stored Cross Site Scripting (XSS).

Let's Begin
Cross site scripting (XSS) is a common attack where malicious code is injected into a vulnerable web application. Stored XSS is the most dangerous kind: the attacker places the malicious code into the application itself (for example, in a message or profile), and it is saved on the server. Then, when other users view that content, the code runs in their browsers. Unlike reflected XSS, where the attacker must trick a user into clicking a specially crafted link, stored XSS waits for victims to come to it.
Summary
The target was a web application that managed server hosting. It offered 24x7 support and datacentre facilities. The application had a support ticket system: customers could open tickets for technical support, server hosting support, billing support, and so on. Admins, technical support team members, and the application's own support team would join the conversation. It worked like a chat: you ask a question in the ticket, and support answers.
Because customers sometimes need to send sensitive information such as passwords through a ticket, the application included an encryption feature. Any member of the conversation could encrypt a message and send it as a reply. The encrypted message would appear in the ticket thread, and when someone clicked it, it would be decrypted so they could read the original content.
That decrypt-on-click behaviour is the interesting part. A message that is stored encrypted and then rendered later, on demand, gives the application a second chance to get output encoding wrong. And that is exactly where this stored XSS vulnerability lived.
Steps Followed
- Created a support ticket.
- Analysed the "Encrypt Message" feature and found that the encrypted message was decrypted on click inside a
<textarea>tag. - Noticed that the application did not allow the
alert,prompt, orconfirmfunctions, but it did allow the uppercased versions of them. - Crafted a special payload to first escape the tag, then input as uppercased "ALERT(1)" but processed as "alert(1)" due to the specially crafted payload.
- Used the "Encrypt Message" feature to encrypt the payload and sent it as a reply to the support ticket.
- So if anyone from the support team, technical team, or admin clicked on the message (which they obviously would) to check the original content, it would be decrypted and the payload would execute.
- Now, all victims involved in the application were vulnerable to XSS when decrypting the message.
Payload:
</textarea><img src=x onerror=”var pop=’ALERT(document.cookie);’; eval(pop.toLowerCase());”
Let's break down this payload line by line:
</textarea>: This closes the<textarea>tag that the decrypted message is placed into. A<textarea>is an HTML element for multi-line text input; content inside it is treated as plain text, not as HTML. By closing it early, the attacker can make the rest of the content be interpreted as HTML.<img src=x>: This creates an image element. Thesrcattribute is set tox, which is not a valid image URL, so the image will fail to load.onerror=”var pop=’ALERT(document.cookie);’; eval(pop.toLowerCase());”: This is an event handler that runs when the image fails to load. It contains JavaScript code:var pop=’ALERT(document.cookie);’;stores the stringALERT(document.cookie);in a variable namedpop. Note thatALERTis uppercase, and the application allowed the uppercased version.eval(pop.toLowerCase());converts the string to lowercase (soALERTbecomesalert) and then executes it witheval. Theevalfunction runs a string as code. Soalert(document.cookie);is executed.
Hence, the title: Encrypted Payload -> Decrypted Execution.

Root cause
The decrypted message was inserted into a <textarea> without neutralising the characters that end the tag. So a </textarea> sequence in the plaintext broke out of the element, and the rest of the content was parsed as HTML. The application did not allow the alert, prompt, or confirm functions, but it did allow the uppercased versions of them. Because the payload carried the uppercased ALERT and lowercased it at runtime with eval, the filter never saw the string it was looking for.
Impact
The payload executed in the session of any admin, technical support team member, or backend support member who decrypted the message in the ticket, and it read document.cookie. The submission was triaged and rewarded with a $600 bounty under the P3 category. The rating reflected the affected actors (Admins, Technical Support Team, and backend support), but also the fact that the technical team had to be added by the admin, which lowered the possible impact.
Fix
The report does not say what change was made. The function-name blocklist should be treated as defence in depth, not as the control that matters.
Variants to test
- Any feature that decrypts or decodes stored content on click and renders it into a form field or preview pane. A positive result is a
</textarea>or similar closing sequence in the plaintext producing new markup in the page. - Blocklists that match lowercase function names only. Try uppercased names combined with
eval(...toLowerCase()), as here, or other case transformations. A positive result is the handler firing despite the filter. - Other tags that fire without user interaction, such as
<img src=x onerror=...>,<svg onload=...>, or<details open ontoggle=...>, in the same decrypt-on-click context. A positive result is script execution when the message is opened. - Encrypted or encoded messages sent to different roles in a ticket or chat thread, to see which roles decrypt them and therefore which sessions are exposed. A positive result is execution in a higher-privileged session than the sender's.
Glossary
- XSS (Cross Site Scripting): A security vulnerability where an attacker injects malicious scripts into web pages viewed by other users.
- Stored XSS: A type of XSS where the malicious script is permanently stored on the target server (e.g. in a database) and served to victims when they access the stored content.
- Reflected XSS: A type of XSS where the malicious script is reflected off a web server, typically via a link, and executed immediately in the victim's browser.
- Payload: The malicious code or data that an attacker sends to exploit a vulnerability.
- Encryption: The process of encoding information so that only authorised parties can read it.
- Decryption: The process of converting encrypted information back to its original form.
- Support ticket: A request for help submitted by a user to a support team, often used in customer service systems.
<textarea>: An HTML element that provides a multi-line plain-text editing control.- HTML tag: A markup construct that defines elements in an HTML document, such as
<img>or<textarea>. alert,prompt,confirm: JavaScript functions that display dialog boxes to the user.eval: A JavaScript function that evaluates a string as code.document.cookie: A property in JavaScript that allows reading and writing cookies associated with the current document.- Cookie: A small piece of data stored by a website in the user's browser, often used for session management or tracking.
- Bounty: A reward paid to a security researcher for responsibly disclosing a vulnerability.
- P3 category: A severity rating in a bug bounty program, typically indicating a medium-severity issue.
- Content Security Policy (CSP): A security mechanism that helps detect and mitigate certain types of attacks, including XSS, by specifying which dynamic resources are allowed to load.
- Defence in depth: A security strategy that uses multiple layers of controls to protect against attacks.
- Blocklist: A list of items (e.g. function names) that are explicitly denied or blocked.
- Output encoding: The process of converting special characters into their safe HTML entities to prevent them from being interpreted as code.