# New release of Lampion trojan spreads in Portugal with some improvements on the VBS downloader **seguranca-informatica.pt/new-release-of-lampion-trojan-spreads-in-portugal-with-some-improvements-on-the-vbs-** downloader July 6, 2020 **New release of Lampion trojan spreads in Portugal with some improvements on the** **VBS downloader.** A new release of the Lampion trojan banker was launched with fresh improvements in the way the malware loader – the initial VBS file – is operating. The recent wave has been noted in Portugal and is impacting clients of several Portuguese and Brazilian banking organizations and also some cryptocurrency platforms. Some details were observed during the malware analysis, namely: Changes in the VBS downloader – DLL injection executes the 1st stage. Anti-VM techniques were improved (probably native features of VM-Protector packer). Changes in how it communicates with the C2 server geolocated in Russia. [Lampion was first documented in December 2019, and it was distributed in Portugal via](https://seguranca-informatica.pt/targeting-portugal-a-new-trojan-lampion-has-spread-using-template-emails-from-the-portuguese-government-finance-tax/#.XwI-myhKguU) phishing emails using templates based on the Portuguese Government Finance & Tax. More recently, in May 2020, [a new variant of Lampion was observed. Here, it was distributed](https://seguranca-informatica.pt/trojan-lampion-is-back-after-3-months) using fake webpages, where the victim downloaded an MSI file, which then held the remaining Lampion infection chain. Our analysis of the phishing email of this new campaign detected at the end of June – July 2020 showed that the template is very similar to the template distributed on May 8th, 2020. A fake template from SAPOTRANSFER was used with the message inside the email referring to any missing payment or invoice. ----- **_Figure 1: The email template used in July 2020 is similar to the previous one used in May_** _2020._ These emails are sent towards the end of the month, simulating the payment of a service or bills – the ideal time to catch the most reckless victims. **_Figure 2: Files available after decompiling the ZIP file distributed via email._** Looking at the following images, the PDF file inside the ZIP file is just a decoy to distract the victim. The text is written in Portuguese, and just the logo at the end of the document was changed between May and July malware versions. ----- **_Figure 3: PDF file and content delivered are similar, only the logo at the end of the document_** _was changed._ [As previously stated [1], [2], the VBS file is one that, when executed, serves as a downloader](https://seguranca-informatica.pt/targeting-portugal-a-new-trojan-lampion-has-spread-using-template-emails-from-the-portuguese-government-finance-tax/#.XwI-myhKguU) for the infection chain. Once executed, additional files are downloaded from Google Cloud, which are loaded into memory using a well-known technique called DLL injection. Once again the code in the VBS file is obfuscated to make it difficult to analyze. ----- **_Figure 4: VBS file – Lampion downloader – obfuscation layer._** It is important to note that this new release brings some changes to Lampion’s documented _modus operandi. The next graph presents the various forms already documented the threat._ ----- **_Figure 5: Different ways of how Lampion has been distributed in-the-wild._** As noted, malware is usually distributed with a simple email template, where the victim downloads a ZIP file with a VBS downloader inside. However, in May 2020, criminals used a fake page to distribute an MSI file, which used the theme COVID-19 that impersonates the Portuguese government and which after being executed launched the VBS file ----- The infection chain, in both scenarios, starts through the VBS downloader file. This file is responsible for downloading two files from online Clouds, such as AWS, Microsoft, SAPO, and more recently Google, creating, thus, persistence on the machines to execute the threat every time machine starts. In detail, an EXE file was downloaded, which when executed, injects into memory the second DLL inside the 0.zip file and protected by a password. This DLL has the trojan code protected using the VM-Protector, a commercial packer. However, in this new release, two DLL files are distributed . VBS file leverages the Windows rundll32 library to inject the first DLL into memory (P-14-7.dll), and it is then responsible for loading the second DLL into memory and starting, thus, the infection process. ## Deofuscation and renaming VBS calls After a few rounds of deobfuscation and renaming calls, we have a clean version of the source code to analyze in-depth. ----- **_Figure 6: Deofuscated VBS file – Lampion trojan July 2020._** Some parts of the code are highlighted in Figure 6 and described below: 1. Function to generate random strings is used to generate arbitrary folders and file names. 2. Random strings generation. 3. Function used to decrypt strings. 4. Delete *.LNK files from the Windows startup folder. 5. Delete *.VBS files from the Windows startup folder. 6. Create a random folder on %appdata% to host the downloaded files (P-14-7.dll and 0.zip). 7. Get classes for computer hardware and configuration. 8. Google Cloud URLs obfuscated (URL1 and URL2). 9. Download the 2nd stage from Google Cloud (0.zip). 10. Download 1st stage – trojan loader – from Google Cloud (P-14-7.dll). 11. Create .VBS file inside %appfolder% – persistence technique used by criminals. 12. Generate the content of the .VBS file (decryption functions, DLL injector, and anti VM/sandbox). 13. Create a folder inside the Windows startup folder. 14. Crete .LNK file inside the Windows startup folder. 15. Set up .LNK file to execute DLL injection via rundll32. 16. Sleep and shutdown commands are two techniques for online sandbox evasion. ----- 17. Trojan starts. In detail, the malware uses a .LNK file to inject the first stage P-14-7.dll into memory. Then, the call YourGonnaPayMeToday is invoked as shown in Figure 7. This DLL is used as a loader for the final payload, a DLL inside 0.zip file, and it is injected into memory via DLL injection. Both files are protected with the commercial packer – VM Protector. ``` --create LKN file- C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\usynknwwbmj.lnk --------run-dll--------CommandLineArguments: C:\Users\admin\AppData\Roaming\59684788644313\eakyvqgqeovfzwxau27622472643851.dll YourGonnaPayMeToday WorkingDirectory: C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\usynknwwbmj RelativePath: ..\..\..\..\..\..\..\..\..\Windows\system32\rundll32.exe TargetFileDOSName: rundll32.exe HotKey: (none) RunWindow: Normal IconIndex: (none) TargetFileSize: 0 FileAttributes: (none) Flags: IDList, RelativePath, WorkingDir, CommandArgs, Unicode Final payload: rundll32.exe C:\Users\admin\AppData\Roaming\59684788644313\eakyvqgqeovfzwxau27622472643851.dll YourGonnaPayMeToday ## VBS file – Decrypted strings Encrypted: 4Ic^GjEj/fzie0[%2%yifjne$h4Wf]g[m$O]6eDeo]wbg[aWSf5_siR$[YDeKcv%HXJe.cEXT[Zj4WkXnhSWKd Decrypted: hxxps://storage.googleapis.]com/bombetabrancaevinho/0.]zip Encrypted: r?F^5jAj.fCiB0*%Z%%iWWFQWGoiC|[5Joe,Z |EXITEWINDOWS| Cliente Desconectado! ## Final Thoughts ``` Malware is one of the major cyber weapons to destroy a business, market reputation, and even infect a wide number of users. The next list presents some tips on how you can prevent a malware infection. It is not a complete list, it just a few steps to protect yourself and your devices. Get outdated software of your system Get email savvy; take several minutes looking at the new email and not a few seconds Beware of fake tech support, emails related do bank transactions, invoices, COVID19, everything you think be strange Keep Internet activity relevant Log out at the end of the day Only access secured and trusted sites (not only websites with green lock – please think you are doing, as many phishing campaigns are abusing of free CA to create valid HTTPS certificates and to distribute malicious campaigns over it) Keep your operating system up to date ----- Make sure you are using an antivírus Beware of malvertising ## Take-home message Be proactive and start taking malware protection seriously! Indicators of Compromise (IOCs) ``` hxxps://storage.googleapis.]com/bombetabrancaevinho/P-14-7.]dll hxxps://storage.googleapis.]com/bombetabrancaevinho/0.]zip --Strings-YourGonnaPayMeToday DoThisBicht Final payload: be703ee8d83c3eb95fd5a343fed3d2947d2b98955be3b6eb8dd4752be1047537 --C2-5.188.9.28 Online Sandbox ``` [VirusTotal](https://www.virustotal.com/gui/file-analysis/NzM1YTI1MWY5MjFiZTg0YTIwMzljYjJiNTg0NjdlNGU6MTU5MzcyMzAzNw==/detection) [Joesandbox](https://www.joesandbox.com/analysis/243202/0/html) [Pedro Tavares](https://seguranca-informatica.pt/author/pipocaz/) **[Pedro Tavares is a professional in the field of information security working as an Ethical](https://www.linkedin.com/in/sirpedrotavares/)** Hacker/Pentester, Malware Researcher and also a Security Evangelist. He is also a founding member at CSIRT.UBI and Editor-in-Chief of the security computer blog segurancainformatica.pt. In recent years he has invested in the field of information security, exploring and analyzing a wide range of topics, such as pentesting (Kali Linux), malware, exploitation, hacking, IoT and security in Active Directory networks. He is also Freelance Writer (Infosec. Resources [Institute and Cyber Defense Magazine) and developer of the 0xSI_f33d – a feed that](https://feed.seguranca-informatica.pt/) compiles phishing and malware campaigns targeting Portuguese citizens. [Read more here.](https://seguranca-informatica.pt/contacto/) -----