GHSA-w5ff-2mjc-4phc AVideo has an OS Command Injection via Unescaped URL in LinkedIn Video Upload Shell Command
SummaryThe `uploadVideoToLinkedIn()` method in the SocialMediaPublisher plugin constructs a shell command by directly interpolating an upload URL received from LinkedIn's API response, without sanitization via `escapeshellarg()`. If an attacker can influence the LinkedIn API response (via MITM, compromised OAuth token, or API compromise), they can inject arbitrary OS commands that execute as the web server user.DetailsThe vulnerability exists in `plugin/SocialMediaPublisher/Objects/SocialUploader.php`.The `initializeLinkedInUploadSession()` method (line 649) sends a POST request to `https://api.linkedin.com/rest/videos?action=initializeUpload` and parses the JSON response at line 693:The parsed `uploadInstructions` array is iterated at line 532, and each `uploadUrl` is passed to `uploadVideoToLinkedIn()` at line 542:The `uploadVideoToLinkedIn()` method (line 711) constructs a shell command by directly concatenating both `$uploadUrl` and `$filePath` into a string passed to `exec()`:Neither `$uploadUrl` nor `$filePath` is sanitized with `escapeshellarg()`. A malicious URL such as `https://uploads.linkedin.local" ; id ; echo "` would break out of the quoted string and execute arbitrary commands.The `$uploadUrl` originates from LinkedIn's API response — a trusted third-party source over HTTPS — so exploitation requires compromising that response (MITM at CA level, compromised OAuth token leading to attacker-controlled API responses, or LinkedIn API compromise). This makes the attack complexity high, but the missing sanitization is a defense-in-depth failure that could become critical if the trust boundary is ever violated.PoCThis vulnerability requires manipulating the LinkedIn API response. A simulated proof-of-concept using a local proxy:**Step 1:** Set up a proxy that intercepts the LinkedIn API response and replaces the `uploadUrl` field:**Step 2:** The resulting shell command becomes:**Step 3:** The `id` command executes as the web server user, writing output to `/tmp/pwned`.**Step 4:** Verify:Impact**Remote Code Execution:** If the LinkedIn API response is compromised, an attacker gains arbitrary command execution as the web server user (`www-data`).**Confidentiality:** Full read access to application source code, configuration files (including database credentials), and any data accessible to the web server process.**Integrity:** Ability to modify application files, inject backdoors, or alter database records.**Practical risk is low** due to the high attack complexity — exploitation requires compromising a trusted HTTPS API response from LinkedIn. This is primarily a defense-in-depth issue.Recommended FixSanitize both `$uploadUrl` and `$filePath` with `escapeshellarg()` before interpolation into the shell command. Alternatively, replace the `exec()` call with PHP's native cURL functions (which are already used elsewhere in the same class):**Option 1 — Minimal fix with `escapeshellarg()`:****Option 2 — Replace shell exec with native PHP cURL (preferred):**Option 2 is strongly preferred as it eliminates the shell execution entirely, removing the injection surface and aligning with the PHP cURL usage already present in `initializeLinkedInUploadSession()` on line 664.
CVSS v3.1 score: 5.9