Skip to content

YARA · Signature Base (Florian Roth / Nextron)

SIGNATURE_BASE_Brc4_Shellcode

Hunts for shellcode opcode used in Badger x86/x64 till release v1.2.9

GenericSignature Base (Florian Roth / Nextron)Detection Rule License 1.1Compiles with YARA-X (with warnings)
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.

brc4-shellcode.yarDetection Rule License 1.1
import "pe"

rule SIGNATURE_BASE_Brc4_Shellcode
{
	meta:
		description = "Hunts for shellcode opcode used in Badger x86/x64 till release v1.2.9"
		author = "@ninjaparanoid"
		id = "7e899d2f-332b-53f7-b9e6-cfde2bce6223"
		date = "2022-11-19"
		modified = "2023-12-05"
		reference = "https://github.com/paranoidninja/Brute-Ratel-C4-Community-Kit/blob/main/deprecated/brc4.yara"
		source_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/yara/hktl_bruteratel_c4.yar#L263-L290"
		license_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/LICENSE"
		logic_hash = "a2816eb0316cebc96569847c17eae3bc50b988b07aa471176a09695fcefc21ec"
		score = 75
		quality = 83
		tags = ""
		version = "last version"
		arch_context = "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)

IdentifierTypeValueModifiers
$shellcode_x64_Starthex{ 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_Endhex{ 5B 5E 5F 41 5C 41 5D 41 5E 41 5F 5D C3 }
$shellcode_x64_StageEndhex{ 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 }
$funcHash1hex{ 5B BC 4A 6A }
$funcHash2hex{ 5D 68 FA 3C }
$funcHash3hex{ AA FC 0D 7C }
$funcHash4hex{ 8E 4E 0E EC }
$funcHash5hex{ B8 12 DA 00 }
$funcHash6hex{ 07 C4 4C E5 }
$funcHash7hex{ BD CA 3B D3 }
$funcHash8hex{ 89 4D 39 8C }
$hashFuncx64hex{ 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 }
$hashFuncx86hex{ 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.

Drop a file here or click to chooseScanned locally with YARA-X. Files up to 200 MB.

Open in editor

References

Licence & attribution

Author: @ninjaparanoid

Source repository: Signature Base (Florian Roth / Nextron) @ 94a1c48d7a

Licence: Detection Rule License 1.1 (repository licence)

Original rule

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

versionlast version
arch_contextx64