Discuz! 7.2/X1 mood wall plug-in SQL injection and persistent XSS vulnerability analysis and repair

Source: Internet
Author: User

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.

Related Article

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.