what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

WordPress Redirection 2.7.1 Deserialization Code Execution

WordPress Redirection 2.7.1 Deserialization Code Execution
Posted Jun 15, 2018
Authored by Glyn Wintle

WordPress Redirection plugin version 2.7.1 suffers from a code execution vulnerability.

tags | exploit, code execution
SHA-256 | 6e03c93d4bc0c24637449acea5c75634bca5123ff219155cf49649fbad878f18

WordPress Redirection 2.7.1 Deserialization Code Execution

Change Mirror Download
Details
================
Software: Redirection
Version: 2.7.1
Homepage: https://wordpress.org/plugins/redirection/
Advisory report: https://advisories.dxw.com/advisories/unserialization-redirection/
CVE: Awaiting assignment
CVSS: 9 (High; AV:N/AC:L/Au:S/C:C/I:C/A:C)

Description
================
Unserialization vulnerability in Redirection could allow admin to execute arbitrary code in some circumstances

Vulnerability
================
It is possible for a user with the administrator privilege to submit a string that contains an encoded object that executes arbitrary code of the attackeras choosing.
The value can be passed in with an AJAX request to admin-ajax.php using the red_ajax_set_redirect action that is passed to the ajax_set_redirect method in this code:
public function ajax_set_redirect( $params ) {
$params = $this->get_params( $params );
....
$result = $redirect->update( $params );
}

private function get_params( $params ) {
if ( empty( $params ) ) {
$params = $_POST;
}
return $params;
}

The update method then passes the attack string to this code:
class Red_Item {
public function update( $details ) {
$data = $sanitizer->get( $details );
$this->load_from_data( (object) $data );
}

private function load_from_data( stdClass $values ) {
foreach ( $values as $key => $value ) {
$this->$key = $value; }
}
The sanitizer does not sanitize the action_data value. Many calls to this class then use its to_json method, which is as follows:
public function get_action_data() {
return $this->action_data ? $this->action_data : \'\';
}

public function to_json() {
maybe_unserialize( $this->get_action_data() ),
}

The sum effect is therefore that unsanitized user input is being passed to maybe_unserialize().


Proof of concept
================
Achieving arbitrary code execution depends on which classes are available (i.e. which plugins and themes are installed and active). It may not be possible in all situations. As such, this PoC will merely attempt to show that an arbitrary string can be passed to the maybe_unserialize() function.

Visit /wp-admin/tools.php?page=redirection.php
Create a new redirect with a/booa, ahttps://www.dxw.com/a, and aRedirectionsa.
Weall assume this redirect was given ID of 1 in the wp_redirection_items table. If that isnat true, change the aida value in the provided JavaScript.
Then, without leaving the page, open your browseras console and execute this JavaScript:
jQuery.ajax(ajaxurl,{
method: \'POST\',
data: {
\'action\': \'red_set_redirect\',
\'_wpnonce\': window.Redirectioni10n.WP_API_nonce,
\'id\': \'1\',
\'match_type\': \'url\',
\'action_code\': \'1\',
\'action_type\': \'url\',
\'url\': \'https://www.dxw.com/\',
\'group_id\': \'1\',
\'action_data\': \'O:8:\"stdClass\":1:{s:5:\"hello\";s:5:\"world\";}\',
},
}).done(console.log)
Then, by inspecting the JavaScript object printed by console.log, or by looking at the Network logs, youall notice that we have a {ahelloa: aworlda} JavaScript object showing that our arbitrary string was passed to unserialize() and therefore, if the correct classes were available, we would be able to turn this into arbitrary code execution.

Mitigations
================
Upgrade to version 2.8 or later.

Disclosure policy
================
dxw believes in responsible disclosure. Your attention is drawn to our disclosure policy: https://advisories.dxw.com/disclosure/

Please contact us on security@dxw.com to acknowledge this report if you received it via a third party (for example, plugins@wordpress.org) as they generally cannot communicate with us on your behalf.

This vulnerability will be published if we do not receive a response to this report with 14 days.

Timeline
================

2017-10-02: Discovered
2017-10-03: Reported via website contact form
2017-10-04: Response received. Author has asked for PoC: aThe value for action_data is sanitised when it is passed through Red_Item_Sanitizea
2017-10-09: Developed a PoC
2017-10-10: Working PoC provided to author.
2017-10-18: Author reported fixed in 2.8
2018-06-06: Advisory published
2018-06-12: CVE requested



Discovered by dxw:
================
Glyn Wintle
Please visit advisories.dxw.com for more information.




Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close