Lab 11-1

Analyze the malware found in Lab11-01.exe.

Questions and Short Answers

  1. What does the malware drop to disk?

    A: The malware extracts and drops the file msgina32.dll onto disk from a resource section named TGAD.

  2. How does the malware achieve persistence?

    A: The malware installs msgina32.dll as a GINA DLL by adding it to the registry location HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GinaDLL, which causes the DLL to be loaded after system reboot.

  3. How does the malware steal user credentials?

    A: The malware steals user credentials by performing GINA interception. The msgina32.dll file is able to intercept all user credentials submitted to the system for authentication.

  4. What does the malware do with stolen credentials?

    A: The malware logs stolen credentials to %SystemRoot%\System32\msutil32.sys. The username, domain, and password are logged to the file with a timestamp.

  5. How can you use this malware to get user credentials from your test environment?

    A: Once the malware is dropped and installed, there must be a system reboot for the GINA interception to begin. The malware logs credentials only when the user logs out, so log out and back in to see your credentials in the log file.

Detailed Analysis

Beginning with basic static analysis, we see the strings GinaDLL and SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon, which lead us to suspect that this might be GINA interception malware. Examining the imports, we see functions for manipulating the registry and extracting a resource section. Because we see resource extraction import functions, we examine the file structure by loading Lab11-01.exe into PEview, as shown in Figure 11-1L.

605033-20190302214148529-1499054793.png

605033-20190302214139319-1564341814.png

605033-20190302214130721-15704448.png

Figure 11-1L: Lab11-01.exe in PEview showing the TGAD resource section

Examining the PE file format, we see a resource section named TGAD. When we click that section in PEview, we see that TGAD contains an embedded PE file.

Next, we perform dynamic analysis and monitor the malware with procmon by setting a filter for Lab11-01.exe. When we launch the malware, we see that it creates a file named msgina32.dll on disk in the same directory from which the malware was launched. The malware inserts the path to msgina32.dll into the registry key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GinaDLL, so that the DLL will be loaded by Winlogon when the system reboots.

605033-20190302214120900-1237077092.png

Lab11-01.exe 所在文件夹,在 Lab11-01.exe 执行前后对比:

605033-20190302214111003-1243354604.png

605033-20190302214059013-362294419.png

605033-20190302214046394-1651121459.png

Extracting the TGAD resource section from Lab11-01.exe (using Resource Hacker) and comparing it to msgina32.dll, we find that the two are identical.

导出 Lab11-01.exe 中的 TGAD 资源节:

605033-20190302214037102-876429344.png

查 TGAD.bin 和 msgina32.dll 文件的 MD5:

605033-20190302214027395-517609872.png

它俩 MD5 相同,应该是同一文件。使用 PEview 查看也相同:

605033-20190302214018142-289881138.png

Next, we load Lab11-01.exe into IDA Pro to confirm our findings. We see that the main function calls two functions: sub_401080 (extracts the TGAD resource section to msgina32.dll) and sub_401000 (sets the GINA registry value). We conclude that Lab11-01.exe is an installer for msgina32.dll, which is loaded by Winlogon during system startup.

605033-20190302214003887-1009847501.png

Analysis of msgina32.dll

We’ll begin our analysis of msgina32.dll by looking at the Strings output, as shown in Listing 11-1L.

605033-20190302213941830-1098761732.png

Listing 11-1L: Strings output of msgina32.dll

The strings in this listing contain what appears to be a log message at \({\color{red}1}​\), which could be used to log user credentials if this is GINA interception malware. The string msutil32.sys is interesting, and we will determine its significance later in the lab.

Examining msgina32.dll’s exports, we see many functions that begin with the prefix Wlx. Recall from Chapter 11 that GINA interception malware must contain all of these DLL exports because they are required by GINA. We’ll analyze each of these functions in IDA Pro.

605033-20190302213932399-945336818.png

605033-20190302213922862-1450183150.png

We begin by loading the malware into IDA Pro and analyzing DllMain, as shown in Listing 11-2L.

605033-20190302213912294-724006166.png

Listing 11-2L: DllMain of msgina32.dll getting a handle to msgina.dll

