Skip to content
XSS Disclosed report Beginner

Content type incorrectly stated

The server returned a response with a Content-Type header claiming it was an image, but the body contained unrecognised data. An attacker could potentially exploit this to cause browsers to misinterpret the content, possibly leading to cross-site scripting if user-controlled data is involved.

lulliii Follow

Originally disclosed on HackerOne

Informational View original
  • Disclosed after 14 days

Hello, Issue detail: The response contains the following Content-type statement: Content-Type: image/jpeg The response states that it contains a JPEG image. However, it actually appears to contain unrecognized content.
Issue background: If a web response specifies an incorrect content type, then browsers may process the response in unexpected ways. If the specified content type is a renderable text-based format, then the browser will usually attempt to parse and render the response in that format. If the specified type is an image format, then the browser will usually detect the anomaly and will analyze the actual content and attempt to determine its MIME type. Either case can lead to unexpected results, and if the content contains any user-controllable data may lead to cross-site scripting or other client-side vulnerabilities. In most cases, the presence of an incorrect content type statement does not constitute a security flaw, particularly if the response contains static content. You should review the contents of the response and the context in which it appears to determine whether any vulnerability exists.
Issue remediation: For every response containing a message body, the application should include a single Content-type header which correctly and unambiguously states the MIME type of the content in the response body.

Response: HTTP/1.1 200 OK Connection: keep-alive Server: gunicorn Date: Tue, 13 Dec 2016 22:58:22 GMT X-Frame-Options: SAMEORIGIN X-Content-Type-Options: nosniff X-Gratipay-Version: 2020 Set-Cookie: csrf_token=gasIdvRVcAs5Fp26DVBn8BJPK7zY1S9r; expires=Tue, 20 Dec 2016 22:58:22 GMT; Path=/; secure X-Xss-Protection: 1; mode=block Content-Type: image/jpeg Cache-Control: no-cache Via: 1.1 vegur Content-Length: 8571

The original report as published on HackerOne, by lulliii. 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

Root cause

Likely the application set an incorrect Content-Type header for the response, possibly due to a misconfiguration or a bug in how the content type is determined.

Impact

If the content contains user-controllable data, this could lead to cross-site scripting or other client-side vulnerabilities, though the report notes that in most cases an incorrect content type alone does not constitute a security flaw.

What the attacker needed

None

The fix

The application should include a single Content-Type header that correctly and unambiguously states the MIME type of the content in the response body.

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 a website sends a file to your browser, it includes a label called a Content-Type that tells the browser what kind of file it is, like an image or a web page. Here, the label said 'image' but the actual content was something else. Browsers might get confused and try to guess the real type, which could sometimes let an attacker sneak in harmful code.

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 lulliii

View all

7 more disclosed reports, best first.

More from Gratipay

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.