我在我的数据库中发现了很多奇怪的字符串,有人试图进入我的网站?

I found a lot of weird string in my database, someone trying to get into my site?

我有一个带有“联系我们”功能的小型网站 (MVC5),今天早上我发现我有数百封来自同一 IP 的电子邮件。我从数据库中查询结果,所有结果都只是一堆奇怪的字符串和一些 script/SQL 注入。

我已经在我的数据库(SQL Server 2014)上使用了参数并对所有用户输入进行了白名单过滤。只是想知道我是否应该担心?

Joey'"
Joey\'\"
Joey'"'"'"'"
Joey AND 1=1 -- 
Joey AND 1=2 -- 
Joey" AND 1=1 -- 
Joey" AND 1=2 -- 
Joey'
Joey
Joey\'
Joey
Joey" UNION SELECT 8, table_name, 'vega' FROM information_schema.tables WHERE table_name like'%
1 AND 1=1 -- 
1 AND 1=2 -- 
' AND 1=1 -- 
' AND 1=2 -- 
" AND 1=1 -- 
" AND 1=2 -- 
Joey''
Joey' UNION SELECT 8, table_name, 'vega' FROM information_schema.taables WHERE taable_name like'%
javascript:vvv002664v506297
vbscript:vvv002665v506297
" onMouseOver=vvv002666v506297
" style=vvv002667v506297
' onMouseOver=vvv002668v506297
/../../../../../../../../../../../../etc/passwd
Joey`true`
Joey`false`
Joey`uname`
' style=vvv002669v506297
Joey"`false`"
Joey"`uname`"
Joey'true'
Joey'false'
Joey'uname'
Joey" UNION SELECT 8, table_name, 'vega' FROM information_schema.taables WHERE taable_name like'%
htTp://www.google.com/humans.txt
hthttpttp://www.google.com/humans.txt
hthttp://tp://www.google.com/humans.txt
Joey
Joey-0-0
Joey\'\"
Joey\'\"
Joey - 0 - 0
Joey 0 0 - -
http://vega.invalid/;?
//vega.invalid/;?
vega://invalid/;?
src=http://vega.invalid/;?
" src=http://vega.invalid/;?
Joeybogus Vega-Inject:bogus
www.google.com/humans.txt
Joeybogus Vega-Inject:bogus
Joey-0
Joey-0-9
Joey
Joey'"
Joey' UNION SELECT 8, table_name, 'vega' FROM information_schema.tables WHERE table_name like'%
Joey' AND 1=2 -- 
Joey' AND 1=1 -- 
Joey''''""""
Joey\'\"
Joey
Joey
Joey
http://www.google.com/humans.txt
Joey
Joey"`true`"
Joey

看起来有人试图通过 SQL 注入。只要您使用输入验证并转义输入,您就应该在这方面没问题。不过,您可能想研究其他强化网站的方法。

这是 protecting against SQL Injection in ASP.NET 的资源。 general website hardening 的另一个资源。希望对您有所帮助!

似乎没有什么你需要过度担心的,人们总是会尝试利用输入表单来查看他们是否能够取回任何数据。看起来你已经完成了所有基本和标准的方法来防止它们到达任何地方。您可以使用多种方法来阻止这种情况的发生。

请求限制

这非常简单,您实际上只是在限制单个用户在一段时间内能够在联系表单中提交数据的次数。有很多关于这个的文章和许多答案分散在 SO 上。最简单的方法是使用 HttpRuntime 缓存并简单地存储用户 IP 地址和过期时间。然后在每个请求上检查缓存以确保他们的 IP 地址没有存储在其中。

IP 封禁

此方法与上述方法类似,但更长期。最简单的方法是跟踪提交多个查询的用户,如果他们在 10 分钟左右的 space 内发送了超过 30 个,请将他们的 IP 地址添加到 table 中,您可以检查并防止他们不再提交查询。

您甚至可以将两者结合使用。

是的,有人试图入侵您的网站。看起来它可能是一个脚本。

我建议使用安全扫描工具来查看您的应用程序中是否存在任何明显的漏洞。 OWASP 有 list 个有用的工具。