小编Sho*_*abh的帖子

ModSecurity(仅检测模式)没有提供有用的日志/警告

我已经在 Kubernetes Nginx 控制器上配置了 modsecurity-nginx 连接器。

\n

目前,我使用 ModSecurity WAF 的目标是在DetectionOnly模式下实施,因为我不想立即开始阻止所有内容。因此,为了实现这一点,我在控制器 ConfigMap 中使用了以下配置。

\n
enable-modsecurity: "true"\n  modsecurity-snippet: |\n    SecRuleEngine DetectionOnly\n    SecAuditEngine On\n    SecAuditLogParts ABIJDEFHZ\n    SecAuditLogFormat JSON\n    SecAuditLogType Serial\n    SecAuditLog /dev/stdout\n
Run Code Online (Sandbox Code Playgroud)\n

为了测试这一点,我尝试了 SQL 注入攻击,将 SQL 查询从客户端插入到我的测试应用程序中。但 ModSecurity 没有在日志中给出任何警告或任何有用的信息来表明 SQL 查询已插入到应用程序中。以下是我分别发送和获取日志的请求:

\n
$ curl -ks -o /dev/null -w \xe2\x80\x98%{http_code}\xe2\x80\x99 \xe2\x80\x9chttps://test-ingress-nginx.example.com/foo?username=1'%20or%20'1'%20=%20'\xe2\x80\x9d\n
Run Code Online (Sandbox Code Playgroud)\n

输出:404

\n
Logs :\n----    \n{\xe2\x80\x9ctransaction\xe2\x80\x9d:{\xe2\x80\x9cclient_ip\xe2\x80\x9d:\xe2\x80\x9c192.xxx.xxx.xx",\xe2\x80\x9ctime_stamp\xe2\x80\x9d:\xe2\x80\x9cTue Feb 16 07:44:10 2021",\xe2\x80\x9cserver_id\xe2\x80\x9d:\xe2\x80\x9c995f188ad543e6fcbcdbfb4c7a2c67327xxxxx",\xe2\x80\x9cclient_port\xe2\x80\x9d:59455,\xe2\x80\x9chost_ip\xe2\x80\x9d:\xe2\x80\x9c10.x.xxx.xxx\xe2\x80\x9d,\xe2\x80\x9chost_port\xe2\x80\x9d:443,\xe2\x80\x9cunique_id\xe2\x80\x9d:\xe2\x80\x9c161346145098.924xxx",\xe2\x80\x9crequest\xe2\x80\x9d:{\xe2\x80\x9cmethod\xe2\x80\x9d:\xe2\x80\x9cGET\xe2\x80\x9d,\xe2\x80\x9chttp_version\xe2\x80\x9d:2.0,\xe2\x80\x9curi\xe2\x80\x9d:\xe2\x80\x9c/foo?username=1'%20or%20'1'%20=%20'\xe2\x80\x9c,\xe2\x80\x9dheaders\xe2\x80\x9d:{\xe2\x80\x9chost\xe2\x80\x9d:\xe2\x80\x9ctest-ingress-nginx.example.com\xe2\x80\x9d,\xe2\x80\x9cuser-agent\xe2\x80\x9d:\xe2\x80\x9ccurl/7.64.1",\xe2\x80\x9caccept\xe2\x80\x9d:\xe2\x80\x9c*/*\xe2\x80\x9c}},\xe2\x80\x9cresponse\xe2\x80\x9d:{\xe2\x80\x9cbody\xe2\x80\x9d:\xe2\x80\x9c<!DOCTYPE HTML PUBLIC \\\xe2\x80\x9c-//IETF//DTD HTML 2.0//EN\\\xe2\x80\x9c>\\n<html><head>\\n<title>404 Not Found</title>\\n</head><body>\\n<h1>Not Found</h1>\\n<p>The requested URL /foo was not found on this server.</p>\\n<hr>\\n<address>Apache/2.4.25 (Debian) Server …
Run Code Online (Sandbox Code Playgroud)

mod-security nginx-ingress

5
推荐指数
1
解决办法
1945
查看次数

标签 统计

mod-security ×1

nginx-ingress ×1