Post

AgentTesla

AgentTesla is spreading through phishing emails. This malware can steal sensitive information like login credentials and keystrokes. In this blog, I’ll be analyzing a recently collected sample from ANY.RUN showing a few of its useful features that speed up the analysis.

You can check the report and download the sample from here

ANY.RUN Analysis

The phishing email contains an attachment with the payload

mail

payload

Execution Graph:

graph

On taking a look at the final payload we get a lot of useful information about the sample behaviour and techniques. And the Chat-GPT plugin can really help to summarize all this information

info

Phishing E-Mail Analysis

The .eml file can also be opened by any text editor. Scrolling down a bit into its content we find information about where the email originated from. This will always differ for every email as it entirely depends on the email infrastructure and how the email got to the victim.

mail info

Scrolling down a couple hundred lines passing through the content, the attachment can be found here as a huge Base64 encoded blob.

attachment

This can be dumped into a file and decoded OR just using a Python script to dump the attachment like this one.

Droppers Analysis

The first executable loads a DLL named SimpleLogin.dll. Which is located in the resources. It’ll be fetched, decrypted then loaded into the memory

first decryption

The same process will be repeated by loading 2 other DLLs from the resources, GZip decompression, and XOR decryption then loading the next stage.

second decryption

Here’s a list of loaders’ DLL names and their SHA-256 hashes :

Loader NameSHA-256
09404copy.exe (pzAh.exe)91A58A047D6EA0C7DDB7C89B0A43A5453FD5D7145C78A836EF803D5FB0F65254
SimpleLogin.dllE8D07DCE1B0EBBF7AC8DFD05B3F3C60BE322F947D96531138610E37F60B0B729
Gamma.dllCFB9215F0D32C6444C089B65D5334B46C57007373B28F906B0C5FA4AFB66EF0C
Tyrone.dll8F1ACE685CF6ECE293D8E0BD5CC63D6A31038B797FC97C429632094C0ED733E6

AgentTesla Analysis

PropertyValue
File Type32-bit .NET Executable
File Name917d4f1f-fa89-464c-b4b2-060ed06bc6cd.exe
SHA-256E6924926B7D31094065FE908D0C7ED1C2D823F84F8019F01CE27B340D5AA744F
SSDEEP3072:wNcx4UoTyR6A6M9dBA8bHb+fXu+K+7mR5XSCnIWk:wNcx4UoTyR6pM9dBA8bHbeXu+37mpnL

The final payload is not really obfuscated so this gives us a clear view of its functionalities.

System Fingerprinting

AgentTesla collects various data about the infected system including the OS name, UserName and ComputerName, size of RAM, CPU name, public IP and time and date of infection. However, this sample is not configured to fetch the public IP.

It also computes a unique has for every infected device by concatenating and MD5 hashing the motherboard serial number, processor ID and MAC address. However, this is also not utilized in this sample.

Credentials Grabbers

AgentTesla is set to steal login credentials from various sets of apps and browsers, Here’s the struct it uses :

1
2
3
4
5
6
7
  public vcYq(string host, string user, string pass, string app)
  {
   this.FhgVGIUuad = host;
   this.EoTZL4GPCok = user;
   this.String_0 = pass;
   this.iZLwcas0C = app;
  }

Browsers

It steals saved logins and OAuth data from the following browsers :

BrowserEngine
FlockGecko
IceCatGecko
PostboxGecko
PaleMoonGecko
CyberFoxGecko
SeaMonkeyGecko
K-MeleonGecko
BlackHawkGecko
ThunderbirdGecko
FirefoxGecko
WaterFoxGecko
IceDragonGecko
ChromeChromium
QIP SurfChromium
UranChromium
PostboxChromium
Cool NovoChromium
Opera BrowserChromium
CoccocChromium
Edge ChromiumChromium
Elements BrowserChromium
Iridium BrowserChromium
OrbitumChromium
Torch BrowserChromium
Yandex BrowserChromium
Comodo DragonChromium
CentBrowserChromium
SputnikChromium
BraveChromium
KometaChromium
Liebao BrowserChromium
Epic PrivacyChromium
7StarChromium
CitrioChromium
ChromiumChromium
ChedotChromium
Sleipnir 6Chromium
CoowonChromium
AmigoChromium
VivaldiChromium
360 BrowserChromium
IE/EdgeChromium
UC BrowserChromium
QQ BrowserChromium
Safari for WindowsWebKit
FalkonQtWebEngine

E-Mail Clients

Grabbing email, password, and server credentials for the following apps :

1
2
3
4
5
6
7
8
9
10
11
Outlook
Windows Mail App
The Bat!
Becky!
IncrediMail
Eudora
ClawsMail
FoxMail
Opera Mail
PocoMail
Mailbird

File Sharing Apps

1
2
3
4
5
6
7
8
9
FileZilla
WinSCP
CoreFTP
Flash FXP
FTP Navigator
SmartFTP
WS_FTP
FtpCommander
FTPGetter

VPNs

1
2
3
OpenVPN
NordVPN
Private Internet Access

Remote Admin Tools

1
2
3
4
WinVNC/UltraVNC
TigerVNC
RealVNC
TightVNC

Messaging Apps

1
2
3
4
eM Client
Discord (Session tokens and MFA tokens)
Trillian
Psi/Psi+ (instant messaging client for the XMPP protocol)

