Skip to main content
HighContentOWASP A08:2021CWE-829

How to fix: Script Loaded From Raw IP Address

A <script> tag loads code from a raw IP address instead of a domain name, which is unusual for legitimate first- or third-party scripts and is a common malvertising/compromise indicator.

Why it matters

Scripts served from bare IPs have no domain reputation, no TLS certificate bound to a hostname in most cases, and are commonly used by injected skimmers (e.g. Magecart-style attacks) to avoid domain-based blocklists.

Legitimate CDNs, analytics vendors, and payment providers serve JavaScript from a named, certificate-bound domain. A script src pointing at a bare IP address is very rarely intentional and is a pattern seen in both malvertising and post-compromise script injection.

How to fix it

  1. 1Identify who added the script and confirm it is expected; if unexplained, treat it as a compromise indicator and investigate immediately.
  2. 2Replace the reference with the vendor's documented domain-based CDN URL.
  3. 3Add Subresource Integrity and a restrictive script-src CSP so an unexpected script host cannot execute even if re-injected.

Code examples

Restrict script sources via CSP

text
Content-Security-Policy: script-src 'self' https://cdn.trusted-vendor.com;

References

Detected automatically by VulnRadar. The check id is script-loaded-from-raw-ip, stable across every scan so you can filter or diff on it.

See every content check

Questions

How severe is Script Loaded From Raw IP Address?
VulnRadar rates this high severity in the content 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 script-loaded-from-raw-ip, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Script Loaded From Raw IP Address map to?
It maps to CWE-829. In the OWASP Top 10 it falls under A08: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 script loaded from raw ip address

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: Script Loaded From Raw IP Address | VulnRadar