KeePass Trojanized in Advanced Malware Campaign

Summary:
A sophisticated malware campaign targeting the open-source password manager KeePass has been uncovered by WithSecure's Threat Intelligence team. The attackers trojanised a legitimate KeePass installer (KeePass-2.56-Setup.exe), distributing it through malvertising via search ads on platforms like Bing and DuckDuckGo that lured users to download from fake lookalike domains (keeppaswrd[.]com). The malicious installer, signed with valid certificates, drops modified KeePass and ShInstUtil executables, establishes registry persistence, and loads a Cobalt Strike beacon from an encrypted file disguised as a JPG. While the trojanized KeePass functions normally, it secretly logs and exports user credentials to .kp and CSV files in the local application data folder. A beacon with a vastly different configuration is also delivered by a malware called Nitrogen Loader.

The extensive attack infrastructure included multiple fake KeePass domains and redirect chains. Analysis suggests the campaign evolved in complexity, with the malware only activating malicious functionality upon opening a password database. While attribution is difficult, overlapping Cobalt Strike watermarks link the activity to ransomware groups like Black Basta and BlackCat, with some evidence suggesting a potential "solo" attempt by a former ransomware affiliate. WithSecure assesses that the campaign was likely orchestrated by a well-resourced and prolific former ransomware affiliate turned Initial Access Broker that have immense experience operating within the ransomware ecosystem. According to WithSecure, the incident coincided with the apparent implosion of the Black Basta ransomware group and the leak of their internal chat logs. Despite the ransom note matching the text of Akira’s ransom note, WithSecure observed two notable factors differentiating this incident from Akira ransomware incidents, making this incident unlikely to be related to Akira.

Security Officer Comments:
This incident represents a significant escalation in the tactics employed by cybercriminals, demonstrating their concerning ability to compromise trusted open-source software like KeePass. The use of malvertising and convincing fake domains and redirect chains through multiple fake domains, coupled with valid certificate signing, highlights the increasing sophistication in attacker infrastructure. The fact that the trojanised application retains its core functionality while silently exfiltrating sensitive data makes detection exceptionally challenging for end-users.

The observed connection to established ransomware groups like Black Basta and the intriguing possibility of a former ransomware affiliate attempting independent operations underscores the interconnectedness and evolving nature of the ransomware-as-a-service (RaaS) ecosystem. Organizations must adopt a comprehensive defense strategy, specifically regarding emphasizing the critical importance of verifying software’s validity through hash checks on tools like VirusTotal, strictly adhering to official download sources, and implementing robust endpoint monitoring to identify unusual behavior, even in seemingly legitimate applications. This campaign acts as a reminder that even well-regarded and widely used security software can become a vector for sophisticated attacks, and frankly, has a higher likelihood of being targeted due to a larger potential impact. Malvertising attacks are highly effective and do not show many signs that they are slowing down.

Suggested Corrections:
IOCs are available here.

Backup your data, system images, and configurations, regularly test them, and keep the backups offline: Ensure that backups are regularly tested and that they are not connected to the business network, as many ransomware variants try to find and encrypt or delete accessible backups. Maintaining current backups offline is critical because if your network data is encrypted with ransomware, your organization can restore systems.

Update and patch systems promptly: This includes maintaining the security of operating systems, applications, and firmware in a timely manner. Consider using a centralized patch management system; use a risk-based assessment strategy to drive your patch management program.

Test your incident response plan: There's nothing that shows the gaps in plans more than testing them. Run through some core questions and use those to build an incident response plan: Are you able to sustain business operations without access to certain systems? For how long? Would you turn off your manufacturing operations if business systems such as billing were offline?

Check your security team's work: Use a 3rd party pen tester to test the security of your systems and your ability to defend against a sophisticated attack. Many ransomware criminals are aggressive and sophisticated and will find the equivalent of unlocked doors.

Segment your networks: There's been a recent shift in ransomware attacks – from stealing data to disrupting operations. It's critically important that your corporate business functions and manufacturing/production operations are separated and that you carefully filter and limit internet access to operational networks, identify links between these networks, and develop workarounds or manual controls to ensure ICS networks can be isolated and continue operating if your corporate network is compromised. Regularly test contingency plans such as manual controls so that safety-critical functions can be maintained during a cyber incident.

Train employees: Email remains the most vulnerable attack vector for organizations. Users should be trained on how to avoid and spot phishing emails.

Implement multi-factor authentication (MFA): External-facing assets that leverage single-factor authentication (SFA) are highly susceptible to brute-forcing attacks, password spraying, or unauthorized remote access using valid (stolen) credentials. Implementing MFA enhances security and adds an extra layer of protection.

Link(s):
https://securityonline.info/trojanized-keepass-used-to-deploy-cobalt-strike-and-steal-credentials/

PDF:
https://labs.withsecure.com/content/dam/labs/docs/W_Intel_Research_KeePass_Trojanised_Malware_Campaign.pdf