Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feature: add support for |all #1038

Closed
YamatoSecurity opened this issue May 7, 2023 · 7 comments · Fixed by #1060
Closed

New feature: add support for |all #1038

YamatoSecurity opened this issue May 7, 2023 · 7 comments · Fixed by #1060
Assignees
Labels
enhancement New feature or request Priority:High
Milestone

Comments

@YamatoSecurity
Copy link
Collaborator

@kazuminn Are you interested in implementing this?

There are several rules that use |all to specify that all keywords need to exist.
Example:

detection:
    keywords_cmdlet:
        '|all':
            - 'OabVirtualDirectory'
            - ' -ExternalUrl '
    keywords_params:
        - 'eval(request'
        - 'http://f/<script'
        - '"unsafe"};'
        - 'function Page_Load()'
    condition: keywords_cmdlet and keywords_params

In this rule example, all of the keywords in keywords_cmdlet need to exist somewhere (any field) in the event log. Also, at least one keyword in keywords_params needs to exist in a field.

|all rules:

deprecated/windows/powershell_suspicious_invocation_specific.yml
rules/windows/builtin/msexchange/win_exchange_proxylogon_oabvirtualdir.yml
rules/windows/builtin/msexchange/win_exchange_proxyshell_mailbox_export.yml
rules/windows/builtin/msexchange/win_exchange_proxyshell_remove_mailbox_export.yml
rules-emerging-threats/2021/Exploits/CVE-2021-26858/web_cve_2021_26858_iis_rce.yml
rules/windows/builtin/msexchange/win_exchange_proxyshell_certificate_generation.yml
rules/windows/builtin/msexchange/win_exchange_set_oabvirtualdirectory_externalurl.yml
rules/windows/builtin/system/microsoft_windows_kernel_general/win_system_susp_sam_dump.yml
@YamatoSecurity YamatoSecurity added the enhancement New feature or request label May 7, 2023
@YamatoSecurity YamatoSecurity added this to the v2.6.0 milestone May 7, 2023
@fukusuket
Copy link
Collaborator

FYI :)

@kazuminn kazuminn self-assigned this May 7, 2023
@kazuminn
Copy link
Collaborator

kazuminn commented May 7, 2023

@YamatoSecurity
Yes. I interested in.

@kazuminn
Copy link
Collaborator

kazuminn commented May 26, 2023

@YamatoSecurity @itiB @hitenkoku @fukusuket
I found |contains|all modifiers in code. But I can't found it in Document.
What's this?

日本語で失礼します。
コード読んでいると、|contains| all というダブルパイプを許容していて、allというのがすでに存在しているみたいなのですが、
ドキュメントには、存在せず。
これは、どうしていくと良さそうですか?

  • ダブルパイプのときは、すでに実装済みの機能を使うようにおいておいて
  • 新しい|allを追加などできます。
  • そもそも、ドキュメントと違いがあるので、既存のallを削除することもできます。

@fukusuket
Copy link
Collaborator

@kazuminn

  • 新しい|allを追加などできます。

が良いかと思いました!

理由:|contains|all特定の1フィールドに対するgrep機能、(フィールドなしの)|all全フィールドに対するgrep機能で、別機能という印象です。またドキュメントに明示がないですが(なぜないのですかね...🤔)、どちらもSigmaリポジトリで結構使われているので、既存の|contains|allは残したほうが良さそうですね。

@hitenkoku
Copy link
Collaborator

hitenkoku commented May 28, 2023

@fukusuket 個人的にはパイプからスタートするものを取り扱うとするとgrep機能には正直違和感があるなぁと思っています。contains|all は現在650件ほど利用しているルールがあるのでこれを消すのは「|all」のみのところでうまく対応できないのであれば確かにコメントしていただいている通り|allのみを別に作るという方針のほうが私も良いと思います。

以下のURLで確かにそのようにするとかいてはいるけどdocument内では確認できませんでした……
SigmaHQ/sigma-specification#53 (reply in thread)

関連するところはこことかですかね?all of keyword|allに置き換えとなった場合は以下の内容が影響を受けそうかなと思っています。(単純に|allフィールドを作成するだけであれば別に作ってしまっても良いかと思っています)
#957

@fukusuket
Copy link
Collaborator

そうですよね、|allのみだったら、全フィールドgrep機能という仕様は違和感ありますね...
(なので、Documentに明示がないのかも...😅) 

関連するところはこことかですかね? ... #957

確かに、こちら少し影響ありそうですね!実装の際は、気にしていただけると幸いです🙇

@kazuminn
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority:High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants