# AVideo API vulnerable to OS command injection through an unescaped FFmpeg process keyword

Unescaped keyword in AVideo's listFFmpegProcesses() grep pipeline lets an attacker with a valid encrypted codeToExec payload inject shell commands via exec().

- Payout: Research
- Severity: high
- Program: AVideo
- Found by: tonghuaroot
- Disclosed: 2026-11-23
- CVE: CVE-2026-63492
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-j44m-77cc-p3cc
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-j44m-77cc-p3cc
- Tags: area:web domain:web impact:internal-access impact:rce kind:research platform:ghsa sev:high tech:php technique:source-review vuln:command-injection vuln:rce

**Target:** PHP API endpoint plugin/API/standAlone/ffmpeg.json.php
**Root cause:** listFFmpegProcesses() interpolates $keyword inside single quotes in a shell pipeline run via exec(); the list and isKeywordRunning callers pass the raw decrypted codeToExec field instead of the allowlisted $keyword, so a quote-breakout payload escapes into /bin/sh -c.
**Steps:**
1. Obtain APISecret = md5($global['salt'] . $global['systemRootPath'] . 'API')
2. Build codeToExec with time=now, list=1, keyword=`x'; touch /tmp/marker #`
3. Encrypt it with encryptString() (AES-256-CBC, key=sha256(saltV2), iv=substr(sha256(systemRootPath),0,16))
4. POST to `/plugin/API/standAlone/ffmpeg.json.php` with `APISecret=<secret>` and `codeToExecEncrypted=<payload>`
5. Observe marker file created by www-data; repeat via isKeywordRunning mode
**How found:** Code review of the endpoint: noticed the local $keyword is allowlisted via preg_replace but the two callers pass the raw decrypted field into listFFmpegProcesses(), where it is interpolated unescaped inside single quotes in a grep pipeline.
**Exploitation:** Attacker crafts a valid encrypted codeToExec payload (time within 30s window) with a quote-closing keyword, POSTs it to the unauthenticated ffmpeg.json.php endpoint; exec() runs the injected command as the web-server user, enabling data theft, DB pivot and persistence.
**Insight:** When a sanitized variable exists but sibling call sites pass the raw source field, grep for every caller of the sink function rather than trusting the presence of a sanitizer; single-quoted shell interpolation is still injectable via quote breakout.

## Proof of concept (copied exactly from the original report)

**curl POST with malicious keyword payload**

```
curl -s -X POST "http://<host>/plugin/API/standAlone/ffmpeg.json.php" \
  --data-urlencode "APISecret=<APISecret>" \
  --data-urlencode "codeToExecEncrypted=<encrypted codeToExec>"
```

**Vulnerable grep interpolation in listFFmpegProcesses**

```
$command .= " | grep '$keyword'";
exec($command, $output, $status);
```

