CVE-2020-5203
Description
In Fat-Free Framework 3.7.1, attackers can achieve arbitrary code execution if developers choose to pass user controlled input (e.g., $_REQUEST, $_GET, or $_POST) to the framework's Clear method.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Fat-Free Framework 3.7.1's `clear()` method allows arbitrary code execution when user input is passed, due to missing input sanitization.
Vulnerability
Overview
CVE-2020-5203 affects Fat-Free Framework (F3) version 3.7.1, a popular PHP micro-framework. The vulnerability resides in the clear() method, which is intended to reset global variables. If a developer naively passes user-controlled input (e.g., $_REQUEST, $_GET, $_POST) to this method, the lack of input sanitization in the underlying eval() call can be exploited to achieve arbitrary code execution [1][2].
Exploitation
Conditions
Exploitation requires that the clear() method is called with unsanitized user input. No authentication is necessary if the vulnerable code path is exposed via HTTP request parameters. The attacker crafts a malicious string that, when evaluated inside eval('unset('.$this->compile('@this->hive.'.$key).');'), triggers code injection. The framework's compile() function processes the key, but the original code did not filter out PHP-close-tag-like patterns or function calls [3].
Impact
A successful attack allows an unauthenticated remote attacker to execute arbitrary PHP code on the server. This could lead to full site compromise, data theft, or further server-side attacks. The framework is widely used for rapid web application development, increasing the potential blast radius [1][2].
Mitigation
The vulnerability was patched in a subsequent commit (dae95a0), which adds a regex-based sanitization step: $key=preg_replace('/(\)\W*\w+.*$)/','',$key); to remove any trailing function calls or PHP structures from the key before evaluation [3]. Users should upgrade to Fat-Free Framework version 3.7.2 or later, which includes this fix [4]. Workarounds involve never passing unfiltered user input to the clear() method.
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
bcosca/fatfreePackagist | < 3.7.2 | 3.7.2 |
Affected products
3- Fat-Free Framework/Fat-Free Frameworkdescription
- Range: =3.7.1
Patches
2dae95a0baf39ensure misuse of clear() wont open a vulnerability
1 file changed · +4 −4
base.php+4 −4 modified@@ -503,6 +503,8 @@ function clear($key) { // Reset global to default value $this->hive[$parts[0]]=$this->init[$parts[0]]; else { + // Ensure we have no code injection + $key=preg_replace('/(\)\W*\w+.*$)/','',$key); eval('unset('.$this->compile('@this->hive.'.$key).');'); if ($parts[0]=='SESSION') { session_commit(); @@ -2963,13 +2965,11 @@ function c($val) { * @param $str string **/ function token($str) { - $fw=$this->fw; - $str=trim(preg_replace('/\{\{(.+?)\}\}/s',trim('\1'), - $fw->compile($str))); + $str=trim(preg_replace('/\{\{(.+?)\}\}/s','\1',$this->fw->compile($str))); if (preg_match('/^(.+)(?<!\|)\|((?:\h*\w+(?:\h*[,;]?))+)$/s', $str,$parts)) { $str=trim($parts[1]); - foreach ($fw->split(trim($parts[2],"\xC2\xA0")) as $func) + foreach ($this->fw->split(trim($parts[2],"\xC2\xA0")) as $func) $str=((empty($this->filter[$cmd=$func]) && function_exists($cmd)) || is_string($cmd=$this->filter($func)))?
dae95a0baf39ensure misuse of clear() wont open a vulnerability
1 file changed · +4 −4
base.php+4 −4 modified@@ -503,6 +503,8 @@ function clear($key) { // Reset global to default value $this->hive[$parts[0]]=$this->init[$parts[0]]; else { + // Ensure we have no code injection + $key=preg_replace('/(\)\W*\w+.*$)/','',$key); eval('unset('.$this->compile('@this->hive.'.$key).');'); if ($parts[0]=='SESSION') { session_commit(); @@ -2963,13 +2965,11 @@ function c($val) { * @param $str string **/ function token($str) { - $fw=$this->fw; - $str=trim(preg_replace('/\{\{(.+?)\}\}/s',trim('\1'), - $fw->compile($str))); + $str=trim(preg_replace('/\{\{(.+?)\}\}/s','\1',$this->fw->compile($str))); if (preg_match('/^(.+)(?<!\|)\|((?:\h*\w+(?:\h*[,;]?))+)$/s', $str,$parts)) { $str=trim($parts[1]); - foreach ($fw->split(trim($parts[2],"\xC2\xA0")) as $func) + foreach ($this->fw->split(trim($parts[2],"\xC2\xA0")) as $func) $str=((empty($this->filter[$cmd=$func]) && function_exists($cmd)) || is_string($cmd=$this->filter($func)))?
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
3- github.com/advisories/GHSA-hpj2-4hfj-g233ghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2020-5203ghsaADVISORY
- github.com/bcosca/fatfree-core/commit/dae95a0baf3963a9ef87c17cee52f78f77e21829ghsax_refsource_CONFIRMWEB
News mentions
0No linked articles in our index yet.