LlamaSmuggle: Prefix-Based Authorization Bypass in Ollama Agent Mode (CVE-2026-102697)
Ollama's Agent Mode stored session permissions as command prefixes that ignored shell separators, so chained commands could run without a second approval.
TL;DR
In Ollama’s experimental Agent Mode, a Bash permission granted with “Allow for this session” was stored as a prefix such as cat:x/agent/ instead of the complete command string. The code deriving that prefix ignored shell separators such as ; and &&. A command like cat x/agent/approval.go; echo ... could therefore match the earlier permission and execute without a second approval.
CVE-2026-102697, CWE-863 (Incorrect Authorization), CVSS v4.0 8.5 High. Affected versions >= 0.14.0, < 0.31.2.
AI agents are no longer limited to generating responses through large language models. They can execute terminal commands, read and modify files, and invoke different tools on behalf of users. As these capabilities expand, an incorrect decision made by a model can directly affect the system on which it operates.
For this reason, user approval has become an important security control for actions performed by AI agents. Even when a model generates a command, the command is generally expected to be presented to the user for approval before execution.
Ollama’s experimental Agent Mode included a similar mechanism for Bash commands. The important question was how Ollama determined which future Bash commands should be covered by an existing approval.
While examining the approval mechanism, I discovered that certain commands were not authorized based on their complete command strings. Instead, Ollama derived a broader authorization prefix containing the executable name and directory information.
This scope was not hidden from the user. Therefore, granting directory-level permission was not inherently a vulnerability.
The actual problem was that the code determining whether a command fell within this permission scope did not interpret Bash commands in the same way as Bash itself.
I named this vulnerability LlamaSmuggle (it was first published as BlindLlama). The name describes the attack: a second command is smuggled past the approval gate inside an already-approved command. The authorization parser and Bash read the same command line differently, and that gap is what makes the smuggling possible.
Ollama Agent Mode
Ollama introduced an experimental CLI with agent loop and Bash tool support in version 0.14.0. The feature could be enabled using ollama run --experimental.
Unlike a traditional chat interaction, Agent Mode allowed the model to execute commands on the operating system when necessary. These calls were subject to a user approval mechanism with three options: Execute once, Allow for this session and Deny.

Figure 1: Session approval. The scope of “Allow for this session” is shown as cat in repro/ directory (includes subdirs).
Execute once authorized only the current call, while Deny rejected it. Allow for this session, however, created a reusable permission based on the current command.
This was the part of the implementation that caught my attention during the investigation. The system had to decide not only whether to execute the current command, but also which future commands could execute without requesting approval again.
How Session Approval Worked
In the vulnerable implementation, session authorization decisions were managed by ApprovalManager. For certain Bash commands, Ollama used the extractBashPrefix() function instead of storing the complete command string.
The function first split the command string using the pipe character:
parts := strings.Split(command, "|")
It then tokenized the first command segment using whitespace:
fields := strings.Fields(firstCmd)
Prefix extraction applied to a specific set of commands defined in the source code as safeCommands:
safeCommands := map[string]bool{
"cat": true, "ls": true,
"head": true, "tail": true,
"less": true, "more": true,
"file": true, "wc": true,
"grep": true, "find": true,
"tree": true, "stat": true,
"sed": true,
}
The name safeCommands did not mean that these commands could execute without user approval. The list determined which commands could receive path-based prefixes when session-wide approval was granted.
For example, cat tools/tools_test.go | head -200 could be reduced to the authorization scope cat:tools/.
When the user selected Allow for this session, AddToAllowlist() stored the derived prefix:
if toolName == "bash" {
if cmd, ok := args["command"].(string); ok {
prefix := extractBashPrefix(cmd)
if prefix != "" {
a.prefixes[prefix] = true
return
}
}
}
Subsequent Bash commands were evaluated by IsAllowed(). In addition to exact permission matches, this check supported prefix matching and hierarchical directory matching. For example, if cat:tools/ had been approved, operations within cat:tools/subdir/ could also inherit that permission.
The root cause of LlamaSmuggle was not the existence of this permission, but the authorization parser’s failure to correctly determine which Bash operations belonged to its scope.
The Semantic Difference Between the Prefix Parser and Bash
Suppose the user had previously approved cat x/agent/approval.go for the session, and the stored authorization scope was cat:x/agent/.
Now consider a subsequent Bash call generated by the model:
cat x/agent/approval.go; echo OLLAMA_APPROVAL_BYPASS
From Bash’s perspective, this string contains two separate commands: first cat x/agent/approval.go, then echo OLLAMA_APPROVAL_BYPASS.
However, extractBashPrefix() was not a Bash parser. It only split the command string on the pipe character and then tokenized the result using strings.Fields(). Consequently, the command could still be reduced to cat:x/agent/.
There is a small but important detail here. Even if strings.Fields() treated the second token as x/agent/approval.go;, the subsequent path.Dir() operation could still resolve its directory to x/agent. Therefore, attaching the semicolon directly to the filename token did not prevent the authorization collision.

