nginx 配置错误导致目录遍历漏洞的解决方法
时间:2014-07-04 01:15 来源:linux.it.net.cn 作者:IT网
漏洞版本:
nginx(Tested at 1.1.10)
漏洞描述:
在nginx中开启autoindex,配置不规范而造成目录遍历漏洞。
配置如下:
复制代码代码示例:
server {
listen 80;
server_name it.net.cn;
index index.htm index.html;
root /home/wwwroot/www;
access_log off;
location /paper {
alias /home/wwwroot/paper/;
autoindex on;
}
}
注意 这里/home/wwwroot/paper/; 有个/
当浏览http://it.net.cn/paper/,正常情况应该遍历/home/wwwroot/paper/这个目录,但如果访问http://it.net.cn/paper../则会遍历/home/wwwroot/这个目录。
安全建议:
使用如下配置
复制代码代码示例:
location /paper {
alias /home/wwwroot/paper;
或
location /paper/ {
alias /home/wwwroot/paper/;
(责任编辑:IT)
漏洞版本:
漏洞描述:
配置如下:
复制代码代码示例:
server {
listen 80; server_name it.net.cn; index index.htm index.html; root /home/wwwroot/www; access_log off; location /paper { alias /home/wwwroot/paper/; autoindex on; } }
注意 这里/home/wwwroot/paper/; 有个/
安全建议:
复制代码代码示例:
location /paper {
(责任编辑:IT)alias /home/wwwroot/paper; 或 location /paper/ { alias /home/wwwroot/paper/; |