nmap -sV --script=http-vuln* <target>
nikto -h <target>
nginx.conf
)error.log
)# 禁用不需要的HTTP方法
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 405;
}
# 隐藏Nginx版本号
server_tokens off;
# 设置安全的响应头
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
add_header Content-Security-Policy "default-src 'self'";
# 限制缓冲区大小
client_body_buffer_size 16k;
client_header_buffer_size 1k;
client_max_body_size 1m;
large_client_header_buffers 4 8k;
--without-<module>
)# 详细日志记录
log_format security '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/security.log security;
漏洞扫描:
配置检查:
性能与安全监控:
WAF解决方案:
通过以上方法和工具,可以系统地挖掘Nginx中的潜在漏洞,并采取有效措施进行修复和防护。