环境:modSecurity3.0,nignx1.13.8 modSecurity配置文件 1.nginx.conf server { listen ; modsecurity on; //启动modsecurity插件 location / { modsecurity_rules_file /usr/local/nginx/conf/modsecurity.conf; //modsecurity配置 root html; index index.html index.htm; } } 2.mo…
crs-setup.cnf #SecDefaultAction指令后的规则都继承这一设置,除非为某条规则指定了一个特定的动作,或者指定了新的SecDefaultAction.特别注意到,未经处理的disruptive动作是不允许的,但是在SecDefautlAction中一不小心就会继承了使用disruptive动作.#SecDefaultAction必须指定一个disruptive动作和处理阶段,而且不能包含元数据动作SecDefaultAction "phase:1,log,auditlog…
modSecurity日志收集:在phase 5阶段处理. 由于CC攻击主要考虑对动态请求的防护,所以要排除静态资源的请求,或者自定义动态请求的后缀或者关键字做接口针对性的防护. 定义需要排除的请求url后缀名称 SecAction \ "id:900260,\ phase:1,\ nolog,\ pass,\ t:none,\ setvar:'tx.static_extensions=/.mvc/ /.jpg/ /.jpeg/ /.png/ /.gif/ /.js/ /.css/ /.ico/…
传统检测模式-自主规则 传统检测模式所有规则都是“闭环”的模式.就像HTTP本身一样,单独的规则是无状态的.这意味着规则之间不共享信息,每个规则都没有关于任何先前规则匹配的信息.它仅使用其当前的单个规则逻辑进行检测.在此模式下,如果规则触发,它将执行当前规则中指定的任 何中断/记录日志操作.设置方法:修改Crs-setup.conf # Example: Self-contained mode, return error 403 on blocking # - In this configura…
规则语言是使用9个指令实现: 语法:SecRule VARIABLES OPERATOR [TRANSFORMATION_FUNCTIONS, ACTIONS] Variables 以下几种: Regular variablesContain only one piece of information, or one string. For example, REMOTE_ADDR, alwayscontains the IP address of the client.CollectionsG…
通用格式 SecRule VARIABLES OPERATOR [TRANSFORMATION_FUNCTIONS, ACTIONS]   阶段phase (1)request headers (2)request body (3)response headers (4)response body (5) logging   一.变量variable 绿色:请求变量  蓝色:server变量  紫色:响应变量 红色:请求体解析变量 黑色:时间变量 橙色:实体变量 ModSecurity Requ…
1.数字型SQL注入 /opt/waf/owasp-modsecurity-crs/rules/REQUEST-942-APPLICATION-ATTACK-SQLI.conf"] [line "17"] [id "942100"] 被LibInjection Check 2.字符型SQL注入 同上 3.数据库后门 match1:LibInjection Check match2: 94235 SecRule REQUEST_COOKIES|!REQUES…
1.IP访问频率 SecAction phase:1,nolog,pass,setvar:IP.counter=+1 SecRule IP:UPDATE_RATE "@gt 10" \ "phase:1,block,msg:'Request rate too high for IP address: %{IP.UPDATE_RATE}'" 优化下,去掉静态资源的 # Only increment the counter if the # request is for…
一.ModSecurity3.0介绍 ModSecurity是一个开源的跨平台Web应用程序防火墙(WAF)引擎,用于Apache,IIS和Nginx,由Trustwave的SpiderLabs开发.作为WAF产品,ModSecurity专门关注HTTP流量,当发出HTTP请求时,ModSecurity检查请求的所有部分,如果请求是恶意的,它会被阻止和记录. 优势: 完美兼容nginx,是nginx官方推荐的WAF 支持OWASP规则 3.0版本比老版本更新更快,更加稳定,并且得到了nginx.…
1.CentOS5.8 x86_64位 采用最小化安装,系统经过了基本优化篇2.apache版本:httpd-2.2.293.源码包存放位置:/home/oldboy/tools4.源码包编译安装位置:/application/ 一.设置日志轮循    1.下载并安装cronolog [root@ser200 tools]# cd /home/oldboy/tools    [root@ser200 tools]# wget http://cronolog.org/download/cronol…