sql注入

来源:互联网 发布:淘宝秒杀助手 编辑:程序博客网 时间:2024/05/23 07:24

SQL注入
在form中提交信息时,根据SQL语法特殊性,编写关键字,而这些关键字拼接到sql中会改变原来sql运行效果 — 达到攻击目的
String sql = “select * from users where name = ” and pwd =””;
如果用户输入关键内容,改变登陆结果
用户名: ddd’ or ‘1’=’1
密码:xxx
select * from users where name = ‘ddd’ or ‘1’=’1’ and pwd =’xxx’

用注释注入 –
用户名: ddd’ –
密码: xxx
select * from users where name = ‘ddd’ – ’ and pwd =’xxx’

不知道账户登陆
用户名: xxx’ or ‘1’=’1’ –
密码: xxx
select * from users where name = ‘xxx’ or ‘1’=’1’ – ’ and pwd =’xxx’

在Java语言解决SQL 注入 —- 使用预编译 PreparedStatement

0 0
原创粉丝点击