Articles of mod security

为什么ModSecurity 3使用nginx强制连续请求而不是并行请求?

我将nginx / 1.10.3与ModSecurity 3( Libmodsecurity 5f60bb5224 , ModSecurity-nginx连接器1b2860a0f1 )结合使用,并将请求代理到后端应用程序。 总体响应时间(整页加载,包括初始AJAX请求) 后端应用程序(本地):1.48秒 nginx( modsecurity off ):1.81秒 nginx( modsecurity on ):6.98秒 观察: 当直接查询后端应用程序时,会asynchronous加载资源。 当ModSecurityclosures时,资源将asynchronous加载。 当ModSecurity打开时,资源按顺序加载。 这是我的ModSecurityconfiguration。 # — Rule engine initialization ———————————————- # Enable ModSecurity, attaching it to every transaction. Use detection # only to start with, because that minimises the chances of post-installation # disruption. # […]

如何debuggingmodsecurity_audit_log

我在我的服务器上访问www.example.com/RestAPI/index.php/tweets.json 。 modsec_audit.log显示以下错误,但在modsec_debug.log没有相关的错误/警告。 我可以看到内部服务器错误logging在example-error_log中。 我怎样才能debugging这个内部服务器错误? –8560e90b-A– [21 / Mar / 2012:07:01:52 +0000] T2l84H8AAAEAAGxPZ @ QAAAAG xxxx 33101 xxxx 80 –8560e90b-B– GET /RestAPI/index.php/tweets.json HTTP / 1.1 Host:www.example.com User-Agent:Mozilla / 5.0(X11; Linux i686; rv:11.0)Gecko / 20100101 Firefox / 11.0 Accept:text / html,应用程序/ xhtml + xml,application / xml; q = 0.9, / ; q = 0.8接受语言:en-us,en; q = […]

Nginx与mod_security支持

我已经编译nginx与mod_security支持。 在错误日志中,我可以看到对mod_security的支持 2012/08/27 11:13:11 [info] 602096#0:ModSecurity for nginx / 2.7.0-rc2( http://www.modsecurity.org/ )已configuration。 2012/08/27 11:13:11 [info] 602096#0:ModSecurity:APR编译版本=“1.4.2”; 加载版本=“1.4.2” 2012/08/27 11:13:11 [信息] 602096#0:ModSecurity:PCRE编译版本=“8.2”; loaded version =“8.02 2010-03-19” 2012/08/27 11:13:11 [信息] 602096#0:ModSecurity:加载的PCRE与编译不匹配! 2012/08/27 11:13:11 [信息] 602096#0:ModSecurity:LIBXML编译版本=“2.7.8” 我已经加载了ModSecurityConfig和ModSecurityEnabled ModSecurityConfig /usr/local/nginx/conf/modsecurity/modsecurity_crs_41_sql_injection_attacks.conf; ModSecurityEnabled打开; 但我不能让mod_security工作。 攻击可以通过,我不会在日志文件中的错误。 我是否需要添加任何额外的configuration来启用ngix的mod_security? 注意:我使用nginx作为反向代理 谢谢

将mod_security规则限制为仅一个虚拟主机

我运行几个域(通过虚拟主机)相同的Apache安装。 有些域需要不同的mod_security规则。 在一个单独的exceptions.conf文件中,我收集了所有这些规则,并且具有以下语法: <Location "/test"> SecAuditEngine Off SecRuleRemoveById 950134 SecRuleRemoveById 981265 SecRuleRemoveById 981289 SecRuleRemoveById 981244 SecAuditEngine RelevantOnly </Location> 但是这个规则将匹配所有域的所有/testing文件夹! 但我只想限制它到一个特定的主机。 我只能在全局的exceptions.conf文件中将这些规则限制为一个虚拟主机?

用modsec块填充的Apache error_log

自从我启用Apache modsecurity以来,我一直在检查日志,并一直在24/7中看到以下内容: [Wed Jun 25 12:40:07 2014] [error] [client 112.215.65.61] ModSecurity: Access denied with code 501 (phase 2). Pattern match "(?:\\\\b(?:(?:n(?:et(?:\\\\b\\\\W+?\\\\blocalgroup|\\\\.exe)|(?:map|c)\\\\.exe)|t(?:racer(?:oute|t)|elnet\\\\.exe|clsh8?|ftp)|(?:w(?:guest|sh)|rcmd|ftp)\\\\.exe|echo\\\\b\\\\W*?\\\\by+)\\\\b|c(?:md(?:(?:32)?\\\\.exe\\\\b|\\\\b\\\\W*?\\\\/c)|d(?:\\\\b\\\\W*?[\\\\\\\\/]|\\\\W*?\\\\.\\\\.)|hmod.{0,40}? …" at REQUEST_HEADERS:User-Agent. [file "/usr/local/apache/conf/modsec2.user.conf"] [line "143"] [id "1234123446"] [msg "System Command Injection"] [data "; id"] [severity "CRITICAL"] [tag "WEB_ATTACK/COMMAND_INJECTION"] [hostname "www.mysite.com"] [uri "/"] [unique_id "U6qY90KT6CAAAAVA0y8AAABL"] [Wed Jun 25 12:43:27 2014] [error] [client 141.0.11.65] […]

configurationmod-security2后Apache服务器发生故障

