Skip to main content
HighHost validationOWASP A02:2021CWE-319

How to fix: HTTP Basic Authentication Over Non-HTTPS

The WWW-Authenticate: Basic header was found on a response served without HTTPS, or the URL is HTTP. Basic authentication transmits credentials as Base64-encoded plaintext, which is trivially decoded by any network observer.

Why it matters

HTTP Basic Auth credentials are transmitted in every request as 'Authorization: Basic base64(user:password)'. On HTTP, any network observer (ISP, shared Wi-Fi, VPN provider) can capture and decode these credentials in plaintext.

Base64 encoding is not encryption. HTTP Basic Auth over HTTP is effectively cleartext credential transmission. The credentials are sent with every request, not just the initial authentication, amplifying exposure.

How to fix it

  1. 1Enforce HTTPS for any endpoint protected by HTTP Basic Auth.
  2. 2Redirect all HTTP traffic to HTTPS before authentication can occur.
  3. 3Consider replacing Basic Auth with a proper session-based or token-based authentication system.
  4. 4If Basic Auth is required: ensure HSTS is configured so browsers will always use HTTPS.

Code examples

Force HTTPS before auth (Nginx)

nginx
server {
  listen 80;
  return 301 https://$host$request_uri; # Redirect HTTP to HTTPS
}

server {
  listen 443 ssl;
  auth_basic "Protected Area";
  auth_basic_user_file /etc/nginx/.htpasswd;
}

References

Detected automatically by VulnRadar. The check id is basic-auth-over-http, stable across every scan so you can filter or diff on it.

See every host validation check

Questions

How severe is HTTP Basic Authentication Over Non-HTTPS?
VulnRadar rates this high severity in the host validation category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id basic-auth-over-http, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does HTTP Basic Authentication Over Non-HTTPS map to?
It maps to CWE-319. In the OWASP Top 10 it falls under A02:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for http basic authentication over non-https

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

HTTP Basic Authentication Over Non-HTTPS fix | VulnRadar