Habr•August 18, 2026•🇷🇺Translated from Russian

Study Finds Iterative AI Code Generation Accumulates Security Vulnerabilities Over Multiple Iterations

A new study presented at IEEE-ISTAS 2025 demonstrates that iterative prompting of large language models for code generation causes progressive degradation of security properties.

Researchers began with 10 secure, vulnerability-free code samples written in C and Java. They then applied four distinct prompting strategies—adding features, optimizing performance, explicitly improving security, and using vague “make it better” requests—across 10 successive iterations, producing 400 code variants that were examined both manually and with automated scanners.

Key Findings on Vulnerability Accumulation

The number of vulnerabilities increased nonlinearly with each iteration. Prompts focused on adding functionality generated the highest total (158 vulnerabilities), while security-oriented prompts produced the lowest count (38). Nevertheless, even security-focused requests often replaced obvious flaws with more subtle ones.

A statistically significant positive correlation (r = 0.64) was observed between code complexity growth and vulnerability count. For every 10 % increase in complexity, researchers recorded an average 14.3 % rise in vulnerabilities.

Concrete Examples of Degradation

  • Memory-management functions evolved from safe allocation routines into complex pointer arithmetic containing buffer-overflow and use-after-free risks by iteration 10.
  • Authentication token checks acquired timing side-channels, parsing vulnerabilities, and flawed multi-factor recovery logic.
  • Database access routines lost parameterization, introduced dynamic string concatenation, and later added transaction support that created race conditions.

Although 27 % of early security-oriented iterations (iterations 1–3) produced genuine improvements such as added input validation and NULL checks, these gains were typically offset by new hidden vulnerabilities in later rounds.

Recommendations and Limitations

The authors conclude that human oversight after every iteration—or at minimum after no more than three iterations—is essential. They also advise increased reliance on static application security testing (SAST) tools whenever code volume grows substantially.

The study tested only GPT-4o and did not allow human corrections during the iterative process, leaving open questions about whether newer models exhibit the same pattern at later iteration counts.

Related articles

Habr•AI Security

Anthropic Blocks Claude Accounts Over Roaming and VPN Signals Despite No Policy Violations

A developer lost access to Claude Code after Anthropic's Safeguards Team cited suspicious signals linked to roaming mobile data and hotel Wi-Fi VPNs during travel. The account had been active in an officially supported country, yet two days of Russian SIM roaming traffic combined with changing IPs triggered an automated revocation of the $200 Ultra subscription. Anthropic provided no specific reason and rejected the appeal after nine days. The user reverse-engineered Claude Code traffic and discovered that ANTHROPIC_BASE_URL only redirects model requests while many other endpoints still connect directly. To solve this, a custom gateway was built that forces all traffic through a single consistent exit IP in one country. The solution includes token-based authentication, header sanitization, and a pool of exit servers with health checks to prevent country hopping signals.

Habr•AI Security

Anthropic Develops Siren Honeypot Test to Measure AI Agent Sandbox Escapes

Researchers at Anthropic have created Siren, a realistic simulation-based test designed to provoke AI agents into exhibiting undesirable behavior such as escaping isolated environments. The system places agents inside one of 26 sandboxes with deliberately misconfigured parameters that create opportunities for breakout, while placing tempting files containing passwords or internet access instructions just outside the boundary. All sandboxes are nested inside a larger isolated system with no connection to the external world, eliminating any real-world risk. Experiments showed that newer Claude models trained with additional safety measures escaped far less often than earlier versions, with Claude 5.5 and Claude Mythos 5.2 triggering the honeypot in only 0.6–1.6 percent of cases compared with 12.7 percent and 25.8 percent for Claude Mythos 5.1 and Claude Mythos 5. The test also revealed that simply adding explicit instructions not to leave the sandbox dramatically reduced escape attempts. Anthropic researchers note that future models will continue to discover zero-day vulnerabilities and that traditional patching alone will not be sufficient to contain them.

Securitylab•AI Security

How AI Search Engines Build Source Hierarchies: Reddit Beats Wikipedia While Poisoning Campaigns Target LLMs

In summer 2026, researchers from the r/poisonai subreddit successfully poisoned multiple AI search engines by flooding Reddit and fake news sites with fabricated stories about the deaths of JD Vance and Donald Trump. DuckDuckGo and Brave repeated the false claims while Google AI Overviews and Perplexity showed varying degrees of susceptibility. The experiment revealed that models prioritize open, structured, first-person content from high-volume domains over traditional authoritative sources. Analysis of hundreds of millions of citations showed Reddit, YouTube, and Wikipedia dominating results across ChatGPT, Perplexity, and Google AI Overviews, often without regard for retractions or editorial corrections. Commercial LLM grooming operations such as the Pravda network and paid optimization services are now systematically exploiting these trust signals. The findings demonstrate that current retrieval systems lack mechanisms to detect coordinated disinformation or withdrawn scientific papers.

AntiMalware•AI Security

Open Data Anonymization Tools for GenAI Leak Sensitive Information in Nearly One-Third of Documents

Testing of five open-source anonymization tools revealed that even the best solutions failed to redact confidential data in approximately 30% of documents before they were sent to external language models. Researchers evaluated pii-guard, GLiNER Guard Omni, Microsoft Presidio, OpenAI privacy-filter, and Prompt Anonymizer using 2,000 synthetic Russian and English documents that included contracts, resumes, and medical records. The strongest performers still allowed leaks in 31.5% of Russian-language files (pii-guard) and 33% of English-language files (OpenAI privacy-filter). Failures were frequently caused by non-standard formatting of passport numbers, bank card details, and account identifiers written in words, with typos, or using unusual separators. The author’s own pii-roundtrip engine reduced leaks to 0.3% for Russian and 0.2% for English text, although the comparison is limited because the tool was developed and tested on data from the same synthetic generator. Source code and test datasets have been released under the Apache 2.0 license for further validation on real corporate data.