最近 DNS 查詢量增加,一直被查 30259.info 這個網域

DNS Amplification Attacks Observer 提供用 iptables 的 u32 阻擋方式

iptables --insert INPUT -p udp --dport 53 -m u32 --u32 "0x28=0x05333032 && 0x2c&0xFFFFFFDF=0x35390449 && 0x30&0xDFDFDFFF=0x4e464f00" -j DROP -m comment --comment "DROP DNS Q 30259.info"

那個字串要怎麼換算,需對封包定義很熟,像我這半懂半解的人來說很難,但復製貼上使用卻很簡單 :)

另一種

iptables --insert INPUT -p udp --dport 53 -m string --from 40 --to 52 --algo bm --hex-string '|05333032353904696e666f00|' -j DROP -m comment --comment "DROP DNS Q 30259.info"

DNS Amplification Attacks Observer  網站提供很多針對 DNS 攻擊阻擋方式,可以參考參考

updated 2014-10-22

我在查詢端 dig ssorc.tw @1.1.1.1

在被查詢端 tcpdump host 2.2.2.2 -s0 -X

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
09:52:06.307790 IP 2.2.2.2.34220 > 1.1.1.1.domain:  14594+ A? ssorc.tw. (26)
        0x0000:  4500 0036 03be 0000 3911 1a12 ca85 f70b  E..6....9.......
        0x0010:  db54 c701 85ac 0035 0022 7721 3902 0100  .T.....5."w!9...
        0x0020:  0001 0000 0000 0000 0573 736f 7263 0274  .........ssorc.t
        0x0030:  7700 0001 0001                           w.....
09:52:06.308536 IP 1.1.1.1.domain > 2.2.2.2.34220:  14594 1/4/0 A 1-34-11-212.HINET-IP.hinet.net (114)
        0x0000:  4500 008e 9204 0000 4011 8473 db54 c701  E.......@..s.T..
        0x0010:  ca85 f70b 0035 85ac 007a 6473 3902 8180  .....5...zds9...
        0x0020:  0001 0001 0004 0000 0573 736f 7263 0274  .........ssorc.t
        0x0030:  7700 0001 0001 c00c 0001 0001 0000 0127  w..............'
        0x0040:  0004 0122 0bd4 c00c 0002 0001 0000 0304  ..."............
        0x0050:  0006 036e 7335 c00c c00c 0002 0001 0000  ...ns5..........
        0x0060:  0304 0006 036e 7337 c00c c00c 0002 0001  .....ns7........
        0x0070:  0000 0304 0006 036e 7331 c00c c00c 0002  .......ns1......
        0x0080:  0001 0000 0304 0006 036e 7333 c00c       .........ns3..

ssorc.tw 的 m string 就是

0573 736f 7263 0274 7700

再 iptables DROP 它

iptables -I INPUT -m udp -p udp --dport 53 -m string --from 38 --algo bm --hex-string '|0573736f726302747700|' -j DROP -m comment --comment "DROP DNS Q ssorc.tw"
Related posts 相關文章
DNS BIND 9.16.50 最後一個版本已釋出
More...
DNS BIND 9.16 版本將 EOL
More...
在 Windows 上面 Plesk Obsidian 18.0.60 後不再維護 BIND DNS
More...
google 搜尋上的廣告連結 keepass.info 不要亂點
More...

作者

留言

作者

# 試著尋找相關設定,但這個 這個會連同被允許遞迴的主機也無法查詢 allow-query-cache { none; }; # 只回應被查什麼,沒試 minimal-responses yes;

作者

# u32 產生器 http://www.bortzmeyer.org/files/generate-netfilter-u32-dns-rule.py # iptables u32 使用說明 http://dnsamplificationattacks.blogspot.tw/p/iptables-block-list.html

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。