Credentials for alternative HTTP authentication method sent as cleartext
Issue ID: v3-global-securityrequirement-http-known-good-clear
Average severity: Critical
Description
API accepts credentials sent in cleartext over an unencrypted channel for a secure alternative HTTP authentication method included in IANA Authentication Scheme Registry.
These schemes aim to address the shortcomings of Basic and Digest authentication and include the following:
- HTTP Origin-Bound Authentication (HOBA) (RFC 7486)
- Mutual Authentication Protocol for HTTP (RFC 8120)
- Salted Challenge Response HTTP Authentication Mechanism
(SCRAM) (RFC 7804)
- SCRAM-SHA-1
- SCRAM-SHA-256
- Voluntary Application Server Identification (VAPID) for Web Push (RFC 8292)
Attackers can easily intercept API calls and retrieve the unencrypted tokens. They can then use the tokens to make other API calls.
For more details, see the OpenAPI Specification.
Example
The following is an example of how this type of risk could look in your API definition. The security scheme defines HOBA as the authentication method, and the server
object sets HTTP as the supported protocol:
{
"servers": [
{
"url": "http://my.api.server.com/",
"description": "API server"
}
],
// ...
"components": {
"securitySchemes": {
"hobaAuth": {
"type": "http",
"scheme": "hoba"
}
}
},
// ...
"security": [
{
"hobaAuth": []
}
]
}
Possible exploit scenario
Attackers can intercept the credentials simply by listening to the network traffic in a public WiFi network. They could also use a traffic logging tool on a smartphone, computer, or browser, or sniff the traffic in the network to get the credentials.
Remediation
Set all server
objects to support HTTPS only so that all traffic is encrypted.
{
"servers": [
{
"url": "https://my.api.server.com/",
"description": "API server"
}
],
// ...
"components": {
"securitySchemes": {
"hobaAuth": {
"type": "http",
"scheme": "hoba"
}
}
},
// ...
"security": [
{
"hobaAuth": []
}
]
}