Figure 2: In the v0.31.1 source, extractBashPrefix() returns the same cat:repro/ prefix for both cat repro/approved.txt and cat repro/approved.txt; echo SECOND_COMMAND_EXECUTED.
The prefix collision was verified with a test file added to Ollama’s original x/agent package without modifying any source files. The test file is not part of the Ollama repository; I added it for verification. The test code and run scripts are in the llamasmuggle-cve-2026-102697 repository.
Crucially, Ollama did not execute the derived authorization prefix. The actual Bash tool received the original command string generated by the model:
exec.CommandContext(ctx, "bash", "-c", command)
As a result, the approval mechanism and the execution environment evaluated different representations of the operation:
Permission granted: cat in x/agent/ directory
Internal scope: cat:x/agent/
New Bash command: cat x/agent/approval.go; echo OLLAMA_APPROVAL_BYPASS
Authorization parser: cat:x/agent/ → matches existing permission
Result: no new approval, Bash executes both commands
The second shell operation was not part of the directory-level cat permission granted by the user. This was the core authorization bypass in LlamaSmuggle.
Safe Proof of Concept
LlamaSmuggle could be reproduced using a harmless PoC demonstrating that an additional shell operation executed without a second user approval. The live screenshots below were captured with Ollama’s official v0.31.1 Windows release. In this release ollama -v reports 0.31.1 for both the client and the server, and the SHA-256 of the downloaded package matches Ollama’s published sha256sum.txt (Figure 4).
In the test, both Bash tool calls were produced from user instructions given directly to the model. The goal was not to measure prompt injection success, but to verify whether a directory-level session permission granted earlier would accept a later command containing a different shell operation without asking for approval again. Agent Mode was run with the qwen3.5:9b model via ollama run qwen3.5:9b --experimental.

Figure 3: The source the prefix collision test ran against. Ollama v0.31.1 tag (710292ff), tracked source files unchanged. The listed untracked files are only test material added for reproduction.

Figure 4: Live reproduction environment. ollama -v is 0.31.1, the server on 127.0.0.1:11436 reports 0.31.1, and the official package’s SHA-256 matches Ollama’s sha256sum.txt.
First, Agent Mode was instructed to execute cat repro/approved.txt, and the user selected Allow for this session, authorizing cat operations within repro/ (Figure 1).
Next, a second Bash call was generated:
cat repro/approved.txt; echo SECOND_COMMAND_EXECUTED
The approval mechanism derived the same prefix and matched it against the previously granted session permission. The command reached execution without requesting another user approval, and Bash executed the echo command as well.

