Pitfalls of Desanitization: Leaking Customer Data from osTicket
osTicket sanitized user-submitted HTML but then modified the sanitized output with a regex that could delete characters and reintroduce XSS. An unauthenticated attacker could submit a malicious ticket that, when viewed by a staff member, executed script to leak other tickets and take over the staff member's account.
Published on sonarsource.com
As part of our continuous effort to improve our Code Quality technology and the security of the open-source ecosystem, our R&D team is always on the lookout for new 0-day security vulnerabilities in prominent software.
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.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the code modified the sanitized HTML after sanitization, using a regex that could delete characters and change the HTML structure, violating the sanitizer's assumptions.
Impact
The attacker could leak tickets of other customers potentially containing sensitive data and fully take over the staff member's account with a password reset email sent to the attacker's email address.
What the attacker needed
No account needed to create a ticket; victim is a staff member who views the ticket
How it was found
- Create a support ticket containing HTML with a crafted src attribute that matches the regex.
- The server sanitizes the HTML with htmLawed.
- The server applies a regex that replaces part of the src attribute and deletes characters, altering the HTML structure.
- The modified HTML is rendered in the staff member's browser, executing the injected script.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When a website accepts formatted text, it must clean it to remove dangerous code. osTicket did clean the text, but then changed it afterwards in a way that made it dangerous again. This let an attacker run their own code in a staff member's browser when the staff member opened a support ticket.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.