适用于 osquery 的生产级检测与响应查询语句
Production-ready detection and response queries for osquery

原始链接: https://github.com/chainguard-dev/osquery-defense-kit

**osquery-defense-kit (ODK)** 是一套包含 250 多条可直接用于生产环境的 osquery 查询集,专为企业威胁检测、事件响应和安全策略执行而设计。与标准查询不同,这些查询经过专门优化,在正常操作期间返回零行结果,仅在出现可疑活动时触发警报。 该工具包按 MITRE ATT&CK 战术对查询进行分类,支持在 Linux 和 macOS 上进行即时分析及持续监控。为确保性能,该套件经过优化,CPU 占用率低于系统总时间的 2%。 主要功能包括: * **检测与事件响应 (IR):** 针对警报生成和证据收集进行了优化。 * **易于使用:** 通过 `osqtool` 进行管理,可实现配置包生成、验证和数据收集的自动化。 * **实战验证:** 已成功识别出多种复杂威胁,例如 Shikitega 恶意软件(Linux)和 CloudMensis 间谍软件(macOS)。 该项目积极欢迎社区贡献,尤其是在平台扩展(包括 Windows 支持)和误报异常优化方面。开发人员可以通过将这些查询集成到现有的 `osquery.conf` 文件中,并利用发布就绪的配置包来部署这些查询,从而保护其环境免受已知攻击向量的威胁。

抱歉。
相关文章

原文

Actions Status Latest Release stable

osquery queries for Detection & Incident Response, containing 250+ production-ready queries.

osquery-defense-kit

ODK (osquery-defense-kit) is unique in that the queries are designed to be used as part of a production detection & response pipeline. The detection queries are formulated to return zero rows during normal expected behavior, so that they may be configured to generate alerts when rows are returned.

At the moment, these queries are predominantly designed for execution on POSIX platforms (Linux & macOS). Pull requests to improve support on other platforms are fully welcome.

  • osquery v5.7.0 or above
  • macOS or Linux
  • If you plan to do local development you will also need Go v1.20+ for osqtool

Run make detect for point-in-time detection. This will not detect as much as a production installation as it will not have access to historical events.

Download a released query pack into a convenient location, and point to these files from the packs stanza of your osquery.conf file

Local Data Collection for IR

Run make collect. This is particularly useful for before/after analysis.

Run make packs. For more control, you can invoke osqtool directly, to override default intervals or exclude checks.

Local verification testing

Run make verify

  • detection/ - Threat detection queries tuned for alert generation.
  • policy/ - Security policy queries tuned for alert generation.
  • incident_response/ - Data collection to assist in responding to possible threats. Tuned for periodic evidence collection.

The detection queries are further divided up by MITRE ATT&CK tactics categories.

At release time, the queries are packed up in osquery query pack format. See Local Pack Generation for information on how to generate your own packs at any time.

Linux: Shikitega (September 2022)

https://cybersecurity.att.com/blogs/labs-research/shikitega-new-stealthy-malware-targeting-linux

Here is a partial list of what queries would have fired an alert based on these queries:

  • Initial Dropper Execution, detected by:
    • execution/tiny-executable-events.sql
    • execution/tiny-executable.sql
  • Next Stage Dropper Execution, detected by:
    • execution/tiny-executable-events.sql
    • execution/tiny-executable.sql
    • execution/unexpected-shell-parents.sql
  • Escalation Prep, detected by:
    • execution/sketchy-fetchers.sql
    • execution/sketchy-fetcher-events.sql
    • c2/unexpected-talkers-linux.sql
    • c2/exotic-command-events.sql
    • c2/exotic-cmdline.sql
  • Escalation Tool Execution detected by:
    • execution/unexpected-executable-permissions.sql
    • execution/unexpected-executable-directory-linux.sql
    • execution/unexpected-tmp-executables.sql
    • c2/exotic-command-events.sql
    • c2/exotic-cmdline.sql
    • initial_access/unexpected-shell-parents.sql
    • evasion/missing-from-disk-linux.sql
  • Privilege Escalation detected by:
    • privesc/unexpected-setxid-process.sql
    • privesc/unexpected-privilege-escalation.sql
    • privesc/events/unexpected-privilege-escalation-events.sql
    • evasion/name_path_mismatch.sql
  • Persistence detected by:
    • persistence/unexpected-cron-entries.sql
    • execution/unexpected-executable-directory-linux.sql

macOS: CloudMensis (April 2022)

https://www.welivesecurity.com/2022/07/19/i-see-what-you-did-there-look-cloudmensis-macos-spyware/

Here is a partial list of what stages would have been detected by particular queries:

  • Initial Dropper Execution, detected by:

    • c2/unexpected-talkers-macos.sql
  • Second Stage Execution, detected by:

    • execution/unexpected-executable-directory-macos.sql
    • persistence/unexpected-launch-daemon-macos.sql
    • execution/unexpected-mounts.sql
  • TCC Bypass, detected by:

    • evasion/unexpected-env-values.sql
  • Spy Agent Execution, detected by:

    • c2/unexpected-talkers-macos.sql
    • execution/exotic-command-events.sql
    • execution/unexpected-executable-directory-macos.sql

Help Wanted! We support any new queries so long as they can be easily updated to address false positives.

Users may submit false positive exceptions for popular well-known software packages, but may be asked to provide evidence for the behavior.

While originally focused on Linux and macOS, we support the addition of queries on any platform supported by osquery.

In particular, we've been asked about Windows support: Chainguard doesn't have any Windows machines, but if you have Windows queries that you think would be useful and match our philosophy, we're more than willing to accept them!

We endeavor to exclude real-world false positives from our detection queries.

Managing false positives is easier said than done - pull requests are welcome!

In aggregate, queries should not consume more than 2% of the wall clock time across a day on a deployed system.

Deployed intervals are automatically determined based on the tags supported by the osqtool, which we use for pack assembly.

联系我们 contact @ memedata.com