November 17, 2026
From AI Prompt Injection to Authenticated XSS in a CRM Platform
بِسْمِ اللَّـهِ الرَّحْمَـٰنِ الرَّحِيمِ

By Abdelrahman Zourob
2 min read
Prompt Injection to Stored XSS: Unauthorized Actions in a CRM Platform
بِسْمِ اللَّـهِ الرَّحْمَـٰنِ الرَّحِيمِ
This is my first writeup, and I wanted to share the idea behind this finding and how I approached it.
The target was a CRM platform, a cloud-based application that helps businesses manage customers, sales, contacts, and communication.
While exploring the application, I came across a new feature called AI Email Reply Generator, which uses AI to analyze email threads and generate suggested replies.
One question immediately came to mind:
What if I could put malicious instructions inside an email and make the AI follow them?
The Initial Idea: Prompt Injection
Since the AI generates replies based on email content, I decided to test whether I could influence its output using embedded instructions.
I sent an email containing a prompt asking the AI to include a specific JavaScript payload in its generated response.
Surprisingly, the AI followed my instructions!
Here is the prompt I used:
From Prompt Injection to Stored XSS
After opening the email thread and clicking Generate Reply, the AI generated a response containing my injected HTML.
The application inserted the generated content into the HTML-based reply editor without proper sanitization.
As a result, the browser interpreted the HTML and executed its JavaScript event handler.
I had achieved JavaScript execution in the authenticated CRM origin!
Proving the Impact
My first thought was to steal the victim's session, but the session cookie had protection in place.
Instead, I investigated whether I could use the victim's authenticated session directly.
I discovered that the application exposed its anti-forgery tokens through JavaScript-accessible cookies, allowing the injected script to issue authenticated same-origin requests.
I managed to perform several unauthorized actions, including:
- Changing the victim's registered email address.
- Sending invitations to arbitrary email addresses using the victim's privileges.
- Privilege escalation, including actions involving higher-level privileges.
- Modifying account settings and other authenticated operations.
The most interesting part?
The attacker doesn't need an account on the CRM platform!
I confirmed that I could send a regular email from an external mailbox directly to the victim's connected mailbox. The victim only needed to open the email thread and click Generate Reply.
This means the attack starts with an ordinary external email and can lead to JavaScript execution and unauthorized actions within the victim's authenticated session.
The Attack Chain
- Attacker sends a crafted email to the victim.
- No CRM account is required.
- Victim opens the email thread.
- Victim clicks Generate Reply.
- AI follows the embedded instructions.
- Generated HTML is inserted into the reply editor without proper sanitization.
- JavaScript executes in the authenticated CRM origin.
- Attacker performs actions using the victim's privileges.
A Small Lesson About Timing!
Unfortunately, I discovered this issue right before an exam.
I had another exam the following day, so I decided to postpone reporting it until I had more free time.
By the time I finally submitted the report, it had already been marked as a Duplicate.
Not exactly the ending I was hoping for!
Still, it was a valuable learning experience, especially when exploring the security implications of AI-powered features.
follow me:
- X: @z3r0ob
- LinkedIn: Abdelrahman Zourob
See you in the next writeup!