9.8 CVE-2020-13756

Used by Malware Patch Exploit
 

Sabberworm PHP CSS Parser before 8.3.1 calls eval on uncontrolled data, possibly leading to remote code execution if the function allSelectors() or getSelectorsBySpecificity() is called with input from an attacker.
https://nvd.nist.gov/vuln/detail/CVE-2020-13756

Categories

CWE-94 : Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.) Refactor your program so that you do not have to dynamically generate code. Use automated static analysis tools that target this type of weakness. Many modern techniques use data flow analysis to minimize the number of false positives. This is not a perfect solution, since 100% accuracy and coverage are not feasible. Use dynamic tools and techniques that interact with the product using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The product's operation may slow down, but it should not become unstable, crash, or generate incorrect results. Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184). Run the code in an environment that performs automatic taint propagation and prevents any command execution that uses tainted variables, such as Perl's "-T" switch. This will force the program to perform validation steps that remove the taint, although you must be careful to correctly validate your inputs so that you do not accidentally mark dangerous inputs as untainted (see CWE-183 and CWE-184). Math component in an LLM framework translates user input into a Pythonexpression that is input into the Python exec() method, allowing codeexecution - one variant of a "prompt injection" attack. Python-based library uses an LLM prompt containing user input todynamically generate code that is then fed as input into the Pythonexec() method, allowing code execution - one variant of a "promptinjection" attack. Framework for LLM applications allows eval injection via a crafted response from a hosting provider. Python compiler uses eval() to execute malicious strings as Python code. Chain: regex in EXIF processor code does not correctly determine where a string ends (CWE-625), enabling eval injection (CWE-95), as exploited in the wild per CISA KEV. "Code injection" in VPN product, as exploited in the wild per CISA KEV. Eval injection in PHP program. Eval injection in Perl program. Eval injection in Perl program using an ID that should only contain hyphens and numbers. Direct code injection into Perl eval function. Eval injection in Perl program. Direct code injection into Perl eval function. Direct code injection into Perl eval function. MFV. code injection into PHP eval statement using nested constructs that should not be nested. MFV. code injection into PHP eval statement using nested constructs that should not be nested. Code injection into Python eval statement from a field in a formatted file. Eval injection in Python program. chain: Resultant eval injection. An invalid value prevents initialization of variables, which can be modified by attacker and later injected into PHP eval statement. Perl code directly injected into CGI library file from parameters to another CGI program. Direct PHP code injection into supporting template file. Direct code injection into PHP script that can be accessed by attacker. PHP code from User-Agent HTTP header directly inserted into log file implemented as PHP script.

References


 

CPE

cpe start end
Configuration 1
cpe:2.3:a:sabberworm:php_css_parser:*:*:*:*:*:*:*:* < 8.3.1


REMEDIATION


Patch

Url
https://github.com/sabberworm/PHP-CSS-Parser/commit/2ebf59e8bfbf6cfc1653a5f0e...


EXPLOITS


Exploit-db.com

id description date
No known exploits

POC Github

Url
No known exploits

Other Nist (github, ...)

Url
http://packetstormsecurity.com/files/157923/Sabberworm-PHP-CSS-Code-Injection...
http://seclists.org/fulldisclosure/2020/Jun/7


CAPEC


Common Attack Pattern Enumerations and Classifications

id description severity
242 Code Injection
High
35 Leverage Executable Code in Non-Executable Files
Very High
77 Manipulating User-Controlled Variables
Very High


MITRE


Techniques

id description
T1027.006 Obfuscated Files or Information: HTML Smuggling
T1027.009 Obfuscated Files or Information: Embedded Payloads
T1564.009 Hide Artifacts: Resource Forking
© 2022 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation.

Mitigations

id description
T1027.006 Browser sandboxes can be used to mitigate some of the impact of exploitation, but sandbox escapes may still exist.
T1027.009 On Windows 10, enable Attack Surface Reduction (ASR) rules to prevent execution of potentially obfuscated scripts.
T1564.009 Configure applications to use the application bundle structure which leverages the <code>/Resources</code> folder location.
© 2022 The MITRE Corporation. Esta obra se reproduce y distribuye con el permiso de The MITRE Corporation.