AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 753554
Accepted
user53029
user53029
Asked: 2016-02-03 12:05:47 +0800 CST2016-02-03 12:05:47 +0800 CST 2016-02-03 12:05:47 +0800 CST

有没有人在 OSSEC 中使用过任何自定义解码器?

  • 772

我在 RHEL 6 服务器上运行 OSSEC HIDS 软件版本 2.8.3。我们一直在实验室中使用 DNS 服务器对此进行测试,以跟踪进入我们的 RPZ 和恶意软件区域的查询。DNS 服务器已安装 OSSEC 代理。为了让它工作,我们必须使用一个定制的书面解码器。除了那些“开箱即用”安装的解码器之外,还有其他人对 OSSEC 和自定义解码器有任何经验吗?我主要是想获得关于其他系统管理员正在使用 OSSEC 做什么的创造性想法,这些想法在我们的生产环境中也可能有用。

例如,有没有人成功编写/使用自定义解码器来检测 Linux 的 USB 存储?

更新:我一直在研究自定义解码器和检测 USB 设备何时插入服务器的规则。这是我想要匹配的日志行:

Feb  3 10:23:08 testsys kernel: usb 1-1.2: New USB device found, idVendor=0781, idProduct=5575

我在 OSSCE 中的解码器规则:

<decoder name="usb-storage">
<program_name>kernel</program_name>
</decoder>

<decoder name="usb-storage-attached">
<parent>usb-storage</parent>
<regex offset="after_parent">^USB \S+: New</regex>
<order>extra_data</order>
</decoder>

我在 OSSEC 的规则:

<group name="syslog,">
<!-- USB Storage Detection Log Types -->
<!-- level=0 for not generating alerts by default -->
<rule id="310201" level="0">
<decoded_as>usb-storage</decoded_as>
<description>Looking for unknown USB attached storage</description>
</rule>

<!-- USB Storage Detection Event Chains -->
<!-- Fire an alert (level=8) if the log line contains "New USB   device found" -->
<rule id="310202" level="8">
<if_sid>310201</if_sid>
<match>^New USB device found</match>
<description>Attached USB Storage</description>
</rule>
</group>
ossec
  • 2 2 个回答
  • 1690 Views

2 个回答

  • Voted
  1. Best Answer
    jesuslinares
    2016-02-05T04:46:29+08:002016-02-05T04:46:29+08:00

    iptables使用内核作为program_name:

    <decoder name="iptables">
       <program_name>^kernel</program_name>
    </decoder>
    

    我们可以使用iptables作为父级(而不是内核)。此外,id字段用于方便创建规则。所以,你需要这个解码器:

    <decoder name="usb-storage-attached">
        <parent>iptables</parent>
        <regex offset="after_parent">^(usb) </regex>
        <order>id</order>
    </decoder>
    

    规则可以是:

    <rule id="310201" level="0">
        <decoded_as>iptables</decoded_as>
        <id>usb</id>
        <description>USB messages grouped.</description>
    </rule>
    
    <rule id="310202" level="1">
        <if_sid>310201</if_sid>
        <match>New USB device found</match>
        <description>Attached USB Storage</description>
    </rule>
    

    现在,您可以将规则 310201 用于与 USB 相关的所有内容。规则 310202 就是您想要的规则:

    Feb  3 10:23:08 testsys kernel: usb 1-1.2: New USB device found, idVendor=0781, idProduct=5575
    
    
    **Phase 1: Completed pre-decoding.
           full event: 'Feb  3 10:23:08 testsys kernel: usb 1-1.2: New USB device found, idVendor=0781, idProduct=5575'
           hostname: 'testsys'
           program_name: 'kernel'
           log: 'usb 1-1.2: New USB device found, idVendor=0781, idProduct=5575'
    
    **Phase 2: Completed decoding.
           decoder: 'iptables'
           id: 'usb'
    
    **Phase 3: Completed filtering (rules).
           Rule id: '310202'
           Level: '1'
           Description: 'Attached USB Storage'
    **Alert to be generated.
    

    我刚刚添加到我们的规则集存储库:解码器和规则。

    • 2
  2. Santiago Bassett
    2016-02-03T17:15:09+08:002016-02-03T17:15:09+08:00

    您可以尝试我们的 OSSEC 规则集。它使用新的解码器和规则定期更新。

    在这里能找到它:

    https://github.com/wazuh/ossec-rules

    说明在这里(包括一个自动运行更新的脚本):

    http://documentation.wazuh.com/en/latest/ossec_ruleset.html

    关于 USB 存储检测,我在 Windows 上做了,配置如下:

    <localfile>  
      <frequency>10</frequency>
      <log_format>full_command</log_format>
      <command>reg QUERY HKLM\SYSTEM\CurrentControlSet\Enum\USBSTOR</command>
    </localfile>
    

    和这样的规则:

    <rule id="140125" level="7">
      <if_sid>530</if_sid>
      <match>ossec: output: 'reg QUERY</match>
      <check_diff />
      <description>New USB device connected</description>
    </rule>
    

    对于Linux,我认为它会更容易。您有日志消息的示例吗?很可能您只需要为其创建规则。

    • 0

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve