polyfill.io CDN — 1 vulnerability check
noctis ships 1 vulnerability check for polyfill.io CDN, covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.
← All products · Feeds on GitHub
Web Application Embedding JavaScript from the Malicious polyfill.io CDN
| CVE | CVE-2024-38526, CVE-2024-38537 |
|---|---|
| Severity | high · CVSS 7.2 |
| Category | exposure — Exposure |
| Services | http, https |
| Detection | set_var, http_request, match, script · highest QoD 75 |
| Feed | tests/vulnerabilities/polyfill/malicious-polyfill-cdn.yaml |
The web application includes a <script> loaded from polyfill.io or another domain operated by the same owner (bootcdn.net, bootcss.com, staticfile.net, staticfile.org, unionadjs.com, xhsbpza.com, union.macoms.la, newcrbpc.com). Since June 2024 this CDN injects malicious code into the served JavaScript, so every visitor's browser executes attacker-controlled code in the site's origin (supply-chain attack). Known affected products include pdoc < 14.5.1 (`pdoc --math`, CVE-2024-38526) and Fides < 2.39.1 (CVE-2024-38537). The check fetches the main entry pages and reports the offending script element.
How noctis detects it
- HTTP(S) request
GET {{page_path}} - Checks
page.bodyfor^(?s:<!--.*?-->|[^<]|<[^!]|<![^-]|<!-[^-])*?<script\b[^>]*?[\s"']src\… - Parses / computes the next value with a Rhai script
- Checks
pf_srcfor^(?:https?:)?//→ finding QoD 75: Malicious polyfill.io CDN script embedded in …
References:
- https://nvd.nist.gov/vuln/detail/CVE-2024-38526
- https://nvd.nist.gov/vuln/detail/CVE-2024-38537
- https://sansec.io/research/polyfill-supply-chain-attack
- https://censys.com/?p=1456
- https://github.com/mitmproxy/pdoc/security/advisories/GHSA-5vgj-ggm4-fg62
- https://github.com/projectdiscovery/nuclei-templates/blob/main/headless/cves/2024/CVE-2024-38526.yaml
Feed source — tests/vulnerabilities/polyfill/malicious-polyfill-cdn.yaml
# Web page embedding JavaScript from the malicious polyfill.io CDN (or a
# domain run by the same owner) — CVE-2024-38526 (pdoc --math), CVE-2024-38537
# (Fides). Ported from OpenVAS/Greenbone NASL
# 2024/polyfill/gb_malicious_polyfill_cdn_http_detect.nasl (GPL-2.0-only),
# with the Nuclei template headless/cves/2024/CVE-2024-38526.yaml as reference.
#
# In June 2024 the new owner of the polyfill.io domain started serving
# malicious JavaScript (mobile redirects to scam / betting sites) to the
# 100k+ sites embedding https://polyfill.io/v3/polyfill.min.js. The same
# operator also runs bootcdn.net, bootcss.com, staticfile.net, staticfile.org
# and the payload domains unionadjs.com, xhsbpza.com, union.macoms.la and
# newcrbpc.com (Sansec, Cloudflare, Censys research). Every visitor's browser
# runs whatever that CDN chooses to serve, in the site's origin.
#
# What "exploitation" means here: the vulnerable condition IS the page making
# visitors' browsers execute a script fetched from the attacker's domain. The
# proof is therefore the exact <script src=…> element served by the target,
# read-only. The feed never fetches anything from the malicious CDN itself.
#
# Differences with the NASL (improvements, stated in the PR):
# - The NASL only reports pages that the webmirror crawler stored in the
# KB (`content/webapp_using_polyfill`); with no crawl data it exits(99).
# noctis has no crawler, so the feed fetches the usual entry pages itself:
# `/`, `/index.html`, `/index.php`, `/docs/` (pdoc output) and `/doc/`,
# following redirects, and stops at the first page with a hit.
# - Only a <script> element whose src HOST is one of the malicious domains
# (or a subdomain, e.g. cdn.polyfill.io) counts. A plain link/text mention
# of "polyfill.io", the safe mirrors (cdnjs.cloudflare.com/polyfill,
# polyfill-fastly.io, fastly-polyfill.io), look-alike hosts
# (notpolyfill.io, polyfill.io.example.org), a path containing the
# string, a `data-src` lazy-load placeholder and a commented-out <script>
# are all rejected: no script is loaded from the attacker there.
# - The evidence is the offending script URL only, not the whole page.
uid: c42c19b4-0817-4055-a722-d9bd14515aa7
name: "Web Application Embedding JavaScript from the Malicious polyfill.io CDN (CVE-2024-38526, CVE-2024-38537)"
description: |
The web application includes a <script> loaded from polyfill.io or another
domain operated by the same owner (bootcdn.net, bootcss.com, staticfile.net,
staticfile.org, unionadjs.com, xhsbpza.com, union.macoms.la, newcrbpc.com).
Since June 2024 this CDN injects malicious code into the served JavaScript,
so every visitor's browser executes attacker-controlled code in the site's
origin (supply-chain attack). Known affected products include pdoc < 14.5.1
(`pdoc --math`, CVE-2024-38526) and Fides < 2.39.1 (CVE-2024-38537). The check
fetches the main entry pages and reports the offending script element.
cves: [CVE-2024-38526, CVE-2024-38537]
cvss: 7.2
severity: high
confidence_base: 0.25
category: exposure
tags:
- polyfill
- supply-chain
- javascript
- malware
- pdoc
- fides
services:
- http
- https
author: noctis
version: "1.0.0"
references:
- "https://nvd.nist.gov/vuln/detail/CVE-2024-38526"
- "https://nvd.nist.gov/vuln/detail/CVE-2024-38537"
- "https://sansec.io/research/polyfill-supply-chain-attack"
- "https://censys.com/?p=1456"
- "https://github.com/mitmproxy/pdoc/security/advisories/GHSA-5vgj-ggm4-fg62"
- "OpenVAS/Greenbone NASL 2024/polyfill/gb_malicious_polyfill_cdn_http_detect.nasl (GPL-2.0-only)"
- "https://github.com/projectdiscovery/nuclei-templates/blob/main/headless/cves/2024/CVE-2024-38526.yaml"
steps:
# ── Per page: pre-init, fetch, extract, report (the loop group) ──────────
# The loop runs this step and every following non-loop step once per page.
# Pre-initialise the stored result so a failed request leaves a defined,
# empty page instead of an undefined variable.
- id: init-page
action: set_var
var_name: page
var_value:
status: 0
url: ""
body: ""
loop:
over:
- /
- /index.html
- /index.php
- /docs/
- /doc/
var: page_path
- id: fetch-page
action: http_request
method: GET
path: "{{page_path}}"
port: "{{port}}"
tls_insecure: true
follow_redirects: true
timeout_secs: 10
store_as: page
# Find a <script … src=…> whose host is (a subdomain of) a malicious domain.
# No on_match: the result is only stored, so the (possibly large) body is
# neither copied into a finding nor transformed in Rhai. Capture group 1 is
# the script URL.
# - The anchored prefix walks the page from the start, consuming whole
# HTML comments (`<!-- … -->`) as one unit and never entering them, so a
# commented-out <script> (or an IE conditional comment) is not reported.
# An unclosed comment hides the rest of the page, as in a browser.
# - `src` must follow whitespace or a quote, so `data-src` / `data-lazy-src`
# placeholders (consent managers, lazy loaders) do not count.
# - The host must directly follow `//` or a label dot (notpolyfill.io does
# not match) and be followed by a port, path, query, fragment, quote,
# whitespace or `>` (polyfill.io.example.org does not match).
- id: find-script
action: match
source: page.body
case_insensitive: true
pattern: |-
^(?s:<!--.*?-->|[^<]|<[^!]|<![^-]|<!-[^-])*?<script\b[^>]*?[\s"']src\s*=\s*["']?((?:https?:)?//(?:[a-z0-9-]+\.)*(?:polyfill\.io|bootcdn\.net|bootcss\.com|staticfile\.net|staticfile\.org|unionadjs\.com|xhsbpza\.com|union\.macoms\.la|newcrbpc\.com)(?::[0-9]+)?(?:[/?#][^"'\s>]*)?)(?:["'\s>]|$)
store_as: pf
- id: script-url
action: script
code: |
if pf.matched && pf.captures.len() > 0 { pf.captures[0] } else { "" }
store_as: pf_src
- id: report
action: match
source: pf_src
pattern: "^(?:https?:)?//"
case_insensitive: true
on_match:
stop: true
finding:
title: "Malicious polyfill.io CDN script embedded in {{page_path}}"
confidence_delta: 0.60
qod: 75
evidence: "{{page.url}} (requested {{page_path}}, HTTP {{page.status}}) embeds <script src=\"{{pf_src}}\"> served from a domain run by the malicious polyfill.io owner"
remediation: "Remove the script or load it from a trusted mirror (e.g. https://cdnjs.cloudflare.com/polyfill/ or https://polyfill-fastly.io/); upgrade pdoc to 14.5.1+ / Fides to 2.39.1+."