神秘sigs文件中挖掘出的新APT组织:Nazar

三年前左右,在2017年4月14日,一个神秘的黑客组织影子经纪人(Shadow Brokers)在互联网上公布了一系列的黑客工具和漏洞,这些曾经被NSA利用的工具/漏洞一定程度上给互联网带来了大地震。

这批泄露中涵盖多种黑客工具和不同的漏洞,例如Windows的“永恒之蓝”漏洞,就是造成WannaCry以及后来NotPetya勒索软件席卷全球的最大元凶。除此之外,研究人员还发现了更多未知内容,尝试解读出其中隐藏的各种秘密。

关于Sigs.py文件

自从3年前影子经纪人泄露这批黑客工具以来,全球各地的安全研究人员就在积极研究,尽管可能出于不同目的,但总是想从中挖出点有用的信息来,整出一些大新闻。除了声名远播的“永恒之蓝”漏洞,其中还有一个名为sigs.py的文件,让很多研究人员大为痴迷。

Sigs.py这个文件据说是作为一个精简版的恶意软件扫描器,被NSA部署在目标系统中,通过扫描目标系统是否存在一些行为特征,从而判断目标系统中是否还有其他APT存在。

这个文件中包含44个特征指纹(Signatures)用来检测其他APT组织的行为,编号为1-45号,其中不包括第42号。如果研究人员的推测是正确的,那么这个文件就表明NSA掌握至少44个APT组织的恶意行为特征,这远超目前公开的APT数量。

下图是sigs.py文件的部分内容:

到目前为止,研究人员已经解开了29个特征的谜底,对应到了各自的APT特征。15个特征的归属仍然是个迷,再一次间接表明NSA在识别各种APT行动上的能力。下面是研究人员暂时还没有解开的特征序号:

代号37

在4月22日举行的OPCDE虚拟网络安全峰会上,卡巴斯基和谷歌前研究员胡安·安德烈斯·格雷罗·萨德(Juan Andres Guerrero-Saade)分享了他的研究成果,即sig37背后的APT组织。

这次的研究发现其实更正了一个关于sig37的错误。在此之前,CrySyS Lab发布的报告中称sig37可能和APT组织Iron Tiger(亦称作Emissary Panda)有关,被推测是一个和中国有关的APT组织。然而在这次峰会上,Guerrero-Saade表示sig37对应的可能完全是另一个全新的黑客组织,极有可能和伊朗有关。通过对比这些活动和现有的公开APT组织活动,可以确定sig37代表着一个全新的黑客组织,并且活动时间最早可以追溯至2008年,但主要活动时间在2010年至2013年。

Guerrero-Saade暂时将这个组织的名字命名为Nazar,源于与其相关的恶意样本中出现的一个字符串。有趣的是,“Nazar”从波斯语(伊朗使用的语言之一)翻译成罗马字符时意思为“监视”,结合NSA和伊朗这一因素,也给sig37的新归属增添了几分真实性。

Guerrero-Saade在峰会的演讲上说道:“研究中发现了一个有趣的现象, Nazar的恶意软件攻击目标是很老的Windows系统,例如Windows XP及之前的版本,到现在仍然有来自伊朗的受害者。” Guerrero-Saade还表示:“在考虑源自伊朗地区的攻击行动时,人们一般会将目光聚集到西方国家来寻找对应的受害者。”但是从这次sig37的研究中发现,如果仅从表面的一些分析来看,Nazar组织很可能是源自伊朗,并且目标也是在伊朗境内。

APT Nazar

Guerrero-Saade在其分析报告中表示,Nazar使用一个模块化的工具箱,其主删除程序通过“regsvr32.exe”在Windows注册表中将多个DLL静默注册为OLE控件。该恶意软件将伪装为通用Windows服务宿主进程(’svchost.exe’)的编排器(’Data.bin’)注册为服务(’EYService’)来提高潜伏的持久能力。

下面是Nazar的组件结构简图:

该恶意软件使用子组件DLL来实现麦克风录音和屏幕抓图功能以及按键记录功能。恶意代码利用两个自定义资源,即“godown.dll”和“filesystem.dll”,并注册为OLE控件,来枚举连接的驱动器,遍历文件夹结构并处理某些C&C功能。恶意代码使用内核驱动程序来嗅探来自受害者机器接口的数据包,并解析它们以获取特定的字符串。

Guerrero-Saade已经在其个人博客中更新了关于Sig37和Nazar组织更详细的分析内容。

YARA RULE

rule apt_ZZ_SIG37_NAZAR_GpUpdatesExe
{
	meta:
		desc = "SIG37 GpUpdates dropper, Chilkat Zip2Secure"
		author = "JAG-S"
		hash = "75e4d73252c753cd8e177820eb261cd72fecd7360cc8ec3feeab7bd129c01ff6"
	strings:
		$open = "open" ascii wide fullword
		$regsrv = "regsvr32.exe" ascii wide
		$filename1 = "Godown.dll -s" ascii wide
		$filename2 = "ViewScreen.dll -s" ascii wide
		$filename3 = "Filesystem.dll -s" ascii wide

	condition:
		uint16(0) == 0x5a4d
		and
		($open and $regsrv and (1 of ($filename*))) 
}

