← Back to SOC feed Coverage →

Rule to detect Moonlight Maze 'xk' keylogger

yara LOW Yara-Rules
communityinfostealer
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at Yara-Rules →
Retrieved: 2026-05-29T11:00:00Z · Confidence: medium

Hunt Hypothesis

The hypothesis is that the detection rule identifies potential Moonlight Maze ‘xk’ keylogger activity through suspicious process creation or file execution patterns indicative of malware behavior. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify and mitigate long-term persistence and data exfiltration risks associated with advanced persistent threats.

YARA Rule

rule apt_RU_MoonlightMaze_xk_keylogger {

meta:
	
	author = "Kaspersky Lab"
	date = "2017-03-27"
	version = "1.0"
	last_modified = "2017-03-27"
	reference = "https://en.wikipedia.org/wiki/Moonlight_Maze"
	description = "Rule to detect Moonlight Maze 'xk' keylogger"

strings:

	$a1="Log ended at => %s"
	$a2="Log started at => %s [pid %d]"
	$a3="/var/tmp/task" fullword
	$a4="/var/tmp/taskhost" fullword
	$a5="my hostname: %s"
	$a6="/var/tmp/tasklog"
	$a7="/var/tmp/.Xtmp01" fullword
	$a8="myfilename=-%s-"
	$a9="/var/tmp/taskpid"
	$a10="mypid=-%d-" fullword
	$a11="/var/tmp/taskgid" fullword
	$a12="mygid=-%d-" fullword


condition:

	((3 of ($a*)))

}

Deployment Notes

This YARA rule can be deployed in the following contexts:

This rule contains 12 string patterns in its detection logic.

References

False Positive Guidance

Original source: https://github.com/Yara-Rules/rules/blob/main/malware/APT_MoonlightMaze.yar