Skip to content

YARA · Mandiant red team tool countermeasures

FIREEYE_RT_Hacktool_MSIL_Sharpersist_2

No description has been set in the source file - FireEye-RT

Hack toolMandiant red team tool countermeasuresBSD 2-Clause LicenseCompiles with YARA-X
Author
FireEye
Date
2020-12-08
Modified
2020-12-09
Score / Quality
75 / 75

What this rule detects

No description has been set in the source file - FireEye-RT

Targets: Windows PE.

It defines 10 patterns (10 text, 0 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

hacktool-msil-sharpersist-2.yarBSD 2-Clause License
rule FIREEYE_RT_Hacktool_MSIL_Sharpersist_2 : FILE
{
	meta:
		description = "No description has been set in the source file - FireEye-RT"
		author = "FireEye"
		id = "49d7891e-b97a-52a8-acfd-bbf986732d6c"
		date = "2020-12-08"
		modified = "2020-12-09"
		reference = "https://github.com/mandiant/red_team_tool_countermeasures/"
		source_url = "https://github.com/mandiant/red_team_tool_countermeasures//blob/3561b71724dbfa3e2bb78106aaa2d7f8b892c43b/rules/SHARPERSIST/production/yara/HackTool_MSIL_SharPersist_2.yar#L4-L23"
		license_url = "https://github.com/mandiant/red_team_tool_countermeasures//blob/3561b71724dbfa3e2bb78106aaa2d7f8b892c43b/LICENSE.txt"
		hash = "98ecf58d48a3eae43899b45cec0fc6b7"
		logic_hash = "57387352f8fd08e8b859dffc1164d46370f248b337526c265634160010572a00"
		score = 75
		quality = 75
		tags = "FILE"
		rev = 1

	strings:
		$a1 = "SharPersist.lib"
		$a2 = "SharPersist.exe"
		$b1 = "ERROR: Invalid hotkey location option given." ascii wide
		$b2 = "ERROR: Invalid hotkey given." ascii wide
		$b3 = "ERROR: Keepass configuration file not found." ascii wide
		$b4 = "ERROR: Keepass configuration file was not found." ascii wide
		$b5 = "ERROR: That value already exists in:" ascii wide
		$b6 = "ERROR: Failed to delete hidden registry key." ascii wide
		$pdb1 = "\\SharPersist\\"
		$pdb2 = "\\SharPersist.pdb"

	condition:
		( uint16( 0 ) == 0x5A4D and uint32( uint32( 0x3C ) ) == 0x00004550 ) and ( ( @pdb2 [ 1 ] < @pdb1 [ 1 ] + 50 ) or ( 1 of ( $a* ) and 2 of ( $b* ) ) )
}

Strings (10 patterns)

IdentifierTypeValueModifiers
$a1text"SharPersist.lib"
$a2text"SharPersist.exe"
$b1text"ERROR: Invalid hotkey location option given."ascii wide
$b2text"ERROR: Invalid hotkey given."ascii wide
$b3text"ERROR: Keepass configuration file not found."ascii wide
$b4text"ERROR: Keepass configuration file was not found."ascii wide
$b5text"ERROR: That value already exists in:"ascii wide
$b6text"ERROR: Failed to delete hidden registry key."ascii wide
$pdb1text"\\SharPersist\\"
$pdb2text"\\SharPersist.pdb"

Condition

( uint16( 0 ) == 0x5A4D and uint32( uint32( 0x3C ) ) == 0x00004550 ) and ( ( @pdb2 [ 1 ] < @pdb1 [ 1 ] + 50 ) or ( 1 of ( $a* ) and 2 of ( $b* ) ) )

In plain words (Heuristic)

  • The file must start with “MZ” — a Windows executable (PE).
  • At least 1 patterns in ( $a* ) must match.
  • At least 2 patterns in ( $b* ) must match.

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

Sample hashes

Hashes of samples the author lists in the rule's meta (look them up in your threat-intelligence platform).

  • 98ecf58d48a3eae43899b45cec0fc6b7

Licence & attribution

Author: FireEye

Source repository: Mandiant red team tool countermeasures @ 3561b71724

Licence: BSD 2-Clause License (repository licence)

Copyright notice: Copyright (c) 2023, MANDIANT

Original rule

Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.

Rule id: 49d7891e-b97a-52a8-acfd-bbf986732d6c

Metadata

rev1

Tags:FILE