Is Your Laravel Application at Risk? The register_argc_argv Vulne
A PHP setting called register_argc_argv lets query string parameters be treated as command-line arguments, so an attacker could change Laravel's environment detection. In theory this could switch the app to the local environment and bypass authentication on the Horizon dashboard, exposing sensitive job data.
Published on medium.com
After receiving a GitHub notification about a security advisory affecting my public repositories, I found myself asking, “What the hell is that? and How a Simple PHP Setting Can Lead to Major Security Risks in Laravel”
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, Laravel used the argv values, which can be populated from the query string when register_argc_argv is enabled, to detect the application environment, allowing an attacker to influence that detection.
Impact
In theory, an attacker could switch the app to the local environment and bypass authentication on the Horizon dashboard, exposing sensitive job data; the author is not sure how this would work in a real-world scenario.
What the attacker needed
PHP-FPM Docker image without implicit php.ini; register_argc_argv set to On; Laravel version in the affected range; Horizon dashboard exposed
The fix
The issue was fixed in patched Laravel versions by ignoring argv values for environment detection on non-CLI SAPIs.
How it was found
- Check whether the PHP setting register_argc_argv is on by viewing a phpinfo page.
- Craft a URL with a query parameter that sets the environment to local.
- Open the Horizon dashboard URL, which may now skip authentication.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
PHP has a setting that, when on, makes it treat parts of a web address as if they were typed on a command line. Laravel uses those command-line values to decide which environment it is running in. If an attacker can change that decision, they might make the app think it is in a less protected mode, such as a developer's local setup, where some admin pages do not ask for a password.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.