CWE-621: Variable Extraction Error

VariantIncomplete

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 MITRE
Back to CWE Lookup

Extended Description

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.

Technical Details

Structure
Simple

Applicable To

Languages
PHP
Platforms

Frequently Asked Questions

What is CWE-621: Variable Extraction Error?+

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.

What are the security consequences of Variable Extraction Error?+

If exploited, CWE-621 (Variable Extraction Error) it can compromise Integrity, leading to outcomes such as Modify Application Data.

How do you prevent or mitigate Variable Extraction Error?+

Recommended mitigations for CWE-621 include: Use allowlists of variable names that can be extracted. Consider refactoring your code to avoid extraction routines altogether.

Which programming languages are affected by Variable Extraction Error?+

CWE-621 commonly affects PHP. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Variable Extraction Error?+

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.

What is the difference between a CWE and a CVE?+

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.

Learn More