//nefariousplan

CVE-2026-45578: AVideo's on_publish.php Typed Three Apostrophes. The Same Project Called escapeshellarg() Forty-Seven Times.

vendor

patterns

cve

proof of concept

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.

CVE-2026-45578 is what five years and three months of difference between a typed character and a function call looks like.

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.

CVE-2026-45578 is what five years and three months of difference between a typed character and a function call looks like.

The line is from 2021-01-30. It shipped that way for five years.

Commit 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:

$command = "php {$global['systemRootPath']}plugin/YPTSocket/on_publish_socket_notification.php '$msg' '$callbackJSFunction' '$users_id' '$send_to_uri_pattern' '$m3u8'";
execAsync($command);

Five 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/:

$command = "php {$global['systemRootPath']}plugin/Live/on_publish_socket_notification.php '$users_id' '$m3u8' '{$obj->liveTransmitionHistory_id}'";

That 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:

$command = get_php()
    . ' ' . escapeshellarg($global['systemRootPath'] . 'plugin/Live/on_publish_socket_notification.php')
    . ' ' . escapeshellarg((string) $users_id)
    . ' ' . escapeshellarg((string) $m3u8)
    . ' ' . escapeshellarg((string) $obj->liveTransmitionHistory_id);

Every 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.

The 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.

The 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.

A canStream account, a stream key with an apostrophe, and an HTTP request.

The 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.

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:

$_POST['name'] = preg_replace("/[&=]/", '', $_POST['name']);

& 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.

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.

The complete exploit chain, given the GHSA's documented preconditions:

  1. The attacker holds a canStream account on the AVideo instance, the lowest streaming privilege the platform supports.
  2. 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().
  3. 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.
  4. $m3u8 = Live::getM3U8File($lth->getKey(), false, true) returns a URL embedding the stored key, including the ' byte the attacker placed there.
  5. $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.
  6. execAsync($command) runs the command line. The appended commands run as the webserver user.

The 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.

The same project calls escapeshellarg() forty-seven times.

At 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:

objects/functionsExec.php                          10
objects/functionsFFMPEG.php                         9
plugin/CloneSite/cloneClient.json.php               6
plugin/Live/standAloneFiles/saveDVR.json.php        5
plugin/Live/standAloneFiles/restreamer.json.php     3
plugin/SocialMediaPublisher/Objects/SocialUploader  3
plugin/API/standAlone/ffmpeg.json.php               2
plugin/AI/AI.php                                    2
plugin/API/standAlone/functions.php                 1
plugin/Live/test.php                                1
plugin/YPTSocket/server.php.php                     1
objects/video.php                                   1
install/fix_dirs_permissions.php                    1
install/stopDDOSAtackIps.php                        1
install/stopDDOSAtackIpsMultipleRequests.php        1

Ten 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:

// Escape the input parameters to prevent command injection attacks
$filename = escapeshellarg($filename);
$destination = escapeshellarg($destination);

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.

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.

This 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.

This is also the same family of fault the catalog tracks under The Shell Was Not The Sink. 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.

Five escapeshellarg() retrofits in eight weeks.

Between 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:

Date Commit Subject
2026-03-18 67d932eb05 fix: enhance security by using escapeshellarg() to prevent command injection in LinkedIn video upload
2026-03-20 1e6cf03e93 fix: Escape shell arguments in wget command to prevent command injection
2026-03-20 25c8ab9026 fix: Enhance security in sanitizeFFmpegCommand by stripping additional characters to prevent command injection
2026-04-15 473c609fc2 fix: Secure command execution by escaping shell arguments for clone site URL and SQL dump file
2026-05-11 30afe95af2 fix: Escape shell arguments in on_publish socket notification command for improved security

Five 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.

The 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 at work.

The shell parser is the destination. The PHP parser is not.

The 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.

The 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.

The character was in the source. The function call was in the rest of the project.

Coverage stack

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.