No unauthorized external script injection occurs
Why it matters
An extension that injects external scripts into web pages becomes a forced intermediary between the user and every site they visit. The injected script runs with the page's origin permissions and can read DOM content, capture form data, and exfiltrate it to any server the injected script chooses — entirely outside the extension's declared permissions. CWE-94 (Code Injection) and OWASP 2021 A03 describe this attack class. Chrome Web Store policy prohibits executing remote code, and Manifest V3 enforces this mechanically — but content scripts that dynamically create <script> tags pointing to external domains achieve the same effect and are a common policy violation. Any injected external script is a persistent supply chain risk: if that third party is compromised, every user of your extension is compromised.
Severity rationale
High because injecting external scripts into web pages grants an uncontrolled third party the ability to read and exfiltrate any data visible to that page — the extension becomes an involuntary attack vector for every site the user visits.
Remediation
Remove all dynamic external script injection from content scripts. Bundle dependencies locally and use fetch-based API calls for external data:
// BAD — injects external script into every page
const s = document.createElement('script');
s.src = 'https://cdn.example.com/tracker.js';
document.head.appendChild(s);
// GOOD — bundle locally or use fetch
import { feature } from './local-bundle.js';
// For external data, use the extension's background service worker
chrome.runtime.sendMessage({ type: 'FETCH_DATA' }, (response) => {
// Use response.data in content script
});
For Manifest V3, the content_security_policy in manifest.json can enforce this at the browser level — set "script-src 'self'" to block injection from external origins entirely.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Extension Data Privacy Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-94 — Improper Control of Generation of Code (Code Injection)
- cwe · CWE-200 — Exposure of Sensitive Information to an Unauthorized Actor
- owasp:2021 · A03 — Injection
- external · chrome-web-store-user-data-policy — Chrome Web Store User Data Privacy Policy — Remote code execution prohibited
Taxons
History
- 2026-04-18·v1.0.0·Initial import from extension-data-privacy·automated