Sending credentials for alternative HTTP authentication method as cleartext allowed

Issue ID: v3-global-securityscheme-http-known-good-clear

Average severity: Minimal

Description

One or more global security schemes in the API allows to set security requirements that accept 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 credentials. They can then use the credentials to make other API calls.

This is a potential risk, because the definition is in security schemes. However, it easily turns into an actual risk when the unsafe method is used in a security requirement.

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"
            }
        }
    }
}

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": []
        }
    ]
}