<!--
  -  Asterisk rules
  -  Author: Daniel Cid.
  -  Updated by Wazuh, Inc.
  -  Copyright (C) 2015-2020, Wazuh Inc.
  -  Copyright (C) 2009 Trend Micro Inc.
  -  This program is a free software; you can redistribute it and/or modify it under the terms of GPLv2.
-->

<group name="syslog,asterisk,">
  <rule id="6200" level="0">
    <decoded_as>asterisk</decoded_as>
    <description>Asterisk messages grouped.</description>
  </rule>

  <rule id="6201" level="0">
    <if_sid>6200</if_sid>
    <match>^NOTICE</match>
    <description>Asterisk notice messages grouped.</description>
    <group>gpg13_4.12,</group>
  </rule>

  <rule id="6202" level="3">
    <if_sid>6200</if_sid>
    <match>^WARN</match>
    <description>Asterisk warning message.</description>
    <group>gpg13_4.12,</group>
  </rule>

  <rule id="6203" level="3">
    <if_sid>6200</if_sid>
    <match>^ERROR</match>
    <description>Asterisk error message.</description>
    <group>gpg13_4.3,</group>
  </rule>

  <rule id="6210" level="5">
    <if_sid>6201</if_sid>
    <match>Wrong password</match>
    <description>Asterisk: Login session failed.</description>
    <group>authentication_failed,pci_dss_10.2.4,pci_dss_10.2.5,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <rule id="6211" level="5">
    <if_sid>6201</if_sid>
    <match>Username/auth name mismatch</match>
    <description>Asterisk: Login session failed (invalid user).</description>
    <group>invalid_login,pci_dss_10.2.4,pci_dss_10.2.5,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <rule id="6212" level="5">
    <if_sid>6201</if_sid>
    <match>No matching peer found</match>
    <description>Asterisk: Login session failed (invalid extension).</description>
    <group>invalid_login,pci_dss_10.2.4,pci_dss_10.2.5,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <rule id="6250" level="10" frequency="8" timeframe="300">
    <if_matched_sid>6211</if_matched_sid>
    <same_source_ip />
    <description>Asterisk: Multiple failed logins (user enumeration in process).</description>
    <mitre>
      <id>T1133</id>
    </mitre>
    <group>pci_dss_10.2.4,pci_dss_10.2.5,pci_dss_11.4,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,nist_800_53_SI.4,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <rule id="6251" level="10" frequency="8" timeframe="300">
    <if_matched_sid>6210</if_matched_sid>
    <same_source_ip />
    <description>Asterisk: Multiple failed logins.</description>
    <mitre>
      <id>T1110</id>
      <id>T1133</id>
    </mitre>
    <group>pci_dss_10.2.4,pci_dss_10.2.5,pci_dss_11.4,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,nist_800_53_SI.4,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <rule id="6252" level="10" frequency="8" timeframe="300">
    <if_matched_sid>6212</if_matched_sid>
    <same_source_ip />
    <description>Asterisk: Extension enumeration.</description>
    <mitre>
      <id>T1133</id>
    </mitre>
    <group>pci_dss_10.2.4,pci_dss_10.2.5,pci_dss_11.4,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,nist_800_53_SI.4,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <!--From Javi Benito jabi.benito@gmail.com-->
  <!--http://sysbrain.wordpress.com/2010/05/24/asterisk-ossec-part-ii/-->
  <rule id="6253" level="5">
    <if_sid>6201</if_sid>
    <match>No registration for peer</match>
    <description>Asterisk: Login session failed (invalid iax user).</description>
    <group>invalid_login,pci_dss_10.2.4,pci_dss_10.2.5,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <!--From Javi Benito jabi.benito@gmail.com-->
  <rule id="6254" level="10" frequency="5" timeframe="300">
    <if_matched_sid>6253</if_matched_sid>
    <same_source_ip />
    <description>Asterisk: Extension IAX Enumeration.</description>
    <mitre>
      <id>T1133</id>
    </mitre>
    <group>pci_dss_10.2.4,pci_dss_10.2.5,pci_dss_11.4,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,nist_800_53_SI.4,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <!--From Javi Benito jabi.benito@gmail.com-->
  <rule id="6255" level="5">
    <if_sid>6202</if_sid>
    <match>Don't know how to respond via</match>
    <description>Asterisk: Possible Registration Hijacking.</description>
    <group>invalid_login,pci_dss_10.2.4,pci_dss_10.2.5,pci_dss_11.4,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,nist_800_53_SI.4,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <!--From Javi Benito jabi.benito@gmail.com-->
  <rule id="6256" level="5">
    <if_sid>6201</if_sid>
    <match>failed MD5 authentication</match>
    <description>Asterisk: IAX peer Wrong Password.</description>
    <group>invalid_login,pci_dss_10.2.4,pci_dss_10.2.5,gpg13_7.1,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

  <!--From Javi Benito jabi.benito@gmail.com-->
  <rule id="6257" level="10" frequency="5" timeframe="300">
    <if_matched_sid>6256</if_matched_sid>
    <same_source_ip />
    <description>Asterisk: Multiple failed logins.</description>
    <mitre>
      <id>T1110</id>
      <id>T1133</id>
    </mitre>
    <group>pci_dss_10.2.4,pci_dss_10.2.5,pci_dss_11.4,gdpr_IV_35.7.d,gdpr_IV_32.2,hipaa_164.312.b,nist_800_53_AU.14,nist_800_53_AC.7,nist_800_53_SI.4,tsc_CC6.1,tsc_CC6.8,tsc_CC7.2,tsc_CC7.3,</group>
  </rule>

</group>