rule apt_ZZ_SIG37_NAZAR_FarsiResources
{
	meta:
		desc = "SIG37 GpUpdates Shared Farsi resources"
		author = "JAG-S"
		hash = "75e4d73252c753cd8e177820eb261cd72fecd7360cc8ec3feeab7bd129c01ff6"
	condition:
		uint16(0) == 0x5a4d
		and
		for any i in (0..pe.number_of_resources - 1): //FARSI resources
			(
				hash.sha256(pe.resources[i].offset, pe.resources[i].length) == "893cf8c164106784669b395825f17c21f46a345babfff6144686e8e1a48bf2f1"
				or
				hash.sha256(pe.resources[i].offset, pe.resources[i].length) == "26ee0ff37e6ffd30ca5415992ececc5faeb8e6a937fcbeb3952ce5581456b7b5"
			)
}

rule apt_ZZ_SIG37_NAZAR_GoDownDll
{
	meta:
		desc = "SIG37 Dropped TypeLibrary"
		author = "JAG-S"		
		hash = "8fb9a22b20a338d90c7ceb9424d079a61ca7ccb7f78ffb7d74d2f403ae9fbeec" //??
	strings:
		$godown1 = /Godown [0-9.]{1,4} Type LibraryWWW/ ascii wide
		$godown2 = "Godown.Shutdown.1" ascii wide
		$godown3 = "qGODOWNLibWWW" ascii wide

		$guid1 = "{772BA12D-8A62-4DD3-B3E8-92DA702E6F3D}" ascii wide //TypeLib reg
		$guid2 = "{B64E94AF-D56B-48B4-B178-AF0723E72AB5}" ascii wide //TypeLib reg
		$guid3 = "{DBCB4B31-21B8-4A0F-BC69-0C3CE3B66D00}" ascii wide

		$shutdown1 = "aShutdownd" ascii wide
		$shutdown2 = "IShutdownWWWd" ascii wide
		$shutdown3 = "IShutdown InterfaceWWW" ascii wide
		$shutdown4 = "method PowerOffWWW" ascii wide		
		$shutdown5 = "property TimeoutWW" ascii wide

	condition:
		uint16(0) == 0x5a4d
		and
		(
			any of ($godown*)
			or
			any of ($guid*)
			or
			2 of ($shutdown*)
		)
}

rule apt_ZZ_SIG37_NAZAR_Kzher_pdb
{
	meta:
		desc = "GoDown PDB Path"
		author = "JAG-S"		
		hash = "4d0ab3951df93589a874192569cac88f7107f595600e274f52e2b75f68593bca"
		hash = "d9801b4da1dbc5264e83029abb93e800d3c9971c650ecc2df5f85bcc10c7bd61"
		hash = "1110c3e34b6bbaadc5082fabbdd69f492f3b1480724b879a3df0035ff487fd6f"
	strings:
		$pdb_spec = "C:\\khzer\\DLLs\\DLL's Source\\" ascii wide
		$pdb_gen = "C:\\khzer\\" ascii wide

	condition:
		uint16(0) == 0x5a4d
		and
		any of them
}


rule apt_ZZ_SIG37_NAZAR_GpUpdates_Distribute
{
	meta:
		desc = "SIG37 GpUpdates unpacked distributor: Distribute.exe"
		author = "JAG-S"
		hash = "6b8ea9a156d495ec089710710ce3f4b1e19251c1d0e5b2c21bbeeab05e7b331f"
		parent = "d34a996826ea5a028f5b4713c797247913f036ca0063cc4c18d8b04736fa0b65"
	strings:
		$uniq_filename1 = "\\godown.dll" ascii wide
		
		
		$common_filename1 = "\\ViewScreen.dll" ascii wide
		$common_filename2 = "\\filesystem.dll" ascii wide
		$common_filename3 = "\\dllcache\\svchost.exe" ascii wide
		$common_filename4 = "\\lame_enc.dll" ascii wide
		$common_filename5 = "\\hodll.dll" ascii wide

		$service1 = "Provides basic host functionality" ascii wide
		$service2 = "EYService" ascii wide
		$service3 = "Windows Host Service" ascii wide
	condition:
		uint16(0) == 0x5a4d
		and
		(
			any of ($uniq_filename*)
			or
			all of ($common_filename*)
			or
			(all of ($service*) and 3 of ($common_filename*))
		)
}

总结

虽然Nazar本身看上去不存在太大的杀伤力,但Nazar的发现证明了对于Sig37谜底的挖掘是物有所值。除了通过分析现有的恶意样本来更多的了解各种APT组织的活动行为,还可以将各种来源的信息碎片在不同特征(Signatures)的引导下组合起来,就很可能会有新的发现。

对于sigs.py的探究还在继续,这次发现可谓是给研究人员的一针兴奋剂,至于还未解密的那些特征(Signatures)带来的是真相还是所谓真相的冰山一角,就让我们拭目以待吧。

参考

Sigs.py文件:

https://github.com/misterch0c/shadowbroker/blob/master/windows/Resources/TeDi/PyScripts/sigs.py

CrySys Lab报告:

https://www.crysys.hu/publications/files/tedi/ukatemicrysys_territorialdispute.pdf

Guerrero-Saade博客:

https://www.epicturla.com/blog/the-lost-nazar

OPCDE峰会演讲视频:

https://www.youtube.com/watch?v=QImyKDvryq8&feature=youtu.be

其他媒体报道:

https://www.zdnet.com/article/security-researcher-identifies-new-apt-group-mentioned-in-2017-shadow-brokers-leak/#ftag=RSSbaffb68

Spread the word. Share this post!

Meet The Author

Leave Comment