我觉得你应该先了解下什么是sql注入,所谓SQL注入式攻击,就是攻击者把SQL命令插入到Web表单的输入域或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令。在某些表单中,用户输入的内容直接用来构造(或者影响)动态SQL命令,或作为存储过程的输入参数,这类表单特别容易受到SQL注入式攻击。 你可以了解下这个http://www.cnblogs.com/heyuquan/archive/...,sql注入是一种安全隐患,实际上跟是什么数据库没有直接关系,是程序过滤不完全导致的,简单的注入就是用户输入了特殊字符,导致我们在代码中的sql语句变了查询的结果也不是我们想要的!
其实吧,我们现在写sql直接都是预编译sql,也就是说你想注入。。。可能是没戏了
直接给你举两个例子吧!【】里面的代表实际sql位置传入的参数
我们的代码:select username,password from user where username=?
然后你传入参数【123 or username is not null】
数据库带着你的参数传进去然后编译这条sql语句
然后编译结果就是:select username,password from user where username='123' or username is not null
最终执行结果就是 所有的用户都查出来了
我们的代码:select username,password from user where username=?
然后你传入参数【123 or username is not null】
然后数据库编译这条sql语句 select username,password from user where username=?
然后带着你的参数放在username位置 发现是字符串,然后加上单引号‘’
然后执行的sql就是:select username,password from user where username=‘123 or username is not null’
最终执行结果就是没有username=‘123 or username is not null’ 的
所以,这填空题你咋填都不对
下载App
关注公众号
Copyright©2023 w3cschool编程狮|闽ICP备15016281号-3|闽公网安备35020302033924号
违法和不良信息举报电话:173-0602-2364|举报邮箱:jubao@eeedong.com
联系方式: