XSS on pages without Content-Type specified using type attribute of <object>
In Firefox, a page served without a Content-Type header can be embedded via an object element whose type attribute tells the browser to render it as HTML. An attacker could use this to get script execution on a page that would otherwise be treated as plain text.
Originally disclosed on Mozilla
- Fixed in 45 days
- Paid in 46 days
- Disclosed after 45 days
In Firefox, when a resource without a `Content-Type` header is loaded using an `<object>` with a `type` attribute, the embedded page is rendered according to the value specified in the `type` attribute. e.g.:
'''html
<!-- The embedded page will be rendered as text/html -->
<object type="//example.com/no-content-type-page" type="text/html"></object>
'''
This can enable XSS attacks if the specified page lacks the `Content-Type` header.
The impact is similar to bug 1978315. This behavior only occurs in Firefox. Since Mozilla is currently working to remove XSS vectors that are specific to Firefox (see bug 1977387), I was wondering if this behavior should also be removed.
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
Root cause
Likely the browser trusts the type attribute on an object element to choose the rendering mode when the response has no Content-Type header, instead of falling back to a safe default.
Impact
An attacker could achieve script execution in Firefox against pages that omit the Content-Type header; the behaviour is Firefox-only and Mozilla is already removing Firefox-specific XSS vectors.
What the attacker needed
A page served without Content-Type; victim uses Firefox; attacker can embed the page
The fix
The behaviour should be removed so that a missing Content-Type is not overridden by the type attribute, consistent with the other Firefox-specific XSS vectors being retired.
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.
Browsers decide how to display a file based on a label the server sends, called the Content-Type. If a server forgets that label, Firefox can be told by the embedding page to treat the file as a normal web page, which means any script inside it runs. That turns a harmless-looking file into a way to run code in a victim's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.