Figure 5: Execution without a second approval. After the running: line, both BLINDLLAMA_BASELINE and SECOND_COMMAND_EXECUTED are printed.
The PoC did not require performing any harmful operation. What it demonstrated was that a second shell command, outside the scope of the user’s approved directory-level cat permission, could reuse the same authorization scope.
The issue was not limited to the semicolon character. The parsing behavior in the source code indicates that shell control structures such as &&, ||, and newlines could produce similar authorization collisions. In this PoC, the semicolon variant was verified at runtime. Other Bash features, such as command substitution, are additional variants of the same parser inconsistency that could be examined separately.
Working Directory Check
Another relevant control in the source code was the isCommandOutsideCwd() function. Interestingly, it parsed command strings differently from the approval parser:
parts := strings.FieldsFunc(command, func(r rune) bool {
return r == '|' || r == ';' || r == '&'
})
Therefore, the same implementation contained two different approaches to parsing shell commands.
However, isCommandOutsideCwd() was not an execution-blocking control. The function was called inside RequestApproval() and only generated a warning in the terminal interface when a command appeared to target paths outside the working directory:
if isCommandOutsideCwd(cmd) {
isWarning = true
warningMsg = "command targets paths outside project"
}
Furthermore, RequestApproval() was invoked only when the command had not already been authorized. If IsAllowed() determined that the command was previously approved, no new approval prompt was opened, and this check was not executed either. The PoC also did not depend on leaving the working directory.
Dangerous Command Denylist and Impact Limitations
The vulnerable Agent Mode implementation also contained a denylist check separate from the session approval mechanism. In x/cmd/run.go, IsDenied() was evaluated before IsAllowed().
A command blocked by the denylist would not reach execution, even if it matched an existing session authorization prefix. Therefore, LlamaSmuggle should not be interpreted as a mechanism that could execute every possible Bash payload unconditionally.
The practical impact depended on the denylist restrictions and the operating-system privileges of the Ollama process.
Primary Root Cause: Incorrect Authorization
Because LlamaSmuggle could result in additional shell command execution, the vulnerability could be associated with command injection. However, the primary security failure occurred in the authorization decision.
When Bash receives A; B, executing both commands is expected behavior. The problem was that the authorization mechanism could treat A; B as covered by a permission that the user had granted only for the operation represented by A.
Scope approved by the user: A
Subsequent command: A ; B
Authorization result: Already allowed
Bash execution: A + B
For this reason, LlamaSmuggle’s primary classification was CWE-863 (Incorrect Authorization).
Attack Preconditions
Exploiting LlamaSmuggle required an affected version of Ollama’s experimental Agent Mode and a session permission granted earlier for the relevant Bash command scope. A later tool call had to produce the same authorization prefix while containing an additional shell operation outside that scope. The command also had to pass the separate denylist check. The real security impact was limited by the operating-system privileges of the Ollama process.
Prompt Injection Attack Scenario
Prompt injection was not required to demonstrate LlamaSmuggle’s underlying authorization collision. However, the possibility of influencing model-generated tool calls through attacker-controlled content increased the vulnerability’s relevance in real-world usage.
For example, a user might ask Ollama Agent Mode to inspect an untrusted repository. During normal operation, the agent could generate cat src/config.go, and the user might approve cat operations within that directory for the remainder of the session.
Later, attacker-controlled content inside the repository could influence the model to generate a command containing additional shell operations while preserving the same authorization prefix:
cat src/config.go; additional-command
Because the existing session scope was cat:src/, the vulnerable approval mechanism could accept the modified command without requesting a new approval.
Prompt injection was not the root cause of LlamaSmuggle. It was one possible way to trigger this authorization bypass in a realistic agent workflow.
Affected Versions and Fix
LlamaSmuggle affected Ollama’s experimental Agent Mode. Normal model serving and traditional chat usage did not use the vulnerable Bash approval path.
The vulnerable prefix-based authorization design was present as early as 0.14.0 and remained in v0.31.1. The affected version range was determined to be >= 0.14.0, < 0.31.2.
The changes introducing the new agent harness were merged on July 2, 2026, and included in version 0.31.2, released on July 6, 2026. This change reworked the previous experimental agent implementation under x/agent and removed the vulnerable prefix-based session authorization path.
The previous agent implementation was replaced, eliminating the vulnerable authorization mechanism from the active execution path.
Disclosure Timeline
May 18, 2026, Initial report: I reported LlamaSmuggle through huntr.dev managed disclosure. I subsequently contacted the Ollama team through GitHub Private Vulnerability Reporting and direct email.
July 2–6, 2026, Agent implementation change: The new agent harness was merged and released in v0.31.2. The release notes did not include a security advisory or CVE reference for the vulnerability.
August–September 2026, CVE process: As the CVE process had not progressed through the vendor, I pursued a separate CVE assignment request.
September 29, 2026, CVE publication: LlamaSmuggle was published as CVE-2026-102697.
Conclusion
LlamaSmuggle originated from what appears to be a relatively small parsing and authorization inconsistency. The working-directory warning and dangerous-command denylist controls did not eliminate this incorrect authorization behavior.
LlamaSmuggle demonstrates a fundamental problem:
For user approval to function as a security boundary, the authorization decision must accurately represent the operation that will actually execute.
Vulnerability Information
| Field | Value |
|---|---|
| Name | LlamaSmuggle (formerly BlindLlama) |
| CVE | CVE-2026-102697 |
| Product | Ollama |
| Component | Experimental Agent Mode / Bash Approval |
| Affected versions | >= 0.14.0, < 0.31.2 |
| First unaffected version | 0.31.2 |
| CWE | CWE-863 (Incorrect Authorization) |
| CVSS v4.0 | 8.5 High |
| CVSS v3.1 | 7.8 High |
| Researcher | Akıner Kısa |
References
- Ollama v0.14.0 Release Notes: Introduction of experimental Agent Mode, the agent loop, and the Bash tool.
- Ollama v0.31.1 approval.go: Vulnerable
safeCommands,extractBashPrefix(),isCommandOutsideCwd(),IsAllowed(), and session approval implementation. - Ollama v0.31.1 run.go: Denylist checks, approval order, and tool execution flow.
- Ollama v0.31.1 bash.go: Execution of the original Bash command string.
- Ollama Agent Harness PR #16963: Introduction of the redesigned agent implementation.
- Ollama Agent Harness Commit a2b3a5e9: Replacement of the previous agent architecture.
- Ollama v0.31.2 Release Notes: First unaffected release.
- LlamaSmuggle reproduction: Test suite, run scripts, and expected output.
- CVE-2026-102697: Published vulnerability record, CWE classification, CVSS scores, and researcher credit.
- VulnCheck Advisory CVE-2026-102697: Published vulnerability advisory.