Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[网络] 32.sql 注入原理 #969

Open
qiilee opened this issue Feb 24, 2020 · 0 comments
Open

[网络] 32.sql 注入原理 #969

qiilee opened this issue Feb 24, 2020 · 0 comments

Comments

@qiilee
Copy link
Member

qiilee commented Feb 24, 2020

答案:就是通过把 SQL 命令插入到 Web 表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的 SQL 命令。

总的来说有以下几点:

  1. 永远不要信任用户的输入,要对用户的输入进行校验,可以通过正则表达式,或限制长度,对单引号和双"-"进行转换等。

  2. 永远不要使用动态拼装 SQL,可以使用参数化的 SQL 或者直接使用存储过程进行数据查询存取。

  3. 永远不要使用管理员权限的数据库连接,为每个应用使用单独的权限有限的数据库连接。

  4. 不要把机密信息明文存放,请加密或者 hash 掉密码和敏感的信息。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant