Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了linux – getaddrinfo()的Glibc bug缓解大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

今天流过 exploit for glibc,涉及到getaddrinfo()调用DNS解析.我正在面向互联网的两个Bind9盒子上运行Ubuntu 12.04.我不确定我完全理解这个漏洞,但它似乎是由一个恶意DNS服务器的大量回复引起的.其中一个缓解措施是“防火墙丢弃UDP DNS数据包> 512字节”,因此我在DNS服务器上配置netfilter以丢弃任何UDP>来自或去往端口53的512字节
今天流过 exploit for glibc,涉及到getaddrinfo()调用DNS解析.我正在面向互联网的两个Bind9盒子上运行Ubuntu 12.04.我不确定我完全理解这个漏洞,但它似乎是由一个恶意DNS服务器的大量回复引起的.其中一个缓解措施是“防火墙丢弃UDP DNS数据包> 512字节”,因此我在DNS服务器上配置netfilter以丢弃任何UDP>来自或去往端口53的512字节:

-A INPUT -i lo -j ACCEPT
-A INPUT -p udp –sport 53 -m length –length 511:65535 -j DROP
-A INPUT -p udp –dport 53 -m length –length 511:65535 -j DROP
-A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT

使用Bind设置或其他任何东西有更好的方法吗?
我已经用scapy测试了规则,它确实阻止了UDP数据包> 512在53号港口被抛出.

每个回复更新:

-A INPUT -i lo -j ACCEPT
-A INPUT -p udp –sport 53 -m length –length 949:65535 -j DROP
-A INPUT -p udp –dport 53 -m length –length 949:65535 -j DROP
-A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT

和/etc/bind/named.conf.options

options {
   ...
   // 2016-02-17 - tmb - glibc exploit mitigation
   edns-udp-size 900 ;
   max-udp-size 900 ;
};

更新2:
如下面atdre所指出的,Cloud@R_618_8225@尝试了上述技术,尽管整个有效载荷无法传输,但内存损坏仍然存在.我想我会调查Unbound.

解决方法

如果您在本地运行绑定,则会为您提供测试:
dig @127.0.0.1 tcf.rs.dns-oarc.net txt

如下所述:https://www.dns-oarc.net/oarc/services/replysizetest.

你会得到这样的回复

root@myhost:~# dig @127.0.0.1 tcf.rs.dns-oarc.net txt

; <<>> DiG <<>> @127.0.0.1 tcf.rs.dns-oarc.net txt
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY,status: NOERROR,id: 61575
;; flags: qr rd ra; QUERY: 1,ANSWER: 5,AUTHORITY: 26,ADDITIONAL: 27

;; OPT PSEUDOSECTION:
; EDNS: version: 0,flags:; udp: 1024
;; QUESTION SECTION:
;tcf.rs.dns-oarc.net.           IN      TXT

;; ANSWER SECTION:
tcf.rs.dns-oarc.net.    60      IN      CNAME   tcf.x981.rs.dns-oarc.net.
tcf.x981.rs.dns-oarc.net. 59    IN      CNAME   tcf.x986.x981.rs.dns-oarc.net.
tcf.x986.x981.rs.dns-oarc.net. 58 IN    CNAME   tcf.x991.x986.x981.rs.dns-oarc.net.
tcf.x991.x986.x981.rs.dns-oarc.net. 57 IN TXT   "Tested at 2016-02-17 15:44:36 UTC"
tcf.x991.x986.x981.rs.dns-oarc.net. 57 IN TXT   "xx.xx.xx.xx DNS reply size limit is at least 991"

并且您可以添加绑定选项

options {
  ...
  edns-udp-size 1024 ;
  max-udp-size 1024 ;
};

在Named.conf文件

如下所述:https://labs.ripe.net/Members/anandb/content-testing-your-resolver-dns-reply-size-issues.

我也会将此与其他缓解措施结合使用.

大佬总结

以上是大佬教程为你收集整理的linux – getaddrinfo()的Glibc bug缓解全部内容,希望文章能够帮你解决linux – getaddrinfo()的Glibc bug缓解所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。