Crooks use HTML smuggling to spread QBot malware via SVG files

Pierluigi Paganini December 15, 2022

Talos researchers uncovered a phishing campaign distributing the QBot malware to Windows systems using SVG files.

Talos researchers uncovered a phishing campaign distributing the QBot malware using a new technique that leverages Scalable Vector Graphics (SVG) images embedded in HTML email attachments.

HTML smuggling is a highly evasive technique for malware delivery that leverages legitimate HTML5 and JavaScript features. The malicious payloads are delivered via encoded strings in an HTML attachment or webpage. The malicious HTML code is generated within the browser on the target device which is already inside the security perimeter of the victim’s network.  

Once a victim receives the email and opens the attachment, their browser decodes and runs the embedded script, which then assembles a malicious payload directly on the victim’s device.

In the attack detailed by Talos, threat actors the embedded SVG files contained JavaScript that reassembles a Base64 encoded QBot malware installer that is automatically downloaded through the victim’s browser.

“SVG images are constructed using XML, allowing them to be placed within HTML using ordinary XML markup tags. Talos has identified malicious emails featuring HTML attachments with encoded SVG images that themselves contain HTML <script> tags. Including script tags within a SVG image is a legitimate feature of SVG.” reads the analysis published by Talos. “Unfortunately this feature is being abused by attackers to smuggle JavaScript onto a victim’s computer.  Attackers rely on the fact that most web browsers will happily decode and execute this JavaScript as if it were a standard part of the document’s HTML.”

The JavaScript embedded in the SVG image contains a malicious zip archive, and then the JavaScript assembled the malware on the end user’s device. The malware payload is assembled directly on the victim’s machine and isn’t transmitted over the network, for this reason, this HTML smuggling technique can bypass detection by security devices.

html-smuggling-flow SVG

The QBot malware spread via phishing messages, the threat is able to hijack a victim’s email and send itself out as a reply to an existing email thread.

The emails use an HTML attachment, and when the recipient opens it, the smuggled JavaScript code inside the SVG image starts the attack. The script creates a password-protected malicious zip archive and then presents the user with a dialog box to save the file. The password is included in the HTML attachment.

If the recipient enters the password provided by the attacker and opens the zip archive, it can extract an .ISO file. The .iso file allows infecting the victim with the Qakbot malware.

“Since HTML smuggling can bypass traditional network defenses, it is critical to deploy some sort of security protection to the endpoints in your environment. Having robust endpoint protection can prevent execution of potentially obfuscated scripts, and prevent scripts from launching downloaded executable content. Endpoint security can also enforce rules about which executables are trusted to run in your environment.” concludes the report.

Follow me on Twitter: @securityaffairs and Facebook and Mastodon

[adrotate banner=”9″][adrotate banner=”12″]

Pierluigi Paganini

(SecurityAffairs – hacking, HTML smuggling)

[adrotate banner=”5″]

[adrotate banner=”13″]



you might also like

leave a comment