GHSA-vc6p-m6vx-6cwq: OliveTin: Second-Order OS Command Injection via shellAfterCompleted
- Source:
- OSV.dev
- Published:
- Fetched:
- Updated:
- Affects:
- github.com/OliveTin/OliveTin
https://osv.dev/vulnerability/GHSA-vc6p-m6vx-6cwq ↗
OliveTin: Second-Order OS Command Injection via shellAfterCompleted ## 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 Affected: Go:github.com/OliveTin/OliveTin Fixed in: 0.0.0-20260728155752-e5d29b68da66 References: https://github.com/OliveTin/OliveTin/security/advisories/GHSA-vc6p-m6vx-6cwq https://nvd.nist.gov/vuln/detail/CVE-2026-75506 https://github.com/OliveTin/OliveTin/pull/1070 https://github.com/OliveTin/OliveTin/pull/1088 https://github.com/OliveTin/OliveTin/commit/4ef86abee7aac4e4ec4a3200c7ca491ca3501065 https://github.com/OliveTin/OliveTin/commit/e5d29b68da66fd7f99072d6afd336dee2c28876c https://github.com/OliveTin/OliveTin https://github.com/OliveTin/OliveTin/releases/tag/3000.17.0