Skip to main content
MediumSSLOWASP A02:2021CWE-319

How to fix: Cleartext subresource loaded through srcset, poster or data

An HTTPS page loads a cleartext subresource through an attribute other than src or a stylesheet href. The carrier is an img or source srcset candidate, a video poster, or an object data URL.

Why it matters

srcset and poster are passive mixed content: the request still goes out in cleartext on browsers that allow it, revealing what the visitor is viewing and letting an on-path attacker swap the image. object data is active mixed content, because the embedded resource can execute in the page's context, so a substituted response is script execution on your origin.

These attributes are consistently missed by mixed-content reviews and by tooling that only looks for src= and href=. srcset in particular holds several URLs in one attribute, so a single cleartext candidate hides among correct ones. Modern browsers auto-upgrade passive mixed content and block the active kind, but neither behaviour is guaranteed on older or embedded clients, and the request that gets upgraded still discloses nothing only because the upgrade succeeded.

How to fix it

  1. 1Rewrite every candidate URL in srcset, and the poster and data attributes, to https or to a relative path.
  2. 2Add upgrade-insecure-requests to the CSP so anything missed is upgraded rather than sent in the clear.
  3. 3Use block-all-mixed-content or a CSP report-only policy to find the remaining cases in real traffic.

Code examples

Every srcset candidate over HTTPS

HTML
<img
  src="https://cdn.example.com/hero-800.jpg"
  srcset="https://cdn.example.com/hero-400.jpg 400w,
          https://cdn.example.com/hero-800.jpg 800w,
          https://cdn.example.com/hero-1600.jpg 1600w"
  sizes="(max-width: 600px) 400px, 800px"
  alt="">

<video poster="https://cdn.example.com/poster.jpg" controls></video>

CSP: upgrade anything left behind

text
Content-Security-Policy: upgrade-insecure-requests

References

Detected automatically by VulnRadar. The check id is ssl-mixed-content-non-src-attribute, stable across every scan so you can filter or diff on it.

See every ssl check

Questions

How severe is Cleartext subresource loaded through srcset, poster or data?
VulnRadar rates this medium severity in the ssl 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 ssl-mixed-content-non-src-attribute, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Cleartext subresource loaded through srcset, poster or data 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 cleartext subresource loaded through srcset, poster or data

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

Cleartext subresource loaded through srcset, poster or data | VulnRadar