linux – 黑客绕过iptables

linux – 黑客绕过iptables,第1张

概述(从SO移动) 我有iptables保护sip服务器.除了我专门打开的IP之外,它会阻止所有IP,它似乎适用于几乎所有人.我已经测试了许多未列入白名单的IP地址,但它们都应该被丢弃. 但是,我找到了一个似乎能够绕过iptables规则的“黑客”.他的探测邀请通过,我不知道如何,或甚至可能. 10年后我才见过这个. 我想它一定是我做过的事情,但我看不到它. 像这样创建的iptables(MYIP在顶 (从SO移动)

我有iptables保护sip服务器.除了我专门打开的IP之外,它会阻止所有IP,它似乎适用于几乎所有人.我已经测试了许多未列入白名单的IP地址,但它们都应该被丢弃.

但是,我找到了一个似乎能够绕过iptables规则的“黑客”.他的探测邀请通过,我不知道如何,或甚至可能. 10年后我才见过这个.

我想它一定是我做过的事情,但我看不到它.

像这样创建的iptables(MYIP在顶部定义 – 编辑):

iptables -Fiptables -Xiptables -N ALLOWEDSIPiptables -P input DROPiptables -P FORWARD DROPiptables -P OUTPUT ACCEPTiptables -A input -m state --state ESTABliSHED,RELATED -j ACCEPTiptables -A input -i lo -j ACCEPTiptables -A input -p tcp -d $MYIP --dport 22 -j ACCEPTiptables -t filter -A input -j ALLOWEDSIP# This is my white List.iptables -A ALLOWEDSIP -j RETURN

现在,在ALLOWEDSIP中只有nothing,我所能做的就是使用SSH(我可以).如果我向它发出电话,他们都会掉线.但wireshark告诉我这个(我的ip编辑):

89.163.146.25 -> x.x.x.x SIP/SDP 805 Request: INVITE sip:521088972597572280@x.x.x.x |x.x.x.x -> 89.163.146.25 SIP 417 Status: 100 Giving a try |x.x.x.x -> 89.163.146.25 SIP 875 Status: 407 Proxy Authentication required |

他的电话打到我的开关,虽然最终被ACL拒绝,但他们应该永远不会到达那里.没有别的东西可以通过.拉出我的头发.谁知道?

只是为了完整性,这是iptables -L的结果:

# iptables -L --line-numbers -vChain input (policy DROP 0 packets,0 bytes)num   pkts bytes target     prot opt in     out     source               destination1       10   640 ACCEPT     all  --  any    any     anywhere             anywhere             state RELATED,ESTABliSHED2        0     0 ACCEPT     all  --  lo     any     anywhere             anywhere3        0     0 ACCEPT     tcp  --  any    any     anywhere             <redacted>.com  tcp dpt:69284        0     0 ALLOWEDSIP  all  --  any    any     anywhere             anywhereChain FORWARD (policy DROP 0 packets,0 bytes)num   pkts bytes target     prot opt in     out     source               destinationChain OUTPUT (policy ACCEPT 6 packets,544 bytes)num   pkts bytes target     prot opt in     out     source               destinationChain ALLOWEDSIP (1 references)num   pkts bytes target     prot opt in     out     source               destination1        0     0 RETURN     all  --  any    any     anywhere             anywhere

编辑:
刚从wireshark看到这个.他们是否可以做一些可怕的事情,比如以其他方式建立然后玩已建立的规则?也许他们正在玩相关的一些洞?

89.163.146.25 -> <redacted> RTCP 806 Source port: tag-pm  Destination port: sip

编辑2:
UDP是关键.当我将OpenSIPS设置为仅侦听TCP时,问题似乎消失了.尽管他们发送了更多的“tag-pm”消息,但他们的尝试都没有通过.不解释为什么数据包甚至可以进入opensips. iptables应该先停止它们.很想知道我在这里做错了什么.

编辑3:
如果我删除RELATED我会停止回复它们,所以这与它有关.但我认为我需要相关的.关于变通方法的任何提示?

解决方法 你可以nullroute.这应该绕过iptables.
route add 89.163.146.25 gw 127.0.0.1 lo

核实

netstat -nr

要么

route -n
总结

以上是内存溢出为你收集整理的linux – 黑客绕过iptables全部内容,希望文章能够帮你解决linux – 黑客绕过iptables所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1044300.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存