Skip to content

Commit 52d6a6d

Browse files
authored
fix(rules): address macOS sigkill for SEKOIA_Infostealer_Mac_Realst (#1510)
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
1 parent a841df9 commit 52d6a6d

2 files changed

Lines changed: 46 additions & 16 deletions

File tree

third_party/yara/YARAForge/yara-rules-full.yar

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -252638,22 +252638,22 @@ rule SEKOIA_Infostealer_Mac_Realst : FILE
252638252638
classification = "TLP:CLEAR"
252639252639

252640252640
strings:
252641-
$str00 = "realst@" ascii
252642-
$str01 = "IP:" ascii
252643-
$str02 = "OS:" ascii
252644-
$str03 = "PC PASSWORD:" ascii
252645-
$str04 = "Cookies:" ascii
252646-
$str05 = "Wallets:" ascii
252647-
$str06 = "Apps:" ascii
252648-
$str07 = "USERNAME: ]" ascii
252649-
$str08 = "FILENAME:" ascii
252650-
$str09 = "multipart/form-data; boundary=" ascii
252651-
$str10 = "src/browsers/firefox/modules/decryptors.rs" ascii
252652-
$str11 = "{\"event_id\":\"" ascii
252653-
$str12 = "..browsers..firefox..modules..data_stealers.." ascii
252654-
$str13 = "..browsers..chromium..modules..key_stealers.." ascii
252655-
$str14 = "..browsers..firefox..modules..decryptors.." ascii
252656-
$str15 = "url: , login: , password:" ascii
252641+
$str00 = { 72 65 61 6C 73 74 40 }
252642+
$str01 = { 49 50 3A }
252643+
$str02 = { 4F 53 3A }
252644+
$str03 = { 50 43 20 50 41 53 53 57 4F 52 44 3A }
252645+
$str04 = { 43 6F 6F 6B 69 65 73 3A }
252646+
$str05 = { 57 61 6C 6C 65 74 73 3A }
252647+
$str06 = { 41 70 70 73 3A }
252648+
$str07 = { 55 53 45 52 4E 41 4D 45 3A 20 5D }
252649+
$str08 = { 46 49 4C 45 4E 41 4D 45 3A }
252650+
$str09 = { 6D 75 6C 74 69 70 61 72 74 2F 66 6F 72 6D 2D 64 61 74 61 3B 20 62 6F 75 6E 64 61 72 79 3D }
252651+
$str10 = { 73 72 63 2F 62 72 6F 77 73 65 72 73 2F 66 69 72 65 66 6F 78 2F 6D 6F 64 75 6C 65 73 2F 64 65 63 72 79 70 74 6F 72 73 2E 72 73 }
252652+
$str11 = { 7B 22 65 76 65 6E 74 5F 69 64 22 3A 22 }
252653+
$str12 = { 2E 2E 62 72 6F 77 73 65 72 73 2E 2E 66 69 72 65 66 6F 78 2E 2E 6D 6F 64 75 6C 65 73 2E 2E 64 61 74 61 5F 73 74 65 61 6C 65 72 73 2E 2E }
252654+
$str13 = { 2E 2E 62 72 6F 77 73 65 72 73 2E 2E 63 68 72 6F 6D 69 75 6D 2E 2E 6D 6F 64 75 6C 65 73 2E 2E 6B 65 79 5F 73 74 65 61 6C 65 72 73 2E 2E }
252655+
$str14 = { 2E 2E 62 72 6F 77 73 65 72 73 2E 2E 66 69 72 65 66 6F 78 2E 2E 6D 6F 64 75 6C 65 73 2E 2E 64 65 63 72 79 70 74 6F 72 73 2E 2E }
252656+
$str15 = { 75 72 6C 3A 20 2C 20 6C 6F 67 69 6E 3A 20 2C 20 70 61 73 73 77 6F 72 64 3A }
252657252657

252658252658
condition:
252659252659
( uint32( 0 ) == 0xfeedface or uint32( 0 ) == 0xcefaedfe or uint32( 0 ) == 0xfeedfacf or uint32( 0 ) == 0xcffaedfe or uint32( 0 ) == 0xcafebabe or uint32( 0 ) == 0xbebafeca ) and 13 of ( $str* )

third_party/yara/update.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,36 @@ function fixup_rules() {
5151
fi
5252
done
5353
done
54+
55+
# Convert text strings to hex for specific rules inside monolithic YARA files.
56+
# Format: "rule_name:filename" pairs. The filename is matched against basename.
57+
local edr_flagged_monolithic_rules=(
58+
"SEKOIA_Infostealer_Mac_Realst:yara-rules-full.yar"
59+
)
60+
for file in "$@"; do
61+
local base
62+
base="$(basename "$file")"
63+
for entry in "${edr_flagged_monolithic_rules[@]}"; do
64+
local rule_name="${entry%%:*}"
65+
local target_file="${entry##*:}"
66+
if [[ "$base" == "$target_file" ]]; then
67+
perl -i -pe '
68+
BEGIN { $in_rule = 0; $in_strings = 0; }
69+
if (/^rule '"${rule_name}"' /) { $in_rule = 1; }
70+
if ($in_rule && /^\s+strings:/) { $in_strings = 1; next; }
71+
if ($in_rule && $in_strings && /^\s+condition:/) { $in_rule = 0; $in_strings = 0; next; }
72+
if ($in_rule && $in_strings) {
73+
s{^(\s*)(\$\w+)\s*=\s*"((?:[^"\\]|\\.)+)"\s+ascii(\s+\w+)?\s*$}{
74+
my ($ind, $var, $raw, $mod) = ($1, $2, $3, $4);
75+
$raw =~ s/\\(.)/$1/g;
76+
my $hex = join(" ", map { sprintf "%02X", ord($_) } split(//, $raw));
77+
sprintf("%s%s = { %s }%s\n", $ind, $var, $hex, defined($mod) ? $mod : "");
78+
}e;
79+
}
80+
' "$file"
81+
fi
82+
done
83+
done
5484
}
5585

5686
# update_dep updates a dependency to the latest release

0 commit comments

Comments
 (0)