strawberry/config/example_rules.yar
trvon ad1676a594
Some checks failed
Build and Test / build (debug, clang) (push) Has been cancelled
Build and Test / build (debug, gcc) (push) Has been cancelled
Build and Test / build (release, clang) (push) Has been cancelled
Build and Test / build (release, gcc) (push) Has been cancelled
Build and Test / docker (push) Has been cancelled
Integrate features into the daemon, build and docs
Wire the policy, feeds, containment, exec guard, behavior, governor,
crash safety and event store into the daemon, detection pipeline, CLI
and meson build (zstd now required); Dockerfile, conan, systemd unit
(LimitCORE=0, resource limits) and installer updates; existing tests
adapted (store paths are directories now). Detections are counted and
notified even when evidence cannot be persisted (persist_failures in
status). prevention_timeout_ms is clamped and behavior dedupe handles
out-of-order events. Docs: API contract, developer guide, plan, UX,
agent rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:17:30 -06:00

104 lines
3.1 KiB
Text

/*
* Strawberry starter rules.
*
* Kept deliberately small and high-signal so a first run with
* scan_existing_processes_on_start=true does not flood the database with
* matches on ordinary system binaries. For real coverage, add a maintained
* rule set next to this file, e.g.:
* - YARA Forge "core" bundle https://github.com/YARAHQ/yara-forge
* - Elastic protections-artifacts (Linux rules)
* https://github.com/elastic/protections-artifacts/tree/main/yara/rules
*
* Every rule should set meta.severity (critical/high/medium/low); Strawberry
* stores it on each hit and defaults to "medium" when it is missing.
*/
import "elf"
rule Strawberry_Test_Marker {
meta:
description = "Harmless marker used to verify the scanner end to end"
author = "Strawberry"
severity = "low"
strings:
$marker = "STRAWBERRY-TEST-MARKER-7f3a9c"
condition:
$marker
}
rule Linux_CryptoMiner_XMRig {
meta:
description = "XMRig-style cryptocurrency miner"
author = "Strawberry"
severity = "high"
strings:
$stratum = "stratum+tcp://" ascii
$stratum_ssl = "stratum+ssl://" ascii
$xmrig = "xmrig" ascii nocase
$donate = "--donate-level" ascii
$randomx = "randomx" ascii nocase
$pool = "pool_wallet" ascii
$nicehash = "nicehash" ascii nocase
condition:
uint32(0) == 0x464c457f
and 1 of ($stratum*)
and 2 of ($xmrig, $donate, $randomx, $pool, $nicehash)
}
rule Linux_ReverseShell_Strings {
meta:
description = "Executable embeds a classic interactive reverse-shell command"
author = "Strawberry"
severity = "high"
strings:
$bash_tcp = /bash -i\s*>&\s*\/dev\/tcp\// ascii
$sh_tcp = /sh -i\s*>&\s*\/dev\/tcp\// ascii
$nc_e = /\bnc(at)?\s+(-[a-z]*\s+)*-e\s+\/bin\/(ba)?sh/ ascii
$mkfifo = /mkfifo\s+\/tmp\/[a-z0-9_]+;\s*(cat|nc)/ ascii
$py_pty = "pty.spawn(\"/bin/sh\")" ascii
$py_pty2 = "pty.spawn(\"/bin/bash\")" ascii
condition:
any of them
}
rule Linux_Packed_UPX_ELF {
meta:
description = "UPX-packed ELF (packing is rare for distro binaries and common for Linux malware)"
author = "Strawberry"
severity = "medium"
strings:
$upx1 = "UPX!" ascii
$upx2 = "$Info: This file is packed with the UPX" ascii
condition:
uint32(0) == 0x464c457f and ($upx1 in (0..1024) or $upx2)
}
rule Linux_LdPreload_Rootkit_Traits {
meta:
description = "Userland LD_PRELOAD rootkit traits: preload persistence plus libc hooking of process/file listing"
author = "Strawberry"
severity = "high"
strings:
$preload = "/etc/ld.so.preload" ascii
$dlsym = "dlsym" ascii
$rtld_next = "RTLD_NEXT" ascii
$readdir = "readdir" ascii
$hide1 = "hide" ascii nocase
$proc = "/proc/" ascii
condition:
uint32(0) == 0x464c457f
and elf.type == elf.ET_DYN
and $preload and $dlsym and $readdir and $proc
and ($rtld_next or $hide1)
and filesize < 2MB
}