As shown in the Listing 11-2L, DllMain first checks the fdwReason argument at \({\color{red}1}​\). This is an argument passed in to indicate why the DLL entry-point function is being called. The malware checks for DLL_PROCESS_ATTACH, which is called when a process is starting up or when LoadLibrary is used to load the DLL. If this particular DllMain is called during a DLL_PROCESS_ATTACH, the code beginning at \({\color{red}2}​\) is called. This code gets a handle to msgina.dll in the Windows system directory via the call to LoadLibraryW at \({\color{red}3}​\).

NOTE

msgina.dll is the Windows DLL that implements GINA, whereas msgina32.dll is the malware author’s GINA interception DLL. The name msgina32 is designed to deceive.

The malware saves the handle in a global variable that IDA Pro has named hModule at \({\color{red}4}​\). The use of this variable allows the DLL’s exports to properly call functions in the msgina.dll Windows DLL. Since msgina32.dll is intercepting communication between Winlogon and msgina.dll, it must properly call the functions in msgina.dll so that the system will continue to operate normally.

Next, we analyze each export function. We begin with WlxLoggedOnSAS, as shown in Listing 11-3L.

605033-20190302213902026-1341739541.png

Listing 11-3L: WlxLoggedOnSAS export just passing through to msgina.dll

The WlxLoggedOnSAS export is short and simply passes through to the true WlxLoggedOnSAS contained in msgina.dll. There are now two WlxLoggedOnSAS functions: the version in Listing 11-3L in msgina32.dll and the original in msgina.dll. The function in Listing 11-3L begins by passing the string WlxLoggedOnSAS to sub_10001000 and then jumps to the result. The sub_10001000 function uses the hModule handle (to msgina.dll) and the string passed in (in this case, WlxLoggedOnSAS) to use GetProcAddress to resolve a function in msgina.dll. The malware doesn’t call the function; it simply resolves the address of WlxLoggedOnSAS in msgina.dll and jumps to the function, as seen at \({\color{red}1}​\). By jumping and not calling WlxLoggedOnSAS, this code will not set up a stack frame or push a return address onto the stack. When WlxLoggedOnSAS in msgina.dll is called, it will return execution directly to Winlogon because the return address on the stack is the same as what was on the stack when the code in Listing 11-3L is called.

If we continue analyzing the other exports, we see that most operate like WlxLoggedOnSAS (they are pass-through functions), except for WlxLoggedOutSAS, which contains some extra code. (WlxLoggedOutSAS is called when the user logs out of the system.)

The export begins by resolving WlxLoggedOutSAS within msgina.dll using GetProcAddress and then calling it. The export also contains the code shown in Listing 11-4L.

605033-20190302213848085-438080138.png

Listing 11-4L: WlxLoggedOutSAS calling the credential logging function sub_10001570

The code in Listing 11-4L passes a bunch of arguments and a format string at \({\color{red}1}\). This string is passed to sub_10001570, which is called at \({\color{red}2}\).

It seems like sub_10001570 may be the logging function for stolen credentials, so let’s examine it to see what it does. Listing 11-5L shows the logging code contained in sub_10001570.

605033-20190302213818574-791408909.png

Listing 11-5L: The credential-logging function logging to msutil32.sys

The call to vsnwprintf at \({\color{red}1}\) fills in the format string passed in by the WlxLoggedOutSAS export. Next, the malware opens the file msutil32.sys at \({\color{red}2}\), which is created inside C:\Windows\System32\ since that is where Winlogon resides (and msgina32.dll is running in the Winlogon process). At \({\color{red}3}\) and \({\color{red}4}\), the date and time are recorded, and the information is logged at \({\color{red}5}\). You should now realize that msutil32.sys is used to store logged credentials and that it is not a driver, although its name suggests that it is.

We force the malware to log credentials by running Lab11-01.exe, rebooting the machine, and then logging in and out of the system. The following is an example of the data contained in a log file created by this malware:

重启刚刚运行过 Lab11-1.exe 的主机,再注销用户,再登录,在 C:\Windows\System32\ 目录下,查看 msutil32.sys 文件内容:

605033-20190302213806732-874148390.png

