Skip to content
XSS Write-up Advanced

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.

Oskar Zeino-Mahmalat Follow

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.

Oskar Zeino-Mahmalat, on sonarsource.com

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

  1. Create a support ticket containing HTML with a crafted src attribute that matches the regex.
  2. The server sanitizes the HTML with htmLawed.
  3. The server applies a regex that replaces part of the src attribute and deletes characters, altering the HTML structure.
  4. 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.

More by Oskar Zeino-Mahmalat

View all

2 more disclosed reports, best first.

More from Enhancesoft (osTicket)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.