Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

CVE-2026-65973: CVE-2026-65973: Local OS Command Injection in Laradocs KaTeX Server-Side Rendering

CVE-2026-65973: Local OS Command Injection in Laradocs KaTeX Server-Side Rendering Vulnerability ID: CVE-2026-65973 CVSS Score: 6.4 Published: 2026-11-25 CVE-2026-65973 (GHSA-h746-qpxh-ph7g) is a local operating sys

CVE-2026-65973: Local OS Command Injection in Laradocs KaTeX Server-Side Rendering

Vulnerability ID: CVE-2026-65973
CVSS Score: 6.4
Published: 2026-11-25

CVE-2026-65973 (GHSA-h746-qpxh-ph7g) is a local operating system command injection vulnerability (CWE-78) in the PeteBishwhip/laradocs package for Laravel. Versions from 0.4.0 to before 1.0.0 fail to sanitize or escape the configured Node.js binary path before passing it as part of a command string to PHP's proc_open() function during server-side KaTeX rendering. An attacker with the ability to modify local configuration files or environment variables can inject shell metacharacters to execute arbitrary OS commands under the privileges of the web server process.

TL;DR

Laradocs versions >= 0.4.0 and < 1.0.0 concatenate an unescaped Node.js binary path directly into a proc_open() command string inside KatexExtension.php. Local attackers who can control the LARADOCS_KATEX_NODE_BIN environment variable or laradocs.parser.katex.node_bin configuration can execute arbitrary commands when KaTeX server-side rendering is active. Upgrading to version 1.0.0 remediates the issue by wrapping the binary path in escapeshellarg().

Technical Details

  • Vulnerability Type: CWE-78: OS Command Injection
  • Affected Component: KatexExtension::spawnNode() in src/Extensions/KatexExtension.php
  • Attack Vector: Local (AV:L) via unescaped Node.js binary path configuration
  • CVSS v3.1 Score: 6.4 Medium (CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H)
  • EPSS Score: 0.63% (44.63rd Percentile)
  • Impact: Arbitrary OS command execution as the PHP web server user
  • Exploit Status: No known public exploits or active exploitation
  • CISA KEV Status: Not Listed

Affected Systems

  • PeteBishwhip/laradocs (Packagist: petebishwhip/laradocs) versions >= 0.4.0, < 1.0.0
  • laradocs: >= 0.4.0, < 1.0.0 (Fixed in: 1.0.0)

Code Analysis

Commit: 100cb1e

[Aikido] AI Fix for Unsafe exec usage can lead to remote code execution (#154)

--- a/src/Extensions/KatexExtension.php
+++ b/src/Extensions/KatexExtension.php
@@ -263,7 +263,7 @@ private function spawnNode(string $input): ?string
         }

         $node = $this->nodeBin ?? 'node';
-        $cmd = $node . ' ' . escapeshellarg($tmpFile) . ' ' . escapeshellarg($input);
+        $cmd = escapeshellarg($node) . ' ' . escapeshellarg($tmpFile) . ' ' . escapeshellarg($input);
         $descriptors = [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'w']];
         $proc = proc_open($cmd, $descriptors, $pipes);

Mitigation Strategies

  • Upgrade petebishwhip/laradocs to version 1.0.0 or later to ensure the Node.js executable path is escaped via escapeshellarg().
  • Disable KaTeX server-side rendering (SSR) by setting laradocs.parser.katex.ssr to false, shifting mathematical rendering to the client browser.
  • Harden access controls around .env and Laravel configuration files so that the web server process and unprivileged users cannot modify LARADOCS_KATEX_NODE_BIN.
  • Audit application administrative panels to ensure dynamic configuration managers cannot overwrite the laradocs.parser.katex.node_bin setting.

Remediation Steps:

  1. Update composer.json to require petebishwhip/laradocs:^1.0.0 and execute 'composer update petebishwhip/laradocs'.
  2. Verify the installed version in composer.lock matches 1.0.0 or higher and confirm commit 100cb1e83920b8d3c9d8d53f98712df80df99435 is present in vendor/petebishwhip/laradocs/src/Extensions/KatexExtension.php.
  3. If unable to upgrade immediately, add LARADOCS_KATEX_SSR=false to the production .env file and clear the cached configuration via 'php artisan config:clear' and 'php artisan config:cache'.
  4. Inspect existing config/laradocs.php and .env files to verify that LARADOCS_KATEX_NODE_BIN contains only a legitimate, absolute filesystem path to the Node.js binary.

References

Read the full report for CVE-2026-65973 on our website for more details including interactive diagrams and full exploit analysis.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.