Remote Code Execution in Laravel Backpack via Host Header Injection
An unauthenticated command injection vulnerability in Laravel Backpack's Stats::makeCurlRequest method allows remote code execution by exploiting unsanitized Host header input passed to an exec() shell command.
Laravel Backpack contains a high-severity remote code execution vulnerability (CVE-2026-54182) within its Stats::makeCurlRequest method. The vulnerability arises because the package constructs a shell command using unescaped input derived from the HTTP Host header and executes it via the PHP exec() function. This vulnerability is reachable pre-authentication during the BackpackServiceProvider::boot() process, which executes on every request in production.
While the application includes a 1-in-100 random execution gate, attackers can trigger the exploit reliably through automated retries. Successful exploitation requires a server environment where the PHP exec() function is enabled and the web server (e.g., Nginx or Apache) fails to normalize or reject malformed Host headers. If these conditions are met, an attacker can gain command execution under the privileges of the web user, leading to full compromise of the application environment, including access to secrets stored in .env files and internal network resources.
Attack Chain
- Attacker identifies a target application running a vulnerable version of Backpack for Laravel.
- Attacker crafts an HTTP request with a malicious
Hostheader containing shell injection payloads (e.g.,; command; #). - The request reaches the web server, which forwards the request to the PHP backend without stripping the malicious
Hostheader. BackpackServiceProvider::boot()is triggered during the standard request lifecycle.- The application execution hits the 1-in-100 random gate; the attacker retries the request until the logic proceeds to
Stats::makeCurlRequest. - The
makeCurlRequestmethod injects the header into a string passed to the PHPexec()function. - The operating system spawns a shell process to execute the injected payload with the privileges of the web server user.
- The attacker achieves code execution to exfiltrate environment variables, modify local files, or move laterally within the network.
Impact
Successful exploitation results in full unauthenticated remote code execution. Attackers can exfiltrate sensitive configuration data, including APP_KEY, database credentials, and third-party API keys. This provides a vector for full data exfiltration, service disruption, and potential lateral movement into internal infrastructure connected to the compromised web host. The number of affected deployments is widespread across applications utilizing the Backpack for Laravel framework.
Recommendation
Prioritized, concrete actions for detection engineering teams:
- Upgrade all instances of Backpack for Laravel to the patched versions (4.1.70, 5.6.2, 6.8.13, 7.0.36) immediately to remove the
makeCurlRequestmethod. - Audit web server configurations to ensure that
Hostheaders are validated against an allowlist of expected domains and that invalid requests are dropped before reaching the application layer. - Configure PHP to disable the
exec(),shell_exec(), andpassthru()functions in production environments if they are not strictly required for application functionality. - Deploy web server logging to monitor for anomalous characters (semicolons, backticks, pipe symbols) within the
Hostheader field of incoming HTTP requests.
Immediate actions
Upgrade Backpack for Laravel to patched versions: 4.1.70, 5.6.2, 6.8.13, or 7.0.36.
Mitigations
Disable PHP exec() functions in production environment.
CVE-2026-54182
Detection coverage 1
Detect CVE-2026-54182 Exploitation - Host Header Command Injection
highDetects exploitation attempts against CVE-2026-54182 by monitoring for shell metacharacters in the Host header.
Detection queries are available on the platform. Get full rules →