Skip to main content
HighSupply chainOWASP A02:2021CWE-319

How to fix: HTTP Script Loaded on HTTPS Page

An HTTPS page loads a JavaScript file over HTTP. This is a mixed-content violation that allows network attackers to replace the HTTP script with malicious code, compromising the entire HTTPS page.

Why it matters

An attacker on the same network (Wi-Fi, ISP-level) can intercept the HTTP script request and replace it with arbitrary JavaScript. This completely compromises the HTTPS page's security guarantees despite TLS protecting the main page.

HTTPS protects the main page load. But if the page loads any resource over HTTP, that resource can be intercepted and modified by a network attacker. A compromised HTTP script can exfiltrate all cookies, form data, and user interactions.

How to fix it

  1. 1Change all http:// script URLs to https://.
  2. 2Add Content-Security-Policy: upgrade-insecure-requests to automatically upgrade HTTP to HTTPS.
  3. 3Add a CSP that blocks all HTTP sources: default-src https:.
  4. 4Serve all scripts from your own domain over HTTPS.

Code examples

CSP upgrade-insecure-requests

TypeScript
// Next.js middleware
response.headers.set(
  'Content-Security-Policy',
  'upgrade-insecure-requests; default-src https: \'self\';'
);

References

Detected automatically by VulnRadar. The check id is supply-chain-http-script-on-https, stable across every scan so you can filter or diff on it.

See every supply chain check

Questions

How severe is HTTP Script Loaded on HTTPS Page?
VulnRadar rates this high severity in the supply chain 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 supply-chain-http-script-on-https, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does HTTP Script Loaded on HTTPS Page 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 script loaded on https page

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

How to fix: HTTP Script Loaded on HTTPS Page | VulnRadar