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