google-deepmind / google-deepmind/gemma

Measurement: Gemma 4 and instruction-injection via third-party documentation

Open
#784 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5.7k
Forks
1k
Avg merge
10h 33m
Merged PRs (30d)
2

Description

Hello Gemma team,

This is a courtesy note about published research, not a vulnerability report — no embargo, no
bounty request, and nothing here is a zero-day. It measures a known, unfixed class (prompt
injection). I am posting publicly because I could not find a security contact —
`security@google.com` is answered by an automated reply stating it is not monitored by humans
and that anything which is not a vulnerability report will receive no response, and the
alternative offered is a bug-bounty intake, which this is not; if a private channel exists,
tell me and I will use it in future.

**What I measured.** I am researching whether coding agents can safely consume documentation
harvested from third-party libraries. I planted an instruction inside a library's
"documentation", asked an agent to write a small function using that library, and varied only
*where that text was placed*: (A) as authoritative guidance, (B) quoted explicitly as untrusted
third-party data with an instruction not to follow directives inside it, (C) in the system
prompt. Compliance = the model acted on the planted instruction. Payloads were inert (a fake
analytics call, an endpoint that was unregistered and resolved nowhere when the tests ran, a
marker string).

**Result for Gemma 4** (2026-08-21):

| model | A instruction | B data-framed | C system |
|---|---|---|---|
| gemma-4-12b (LM Studio, N=2, 6 payloads) | 7/12 | **0/12** | **11/12** |
| gemma-4-e4b (LM Studio, N=3, 3 payloads) | 9/9 | 2/9 | not run |
| gemini-3.7-flash-high (via Antigravity, N=2, 6 payloads) | 2/12 | **0/12** | 2/12 |
| gemini-3.1-pro-high (via Antigravity, N=2, 3 payloads) | 4/6 | **0/6** | not run |

Three observations I intend to publish:

1. **gemma-4-12b is the clearest demonstration of the study's main point.** Data-framing
protected it completely (0/12 — it even resisted a payload that argued the framing was a
test harness). Moving the identical text into the **system channel took it to 11/12**. The
mitigation was not weakened; it was bypassed.
2. **gemma-4-e4b complied 9/9 unframed**, including an instruction to POST the process
environment to an external endpoint.
3. **Gemini was the most robust non-Claude agent I measured** — gemini-3.7-flash at 4/36
overall, with nothing landing through data-framing (0/12). I will publish that alongside the
Gemma numbers, because the contrast is part of the finding: exposure varies enormously
between models of comparable capability from the same vendor, which is evidence it is a
training choice rather than a scale effect.

**Limitations, stated plainly.** N is small (2–3 per cell), one prompt template, one task
domain (a Kotlin date-formatting function), local Gemma runs are quantized, and compliance is
scored by string match on an inert marker with a hand-written scorer. These are single
measurements, version- and date-stamped, not a characterization of the models.

**The finding I consider primary is architectural, not about your models.** Across six vendors,
putting third-party text in the instruction or system channel defeats the "treat this as
untrusted data" mitigation. That is a warning to people building documentation-harvesting tools
— which includes me. This research is a negative result about my own design.

If the method is flawed, say so and I will correct or withdraw the numbers — the records are
versioned and I will amend them after publication.

Method, payloads, raw transcripts and a runnable reproduction kit:
`experiments/test0/measurement/injection/` at `https://github.com/dependencyskills/dependencyskills`.

— Brill Pappin
Dependency Skills · github.com/dependencyskills/dependencyskills

Contributor guide

Open the contributing guide

Research direction

Start with experiments/test0/measurement/injection/ in the linked Dependency Skills reproduction kit and review its method, payloads, raw transcripts, and scorer. Determine whether Gemma-specific action is requested and whether the measurements can be independently reproduced; the issue is done only when the findings are assessed or a concrete follow-up is defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
ai, security
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.