Executive Summary
Agent Tesla is a Remote Access Trojan (RAT) malware written in .NET. Threat actors and APT groups use this kind of malware because of its wide stealing and evasion operations. The first Agent Tesla emerged in 2014 and got the right attention because of its ability to steal sensitive information from the victims’ endpoints, browsers data, DB data, FTP data, VPN data, capture screenshots, etc. This kind of malware spreads through email attachments. These days, in 2024, there is an increase in the use of the Agent Tesla malware by threat actors. This reason is Agent Tesla is being offered as Malware as a Service (MaaS) on the Dark Net.
This malware analysis report on the AgentTesla malware will reveal its insights, characteristics, and operations. The malware was delivered to a client via an email attachment named "Purchase Inquiry.gz". The analysis involves a comprehensive examination of the malware’s multi-stage execution process, payloads, and specific types of targeted data.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685804b453c73dfc19e69dc_email.jpg)
Technical Details
File Name: Purchase Inquiry.bat
File Type: Batch
Size: 4KB
MD5: 380c9e85f6960add801843076c33ec3b
SHA256: d9002ae6089045126350070c7b0790b4eb478e9b764bfdae3ee61e2e62a0e277
AgentTesla Execution Diagram
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668580d61cef16519d0d9964_execution%20diagram.png)
First Stage Analysis
The first stage of the Agent Tesla is a Batch file, which contains two parts. In the first part, the file runs a WSF script that is attached to the batch file. Once the WSF script is executed, the Batch file deletes itself.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685812f453c73dfc19fa073_stage1.png)
The WSF script is written in JavaScript and embedded within the batch file. It is executed by the cscript command. The script is obfuscated, making it difficult to read and understand the first stage's code. This is a common technique used by malware authors to evade detection and analysis. After the de-obfuscation process, the script executes a PowerShell payload, which is also obfuscated.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685817dd97013a5b03d2a91_obfuscated%20powershell.png)
After running the script, two processes were launched: the cscript process, which executes the WSF script, and the PowerShell process, which runs the payload.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668581a9ea29d8ada23a7bff_powershell%20process.png)
The PowerShell payload sets the system's security protocol to TLS 1.2 and loads the Microsoft.VisualBasic assembly. The script then repeatedly pings Google until an internet connection is detected. Upon connection, it creates a new WebClient object to download and execute a script from https://didaktik-labor.de/mx1.jpg.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668582348ab918cb1c54e020_download%20and%20execute%20mx1.png)
Second Stage Analysis
The second stage of AgentTesla consists of another PowerShell script with three different obfuscated payloads.
The first payload, stored in the u8yee variable, contains an obfuscated payload where the script substitutes the 'A' character with '00'.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685828f7c66f448b8b0b4af_u8yee%20variable.png)
After replacing the 'A' character with '00' in the payload, we can understand that the first payload is coded in binary.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668582b91cef16519d10062a_u8yee%20binary.png)
It is a PowerShell function that is responsible for decompressing the other two payloads that exist in the second stage using Gzip.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858446c19fb40b98af0d5f_Gzip.png)
The first payload decompresses the second and third payloads using Gzip. The second payload is stored in the variable y74gh00rffd and contains an obfuscated payload in which the script replaces the 'EV' characters with '0x'. This suggests that the second payload is in hexadecimal format.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668584854e373ece6bebfa64_y74gh00rffd%20variable.png)
After decompressing the second payload, the script produces a DLL file.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668584a99712b3910a219cfb_Producing%20a%20DLL.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668584d78a398e4712256b89_dll%20file%20die.png)
The eSQy variable contains an obfuscated payload, in which the script replaces the 'EV' characters with '0x'. This suggests that the third payload is in hexadecimal format, also.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858515070f1ef87f99cf09_eSQy%20variable.png)
After decompressing the third payload, the script produces an EXE file. The file is written in .NET and runs on a 32-bit architecture.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685854988f18a65637a621f_Producing%20an%20EXE.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685856543f2945b1250c8d7_exe%20file%20die.png)
After decompressing the script and dropping the DLL and EXE files, it extracts the Black function from the toooyou module in the DLL file and then uses the InstallUtil tool to execute the EXE file.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685859e9108c8efcce43797_installutil.png)
The Black function executes code using the calli instruction, repeatedly calling a method until a certain condition is met. This is part of a larger obfuscated malware process that decompresses, drops, and executes malicious payloads (EXE and DLL files) on the target system. In conjunction with the rest of the script, this function's purpose is to evade detection and execute malicious binaries and operations. Furthermore, the Black function gets two variables as values; the first value that the function gets is the InstallUtil.exe, and the second value is the eSQy variable, which executes the EXE file.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858613c19fb40b98b17bda_Black%20Function.png)
Dissecting the Agent Tesla
After the first and second stages are successfully executed, the second stage drops two files: a DLL file and an EXE file. The EXE file is the Agent Tesla malware.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685864c05a3ddf15b68b365_Agent%20Tesla%20malware.png)
At the beginning of the malware debugging, the malware configures the ServicePointManager to allow HTTPS connections using SSL 3.0, TLS 1.0, TLS1.1, and TLS 1.2 protocols.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668586e0c6951d7b491d1213_ServicePointManager.png)
After the malware sets up the HTTPS connections, it prepares the execution process by ensuring that only one copy of the current process is running and terminating any other copies of the same process. It does this by comparing the process IDs of all running copies of the process and terminating those with different IDs from the current process.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668587241076c57030c8c987_termination.png)
The malware checks for the %appdata%\Roaming path in the endpoint in the StartupDirectoryPath variable for dropping the gnxLZ.exe file.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668587ea2a48f6400adf94f2_Persistence%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668587f11771c7c79ccb31fd_Persistence%202.png)
Then, the malware enumerates the username and the hostname of the current endpoint.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685880efbf02f44084e95e7_username%20and%20hostname.png)
Browsers
The malware targets specific browsers and steals data from them. The browsers’ paths are locations where these browsers typically store user data, such as cookies, browsing history, saved passwords, and other sensitive information. The malware steals data from the following browsers: SeaMonkey, K-Meleon, CyberFox, Thunderbird, PaleMoon, WaterFox, IceCat, IceDragon, BlackHawk, Postbox, Firefox, Flock, Comodo Dragon, Sputnik, Amigo, Opera, Yandex, Elements, Orbitum, CoolNovo, Coowon, 360 Browser, Chrome, Torch, QIP Surf, Coccoc, Chedot, Brave, CentBrowser, Edge, Vivaldi, Citrio, Iridium, 7Star, Epic, Kometa, Chromium, Liebao, Uran, UC Browser, Safari for Windows, QQBrowser, Falkon Browser, and Flock Browser.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685891cb2f9fc93f0a5e487_browsers%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858924bc56959308b8b2a6_browsers%202.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685892cbc56959308b8bd14_browsers%203.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858932c6581217ba29cec9_browsers%204.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685893b9f50b0c5124ceeea_browsers%205.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668589429f50b0c5124cfa38_browsers%206.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858955097e8996dce51403_browsers%207.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685895b9bffd3eb4696cbc9_browsers%208.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/6685896222fc2efe17524f29_browsers%209.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858968ab7904e7aab4a00d_browsers%2010.png)
Email Software
In addition, the malware is designed to target specific email software and extract sensitive data from them. The email software that the malware targets: Outlook, WindowsMail App, The Bat, Becky, IncrediMail, Eudora, ClawsMail, FoxMail, Opera Mail, PocoMail, eM Client, and Mailbird.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/668589fbf537f6fd0967c769_email%20theft%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66859b7d81d4cd633c99ba6a_email%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a161a142af869d1fc21_email%20theft%203.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a1bab7904e7aab522e2_email%20theft%204.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a215e0bbcbffcb75493_email%20theft%205.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a27ee686319b0fa25f5_email%20theft%206.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a2c4c11c81931c205df_email%20theft%207.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a3222fc2efe17531b5c_email%20theft%208.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a3722fc2efe17531d30_email%20theft%209.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a3c1060aa78e26ee2d9_email%20theft%2010.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a434c11c81931c22632_email%20theft%2011.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858a48ee686319b0fa5ac1_email%20theft%2012.png)
FTP Management Software
Additionally, the malware targets specific FTP management software and steals sensitive data from them. The malware steals data from the following FTP management software: FileZilla, WinSCP, CoreFTP, Flash FXP, FTP Navigator, SmartFTP, WS_FTP, FtpCommander, and FTPGetter.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858ad9e0594a3e48459ddd_ftp%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858ade0111b8038f72c9dd_ftp%202.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858ae3ab7904e7aab55b4b_ftp%203.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858aeb88081921f2f8590e_ftp%204.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858af14c11c81931c317ef_ftp%205.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858af6251726555ecb3dbf_ftp%206.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858afb432f2d7fa8d10ad5_ftp%207.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858b0188081921f2f874fd_ftp%208.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858b07f0cff66a4f37cb47_ftp%209.png)
VPN Software
Additionally, the malware targets specific VPN software and steals sensitive data from them. The malware steals data from the following VPN software: OpenVPN, NordVPN, and PrivateInternet Access.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858b4bf0cff66a4f37d680_vpn%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858b536c4dd9a49a2ff8fa_vpn%202.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858b59e7b7c694545b1af1_vpn%203.png)
Message Software
In addition, the malware targets specific Message software and steals sensitive data from them. The malware steals data from the following Message software: Discord, Trillian, and Psi/Psi+.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858b8aea59d11ad1693a96_message%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858b8f0111b8038f738906_message%202.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858b9444b97270a3c18156_message%203.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858bb8e76ddbde6eae4463_procmon%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858bbdea897e3c5b2d99d4_procmon%202.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858bc5fdb2666eb26b91a4_procmon%203.png)
The malware gathers detailed system information, including the current time, computer name, operating system, username, RAM, CPU, and external IP address. Threat actors can utilize this information to profile victims, plan further attacks, or sell on dark net forums.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858c20e76ddbde6eaec323_gather%20info.png)
After stealing all the intended information, the malware organizes the data from the victim's computer and then sends it to the attacker's C2 server.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858c496565635d65aa4500_Org.png)
Then, the malware configures and opens an SMTP connection with the attacker’s SMTP mailserver.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858c9a18bd0519ad47b56d_smtp%20conf%201.png)
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858c9f88081921f2fa803e_smtp%20conf%202.png)
The attacker’s SMTP server information:
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858cb9f07789ef70254606_smtp%20info.png)
The malware connects to the SMTP server using port 587 to 94.237.43.240.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858cd59f2c5f974bd98c03_tcpview.png)
The SMTP connection packets in Wireshark:
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858cee0fd99073b894b545_smtp%20packet%20in%20wire.png)
The SMTP server's IP address is 94.237.43.240. The first packet sent from the SMTP server indicates that it is hosted on the stablehost.com website.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858d154e57e2e856277223_stablehost.png)
The malware exfiltrates the data to the SMTP server over TLSv1.2 (HTTPS).
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858d38b4346541afbd1e2f_data%20exfil.png)
Conclusion
Agent Tesla is malware known for stealing sensitive and valuable data from various browsers, FTP management software, SQL management software, VPN software, and email applications. This kind of malware poses significant risks to individuals and organizations world-wide. The multi-stage obfuscation and evasion techniques highlight Agent Tesla's advanced nature, necessitating advanced detection and response measures.
The threat actor targeted several individuals, and their sensitive data was stolen from their endpoints.
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858d9a74c5f186d1291607_stolen%20data.png)
An example of a stolen data from a victim:
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858db298cc40b488628dfa_stolen%20data%201.png)
Indicators of Compromise (IoCs)
1. Purchase Inquiry.bat | 380c9e85f6960add801843076c33ec3b
2. mx1.jpg | 11d8ddcb74dd3c1c10dcf8e6df8e5af9
3. GC.dll | 416c046fdcf4625c189ec37230052b62
4. 2e8ecadb887cb758c0b0dcb79442d616
5. %appdata%\Roaming\gnxLZ.exe
6. https://didaktik-labor.de | 91.220.34.2
7. mail.knoow.net / knoow.net | 94.237.43.240
MITRE ATT&CK
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858df8f12a5422776dcf56_mitre.png)
Yara Rule
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858e11124c7c0b0400e025_yara%20code.png)
Yara Detection
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858e2749b6d03aacfd15ee_Yara%20Detection.png)
Snort Rule
#AgentTesla Detection
alert tcp any any -> any 443 (msg:"Suspicious for Ingress Tool Transfer - Communication with didaktik-labor.de"; flow:to_server,established; content:"|64 69 64 61 6b 74 69 6b 2d 6c 61 62 6f 72 2e 64 65|"; sid:1000000;)
alert tcp any 587 -> any any (msg:"Data Exfiltration to AgentTesla C2 - Communication with ams.stablehost.com"; flow:to_client,established; content:"|61 6d 73 2e 73 74 61 62 6c 65 68 6f 73 74 2e 63 6f 6d|"; flowbits:set,ams_stablehost_com_detected; flowbits:noalert; sid:1000001;)
alert tcp any any -> any 587 (msg:"Data Exfiltration to AgentTesla C2 - Communication with mail.knoow.net and ams.stablehost.com"; flow:to_server,established; content:"|6d 61 69 6c 2e 6b 6e 6f 6f 77 2e 6e65 74|"; flowbits:isset,ams_stablehost_com_detected; sid:1000002;)
Snort Detection
![](https://cdn.prod.website-files.com/655b74a21bf061a53f52743c/66858ed65cd8140487af454d_Snort%20Detection.png)