-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"WWBN AVideo's `plugin/Live/on_publish.php`, between 2021-01-30 and 2026-05-11, built the YPTSocket notification command line by typing three pairs of single-quote characters into a PHP double-quoted string and interpolating the three notification arguments between them. The single quotes were typed. None of them were function calls. The same project, at the moment the bug was sitting in this file, called `escapeshellarg()` from forty-seven other non-vendor call sites. Ten of those sites live inside `objects/functionsExec.php`, the file that defines `execAsync()`, the function this line called.\n\nCVE-2026-45578 is what five years and three months of difference between a typed character and a function call looks like.\n\n## The line is from 2021-01-30. It shipped that way for five years.\n\nCommit `f8e051c342`, dated 2021-01-30 21:04:19 -0300 and authored by Daniel Neto under the commit message `Send Async`, added the YPTSocket notification dispatch to `on_publish.php`. The line it added:\n\n```php\n$command = \"php {$global['systemRootPath']}plugin/YPTSocket/on_publish_socket_notification.php '$msg' '$callbackJSFunction' '$users_id' '$send_to_uri_pattern' '$m3u8'\";\nexecAsync($command);\n```\n\nFive interpolations, each wrapped in a literal pair of `'` characters typed into the surrounding PHP double-quoted string. Same-day commit `11dddd831b` reshaped the call to three interpolations and moved the receiver path from `plugin/YPTSocket/` to `plugin/Live/`:\n\n```php\n$command = \"php {$global['systemRootPath']}plugin/Live/on_publish_socket_notification.php '$users_id' '$m3u8' '{$obj->liveTransmitionHistory_id}'\";\n```\n\nThat exact shape held from 2021-01-30 through 2026-05-11. Five years, three months, eleven days. Commit `30afe95af2`, dated 2026-05-11 11:48:22 -0300, message `fix: Escape shell arguments in on_publish socket notification command for improved security`, replaced the line with:\n\n```php\n$command = get_php()\n . ' ' . escapeshellarg($global['systemRootPath'] . 'plugin/Live/on_publish_socket_notification.php')\n . ' ' . escapeshellarg((string) $users_id)\n . ' ' . escapeshellarg((string) $m3u8)\n . ' ' . escapeshellarg((string) $obj->liveTransmitionHistory_id);\n```\n\nEvery typed `'` becomes a call to `escapeshellarg()`. The script path interpolation that had been bare in the pre-fix line, `{$global['systemRootPath']}plugin/Live/on_publish_socket_notification.php`, written without any quote at all, also becomes a call to `escapeshellarg()`. The commit message body is a single URL: `https://github.com/WWBN/AVideo/security/advisories/GHSA-xw67-cg5f-4m2r`.\n\nThe pre-fix line's intent is legible from the line alone. The author wrote three pairs of single quotes because shell command grammar reads single-quoted regions as string-quoted arguments. The three interpolated values are runtime data. The runtime data should travel into the child process as shell-string arguments. The author encoded that contract into the source as characters.\n\nThe shell does treat single-quoted regions as string-quoted. The single-quoted region terminates at the next single quote. The shell's own escape rule for an apostrophe inside an apostrophe-quoted string is to close the string, emit a backslash-escaped apostrophe outside any quotes, and open a new apostrophe-quoted string: the four-byte sequence `'\\''`. There is no in-band escape for `'` inside an apostrophe-quoted shell region. The rule is that you cannot have one. `escapeshellarg()` knows the rule and emits the four-byte sequence. A typed apostrophe in source does not know the rule and emits one byte.\n\n## A canStream account, a stream key with an apostrophe, and an HTTP request.\n\nThe three interpolated values are `$users_id` (the row's `users_id`, a database integer), `$m3u8` (built from the stream's key by `Live::getM3U8File()`), and `$obj->liveTransmitionHistory_id` (the autoincrement primary key of the row just saved on line 163). Of the three, `$m3u8` is the one a low-privilege caller controls.\n\n`Live::getM3U8File($lth->getKey(), false, true)` reads the key from the just-saved `LiveTransmitionHistory` row and composes an `.m3u8` URL by string interpolation against the key. The key arrives at the file via `$_POST['name']`, which passes through exactly one sanitizing pass at line 117:\n\n```php\n$_POST['name'] = preg_replace(\"/[&=]/\", '', $_POST['name']);\n```\n\n`&` and `=` are stripped because the value is about to be interpolated into a URL query string elsewhere. `'` is not on the list. The author was thinking about the URL parser at that line. The shell parser further down the pipeline is not the URL parser, and `preg_replace` is the same character-level discipline as the typed apostrophes downstream: a sanitization grammar encoded in literal characters in a regex, not a call to a destination-aware primitive.\n\n`Live::cleanUpKey()` at `plugin/Live/Live.php` line 2680 strips suffixes like `_hi`, `_low`, and `_mid` used for adaptive-bitrate variants. It does not strip apostrophes.\n\nThe complete exploit chain, given the GHSA's documented preconditions:\n\n1. The attacker holds a `canStream` account on the AVideo instance, the lowest streaming privilege the platform supports.\n2. The attacker calls `saveLive.php` (or the equivalent intake) and stores a stream key whose value contains a single quote, for example `evil';id>/tmp/pwn;#`. The character survives both the URL sanitizer in `on_publish.php` and the suffix-stripping `cleanUpKey()`.\n3. The attacker initiates an RTMP publish session against the front-end nginx-rtmp instance. nginx-rtmp's `on_publish` hook calls back into the application's `on_publish.php`. The handler reads the key, verifies the user can stream, saves the `LiveTransmitionHistory` row, and reaches line 267.\n4. `$m3u8 = Live::getM3U8File($lth->getKey(), false, true)` returns a URL embedding the stored key, including the `'` byte the attacker placed there.\n5. `$command` is built by string interpolation. The PHP double-quoted string substitutes `$m3u8` between the two literal `'` characters the author typed. The shell receives `'/path/to/evil';id>/tmp/pwn;#.m3u8'`. The first `'` opens the wrap. The second `'`, supplied by the attacker, closes it. `;id>/tmp/pwn;#.m3u8` is read by the shell as additional commands in the same line.\n6. `execAsync($command)` runs the command line. The appended commands run as the webserver user.\n\nThe advisory's CVSS vector encodes the prerequisite: `AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`. PR:L is the `canStream` account. The exploit's shape from the attacker's side is two requests: one HTTP write to set the key, one RTMP publish to trigger the handler. Two requests, one PR:L credential, code execution as the webserver user.\n\n## The same project calls `escapeshellarg()` forty-seven times.\n\nAt the commit immediately before the fix (`7a03fb7c92`, the parent of `30afe95af2`), the AVideo working tree contained `escapeshellarg()` in forty-seven non-vendor call sites across fifteen files:\n\n```\nobjects/functionsExec.php 10\nobjects/functionsFFMPEG.php 9\nplugin/CloneSite/cloneClient.json.php 6\nplugin/Live/standAloneFiles/saveDVR.json.php 5\nplugin/Live/standAloneFiles/restreamer.json.php 3\nplugin/SocialMediaPublisher/Objects/SocialUploader 3\nplugin/API/standAlone/ffmpeg.json.php 2\nplugin/AI/AI.php 2\nplugin/API/standAlone/functions.php 1\nplugin/Live/test.php 1\nplugin/YPTSocket/server.php.php 1\nobjects/video.php 1\ninstall/fix_dirs_permissions.php 1\ninstall/stopDDOSAtackIps.php 1\ninstall/stopDDOSAtackIpsMultipleRequests.php 1\n```\n\nTen of the forty-seven sites live inside `objects/functionsExec.php`. That file defines `execAsync()` at line 679, the function `on_publish.php`'s broken line called as its terminal action. Line 377 of the same file reads:\n\n```php\n// Escape the input parameters to prevent command injection attacks\n$filename = escapeshellarg($filename);\n$destination = escapeshellarg($destination);\n```\n\n`execAsync()` lives three hundred lines below an inline comment that names \"command injection\" by name and demonstrates `escapeshellarg()` on two consecutive lines. The function the caller called is defined three hundred lines below the worked example. The caller is in a different file. The discipline did not cross the file boundary.\n\n`plugin/YPTSocket/server.php.php` also calls `escapeshellarg()`. The plugin that hosts the receiver of the YPTSocket notification used `escapeshellarg()` correctly for its own openssl certificate-date check. The sender of the notification, in `on_publish.php`, did not.\n\nThis is the Quote Wrap Is Not Escape shape at the line level. The author wrote `'$users_id'` because the destination parser, the shell, uses single quotes to delimit string-quoted arguments. The author did not call `escapeshellarg()` because typing the apostrophe felt like the same thing. It is not the same thing. The typed apostrophe is a literal byte in the PHP source that PHP emits unchanged into the assembled command string. `escapeshellarg()` is a function that knows the destination grammar's escape rule and emits the byte sequence the shell will read as a complete, attacker-safe argument. The same codebase exposed the right primitive. The bug site reached for a literal apostrophe.\n\nThis is also the same family of fault the catalog tracks under [The Shell Was Not The Sink](/posts/everest-forms-cve-2026-3300-sanitized-for-html-fed-to-eval). Everest Forms Pro applied `sanitize_text_field()` to values flowing into `eval()`; the destination was PHP and the function's name encoded HTML. AVideo's `on_publish.php` did not apply any function at all. The character was the entire safety belt. Both shapes are the same gap between the author's awareness that a destination exists and the function call the destination requires; AVideo's case is the version in which the function call was never reached for.\n\n## Five `escapeshellarg()` retrofits in eight weeks.\n\nBetween 2026-03-18 and 2026-05-11, fifty-four days by the same author, AVideo shipped five `escapeshellarg`-themed security fix commits across five different exec sites in the project:\n\n| Date | Commit | Subject |\n| --- | --- | --- |\n| 2026-03-18 | `67d932eb05` | fix: enhance security by using escapeshellarg() to prevent command injection in LinkedIn video upload |\n| 2026-03-20 | `1e6cf03e93` | fix: Escape shell arguments in wget command to prevent command injection |\n| 2026-03-20 | `25c8ab9026` | fix: Enhance security in sanitizeFFmpegCommand by stripping additional characters to prevent command injection |\n| 2026-04-15 | `473c609fc2` | fix: Secure command execution by escaping shell arguments for clone site URL and SQL dump file |\n| 2026-05-11 | `30afe95af2` | fix: Escape shell arguments in on_publish socket notification command for improved security |\n\nFive commits. Five exec sites. Five retrofits of `escapeshellarg()` into shell-command construction that had shipped without it. The on_publish socket notification is the fifth and the only one with a public CVE identifier. The other four close call sites the author found themselves; this one closes a call site reporter `offset` filed against the project on the security tab.\n\nThe class of bug is the gap between the author's exec discipline at the function level, in `functionsExec.php`, where `escapeshellarg()` is called ten times alongside a comment that names command injection, and the same author's exec discipline at the call site level, where individual shell commands keep getting assembled by hand in the same project. The `escapeshellarg()` call count at the project level rises one CVE at a time. CVE-2026-45578 is one observation. The eight-week sequence is the [Design Debt Driver](/patterns/design-debt-driver) at work.\n\n## The shell parser is the destination. The PHP parser is not.\n\nThe line `'$users_id'` inside a PHP double-quoted string is two characters and a variable. PHP's parser reads the first `'` as a literal byte, interpolates `$users_id`, and reads the closing `'` as another literal byte. By the time the assembled string reaches the shell, PHP has already finished. The shell sees a byte sequence that begins with `'`, ends with `'`, and contains whatever bytes the interpolation supplied.\n\nThe author wrote the apostrophes because the shell's grammar uses them. The author did not call `escapeshellarg()` because typing the apostrophe felt like the same thing. It is not the same thing. `escapeshellarg()` produces an apostrophe-wrapped region in which any internal apostrophes are split by the `'\\''` escape sequence the POSIX shell defines. A typed apostrophe in the PHP source produces a region that terminates at the first interpolated apostrophe byte. The two are different functions of the input.\n\nThe character was in the source. The function call was in the rest of the project.\n\n## Coverage stack\n\n- NVD record: [CVE-2026-45578](https://nvd.nist.gov/vuln/detail/CVE-2026-45578)\n- GHSA: [GHSA-xw67-cg5f-4m2r](https://github.com/WWBN/AVideo/security/advisories/GHSA-xw67-cg5f-4m2r) (reporter: `offset`)\n- The 2021 introduction: [`f8e051c342` \"Send Async\"](https://github.com/WWBN/AVideo/commit/f8e051c342)\n- The 2026-05-11 fix: [`30afe95af2`](https://github.com/WWBN/AVideo/commit/30afe95af2)\n- Vulnerable file (post-fix): [`plugin/Live/on_publish.php`](https://github.com/WWBN/AVideo/blob/master/plugin/Live/on_publish.php)\n- Adjacent worked example: [`objects/functionsExec.php` line 377](https://github.com/WWBN/AVideo/blob/master/objects/functionsExec.php#L377)\n","closing_line":"`escapeshellarg()` is a function. `'` is a character. AVideo called the function forty-seven times in the same checkout and typed the character three times on line 267, for five years and three months.","hook_md":"WWBN AVideo's `plugin/Live/on_publish.php`, between 2021-01-30 and 2026-05-11, built the YPTSocket notification command line by typing three pairs of single-quote characters into a PHP double-quoted string and interpolating the three notification arguments between them. The single quotes were typed. None of them were function calls. The same project, at the moment the bug was sitting in this file, called `escapeshellarg()` from forty-seven other non-vendor call sites. Ten of those sites live inside `objects/functionsExec.php`, the file that defines `execAsync()`, the function this line called.\n\nCVE-2026-45578 is what five years and three months of difference between a typed character and a function call looks like.","post_id":567,"slug":"avideo-cve-2026-45578-the-apostrophes-were-typed","title":"CVE-2026-45578: AVideo's on_publish.php Typed Three Apostrophes. The Same Project Called escapeshellarg() Forty-Seven Times.","type":"initial","unreadable_sentence":"`execAsync()` is defined three hundred lines below ten call sites of `escapeshellarg()` and an inline comment that names command injection by name. `on_publish.php` is the caller of `execAsync()` and typed three apostrophes."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCaq7zZgAKCRDeZjl4jgkQ Jjp5AQDYLzueYmkmIPDby3B/EPATh7fyPYjax6/S50gyNNXcYQEAu0qlVfR7KJnw 0JHQ7EHLwXlA7oas/GWveCMymMykUgw= =IDz+ -----END PGP SIGNATURE-----