The product uses external input to determine the names of variables into which information is extracted, without verifying that the names of the specified variables are valid. This could cause the program to overwrite unintended variables.
View on MITREFor example, in PHP, extraction can be used to provide functionality similar to register_globals, a dangerous functionality that is frequently disabled in production systems. Calling extract() or import_request_variables() without the proper arguments could allow arbitrary global variables to be overwritten, including superglobals. Similar functionality is possible in other interpreted languages, including custom languages.
An attacker could modify sensitive data or program variables.
Use allowlists of variable names that can be extracted.
Consider refactoring your code to avoid extraction routines altogether.
No detection method information available for this CWE.
This code uses the credentials sent in a POST request to login a user.
The call to extract() will overwrite the existing values of any variables defined previously, in this case $isAdmin. An attacker can send a POST request with an unexpected third value "isAdmin" equal to "true", thus gaining Admin privileges.
Chain: PHP app uses extract for register_globals compatibility layer (CWE-621), enabling path traversal (CWE-22)
View Detailsimport_request_variables() buried in include files makes post-disclosure analysis confusing
View DetailsNo relationship information available for this CWE.
CWE-621: Variable Extraction Error is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product uses external input to determine the names of variables into which information is extracted, without verifying that the names of the specified variables are valid. This could cause the program to overwrite unintended variables. For example, in PHP, extraction can be used to provide functionality similar to register_globals, a dangerous functionality that is frequently disabled in production systems. Calling extract() or import_request_variables() without the proper arguments could allow arbitrary global variables to be overwritten, including superglobals. Similar functionality is possible in other interpreted languages, including custom languages.
If exploited, CWE-621 (Variable Extraction Error) it can compromise Integrity, leading to outcomes such as Modify Application Data.
Recommended mitigations for CWE-621 include: Use allowlists of variable names that can be extracted. Consider refactoring your code to avoid extraction routines altogether.
CWE-621 commonly affects PHP. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.
MITRE documents real CVEs mapped to CWE-621, including CVE-2006-7135, CVE-2006-7079, CVE-2006-6661 and CVE-2006-2828. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.
A CWE (Common Weakness Enumeration) like CWE-621 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.