Other Software Data

1
2
3
4
Domain Logon
MysqlWorkbench
Internet Downloader Manager (grabs saved Hostname, Username and passwords)
JDownloader 2.0

Data Exfiltration

AgentTesla exfils data via SMTP, it’s set to send data back to the C2 every 20 minutes. It is able to provide a screenshot, keylogs and clipboard contents and of course the stolen credentials.

1
2
3
4
Sender : `sales@protecstronme.com`
Password : `  @iAiRA(0  `
Host: `us2.smtp.mailhostbox.com`
Port : `587`

The grabbed data is formatted in HTML and saved to a file: PW_<UserName/ComputerName>_<yyyy_MM_dd_HH_mm_ss>.html

And the screenshot is saved in jpeg file : SC_<UserName/ComputerName>_<yyyy_MM_dd_HH_mm_ss>.jpeg

The e-mail subject is PW_<UserName/ComputerName> and the body contains information about the infected system (UserName, ComputerName, ProcessorName, OS and the public IP if configured)

ANY.RUN did great capturing the traffic for us:

traffic

The HTML content should be like so:

content

NOTE: This sample is again not configured to enable Keylogging nor take a screenshot of the system. If keylogging was enabled, the keylogs would be stored at %tmp%/log.tmp

And it appears to be set for communication over TOR but it’s yet to be implemented.

Persistence

Persistence is not enabled in our case but it generally seems to achieve it via the startup folder and registery key.

App Startup FullPath : %appdata%\aXfhqD\aXfhqD.exe

Startup RegName : aXfhqD

IOCs

ANY.RUN provides us with the IOCs ready for some Copy-Pasta and it of course matches with what we got during our analysis

Files

  • Dropped executable file: 09404copy.exeSHA-256: 91a58a047d6ea0c7ddb7c89b0a43a5453fd5d7145c78a836ef803d5fb0f65254
  • email: 7a03424d-5804-f8e2-8c1b-562ce548300c.emlSHA-256: 7b2184447031e1e9ebf9509b0dfa4c66744cdf3468299aaad269ad927158d3c8

YARA Rule

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
rule AgentTesla 
{
    meta:
        author = "@3weSxZero"
        date = "2024-06-04"
    strings:
        $str0 = "pzAh.exe"
        $str1 = "words.txt"
        $x1 = "us2.smtp.mailhostbox.com" fullword wide
        $s2 = "org.jdownloader.settings.AccountSettings.accounts.ejs" fullword wide
        $s3 = "\\Trillian\\users\\global\\accounts.dat" fullword wide
        $s4 = "Software\\A.V.M.\\Paltalk NG\\common_settings\\core\\users\\creds\\" fullword wide
        $s5 = "\\\"(hostname|encryptedPassword|encryptedUsername)\":\"(.*?)\"" fullword wide
        $s6 = "SmtpPassword" fullword wide
        $s7 = "SystemProcessorPerformanceInformation" fullword ascii
        $s8 = "aXfhqD.exe" fullword wide
        $s9 = "\\Program Files (x86)\\FTP Commander\\Ftplist.txt" fullword wide
        $s10 = "\\VirtualStore\\Program Files (x86)\\FTP Commander\\Ftplist.txt" fullword wide
        $s11 = "\\Program Files (x86)\\FTP Commander Deluxe\\Ftplist.txt" fullword wide
        $s12 = "\\VirtualStore\\Program Files (x86)\\FTP Commander Deluxe\\Ftplist.txt" fullword wide
        $s13 = "SMTP Password" fullword wide
        $s14 = "privateinternetaccess.com" fullword wide
        $s15 = "paltalk.com" fullword wide
        $s16 = "discord.com" fullword wide
        $s17 = "https://account.dyn.com/" fullword wide
        $s18 = "JDownloader 2.0" fullword wide
        $s19 = "JDownloader 2.0\\cfg" fullword wide
        $s20 = "Internet Downloader Manager" fullword wide
    condition:
        uint16(0) == 0x5a4d and filesize < 700KB and (1 of ($x*) and 4 of ($s*)) or (1 of ($str*))
}

Of course, the rule should be tested, I’ll use ANY.RUN’s ThreatIntel Yara search

ANY.RUN yara

MITRE ATT&CK® TTPs

ANY.RUN is really doing everything for us

MITRE

Providing great insights as well

MITRE

TacticIDNameUse
ExecutionT1204User ExecutionThe adversary rely upon an action by the user in order to gain execution.
Credential accessT1555Credentials from Password StoresAdversaries search for common password storage locations to obtain user credentials.
Credential accessT1555.003Credentials from Web BrowsersAdversaries acquire credentials from web browsers by reading files specific to the target browser.
Credential accessT1552.001Credentials In FilesAdversaries search local file systems and remote file shares for files containing insecurely stored credentials
DiscoveryT1012Query RegistryAdversaries interact with the Windows Registry to gather information about the system, configuration, and installed software.
DiscoveryT1082System Information DiscoveryAn adversary attempt to get detailed information about the operating system and hardware, including version and architecture.
CollectionT1114.001Local Email CollectionAdversaries target user email on local systems to collect sensitive information.
C & CT1071.003Mail ProtocolsAdversaries communicate using application layer protocols associated with electronic mail delivery to avoid detection/network filtering by blending in with existing traffic.
This post is licensed under CC BY 4.0 by the author.