<!-- @(#) $Id: ./etc/rules/apache_rules.xml, 2011/09/08 dcid Exp $

  -  Official Apache rules for OSSEC.
  -
  -  Copyright (C) 2009 Trend Micro Inc.
  -  All rights reserved.
  -
  -  This program is a free software; you can redistribute it
  -  and/or modify it under the terms of the GNU General Public
  -  License (version 2) as published by the FSF - Free Software
  -  Foundation.
  -
  -  License details: http://www.ossec.net/en/licensing.html
  -
  -  Contributed by: Ahmet Ozturk
  -->
                        

<group name="apache,">
  <rule id="30100" level="0">
    <decoded_as>apache-errorlog</decoded_as>
    <description>Apache messages grouped.</description>
  </rule>    

  <rule id="30101" level="0">
    <if_sid>30100</if_sid>
    <match>^[error] </match>
    <description>Apache error messages grouped.</description>
  </rule>
  
  <rule id="30102" level="0">
    <if_sid>30100</if_sid>
    <match>^[warn] </match>
    <description>Apache warn messages grouped.</description>
  </rule>
  
  <rule id="30103" level="0">
    <if_sid>30100</if_sid>
    <match>^[notice] </match>
    <description>Apache notice messages grouped.</description>
  </rule>

  <rule id="30104" level="12">
    <if_sid>30103</if_sid>
    <match>exit signal Segmentation Fault</match>
    <description>Apache segmentation fault.</description>
    <info type="link">http://www.securityfocus.com/infocus/1633</info>
    <group>service_availability,</group>
  </rule>

  <rule id="30105" level="5">
    <if_sid>30101</if_sid>
    <match>denied by server configuration</match>
    <description>Attempt to access forbidden file or directory.</description>
    <group>access_denied,</group>
  </rule>

  <rule id="30106" level="5">
    <if_sid>30101</if_sid>
    <match>Directory index forbidden by rule</match>
    <description>Attempt to access forbidden directory index.</description>
    <group>access_denied,</group>
  </rule>

  <rule id="30107" level="6">
    <if_sid>30101</if_sid>
    <match>Client sent malformed Host header</match>
    <description>Code Red attack.</description>
    <info type="link">http://www.cert.org/advisories/CA-2001-19.html</info>
    <info type="text">CERT: Advisory CA-2001-19 "Code Red" Worm Exploiting Buffer Overflow In IIS Indexing Service DLL</info>
    <group>automatic_attack,</group>
  </rule>

  <rule id="30108" level="5">
    <if_sid>30102</if_sid>
    <match>authentication failed</match>
    <description>User authentication failed.</description>
    <group>authentication_failed,</group>
  </rule>

  <rule id="30109" level="9">
    <if_sid>30101</if_sid>
    <regex>user \S+ not found|user \S+ in realm \.* not found</regex>
    <description>Attempt to login using a non-existent user.</description>
    <group>invalid_login,</group>
  </rule>

  <rule id="30110" level="5">
    <if_sid>30101</if_sid>
    <match>authentication failure</match>
    <description>User authentication failed.</description>
    <group>authentication_failed,</group>
  </rule>

  <rule id="30112" level="0">
    <if_sid>30101</if_sid>
    <match>File does not exist: |</match>
    <match>failed to open stream: No such file or directory|</match>
    <match>Failed opening </match>
    <description>Attempt to access an non-existent file (those are reported on the access.log).</description> 
    <group>unknown_resource,</group>
  </rule>

  <!-- [Tue Mar 07 12:05:15 2006] [error] [client 200.206.165.91] Invalid URI in request %3Bi%3A3%3Bi%3A0%3B%7D; usercookie[password]=d6ed9e1750d0b2aba6b3311cbec087d8; 45befd35f8a0f47b89ed8831f892b8dc=167c4e46a940cd2570b952eea527b27a; PHPSESSID=616hjdg7kj9bln37efsv7vt7g3
  - [client 65.204.137.200] script '/var/www/html/xmlrpc.php' not found or unable to stat
  -->
  <rule id="30115" level="5">
    <if_sid>30101</if_sid>
    <match>Invalid URI in request</match>
    <description>Invalid URI (bad client request).</description>
    <group>invalid_request,</group>
  </rule>

  <rule id="30116" level="10" frequency="8" timeframe="120">
    <if_matched_sid>30115</if_matched_sid>
    <same_source_ip />
    <description>Multiple Invalid URI requests from </description>
    <description>same source.</description>
    <group>invalid_request,</group>
  </rule>

  <rule id="30117" level="10">
    <if_sid>30101</if_sid>
    <match>File name too long|request failed: URI too long</match>
    <description>Invalid URI, file name too long.</description>
    <group>invalid_request,</group>
  </rule>

  <!-- Mod security rules by <ossec ( at ) sioban.net -->
  <rule id="30118" level="6">
    <if_sid>30101</if_sid>
    <match>mod_security: Access denied|ModSecurity: Access denied</match>
    <description>Access attempt blocked by Mod Security.</description>
    <group>access_denied,</group>
  </rule>

  <rule id="30119" level="12" frequency="6" timeframe="120">
    <if_matched_sid>30118</if_matched_sid>
    <same_source_ip />
    <description>Multiple attempts blocked by Mod Security.</description>
    <group>access_denied,</group>
  </rule>
  
  <rule id="30120" level="12">
    <if_sid>30101</if_sid>
    <match>Resource temporarily unavailable:</match>
    <description>Apache without resources to run.</description>
    <group>service_availability,</group>
  </rule>
  
  <rule id="30200" level="6" noalert="1">
    <match>^mod_security-message: </match>
    <description>Modsecurity alert.</description>
  </rule>

  <rule id="30201" level="6">
    <if_sid>30200</if_sid>
    <match>^mod_security-message: Access denied </match>
    <description>Modsecurity access denied.</description>
    <group>access_denied,</group>
  </rule>
  
  <rule id="30202" level="10" frequency="8" timeframe="120">
    <if_matched_sid>30201</if_matched_sid>
    <description>Multiple attempts blocked by Mod Security.</description>
    <group>access_denied,</group>
  </rule>
</group> <!-- ERROR_LOG,APACHE -->


<!-- EOF -->

