Undocumented content-type

firetail:undefined-content-type

Type:

Observation

Rule Severity:

Medium

Response has Content-Type that is not documented in the schema.

Handling unknown Content-Type values can introduce security risks. For instance, a malicious payload might be treated as a harmless data type, leading to vulnerabilities such as cross-site scripting (XSS) or other security threats.

Remediation

Properly document all content types that an endpoint can deliver in a response.

Example Attack Scenario

An API endpoint meant to return JSON accidentally responds with an HTML Content-Type due to a misconfiguration or an error. If the response contains unsanitized user-generated content, attackers could embed malicious JavaScript in the response. When processed by the client, this script might execute in the user’s browser, resulting in a cross-site scripting (XSS) attack. Properly documenting and validating Content-Type values would prevent such an attack by ensuring strict adherence to the intended response formats.

How to Identify with Example Scenario

How to Resolve with Example Scenario

How to Identify with Example Scenario

Find the text in bold to identify issues such as these in API specifications

How to Resolve with Example Scenario

Modify the text in bold to resolve issues such as these in API specifications
References:

More findings

All Findings