The usernames are Administrator, it password is 1234, and the domain is WWW-BD759F7E3ED.

Summary

Lab 11-1 is a GINA interceptor installer. The malware drops a DLL on the system and installs it to steal user credentials, beginning after system reboot. Once the GINA interceptor DLL is installed and running, it logs credentials to msutil32.sys when a user logs out of the system.

Preference

PRACTICAL MALWARE ANALYSIS: MALWARE BEHAVIOR(LAB 11-01)

恶意代码分析实战 Lab 11-1 习题笔记

转载于:https://www.cnblogs.com/kafffka/p/10463117.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/412126.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

head first java原文_Head First Java

条件语句&和|可以用作条件语句,但是是长连接,左右两边的表达式必须都执行完!这和&&和||不同,&&和||是短连接,只要左边的表达式已经能够计算出整个表达式的结果,右边的表达式就不会执行…

C#操作XML

已知有一个XML文件&#xff08;bookstore.xml&#xff09;如下&#xff1a; <?xml version"1.0"encoding"gb2312"?><bookstore><book genre"fantasy"ISBN"2-3631-4"><title>Oberons Legacy</title> &…

20175204 张湲祯 2018-2019-2《Java程序设计》 第一周学习总结

20175204 张湲祯 2018-2019-2《Java程序设计》第一周学习总结 教材学习内容总结 -第一章Java入门要点&#xff1a; -Java的地位&#xff1a;具有面向对象&#xff0c;与平台无关&#xff0c;安全稳定和多线程等优良特性&#xff0c;是软件设计中优秀的编程语言。 -Java的特点&a…

使用线程,防止当前程序被阻塞

在编写Windows Form程序时有时需要编写一个处理大事件的函数&#xff0c;这导致了程序的运行时间变得很长&#xff0c;这时问题就出现了&#xff0c;当程序没有处理完毕之前当前窗体被锁死了&#xff0c;而且用户如果此时点击窗体的其他部分&#xff0c;便会出现没有响应的标识…

探索未知种族之osg类生物---呼吸分解之更新循环一

上节总结 前几天我们大体上介绍完成了osg的事件循环的介绍&#xff0c;总结一下osg的时间循环主要就是得到平台(windows)的所有消息&#xff0c;并遍历所有的node的eventCallback&#xff0c;并对他们进行处理。接下来我们就要进入osg的另一个维持生命的循环---更新循环。 更新…

java变换变量赋值_Java变量的类型转换

在程序中&#xff0c;当把一种数据类型的值赋给另一种数据类型的变量时&#xff0c;需要进行数据类型转换。根据转换方式的不同&#xff0c;数据类型转换可分为两种:自动类型转换和强制类型转换。自动类型转换自动类型转换也叫隐式类型转换&#xff0c;指的是两种数据类型在转换…

如何进行.NET高效开发

sugar 2006-03-12 13:53 转载于:https://www.cnblogs.com/SCOTT-SUN/archive/2006/06/02/416077.html

洛谷 P3244 / loj 2115 [HNOI2015] 落忆枫音 题解【拓扑排序】【组合】【逆元】

组合计数的一道好题。什么非主流题目 题目背景 &#xff08;背景冗长请到题目页面查看&#xff09; 题目描述 不妨假设枫叶上有 \(n​\) 个穴位&#xff0c;穴位的编号为 \(1\sim n​\)。有若干条有向的脉络连接着这些穴位。穴位和脉络组成一个有向无环图——称之为脉络图&…

配置msf连接postgresql数据库

BackTrack 5 R3版本的Metasploit在每次的升级后总会出现奇奇怪怪的错误&#xff0c;主要是Ruby的库出错&#xff0c;网上找了一些解决的办法&#xff0c;但每次更新后又会出错&#xff0c;蛋碎。 解决方法&#xff1a; BackTrack 5中默认自动开启端口7337。 1、查看PostgreSQL端…

web文件加密

讲解以及源代码下载ASP.NET 2.0: Encrypting Connection Strings http://blogs.vertigosoftware.com/snyholm/archive/2005/12/16/1746.aspx http://msdn2.microsoft.com/en-us/library/yxw286t2.aspx中文http://msdn2.microsoft.com/zh-cn/library/yxw286t2.aspx ASP.NET 2.0:…

