A function of phpyun does not strictly process parameters, resulting in SQL injection.

Source: Internet
Author: User

Phpyun personal member center member/model/index. class. php $ _ COOKIE ["usertype"]; The parameter is injected. The following Code shows that $ data ["usertype"] directly reads the COOKIE value and brings it into SQL, SQL does not filter the value

Function msg_action () {if ($ _ GET ["del"]) {$ nid = $ this-> obj-> DB_delete_all ("userid_msg ", "'id' = '". $ _ GET ["del"]. "'and 'uid' = '". $ this-> uid. "'"); isset ($ nid )? $ This-> obj-> ACT_msg ("index. php? C = msg "," deleted successfully "): $ this-> obj-> ACT_msg (" index. php? C = msg "," failed to delete ") ;}$ this-> public_action (); $ urlarr = array (" C "=>" msg ", "page" => "{page}"); $ pageurl = $ this-> url ("index", "index", $ urlarr ); $ this-> get_page ("userid_msg", "'uid' = '". $ this-> uid. "'and type! = '1' order by id desc ", $ pageurl," 20 "); if ($ _ GET [" c_uid "]) {$ data ["c_uid"] = $ _ GET ["c_uid"]; $ data ["inputtime"] = mktime (); $ data ["p_uid"] = $ _ COOKIE ["uid"]; $ data ["usertype"] = $ _ COOKIE ["usertype"]; $ data ["com_name"] = $ _ GET ["c_name"]; $ haves = $ this-> obj-> DB_select_once ("blacklist ", "'P _ uid' = ". $ data ["p_uid"]. "and 'C _ uid' = ". $ data ["c_uid"]. "and 'usertype' = ". $ data ["usertype"]. ""); if (is_array ($ haves) {$ this-> obj-> ACT_m Sg ($ _ SERVER ['HTTP _ referer'], "This user is already in your blacklist ");} else {$ nid = $ this-> obj-> insert_into ("blacklist", $ data); $ this-> obj-> DB_delete_all ("userid_msg ", "'uid' = ". $ data ["p_uid"]. "and 'fid' = ". $ data ["c_uid"]. "", ""); $ nid? $ This-> obj-> ACT_msg ($ _ SERVER ['HTTP _ referer'], "Operation successful "): $ this-> obj-> ACT_msg ($ _ SERVER ['HTTP _ referer'], "operation failed") ;}} function DB_select_once ($ tablename, $ where = 1, $ select = "*") {$ cachename = $ tablename. $ where; if (! $ Return = $ this-> Memcache_set ($ cachename) {$ SQL = "SELECT ". $ select. "FROM ". $ this-> def. $ tablename. "WHERE ". $ where. "limit 1"; echo $ SQL; $ query = $ this-> db-> query ($ SQL ); $ return = $ this-> db-> fetch_array ($ query); $ this-> Memcache_set ($ cachename, $ return);} return $ return ;}

 

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.