YARA · Signature Base (Florian Roth / Nextron)
SIGNATURE_BASE_Brc4_Shellcode
Hunts for shellcode opcode used in Badger x86/x64 till release v1.2.9
- Author
- @ninjaparanoid
- Date
- 2022-11-19
- Modified
- 2023-12-05
- Score / Quality
- 75 / 83
What this rule detects
Hunts for shellcode opcode used in Badger x86/x64 till release v1.2.9
Targets: Windows PE.
It defines 13 patterns (0 text, 13 hex, 0 regex). YARA modules used: pe.
YARA-X says: warning[text_as_hex]: hex pattern could be written as text literal
Summary generated from the rule's metadata and condition.
Rule source
Includes the imports needed to compile it on its own.
import "pe"
rule SIGNATURE_BASE_Brc4_Shellcode
{
meta:
= "Hunts for shellcode opcode used in Badger x86/x64 till release v1.2.9"
= "@ninjaparanoid"
= "7e899d2f-332b-53f7-b9e6-cfde2bce6223"
= "2022-11-19"
= "2023-12-05"
= "https://github.com/paranoidninja/Brute-Ratel-C4-Community-Kit/blob/main/deprecated/brc4.yara"
= "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/yara/hktl_bruteratel_c4.yar#L263-L290"
= "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/LICENSE"
= "a2816eb0316cebc96569847c17eae3bc50b988b07aa471176a09695fcefc21ec"
= 75
= 83
= ""
= "last version"
= "x64"
strings:
$shellcode_x64_Start = { 55 50 53 51 52 56 57 41 50 41 51 41 52 41 53 41 54 41 55 41 56 41 57 }
$shellcode_x64_End = { 5B 5E 5F 41 5C 41 5D 41 5E 41 5F 5D C3 }
$shellcode_x64_StageEnd = { 5C 41 5F 41 5E 41 5D 41 5C 41 5B 41 5A 41 59 41 58 5F 5E 5A 59 5B 58 5D C3 }
$funcHash1 = { 5B BC 4A 6A }
$funcHash2 = { 5D 68 FA 3C }
$funcHash3 = { AA FC 0D 7C }
$funcHash4 = { 8E 4E 0E EC }
$funcHash5 = { B8 12 DA 00 }
$funcHash6 = { 07 C4 4C E5 }
$funcHash7 = { BD CA 3B D3 }
$funcHash8 = { 89 4D 39 8C }
$hashFuncx64 = { EB 20 0F 1F 44 00 00 44 0F B6 C8 4C 89 DA 41 83 E9 20 4D 63 C1 4B 8D 04 10 49 39 CB 74 21 49 83 C3 01 41 89 C2 }
$hashFuncx86 = { EB 07 8D 74 26 00 83 C2 01 0F B6 31 C1 C8 0D 89 F1 8D 5C 30 E0 01 F0 80 F9 61 89 D1 0F 43 C3 39 D7 75 E3 }
condition:
(pe.machine == pe.MACHINE_AMD64 and ( 2 of ( $shellcode* ) or all of ( $funcHash* ) and $hashFuncx64 ) ) or ( pe.machine == pe.MACHINE_I386 and ( all of ( $funcHash* ) and $hashFuncx86 ) )
}
Strings (13 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $shellcode_x64_Start | hex | { 55 50 53 51 52 56 57 41 50 41 51 41 52 41 53 41 54 41 55 41 56 41 57 } | |
| $shellcode_x64_End | hex | { 5B 5E 5F 41 5C 41 5D 41 5E 41 5F 5D C3 } | |
| $shellcode_x64_StageEnd | hex | { 5C 41 5F 41 5E 41 5D 41 5C 41 5B 41 5A 41 59 41 58 5F 5E 5A 59 5B 58 5D C3 } | |
| $funcHash1 | hex | { 5B BC 4A 6A } | |
| $funcHash2 | hex | { 5D 68 FA 3C } | |
| $funcHash3 | hex | { AA FC 0D 7C } | |
| $funcHash4 | hex | { 8E 4E 0E EC } | |
| $funcHash5 | hex | { B8 12 DA 00 } | |
| $funcHash6 | hex | { 07 C4 4C E5 } | |
| $funcHash7 | hex | { BD CA 3B D3 } | |
| $funcHash8 | hex | { 89 4D 39 8C } | |
| $hashFuncx64 | hex | { EB 20 0F 1F 44 00 00 44 0F B6 C8 4C 89 DA 41 83 E9 20 4D 63 C1 4B 8D 04 10 49 39 CB 74 21 49 83 C3 01 41 89 C2 } | |
| $hashFuncx86 | hex | { EB 07 8D 74 26 00 83 C2 01 0F B6 31 C1 C8 0D 89 F1 8D 5C 30 E0 01 F0 80 F9 61 89 D1 0F 43 C3 39 D7 75 E3 } |
Condition
(pe.machine == pe.MACHINE_AMD64 and ( 2 of ( $shellcode* ) or all of ( $funcHash* ) and $hashFuncx64 ) ) or ( pe.machine == pe.MACHINE_I386 and ( all of ( $funcHash* ) and $hashFuncx86 ) )In plain words (Heuristic)
- All patterns in ( $funcHash* ) must match.
- At least 2 patterns in ( $shellcode* ) must match.
- Uses the pe module.
- Pattern $hashFuncx64 must be present.
- Pattern $hashFuncx86 must be present.
Test this rule in your browser
Drop a file to scan it with this rule using YARA-X compiled to WebAssembly. Nothing is uploaded.
Licence & attribution
Author: @ninjaparanoid
Source repository: Signature Base (Florian Roth / Nextron) @ 94a1c48d7a
Licence: Detection Rule License 1.1 (repository licence)
Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.
Rule id: 7e899d2f-332b-53f7-b9e6-cfde2bce6223
Metadata
| version | last version |
|---|---|
| arch_context | x64 |