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
- 1Rewrite every candidate URL in srcset, and the poster and data attributes, to https or to a relative path.
- 2Add upgrade-insecure-requests to the CSP so anything missed is upgraded rather than sent in the clear.
- 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
<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
Content-Security-Policy: upgrade-insecure-requestsReferences
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.
More ssl checks
- HighSecure Cookie Set on HTTP Endpoint
- CriticalSite Served Over Unencrypted HTTP
- InfoExpect-CT Header Not Present
- LowHTTPS Served on Non-Standard Port
- InfoX-HTTP-Method-Override / X-Forwarded-Method Header in Response
- InfoHSTS Present on HTTP Response (SSL-Strip Indicator)
- MediumMixed-Protocol Content (HTTPS Page Loading HTTP Resources)
- LowHSTS declared in a meta tag, where browsers ignore it
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.