Friday, November 6, 2026

Hackers Use GenAI to Turn Legitimate Web Pages Malicious in Seconds

A Novel Attack Technique Leverages LLMs to Generate Polymorphic Malicious Code at Runtime Dynamically.

Imagine visiting a webpage that appears completely legitimate. No suspicious links, no detectable malicious code, no warning signs. Yet within seconds, it transforms into a sophisticated phishing page tailored specifically to you.

This isn’t a hypothetical threat it’s an emerging attack vector where adversaries weaponize generative AI to evade traditional security defenses.

Security researchers have identified a novel attack technique where threat actors exploit client-side API calls to large language model (LLM) services, generating malicious JavaScript dynamically in real time. The attack begins with a seemingly benign webpage.

Attackers use carefully engineered prompts to bypass AI safety guardrails, tricking the LLM into returning malicious code snippets that are then assembled and executed in the victim’s browser, resulting in a fully functional phishing page.

The sophistication of this approach lies in its evasive design. Each malicious payload is polymorphic syntactically unique yet functionally identical across visits.

Because the malicious code is generated dynamically at runtime rather than delivered as a static payload, it bypasses network-based security analysis. Additionally, since the code originates from trusted LLM domains, it evades traditional threat detection mechanisms.

How the Attack Works

The attack follows three distinct steps. First, threat actors select a malicious webpage from active phishing or malware campaigns to serve as a template.

Second, they translate the malicious JavaScript functionality into plain-text prompts, iteratively refining them to bypass LLM safety mechanisms.

Third, these engineered prompts are embedded within a webpage. When a victim loads the page, it requests the LLM API to generate malicious code snippets, which are then assembled and executed within the browser.


Workflow of the PoC. The first two steps are initial preparation, and the third is an example of generating malicious content to be rendered in the browser ( Source : Unit42 palo alto).
Workflow of the PoC. The first two steps are initial preparation, and the third is an example of generating malicious content to be rendered in the browser ( Source : Unit42 palo alto).

Researchers demonstrated this technique using the LogoKit phishing campaign as a proof of concept. The original attack uses a static JavaScript payload to transform a benign web form into a convincing phishing lure.

By converting this payload into LLM prompts, they successfully generated dynamic variants capable of stealing credentials and impersonating legitimate webpages.

Simple prompt rephrasing proved remarkably effective a generic request for an AJAX POST function was permitted where a direct request for “credential exfiltration code” was blocked.

Why This Matters

This attack model represents a significant escalation in web-based threats. Current research indicates that 36% of detected malicious webpages exhibit runtime assembly behavior, executing constructed child scripts with functions like eval().

The non-deterministic output of the model provided a high degree of polymorphism, with each query returning a syntactically unique yet functionally identical variant of the malicious code.

Polymorphism creating multiple variants of dynamically generated JavaScript code (source : Unit42 palo alto).
Polymorphism creating multiple variants of dynamically generated JavaScript code (source : Unit42 palo alto).

Once loaded in a victim’s browser, the page makes requests to trusted LLM services like DeepSeek or Google Gemini.

Adding LLM-generated polymorphic code dramatically increases the difficulty of detection.

The non-deterministic nature of LLM outputs creates constant code mutation, making signature-based detection ineffective.

Each victim receives a syntactically unique variant, preventing pattern-matching security tools from identifying the threat.

Moreover, the malicious code is transmitted through trusted domains, effectively bypassing network-based filtering.

Traditional network analysis and static payload detection are insufficient against this threat. Organizations should implement runtime behavioral analysis within browsers to detect and block malicious activity at the point of execution.

Additionally, restricting access to unsanctioned LLM services at workplaces can serve as a preventative measure.

The most effective defense combines in-browser protection with offline analysis using browser-based sandboxes that render webpages in isolated environments. This approach can identify behavioral anomalies during runtime execution.

As threat actors continue innovating, the security landscape faces a critical inflection point. This AI-augmented attack technique exemplifies how emerging technologies can be weaponized to circumvent established defenses.

Organizations must shift from static detection toward dynamic, runtime-focused security strategies to effectively counter this evolving threat.

Follow us on Google News, LinkedIn, and X to Get Instant Updates and Set GBH as a Preferred Source in Google.

Mayura Kathir
Mayura Kathirhttps://gbhackers.com/
Mayura Kathir is a cybersecurity reporter at GBHackers News, covering daily incidents including data breaches, malware attacks, cybercrime, vulnerabilities, zero-day exploits, and more.

Hot this week

How To Access Dark Web Anonymously and know its Secretive and Mysterious Activities

What is Deep Web The deep web, invisible web, or...

How to Build and Run a Security Operations Center (SOC Guide) – 2023

Today’s Cyber security operations center (CSOC) should have everything...

Russian Hackers Bypass EDR to Deliver a Weaponized TeamViewer Component

TeamViewer's popularity and remote access capabilities make it an...

Web Server Penetration Testing Checklist – 2026

Web server pentesting is performed under three significant categories: identity,...

ATM Penetration Testing – Advanced Testing Methods to Find The Vulnerabilities

ATM Penetration testing, Hackers have found different approaches to...

ARTEX AI Framework Linked to Bank Breaches and Cloud Attacks Found Exposed Across Hundreds of Servers

An autonomous penetration-testing framework linked to South Korean banking...

OpenMatter Network Positions Decentralized Computing as an Alternative to Data Centers for AI

Melbourne, Florida, November 5th, 2026, CyberNewswire OpenMatter Network, a pioneer...

Hackers Develop New HYFLOCK Ransomware That Encrypts Files and Attempts to Block Recovery

HYFLOCK ransomware operators have developed successive Windows encryptors that...

Related Articles

Recent News