Php Parse Value Shadowing
Description
This detector identifies PHP parse value shadowing vulnerabilities where parse functions like parse_str() use unsanitized user input as their source parameter. When untrusted data is parsed directly, attackers can inject arbitrary variables into the current scope, potentially overwriting existing variables and leading to security bypasses or code execution.
Detection Strategy
• Identifies calls to PHP parsing functions (likely parse_str, parse_url, or similar parse functions)
• Checks that the function call has exactly one argument (the source parameter)
• Verifies the source argument comes from unsafe user input (GET, POST, REQUEST variables, etc.)
• Confirms the input is not properly sanitized before being passed to the parse function
• Reports vulnerability when untrusted data flows directly into parse functions without validation
Vulnerable code example
<?php
function processRequest() {
$is_admin = false;
parse_str($_GET['data']); // Vulnerable: extracts to global scope, can overwrite $is_admin
}
function loadConfig() {...✅ Secure code example
<?php
function processRequest() {
$is_admin = false;
parse_str($_GET['data'], $params); // Safe: extracts to $params array, cannot overwrite $is_admin
}
function loadConfig() {...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.