A new class of cybersecurity vulnerability has emerged, exploiting a well-known flaw in large language models: hallucination. Researchers have demonstrated that attackers can deliberately trigger AI coding assistants to generate insecure code or insert backdoors, a technique dubbed 'hallucination hijacking'.
The attack works by crafting prompts that cause the AI to stray from safe coding practices, producing plausible-looking but malicious code snippets. This is particularly dangerous as developers increasingly rely on AI suggestions without thorough review.
"We found that by subtly altering prompts, we could get the AI to suggest code with exploitable vulnerabilities," said one researcher.
Experts urge developers to treat AI code suggestions as a starting point, not a final product. Always verify generated code through manual review and testing. As AI becomes more integrated into development workflows, understanding its limitations is critical to maintaining security.