← Back to brief
Policy & SafetyOfficialPreprintarXiv Cryptography and Security

Insecure Coding Preferences in Long-Term Memory Pose Security Risks for LLM-based Code Generation

A new preprint presents the first systematic empirical study of how insecure coding preferences stored in long-term memory can increase the risk of generating vulnerable code in LLM-based code generation systems. The researchers evaluated four major LLMs across five programming languages and found that insecure memories increased the vulnerability rate by 2.7–50.3 percentage points. They also identified a gap between increased vulnerabilities and warning rates, and showed that memory-level safety filtering can detect all risky memory entries and restore safer code generation.

Why it matters: This work reveals a significant and previously underexplored security risk in LLM-based code generation systems that use long-term memory, with practical implications for the safe deployment of such technologies.

Full story at: arXiv Cryptography and Security