Aliyun tips for discuz memcache+ssrf Getshell vulnerabilities

Source: Internet
Author: User

A lot of friends must have received Aliyun hint Discuz memcache+ssrf Getshell loophole, but the purchase of Ali the knight to pay the minimum 100 yuan, I would like to share below how to solve the Discuz MEMCACHE+SSRF The problem of Getshell vulnerabilities.

Vulnerability Analysis:

Discuz There is a ssrf vulnerability, in the case of configuration memcache, the attacker can use SSRF through the memcache relay, write Webshell malicious code to the disk, resulting in database leaks.

Workaround One:

Download the use of Cloud Shield Knight repair after the function_core.php file overwrite the original file can be.

File Road Strength:/source/function/function_core.php

You can also add the following code after 1090 lines:

The code is as follows Copy Code

if (!empty ($_g[' setting '] [' output '] [' preg '] [' search ']] && (empty $_g[' setting '] [' rewriteguest ']) | | empty ($ _g[' UID '])) {
if (Empty ($_g[' setting '] [' domain '] [' app '] [' Default ']) {
$_g[' setting ' [' Output '] [' preg '] [' search '] = Str_replace (' \{curhost\} ', Preg_quote ($_g[' SiteURL '], '/'), $_g[' Setting ' [' Output '] [' preg '] [' search ']];
$_g[' setting ' [' Output ']] [' preg '] [' replace '] = Str_replace (' {curhost} ', $_g[' SiteURL '], $_g[' setting '] [' output '] [' Preg ' [' replace ']];
}

if (Preg_match (/|#|\+|%). *(/|#|\+|%) E ", $_g[' setting ' [' Output ']] [' preg '] [' search ']]!== FALSE) {die (" request Error ");} $content = Preg_replace ($_g[' Setting '] [' output '] [' preg '] [' search '], $_g[' setting ' [' Output '] [' preg '] [' replace '], $content);
}

Workaround two: Stop using or uninstall Memcache

Memcache Uninstall method under Windows:

memcached-d stop

memcached-d Remove

SC delete "Memcached Server"

Linux memcached Uninstall method

1, first find your memcached directory, you can use the following command to find a folder named memcached
Find/-name memcached
2. End memcached Process
Killall memcached
3, delete the memcached directory and documents
Rm-rf/www/wdlinux/memcached
Rm-rf/www/wdlinux/init.d/memcached
4, turn off memcached boot
Chkconfig memcached off
5. Remove the memcached from the boot
Chkconfig–del memcached

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.