• 我们在哪一颗星上见过 ,以至如此相互思念 ;我们在哪一颗星上相互思念过,以至如此相互深爱
  • 我们在哪一颗星上分别 ,以至如此相互辉映 ;我们在哪一颗星上入睡 ,以至如此唤醒黎明
  • 认识世界 克服困难 洞悉所有 贴近生活 寻找珍爱 感受彼此

恶意代码技术理论:Sigma规则

恶意代码技术理论 云涯 3年前 (2021-07-01) 2946次浏览

1 Sigma概述

Sigma 是一种通用且开放的签名格式,允许您以直接的方式描述相关的日志事件。规则格式非常灵活,易于编写,适用于任何类型的日志文件。

Sigma 是一个开放的规则标准,允许您以通用形式描述对日志数据的搜索。这些规则可以转换并应用于许多日志管理或 SIEM 系统,甚至可以在命令行上与 grep 一起使用。

GitHub地址:https://github.com/SigmaHQ/sigma

使用方法:https://www.nextron-systems.com/2018/02/10/write-sigma-rules/

使用方法:https://github.com/SigmaHQ/sigma/wiki/Specification

2 Sigma规则

2.1 规则模板

title: 小于50个字符的大写短标题
id: 可以在如下网站生成 https://www.uuidgenerator.net/version4
status: 状态
description: 对检测规则的描述 
references:
    - 可以帮助读者或分析人员理解被触发规则的含义的所有引用的列表
tags:
    - attack.execution  # 例如 MITRE ATT&CK category
    - attack.t1059      # 例如 MITRE ATT&CK technique id
    - car.2014-04-003   # 例如 CAR id
author: Michael Haag, Florian Roth, Markus Neis  # 作者列表
date: 2018/04/06  # 规则日期
logsource:                      # 重要的字段映射在预定义或您的其他配置文件
    category: process_creation  # 在这个例子中使用了process_creation
    product: windows            # 产品
detection:
    selection:
        FieldName: 'StringValue'
        FieldName: IntegerValue
        FieldName|modifier: 'Value'
    condition: selection
fields:
    - 日志源中需要进一步研究的重要字段
falsepositives:
    - 描述可能的假阳性情况,以帮助分析人员进行调查
level: 四个级别 (low, medium, high, critical)
type: //rec
必需的:
  title:               //规则的简短标题,应包含规则应检测的内容(最多 256 个字符)
     类型: //字符串
     长度:
          min: 1
          max: 256
  logsource:           //日志源 描述了检测所需的日志来源、平台、应用程序和类型
     类型: //rec
     可选的:
          category: //分类 例如防火墙,web,防病毒
          product: //产品  例如windows,apache
          service: //服务  例如sshd,applocker
          definition: //定义  字符串
  detection:          //表示对日志数据的搜索的搜索标识符
     类型: //rec
     必需的:
          condition:
               类型: 
               包括:
                    - type: //str
                    - type: //arr
                      contents: //str
                      length:
                           min: 2
     可选的:
          timeframe: //字符串  使用天、小时、分钟、秒的典型缩写  例如15s、30m、12h、7d、3M
     其他: 
          类型: any
          包括:
               - type: arr
                 contents: //str
               - type: //map
                 values:
                      type: //any
                      of:
                           - type: //str
                           - type: //arr
                             contents: //str
                             length:
                                  min: 2
可选择的:
     id:               //Sigma 规则应由id属性中的全局唯一标识符标识。建议网络生成
          type: //any
          of:
               - type: //str
                 length:
                      min: 1
                      max: 64
     related:
          type: //arr
          contents:
               type: //rec
               required:
                    type:
                         type: //any
                         of:
                              - type: //str
                                value: derived
                              - type: //str
                                value: obsoletes
                              - type: //str
                                value: merged
                              - type: //str
                                value: renamed
                     id:
                        type: //any
                        of:
                             - type: //str
                               length:
                                    min: 1
                                    max: 64
                             - type: //arr
                               contents: //str
                               length:
                                    min: 1
                                    max: 64
     status:             //声明规则的状态(stable、test、experimental)
          type: //any
          of:
               - type: //str
                 value: stable   //稳定的,可用于生产系统或仪表板
               - type: //str
                 value: testing  //一个几乎稳定的规则,可能需要一些微调
               - type: //str
                 value: experimental  //一种实验性规则,可能导致错误结果或噪音
     description:       //规则和可以检测到的恶意活动的简短描述
     author:            //规则作者
     license:          //许可证
     references:       //对规则来源的引用
          type: //arr
          contents: //str
     fields:           //有价值显示给分析人员的日志字段列表
          type: //arr
          contents: //str
     falsepositives:   //可能发生的已知误报列表
          type: //any
          of:
               - type: //str
               - type: //arr
                 contents: //str
                 length:
                      min: 2
     level:           //等级
          type: //any
          of:
               - type: //str
                 value: low     //值得注意的事件,但很少发生事件
               - type: //str
                 value: medium  //应该更频繁地手动审查的相关事件
               - type: //str
                 value: high    //应触发内部警报并需要及时审查的相关事件
               - type: //str
                 value: critical  //表示事件的高度相关事件。应立即审查关键事件
     tags:            //标签   小写字母,下划线,连字符组成   尽量简短  预定义标签:https://github.com/SigmaHQ/sigma/wiki/Tags
          type: //arr
          contents: //str
rest: //any

3 编些Sigma规则

3.1 获取存储库

下载或git存储库:https://github.com/SigmaHQ/sigma

./rules 规则库

./tools/sigmac 规则编译器

3.2 复制和编辑 YAML 文件

推荐VScode:https://code.visualstudio.com/

可以默认支持YAML突出显示和语法检查。

 


云涯历险记 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:恶意代码技术理论:Sigma规则
喜欢 (5)