Execution Flow
User visits a benign-looking URL.
Browser executes a script to fetch data from an AI API.
The API receives a "
jailbreak" prompt requesting phishing code.
The API returns functional malicious JavaScript.
The browser executes the returned string (likely via eval() or Function() constructors).
Mitigation & Defense Strategy
Traditional antivirus (AV) and static analysis are ineffective against this threat. Defense must focus on Runtime Enforcement and Policy Restrictions, aligning with NIST SP 800-53 (System and Communications Protection).
Strict Content Security Policy (CSP) (Critical) The most effective defense is to prevent the browser from talking to unauthorized third-party APIs. Implement a strict CSP header on your web properties.
HTTP:
Content-Security-Policy: default-src 'self'; script-src 'self'; connect-src 'self';
If connect-src does not whitelist the AI provider (e.g., *.googleapis.com), the malicious prompt cannot be sent, and the payload cannot be retrieved.
Network Filtering (
Egress Control) For enterprise environments, restrict access to GenAI APIs on endpoints that have no business need for them.
Action
Block specific API endpoints (e.g., api.openai.com/v1/completions) at the Secure Web Gateway (SWG) level for general user subnets.
Behavioral Analysis (Endpoint) Since the code changes, detection must be behavioral.
Indicator
Look for processes or browser tabs initiating high-frequency API calls to LLM services followed immediately by the execution of unverified scripts or DOM manipulation (e.g., sudden creation of login forms).
NIST/MITRE Context
MITRE ATT&CK T1059.007 (JavaScript) Adversaries executing code via the browser.
MITRE ATT&CK T1583 (Acquire Infrastructure) Leveraging web services.
NIST CSF (Protect)
Implement Data Security and Information Protection Processes and Procedures (PR.IP).
Conclusion
This threat represents a shift from "
static evasion" (obfuscation) to "
dynamic generation." Security teams cannot rely on threat feeds for hash blocking in this context. The defense
must pivot to Zero Trust principles regarding web content. Do not allow your internal browsers to communicate with external AI APIs unless explicitly authorized and scoped.