Twenty Year Anniversary

WordPress Redirection 2.7.3 Remote File Inclusion

WordPress Redirection 2.7.3 Remote File Inclusion
Posted Jun 12, 2018
Authored by Glyn Wintle

WordPress Redirection plugin version 2.7.3 suffers from a remote file inclusion vulnerability.

tags | exploit, remote, code execution, file inclusion
MD5 | ad8fd6f0edda2fb7d07a6e8d56138be6

WordPress Redirection 2.7.3 Remote File Inclusion

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

Description
================
ACE via file inclusion in Redirection allows admins to execute any PHP file in the filesystem

Vulnerability
================



If you are logged in as an administrator on any site by using the setup page for the redirection plugin you can run arbitrary code and completely compromise the system.
This is done by writing the URL to redirect to in the format file://path/to/file/here. Unfortunately the plugin executes any PHP within that file. This means that any file with any extension on the filesystem that contains a small amount of user controlled data can be turned into a back door. The plugin also has the functionality to create files and place user controlled data in them. This results in attacker controlled code running and complete compromise of the system.
When the code for handling a redirect looks at the URL to redirect to it does the following:





class Pass_Action extends Red_Action {
function process_before( $code, $target ) {
// Determine what we are passing to: local URL, remote URL, file
if ( substr( $target, 0, 7 ) === \'http://\' || substr( $target, 0, 8 ) === \'https://\' ) {
echo @wp_remote_fopen( $target );
die();
}
else if ( substr( $target, 0, 7 ) === \'file://\' ) {
$parts = explode( \'?\', substr( $target, 7 ) );
if ( count( $parts ) > 1 ) {
// Put parameters into the environment $args = explode( \'&\', $parts[1] );
if ( count( $args ) > 0 ) {
foreach ( $args as $arg ) {
$tmp = explode( \'=\', $arg );
if ( count( $tmp ) === 1 )
$_GET[ $arg ] = \'\';
else
$_GET[ $tmp[0] ] = $tmp[1];
}
}
}

include( $parts[0] );
exit();
}
else {
$_SERVER[\'REQUEST_URI\'] = $target;
if ( strpos( $target, \'?\' ) ) {
$_SERVER[\'QUERY_STRING\'] = substr( $target, strpos( $target, \'?\' ) + 1 );
parse_str( $_SERVER[\'QUERY_STRING\'], $_GET );
}
}

return true;
}
}







The above code behaves as expected if the url to redirect to is a HTTP or HTTPS URL.
If the URL begins with file:// it passes the path to the include function.
Its also worth mentioning that if the URL is not http, https or file, then the code allows the $_GET parameter to be contaminated with unescaped values, which may result in SQL injections.




Proof of concept
================

echo a<?php phpinfo();a > dog-meme.jpg
Visit /wp-admin/media-new.php
Upload dog-meme.jpg
Copy the URL of the file (i.e. http://localhost/wp-content/uploads/2017/10/dog-meme.jpg)
Visit /wp-admin/tools.php?page=redirection.php
Fill aSource URLa with a/testa
Fill aTarget URLa with afile:///var/www/html/wp-content/uploads/2017/10/dog-meme.jpga (this will probably require some modification if your WP installation is at a different path or dog-meme.jpg is saved in a different directory)
Set aGroupa to aRedirectionsa
Press aAdd Redirecta
Press aEdita on the newly added redirect
Press the cog icon
Set aWhen matcheda to aPass-througha
Press aSavea


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. Plugin author reports this as intended behaviour, as
it is assumed that the administrator has full access to the system. However, also future version will include a fix.

2017-10-18: Author reported fixed in 2.8
2018-06-12: Advisory published



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




Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

Want To Donate?


Bitcoin: 18PFeCVLwpmaBuQqd5xAYZ8bZdvbyEWMmU

File Archive:

August 2018

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close