CnCxzSecs Blog
Brief description:
Discuz! 7.2/X1 mood wall plug-in SQL injection and persistent XSS vulnerabilities.
SQL injection is quite bad, and GPC is required to be off (currently, such websites are almost out of print)
Because XSS is persistent, It is triggered as long as the administrator opens the application. How to Use XSS is wise.
Detailed description:
By Discuz! Authenticated (Http://addons.discuz.com/workroom.php) Mood wall plug-ins (Http://www.discuz.net/forum.php? Mod = viewthread & tid = 1632898.). SQL injection and cross-site scripting are caused by uninitialized dependent variables and lax filtering.
Moodwall. inc. php
SQL injection, in addition to the following code, there are many such cases in this file that can be directly used after $ _ POST is obtained. Terrible.
Elseif ($ action = edit_mood & moodid ){
// Moodid is not initialized and directly entered into SQL query
$ Check = $ db-> result_first ("SELECT * FROM {$ tablepre} moodwall WHERE id = $ moodid AND uid = $ discuz_uid ");
If (! $ Check |! $ Moodid ){
Showmessage (moodwall: moodwall_inc_php_2, plugin. php? Id = moodwall & action = user_mood );
}
$ SQL = "SELECT * FROM {$ tablepre} moodwall WHERE id = $ moodid ";
$ Query = $ db-> query ($ SQL );
$ Moodlist_edit = array ();
While ($ mood_edit = $ db-> fetch_array ($ query )){
$ Moodlist_edit [] = $ mood_edit;
}
XSS
$ Uid = $ _ POST [uid];
$ Username = $ _ POST [username];
$ Bgpic = $ _ POST [bgpic];
$ Mood = $ _ POST [mood];
$ Message = $ _ POST [message];
$ Dateline = time ();
// $ _ POST get the data directly into the database, and the front-end warehouse code is not filtered, so it will not be pasted here.
$ Db-> query ("insert into {$ tablepre} moodwall (uid, username, bgpic, mood, message, dateline) VALUES ($ uid, $ username, $ bgpic, $ mood, $ message, $ dateline )");
Proof of vulnerability:
Find a website to install this application at will:
/Plugin. php? Id = moodwall & action = edit_mood & moodid = 2
Insert html code directly in the posting mood
"> <Script> alert (/xss/) </script>
Solution:
Filter, filter, initialize, and initialize.
Discuz is strongly recommended! The team strictly reviews third-party applications and then publishes them on its own official forum. Discuz! Not once or twice because of the plug-in failure.