java开发和android开发_浅谈Java开发和Android开发的不同

Java是具有多种用例的完整开发语言&#xff0c;包括Web开发&#xff0c;PC程序开发&#xff0c;嵌入式开发等。Android开发是面向手机应用&#xff0c;使用Java较多&#xff0c;还有常用的H5跨平台混合架构模式。一&#xff0c;UI界面开发不同1)Java Swing现在Java开发基本上都…

远程上传下载文件-Xftp5

Xftp5下载 链接&#xff1a;https://pan.baidu.com/s/1Wzso_Q7mPy5uGOUlripEWg 密码&#xff1a;xfx9 安装选择家庭版 由于21端口没有开&#xff0c;所以不能选FTP, 选择SFTP&#xff0c;22端口 用哪个用户登录机会自动到该用户的家目录 连接上出先乱码问题 属性 OK. 转载于:h…

java反射 pdf_java反射学习笔记整理.pdf

java反射学习笔记整理.pdf还剩15页未读&#xff0c;继续阅读下载文档到电脑&#xff0c;马上远离加班熬夜&#xff01;亲&#xff0c;很抱歉&#xff0c;此页已超出免费预览范围啦&#xff01;如果喜欢就下载吧&#xff0c;价低环保&#xff01;内容要点&#xff1a;Java 反射笔…

变态跳台阶

题目描述 一只青蛙一次可以跳上1级台阶&#xff0c;也可以跳上2级……它也可以跳上n级。求该青蛙跳上一个n级的台阶总共有多少种跳法。题解 简要提炼思路&#xff1a; 1、有n个台阶&#xff0c;则每次可以跳1&#xff0c;2&#xff0c;3&#xff0c;&#xff0c;&#xff0c;n个…

Visual Basic .NET处理Excle表格全接触

Visual Basic .Net处理Excel表格机理和处理Word文档一样&#xff0c;也是通过互操作&#xff0c;引入COM组件来实现的&#xff0c;所以前提条件是运行本文中介绍的程序的计算机必须安装Office 2000中的Excel软件。如果计算机安装的Office 2000&#xff0c;那么这个COM组件就是M…

aspnet_UsersInRoles_GetUsersInRoles

ALTERPROCEDUREdbo.aspnet_UsersInRoles_GetUsersInRoles --查询某角色的用户ApplicationNameNVARCHAR(256), RoleNameNVARCHAR(256)ASBEGINDECLAREApplicationIdUNIQUEIDENTIFIERSELECTApplicationIdNULLSELECTApplicationIdApplicationId FROMaspnet_Applications WHERELO…

Jenkins二 安装gitlab及其使用

git --version 如果没有安装git直接源码安装即可&#xff0c;如果安装了先删除原来的git。 yum -y remove git先安装编译git需要的包。 yum install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel下载&安装 去gitlab官网 https://abou…

编程使用资源文件实现多语言页面(In Action)

需求&#xff1a;我们的ASP.NET站点需要提供多语言支持&#xff0c;考虑到我们使用的是ASP.NET2.0&#xff0c;我们可以利用资源文件来实现。 <?xml:namespace prefix o ns "urn:schemas-microsoft-com:office:office" />NOTE:这里我们使用编程的方法实现&a…

java final内存机制_Java中的内存处理机制和final、static、final static总结

装载自&#xff1a;http://blog.csdn.net/wqthaha/article/details/20923579Java程序运行在JVM上&#xff0c;可以把JVM理解成Java程序和操作系统之间的桥梁&#xff0c;JVM实现了Java的平台无关性&#xff0c;由此可见JVM的重要性。所以在学习Java内存分配原理的时候一定要牢记…

MySQL中的字符集涵义及使用方法总结(二)

五.乱码的避免最好让上述9个字符集变量值保持一致&#xff0c;或者至少“兼容”&#xff0c;同时也要考虑到OS中locale的值。当然&#xff1a;character_set_system例外&#xff0c;它是存储和表示元信息使用的字符集&#xff0c;一般都是ascii串&#xff0c;使用utf8和使用lat…