Dridex spreads mainly using Office documents containing malicious macros, initially the primary stage would involve using VBA (Visual Basic for Applications) to download and execute the loader from one of multiple servers, though this had some flaws.

Antivirus and Firewall vendors maintain a list of malicious URLs and IP addresses in order to block new malware infections or updates from current ones. It only takes a few hours for most vendors to add new endpoints to their block-list, so in order to maintain effective propagation malware distributors must constantly cycle out old servers for clean ones (which can be expensive and time consuming). To combat endpoint blocking, campaigns like Dridex and Locky do not use their own infrastructure for initial payload distribution; instead they purchase hacked servers which they use to host payloads for very short periods (as little as a few days), then once the server become blacklisted they ditch them for newly compromised ones. Although using compromised servers is a very easy and cheap way to ensure payloads are always distributed from clean IPs, it does have its downsides which the team behind Dridex and Locky have been learning these past few months.

You’ve probably been seeing a lot of headlines like “Locky C&C hacked’, “Dridex Botnet Compromised”; these are pretty eye-catching but they’re not entirely true. As you can probably guess, the problem with using hacked servers is you wouldn’t be the only one with access, the owner obviously has access and so does anyone else who can find how the server was compromised. What has been happening a lot lately is that the payloads on the hacked servers have been getting replaces with anything from text consisting of strings like “DRIDEX IS AN ATTENTION WHORE” or “STUPID LOCKY” to antivirus installers and warnings not to enable Office macros. It’s not been confirmed whether it actually is a vigilante hacking the hacked servers as reported, though in the case of the payload being replace with an Avira installer, it’s most likely that a researcher simply contacted the server owner and asked them to replace the executable.

What’s important to note is the initial payload servers are separate from the C&C infrastructure, so the person behind this is not able to disinfect any already infected machines or access stolen data; however, they can prevent new infections until the offending servers are removed in the next wave of spam. The payload replacement is nothing more than a small financial loss to the developers behind both of the malware families, but apparently it was enough of a nuisance that they updated the distribution methods to combat this.

New Loader Distribution

I had expected the macros to verify the digital signature of the downloaded loader before running it, though this may not have been a viable option as it drastically increases the detection surface for what was previously a very simple few line macro wrapped in hundreds of lines of inconspicuous code.

Instead, the new macros now directly embed the loader in the form of a Base64 encoded string, but decoding Base64 would require a fair bit of code which would again increase the detection surface, so the developers have found a neat little trick.