我从https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_security-with-apache-on-debian-ubuntuconfiguration了mod-security。 之后,重新启动Apache服务,但我发现错误: The apache2 configtest failed. Output of config test was: AH00526: Syntax error on line 97 of /usr/share/modsecurity-crs/modsecurity_crs_10_setup.conf: ModSecurity: Found another rule with the same id Action 'configtest' failed. The Apache error log may have more information. 错误日志:(但我认为这不是从模式安全的错误logging) [Sun Jan 11 01:40:20.278652 2015] [mpm_prefork:notice] [pid 5359] AH00169: caught SIGTERM, shutting down 我也使用模式回避。

mod_security规则通过querystring或referer来阻止GET请求

在我的VPS的最后几天,在一个文件上有很多GET请求,导致高内存负载(全部来自一个引用URL,具有不同的IP)。 直到现在我已经通过.htaccess阻止了这些请求 # by refurl RewriteCond %{HTTP_REFERER} domain\.com [NC] RewriteRule .* – [F] # by querystring RewriteCond %{QUERY_STRING} \ba=ZicX9v\b [NC] RewriteRule ^ – [F] 但是这样的请求仍然由apache处理,并且仍然导致很高的内存负载。 我可以用mod_security(也许在阶段1)阻止这个请求来防止/减less内存负载吗? 到现在为止,我已经把这个规则设置为mod_secuurity(但是我不确定是正确的): SecRule REQUEST_HEADERS:REFERER "(?i:(THEDOMAIN))" phase:1,deny,status:412,id:'1234' PS:我的VPS是linux和apache2.2 编辑:我的整个网站强制HTTPS,不知道如果我应该添加一些东西

如果请求被阻止,mod_security是否只能logging触发的规则?

我已经安装了mod_security,目前我正在运行DetectionOnly模式,因为我监视日志并进行configuration以适合我的服务器需求。 我已经设置了exception评分,并相应地调整了分数,以减less误报。 在Apache2 error_log我收到如下所示的日志事件: [Fri May 01 14:48:48 2015] [error] [client 81.138.5.14] ModSecurity: Warning. Operator LT matched 20 at TX:inbound_anomaly_score. [file "/etc/apache2/modsecurity-crs/activated_rules/modsecurity_crs_60_correlation.conf"] [line "33"] [id "981203"] [msg "Inbound Anomaly Score (Total Inbound Score: 13, SQLi=11, XSS=): Restricted SQL Character Anomaly Detection Alert – Total # of special characters exceeded"] [hostname "www.domain.co.uk"] [uri "/wp-admin/admin-ajax.php"] [unique_id "VUOEQNRurOYAABA-HZEAAAAA"] […]

modsecurity不包含自定义REDQUEST_HEADER_NAMES

尝试构build一个规则,以使任何不包含头X-CFKey的入站stream量与特定的X-CFKey相匹配。 我已经成功的testing了X-CFKey的modsecurity,但是在标题丢失的时候失败了。 我正在尝试使用!@contains来testing标题存在的不足。 我能够让@contains通过可预见的通过!@contains匹配的一切。 SecRule REQUEST_HEADERS_NAMES "!@contains x-cfkey" \ "id:52,log,deny,status:403,t:lowercase,msg:'Does not contain header X-CFKey'" 我在这里错过了什么,为什么! 变得如此不可预测?

排除来自modsecurity日志的敏感数据

我正在设置Modsecurity,而且我注意到一些敏感数据(信用卡号)最终在日志中。 我应该如何防止呢? 最好是我希望它被logging,但与敏感的数据损坏。 access.log中敏感行的示例 id_offer=28&ch_name=%27+or+1%3D1&ch_address1=Korvstolsv%E4gen+2&ch_address2=&ch_zip=756+48&ch_city=STOCKHOLM&ch_email=aslask%40test.net&ch_phone=018-9999999&cardno=1234456712342345&cvc=123&expire_month=–&expire_year=–&send=Avbryt 也许它可能是这样的呢? (滚动到右侧,敏感字段是cardno和cvs) id_offer=28&ch_name=%27+or+1%3D1&ch_address1=Korvstolsv%E4gen+2&ch_address2=&ch_zip=756+48&ch_city=STOCKHOLM&ch_email=aslask%40test.net&ch_phone=018-9999999&cardno=manglemanglemangle&cvc=xxx&expire_month=–&expire_year=–&send=Avbryt 如果包含敏感数据,则可以select完全删除该部分。 由于我应该使用POST而不是GET的评论,这是一个POST。 –36b1f462-A– [30/May/2017:19:06:55 +0200] WS2mrwpABwsAACy1A9wAAAAG 185.624.636.40 61597 610.64.66.8 445 –36b1f462-B– POST /wb/e/check.php HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: sv-SE,sv;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate, br Content-Type: application/x-www-form-urlencoded Content-Length: 216 Referer: https://example.com/wb/e/auth.php Connection: keep-alive Upgrade-Insecure-Requests: 1 –36b1f462-C– id_offer=28&ch_name=%27+or+1%3D1&ch_address1=Korvstolsv%E4gen+2&ch_address2=&ch_zip=756+48&ch_city=STOCKHOLM&ch_email=aslask%40test.net&ch_phone=018-9999999&cardno=1234456712342345&cvc=123&expire_month=–&expire_year=–&send=Avbryt