ibatis之sql注入

WBOY
Release: 2016-06-07 16:21:12
Original
1101 people have browsed it

今天亲自试了一把,原来ibatis中的$是如此的危险,如果你用$的话,很可能就会被sql注入!!! 所以: 使用:select * from t_user where name like '%'||#name #||'%' 禁用:select * from t_user where name like '%'||'$name$'||'%' 解释: 预编译语句已经对o

  今天亲自试了一把,原来ibatis中的$是如此的危险,如果你用$的话,很可能就会被sql注入!!!

  所以:

  使用:select * from t_user where name like '%'||#name #||'%'

  禁用:select * from t_user where name like '%'||'$name$'||'%'

  解释:

  预编译语句已经对oracle的特殊字符单引号,进行了转义。即将单引号视为查询内容,,而不是字符串的分界符。

  由于SQL注入其实就是借助于特殊字符单引号,生成or 1= 1这种格式的sql。预编译已经对单引号进行了处理,所以可以防止SQL注入

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!