When you see the discuz dede vulnerability, you will be inspired. Haha ......
The process is simple. Remember that there is no need to post too much code.
Diff
Balabalabala .....
If (! Defined ('in _ discuz ')){
-89,7 + 89,7 @@
}
}
If ($ searcharray & $ replacearray ){
-$ Content = preg_replace ("/(<a \ s +. *?>. *? <\/A>) | () | (\ [Attach \] (\ d +) \ [\/attach \])/ies ", 'helper _ seo: base64_transform (" encode ", "<relatedlink>", "\ 1 \ 2 \ 3", "</relatedlink>") ', $ content );
+ $ Content = preg_replace ("/(<a \ s +. *?>. *? <\/A>) | () | (\ [Attach \] (\ d +) \ [\/attach \])/ies "," helper_seo: base64_transform ('encoding', '<relatedlink> ', '\ 1 \ 2 \ 3',' </relatedlink> ') ", $ content );
$ Content = preg_replace ($ searcharray, $ replacearray, $ content, 1 );
$ Content = preg_replace ("/<relatedlink> (.*?) <\/Relatedlink>/ies "," helper_seo: base64_transform ('decode', '', '\ 1','') ", $ content );
}
@-100,7 + 100,7 @ www.2cto.com
Public static function base64_transform ($ type, $ prefix, $ string, $ suffix ){
If ($ type = 'encoding '){
-Return $ prefix. base64_encode (str_replace ("\ '", "'", $ string). $ suffix ;//--
+ Return $ prefix. base64_encode (str_replace ("\\\" "," \ "", $ string). $ suffix;
} Elseif ($ type = 'decode '){
Return $ prefix. base64_decode ($ string). $ suffix;
}
It is clear enough that the problem is located near line 92 of/source/class/helper/helper_seo.php:
$ Content = preg_replace ("/(. *? <\/A>) | (\ [attach \] (\ d +) \ [\/attach \])/ies ", 'helper _ seo :: base64_transform ("encode", "", "\ 1 \ 2 \ 3", "") ', $ content );
Preg_replace uses the e modifier and double quotation marks, which causes remote arbitrary code execution.
The Forum must support a number of functions. For more information about the functions, see row 68 $ _ G ['cache'] ['relatedlink'] And relatedlink in grep. Do not paste the specific code first, find the seo function that needs to be enabled in the background, and click "operation"-"Link"/"admin. php? Frames = yes & action = misc & operation = relatedlink, and at least one link needs to be set. This function is not available to all administrators, but I think most of it will be available, it can only be a shell tips in the background.
Function_core.php 1925
Function parse_related_link ($ content, $ extent ){
Return helper_seo: parse_related_link ($ content, $ extent );
}
View Regular Expressions
"/(<A \ s +. *?>. *? <\/A>) | () | (\ [Attach \] (\ d +) \ [\/attach \])/ies"
So is the method still used? Various places, such as source/include/space/space_blog.php, all understand: P
The detailed usage method will be made public later. I will go to work in the company's data center later to see the scope of the impact. After five points, I will find a program for a long time.
Author's blog