Skip to content

YARA · SEKOIA.IO Community

SEKOIA_Backdoor_Win_Mgbot_Main

Detect MgBot main.dll file

MalwareMgbotSEKOIA.IO CommunityDetection Rule License 1.1Compiles with YARA-X (with warnings)
Author
Sekoia.io
Date
2024-03-20
Modified
2024-12-19
Score / Quality
75 / 80

What this rule detects

Detect MgBot main.dll file

Associated malware family: Mgbot.

Targets: Windows PE.

It has no patterns: the condition alone decides (modules, file properties or other rules). YARA modules used: pe, hash.

YARA-X says: warning[deprecated_field]: field `number_of_sections` is deprecated

Summary generated from the rule's metadata and condition.

Rule source

Includes the imports needed to compile it on its own.

backdoor-win-mgbot-main.yarDetection Rule License 1.1
import "pe"
import "hash"

rule SEKOIA_Backdoor_Win_Mgbot_Main
{
	meta:
		description = "Detect MgBot main.dll file"
		author = "Sekoia.io"
		id = "528baa11-58d5-470a-bd6d-963d4ac75d97"
		date = "2024-03-20"
		modified = "2024-12-19"
		reference = "https://symantec-enterprise-blogs.security.com/blogs/threat-intelligence/apt-attacks-telecoms-africa-mgbot"
		source_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/yara_rules/backdoor_win_mgbot_main.yar#L4-L35"
		license_url = "https://github.com/SEKOIA-IO/Community/blob/a438a5901a211c2abdf75da9c93921ef187473d1/LICENSE.md"
		hash = "706c9030c2fa5eb758fa2113df3a7e79257808b3e79e46869d1bf279ed488c36"
		hash = "017187a1b6d58c69d90d81055db031f1a7569a3b95743679b21e44ea82cfb6c7"
		logic_hash = "61b335c88ce8bc56396b597c7c6f27b1d431941682401f0b3950c80edf7d8403"
		score = 75
		quality = 80
		tags = ""
		version = "1.0"
		classification = "TLP:CLEAR"

	condition:
		pe.imphash( ) == "8e1ee04a99c77bd54c6dc55214ffa2e3" or hash.md5 ( pe.rich_signature.clear_data ) == "67e8e8b75b981b5c8ff31149dc2c61b2" or for any i in ( 0 .. pe.number_of_sections -1 ) : ( hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "7c6adf9987e6dfbf19b5f156b0314798" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "46fa9f5a035c8ae8de1a0d14150bd5ef" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "f7895f9456f8d51125e6744960c38133" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "5d82bb8a7ef37c417615381b446f715c" ) or for any i in ( 0 .. pe.number_of_resources -1 ) : ( hash.sha256 ( pe.resources [ i ] . offset , pe.resources [ i ] . length ) == "d7808c6662f098e685040f7c61bc033d9e73002f674de7cf2ffcd6230d60d429" )
}

Condition

pe.imphash( ) == "8e1ee04a99c77bd54c6dc55214ffa2e3" or hash.md5 ( pe.rich_signature.clear_data ) == "67e8e8b75b981b5c8ff31149dc2c61b2" or for any i in ( 0 .. pe.number_of_sections -1 ) : ( hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "7c6adf9987e6dfbf19b5f156b0314798" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "46fa9f5a035c8ae8de1a0d14150bd5ef" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "f7895f9456f8d51125e6744960c38133" or hash.md5 ( pe.sections [ i ] . raw_data_offset , pe.sections [ i ] . raw_data_size ) == "5d82bb8a7ef37c417615381b446f715c" ) or for any i in ( 0 .. pe.number_of_resources -1 ) : ( hash.sha256 ( pe.resources [ i ] . offset , pe.resources [ i ] . length ) == "d7808c6662f098e685040f7c61bc033d9e73002f674de7cf2ffcd6230d60d429" )

In plain words (Heuristic)

  • A for-loop checks a property over several matches or items.
  • Uses the pe module.
  • Uses the hash module.
  • Compares a hash of the file or a part of it.
  • Checks the PE import hash (imphash).
  • Checks PE sections (names, count or properties).

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).

  • 706c9030c2fa5eb758fa2113df3a7e79257808b3e79e46869d1bf279ed488c36
  • 017187a1b6d58c69d90d81055db031f1a7569a3b95743679b21e44ea82cfb6c7

Licence & attribution

Author: Sekoia.io

Source repository: SEKOIA.IO Community @ a438a5901a

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: 528baa11-58d5-470a-bd6d-963d4ac75d97

Metadata

version1.0
classificationTLP:CLEAR

More Mgbot rules