Armitage Archive

The Security Paradox of Local LLMs

by Jacek Migdal

Original article

This page contains highlights I saved while reading The Security Paradox of Local LLMs by Jacek Migdal. These quotes were collected using Readwise.

Highlights

Researchers can’t test frontier models, while local models remain open to red-team testing. This makes the supposedly “safer” option more vulnerable due to:

Weaker reasoning: Less capable of identifying malicious intent in complex prompts • Poorer alignment: More susceptible to cognitive overload and obfuscation techniques • Limited safety training: Fewer resources dedicated to adversarial prompt detection

Permalink to this highlight


While the first attack plants a backdoor for later use, this one doesn’t wait for code to be deployed. It achieves immediate RCE on the developer’s machine during the code generation process.

The technique works by first distracting the model with a cognitive overload to bypass its safety filters. Once the model’s defenses are down, a second part of the prompt asks it to write a Python script containing an obfuscated payload.

Permalink to this highlight


the software community lacks a safe, standard way to test AI assistant security. Unlike traditional software where penetration testing is routine, our only “safe” labs are the most vulnerable local models.

This new threat requires a new mindset. We must treat all AI-generated code with the same skepticism as any untrusted dependency and implement proper strategies in this new wave of LLM-assisted software development. Here are four critical defenses to start with:

  1. All generated code must be statically analysed for dangerous patterns (e.g., eval(), exec()) before execution, with certain language features potentially disabled by default.
  2. Initial execution of code should be in a sandbox (e.g., a container or WebAssembly runtime).
  3. The assistant’s inputs, outputs, and any resulting network traffic must be monitored for anomalous or malicious activity.
  4. A simple, stateless “second look” could prevent many failures. A secondary review by a much smaller, simpler model, tasked only with checking the final output for policy violations, could be a highly effective safety layer. For example, a small model could easily flag the presence of eval() in the generated code, even if the primary model was tricked into generating it.

Permalink to this highlight


These attacks don’t require sophisticated exploits; they succeed by turning a developer’s normal workflow into an attack chain. It starts when a developer injects seemingly harmless content into their AI assistant’s context window.

The attack chain:

  1. Attacker plants malicious prompt in likely-to-be-consumed content.
  2. Developer feeds this content to their AI assistant – directly or via MCP (Model Context Protocol).
  3. AI generates compromised code during normal workflow.
  4. Developer deploys code or runs it locally.
  5. Attacker gains persistent access or immediate control.

Permalink to this highlight


LLMs are facing a lethal trifecta: access to your private data, exposure to untrusted content and ability to externally communicate. They’re facing new threats such as code injection, when an attacker as part of a prompt can introduce vulnerabilities in your application.

Permalink to this highlight


Want more like this? See all articles or get a random quote.