Post

Malware Research - AMOS Variant (OpenVPN)

I was given the opportunity to conduct malware analysis on a suspicious program downloaded by one of our employees at work. I was praised for my efforts and dedication in analyzing it which gave me the motivation to keep on learning about malware analysis and CTI. Here is my writeup on the whole incident.

Summary

The payload was a variant of the Atomic macOS Stealer (AMOS) that affects both Windows and macOS users. The reason why I documented this incident was because it was the first (to my knowledge) AMOS variant that masqueraded OpenVPN and used RC4 as its payload encryption method. Attachment (password is infected)

Distribution

On 12 September 2024, the victim received a Google Form from a company called Vantage Point Media using the email address of vpmediatech[.]com. This Google Form acted as a hiring test whereby it prompted the victim to input their email, full name and answers for a set of questions replicating real interview questions.

form1

On the final page, the victim will then be prompted to download a suspicious installation media that works on both Windows and macOS machines with the download link hxxps[:]//openvpn[.]tech/vpn-download.

form2

If the victim was using macOS, accessing the download link will redirect the victim to hxxps[:]//utv4fun[.]com/kusaka.php?call=vpn where a DMG file will be fetched and downloaded.

Note: It seems like the malicious DMG file might be polymorphic due to having a version number each time a new DMG file was downloaded from the URL.

dmg1

If the victim was using Windows, accessing the download link will redirect the user to hxxps[:]//openvpn-win[.]pages[.]dev where a MSI installer will be fetched and downloaded. However, the scope of this writeup will only be on the DMG file for now.

msi1

Malware Analysis

Mounting the DMG file on a virtual machine, a universal Mach-O binary called openvpn-connect can be obtained that supports both x86 and ARM architectures. It was also ad-hoc signed which means that it does not contain any cryptographic proof.

bin1

Executing the DMG file, a prompt will be shown on-screen to instruct the user to launch the malicious Mach-O binary by right clicking and opening it directly. This was a common tactic used to override the integrated security feature in Apple’s operating system (also known as GateKeeper) and execute unsigned applications.

exe1

Launching the Mach-O binary, the user will be prompted again to input the root password. This was most likely to trick the user in providing root privileges for the malware to access certain macOS utilities.

exe2

Decompiling the Mach-O binary with otool, a long hex string can be identified, suggesting that the payload might be encoded in hex.

bin2

Coincidentally, a 32-byte hex string can be identified right below the encoded payload, most likely a decryption key.

bin3

Payload Analysis

Attempting to decrypt the hex string with multiple encryption algorithms, the payload was successfully decrypted with RC4. The full AppleScript payload can be obtained for further analysis.

Hide Terminal and Create Staging Directory

Analyzing the payload, it begins by ensuring the Terminal window stays hidden while the payload is running in the background to conceal itself from the user.

code1

It then retrieves the current username to construct a path to the user’s home directory. It also creates a staging directory on /tmp/ to store the stolen data. The staging directory name seems to be generated using a random four-digit number in the range of 1000-9999.

code2

Extract System Information

The data extraction process begins with the system information including software, hardware, and display configurations using the system_profiler utility. The result of this command is then written to a file named “info” under the staging directory.

code3

Password Prompt using DSCL

The payload constructs the path to the user’s Application Support directory, which is used to locate various application data. It then calls a function to retrieve the user’s password via an authentication prompt using the DSCL utility.

code4

If the password entered was valid, the payload will attempt to retrieve the Chrome password from the macOS keychain and write it to a file named “masterpass-chrome” under the staging directory. If not, the payload enters a loop that will continuously prompt the user for the valid password.

code5

Extract Browser and Cryptocurrency Wallet Data

Several mappings were created to define the directory paths for specific Chromium-based browsers and cryptocurrency wallet applications. The payload then proceeds to recursively read the stored data in the mapped directories to extract Chromium-based browser data (cookies, web data, plugins, etc.) and JSON files for specific cryptocurrency wallet applications.

code6

The payload was also extracting Safari cookies, Apple Note database and files with the extension of .pdf, .docx, .doc, .wallet and .keys on the Desktop, Documents and Downloads folder. These extracted data are copied and placed within a folder named “FileGrabber” under the staging directory.

code7

Interesting observation: The FileGrabber function seem to only extract files that do not exceed the file size of 10 MB before copying them to the “FileGrabber” folder. This was most likely done to prevent network bandwidth issues, server limitations, and timeouts during data exfiltration to the C2 server.

grab1

Data from other sources including Firefox data, keychain database and Telegram data, was also extracted and stored as different files under the staging directory.

grab3

Exfiltration

Finally, the payload compresses the staging directory into a ZIP file out.zip to be exfiltrated to the C2 server using curl. The ZIP file was sent via a HTTP POST request to http://85.209.11.155/joinsystem/ using a predefined user and BuildID. The payload then covers its track by removing the staging directory and ZIP file from the system after exfiltration.

code8

ctwo

Indicators of Compromise

IndicatorsTypeDescription
7f4582259482af646aecd6b1addb50cb283706753376e7dbadb4c33ab3ddff21SHA256DMG file
9793fc09d1f18b16cc7e1af52e68957387eda27e904fe44cdad904016fcb55b8SHA256Mach-O binary
hxxps://docs[.]google[.]com/forms/d/e/1FAIpQLSdjxyobIi5WKyT9dvL8NgYBk6434oYqhGomOHrCDPSBK1shCw/viewform?usp=sf_linkURLGoogle Form
hxxps://openvpn[.]tech/vpn-downloadURLDownload link
hxxps://utv4fun[.]com/kusaka[.]php?call=vpnURLmacOS installer download
hxxps://openvpn-win[.]pages[.]devURLWindows installer download
openvpn[.]techDomainMalicious domain
85[.]209[.]11[.]155IP addressC2 server
This post is licensed under CC BY 4.0 by the author.