我使用nginx + php5-fpm运行一个小型wordpress站点。
我注意到很多僵尸网络攻击来自具有主机名的IP,如:
52-182.static.spheral.ru
208-135.static.spheral.ru
118-239.static.spheral.ru与这些机器相关的实际IP是非常不同的,实际上没有一个可识别的模式:
195.62.52.182
195.88.208.135
193.19.118.239如何通过与主机名模式匹配的IP阻止来自所有机器的请求:
*.static.spheral.ru我想在nginx中直接这样做,以避免额外的跳转(以及消耗机器资源),这需要从php进程中完成。
我相信,通过主机名的阻塞将允许我先发制人地阻止来自同一僵尸网络的未来攻击,但来自尚未向我透露的IP。
(如果需要的话,我很乐意安装一个nginx插件/附加软件。)
发布于 2016-06-03 02:21:57
首先,让我从一个重要的事实开始:反向IP查找的Regex对于阻止传入请求是个坏主意。反向DNS是一种信息功能。与DNS不同,在DNS中,域必须指向正确的IP地址,因此反向查找IP指向任意域几乎没有什么后果。因此,攻击者在反向DNS记录中遍历任意域以不断绕过过滤器是非常简单的。基于反向DNS的安全功能可分为CWE-350 (https://cwe.mitre.org/data/definitions/350.html).
在这种情况下,问题的根源似乎是一个特定的提供者,所以您只需阻止他们的整个IP范围。让我们首先查找其中一个IP地址(我假设反向IP->主机名条目在本例中是有效的):
~# nslookup 52-182.static.spheral.ru
Server: 192.168.153.2
Address: 192.168.153.2#53
Non-authoritative answer:
Name: 52-182.static.spheral.ru
Address: 195.88.209.9现在让我们确定它们的IP范围/提供者:
root@bt:~# whois 195.88.209.9
% This is the RIPE Database query service.
% The objects are in RPSL format.
%
% The RIPE Database is subject to Terms and Conditions.
% See http://www.ripe.net/db/support/db-terms-conditions.pdf
% Note: this output has been filtered.
% To receive output for a database update, use the "-B" flag.
% Information related to '195.88.208.0 - 195.88.209.255'
% Abuse contact for '195.88.208.0 - 195.88.209.255' is 'info@spheral.ru'
inetnum: 195.88.208.0 - 195.88.209.255
netname: IPSERVER
descr: Operated by IT Expert LLC
remarks: Abuse mailbox: abuse@ipserver.su
country: RU
org: ORG-Al123-RIPE
admin-c: SOV63-RIPE
tech-c: SOV63-RIPE
status: ASSIGNED PI
mnt-by: RIPE-NCC-END-MNT
mnt-by: MNT-SPHERE
mnt-routes: MNT-SPHERE
mnt-routes: FIORD-MNT
mnt-domains: MNT-SPHERE
created: 2009-04-15T12:34:23Z
last-modified: 2016-04-14T09:38:32Z
source: RIPE
sponsoring-org: ORG-SL202-RIPE
organisation: ORG-Al123-RIPE
org-name: Antaro ltd.
abuse-mailbox: abuse@spheral.ru
org-type: other
address: 127473, Moscow, 2 Schemilovskiy per., d.5/4., str.1
abuse-c: AC29892-RIPE
mnt-ref: ANTARO-MNT
mnt-by: ANTARO-MNT
created: 2009-04-14T08:02:50Z
last-modified: 2016-02-15T16:45:17Z
source: RIPE # Filtered
person: Strekozov Oleg Vladimirovich
address: Russia, 107031, Moscow, proezd Dmitrosvkiy 8
phone: +18552100465
nic-hdl: SOV63-RIPE
mnt-by: MNT-SPHERE
created: 2012-05-05T22:19:17Z
last-modified: 2014-09-15T13:18:40Z
source: RIPE
% Information related to '195.88.208.0/23AS28917'
route: 195.88.208.0/23
descr: IPSERVER
origin: AS28917
mnt-by: FIORD-MNT
mnt-routes: FIORD-MNT
created: 2012-12-24T08:35:13Z
last-modified: 2015-03-10T14:32:44Z
source: RIPE # Filtered
% This query was served by the RIPE Database Query Service version 1.87.3 (DB-2)根据这些信息,您可以对这些攻击向info@spheral.ru提出正式投诉,如果您的虐待报告未被处理,则可以升级到abuse@spheral.ru和abuse@ipserver.su。
如果您喜欢CIDR表示法,也可以使用范围195.88.208.0 - 195.88.209.255或195.88.208.0/23阻止将来的攻击。
我希望这能帮到你。
https://security.stackexchange.com/questions/124977
复制相似问题