IT资讯 4 个单词,谷歌返回 16 个 SQL 注入漏洞

robbie · 2021-07-27 11:00:08 · 热度: 21

一名开发者出于好奇在 Google 使用php mysql email register作为关键词进行了搜索。很显然,这是在查找如何使用 PHPMySQL 实现邮箱注册的功能。

搜索结果返回了教程、操作方法、代码片段等内容。不过大多数结果都包含有错误的 SQL 语句,例如:

// Don't do this!
mysqli_query("SELECT * FROM user WHERE id = '" . $_POST["user'] . "'");

根据对谷歌搜索结果的整理,这些 SQL 语句可大致分为四种类型:

  1. SQL 查询中的所有参数都被转义
  2. 只在绝对必要的情况下才对传入的参数进行转义
  3. 作者尝试进行了部分转义,但存在漏洞
  4. 没有任何转义逻辑
# Status URL Site Notes
1 3 link CodeWithAwa "SELECT * FROM users WHERE email='$email' LIMIT 1";
2 1 link envatotuts+  
3 1 link Code Boxx  
4 1 link Aaraf Academy  
5 3 link Webslesson WHERE user_activation_code = '".$user_activation_code."'
6 2 link CodingNepal  
7 3 link YouTube Timestamp provided
8 3 link YouTube This is part 1 of a series of 3. Part 1 is fine, but there are problems in part 2, as well as part 3 here and here and here
9 4 link morioh Redirects you to tutsmake.com where the code is to be found
10 3 link Webs Codex "SELECT * FROM users WHERE otp = '$postOtp'
11 1 link CodeShack  
12 1 link webtipstricks  
13 4 link studentstutorial  
14 4 link positronX.io  
15 1 link Mage Mastery  
16 1 link phppot  
17 4 link TalkersCode  
18 3 link OurSourceCode $query = "update users set status='1' where token='$token'";
19 1 link DZone  
20 3 link Sourcecodester mysqli_query($conn,"select * from user where userid='$user'"), Also, using htmlspecialchars() for SQL escaping everywhere
21 4 link coding cyber  
22 2 link developphp Uses custom RegExes mostly
23 4 link ProgrammerSought  
24 1 link Grepper  
25 1 link CodeAndCourse  
26 4 link w3tweaks  
27 1 link Speedy Sense  
28 1 link Technopoints  
29 4 link Techno Smarter  
30 4 link FormGet  

这名开发者表示,当他发现一个搜索结果中存在有问题的 SQL 语句时,就会跳到浏览下一个结果。上面就是根据此过程整理出来的 30 条搜索结果,其中部分答案包含 SQL 注入语句。对此他认为,大多数 Google 搜索结果的质量十分低下。有些搜索结果就是通过 SEO 优化而排在前面的“扯淡”教程。

同时,这篇文章也引起了 程序员 的广泛讨论(redditHacker News),不过大家关注的重点也纷纷转移到了编程语言 PHP 上。但作者本意其实是希望程序员能甄别互联网上随手可得的任何资料,毕竟这里面鱼龙混杂。尤其要注意那些通过 SEO 优化而排名靠前的搜索结果,因为它们往往就是“雷区”。

猜你喜欢:
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册