Twenty Year Anniversary

Relevanssi 3.5.12 / 3.6.0 SQL Injection

Relevanssi 3.5.12 / 3.6.0 SQL Injection
Posted Apr 11, 2018
Authored by Glyn Wintle

Relevanssi versions 3.5.12 and 3.6.0 suffer from a remote SQL injection vulnerability.

tags | exploit, remote, sql injection
MD5 | 410a758b0c586d1e5043901f4f2ce80d

Relevanssi 3.5.12 / 3.6.0 SQL Injection

Change Mirror Download
Details
================
Software: Relevanssi
Version: 3.5.12,3.6.0
Homepage: https://wordpress.org/plugins/relevanssi/
Advisory report: https://advisories.dxw.com/advisories/sqli-relevanssi/
CVE: Awaiting assignment
CVSS: 8.5 (High; AV:N/AC:L/Au:S/C:C/I:C/A:N)

Description
================
SQLi in Relevanssi might allow an admin to read contents of database

Vulnerability
================
If logged in as an administrator on any site, you can go to Settings > Relevanssi Premium and potentially extract all values in the database including password hashes and user activation tokens.
This is achieved by a SQL injection based on the fact that some of the configuration options are appended into a SQL query in a unsafe way.
The configuration page contains the following code, that allows the user to set the option relevanssi_post_type_weights to any value:
function update_relevanssi_options() {
....
foreach ($_REQUEST as $key => $value) {
if (substr($key, 0, strlen(\'relevanssi_weight_\')) == \'relevanssi_weight_\') {
$type = substr($key, strlen(\'relevanssi_weight_\'));
$post_type_weights[$type] = $value;
}
....
}
if (count($post_type_weights) > 0) {
update_option(\'relevanssi_post_type_weights\', $post_type_weights);
}
....
}
Now when a search is made, the function relevanssi_search is called, this appends the user controled value into the SQL query:
$post_type_weights = get_option(\'relevanssi_post_type_weights\');

...

!empty($post_type_weights[\'post_tag\']) ? $tag = $post_type_weights[\'post_tag\'] : $tag = $relevanssi_variables[\'post_type_weight_defaults\'][\'post_tag\'];

!empty($post_type_weights[\'category\']) ? $cat = $post_type_weights[\'category\'] : $cat = $relevanssi_variables[\'post_type_weight_defaults\'][\'category\'];

$query = \"SELECT relevanssi.*, relevanssi.title * $title_boost +
relevanssi.content + relevanssi.comment * $comment_boost +
relevanssi.tag * $tag + relevanssi.link * $link_boost +
relevanssi.author + relevanssi.category * $cat + relevanssi.excerpt +
relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
FROM $relevanssi_table AS relevanssi $query_join
WHERE $term_cond $query_restrictions\";

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

Visit /wp-admin/options-general.php?page=relevanssi%2Frelevanssi.php
Assign 0.75\' (the default value plus a single quote at the end) to aTag weighta
Press aSave the optionsa
Visit /?s=test
The logs should contain the following error because of the syntax error we introduced: aWordPress database error You have an error in your SQL syntaxa

Note: while itas possible to inject syntax errors, itas currently unknown whether this bug can be used to inject anything that would be useful to an attacker.

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

Disclosure policy
================
dxw believes in responsible disclosure. Your attention is drawn to our disclosure policy: https://security.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-02: Reported to vendor via email
2017-10-03: First response from vendor
2017-10-03: Version 3.6.1 released which contains a fix for this bug



Discovered by dxw:
================
Glyn Wintle
Please visit security.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:

July 2018

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