Rare implementation of RC5/RC6 in ‘ShadowBrokers’ dump connects them to Equation malware
August 13, 2016 saw the beginning of a truly bizarre episode.

A new identity going under the name ‘ShadowBrokers’ came onto the scene claiming to possess files belonging to the apex predator of the APT world, the Equation Group [PDF].
In their initial leak, the ShadowBrokers claimed the archive was related to the Equation group, however, they didn’t provide any technical details on the connections.
Along with some non-native rants against ‘Wealthy Elites’, the ShadowBrokers provided links to two PGP-encrypted archives.

The first was provided for free as a presumptive show of good faith, the second remains encrypted at the time of writing.

The passphrase is being ‘auctioned’, but having set the price at 1 million BTC (or 1/15th of the total amount of bitcoin in circulation), we consider this to be optimistic at best, if not ridiculous at face value.
The first archive contains close to 300MBs of firewall exploits, tools, and scripts under cryptonyms like BANANAUSURPER, BLATSTING, and BUZZDIRECTION. Most files are at least three years old, with change entries pointing to August 2013 the newest timestamp dating to October 2013.

As researchers continue to feast on the release, some have already begun to test the functional capabilities of the exploits with good results.
Having originally uncovered the Equation group in February 2015, we’ve taken a look at the newly released files to check for any connections with the known toolsets used by Equation, such as EQUATIONDRUG, DOUBLEFANTASY, GRAYFISH and FANNY.
While we cannot surmise the attacker’s identity or motivation nor where or how this pilfered trove came to be, we can state that several hundred tools from the leak share a strong connection with our previous findings from the Equation group.
The Devil’s in the Crypto
The Equation group uses the RC5 and RC6 encryption algorithms quite extensively throughout their creations. RC5 and RC6 are two encryption algorithms designed by Ronald Rivest in 1994 and 1998.

They are very similar to each other, with RC6 introducing an additional multiplication in the cypher to make it more resistant.

Both cyphers use the same key setup mechanism and the same magical constants named P and Q.
The particular RC5/6 implementation from Equation group’s malware is interesting and deserves special attention because of its specifics.
Inside the Equation group malware, the encryption library uses a subtract operation with the constant 0x61C88647.
In most publicly available RC5/6 code, this constant is usually stored as 0x9E3779B9, which is basically -0x61C88647.
Since an addition is faster on certain hardware than a subtraction, it makes sense to store the constant in its negative form and adding it instead of subtracting.
In total, we’ve identified 20 different compiled versions of the RC5/6 code in the Equation group malware.
The Equation Giveaway
Encryption-related code in a DoubleFantasy (actxprxy32.dll) sample
In the screenshot above, one can observe the main loop of a RC6 key setup subroutine extracted from one of the Equation group samples.

The ShadowBrokers’ free trove includes 347 different instances of RC5/RC6 implementations.

As shown in the screenshot below, the implementation is functionally identical including the subtraction of the inverted constant 0x61C88647.
The Equation Giveaway
Specific RC6 implementation from “BUSURPER-2211-611.exe” (md5: 8f137a9100a9fcc8b512b3729878a373
Comparing the older, known Equation RC6 code and the code used in most of the binaries from the new leak we observe that they are functionally identical and share rare specific traits in their implementation.
The Equation Giveaway
In case you’re wondering, this specific RC6 implementation has only been seen before with Equation group malware.

There are more than 300 files in the Shadowbrokers’ archive which implement this specific variation of RC6 in 24 different forms.

The chances of all these being faked or engineered is highly unlikely.
This code similarity makes us believe with a high degree of confidence that the tools from the ShadowBrokers leak are related to the malware from the Equation group. While the ShadowBrokers claimed the data was related to the Equation group, they did not provide any technical evidence of these claims.

The highly specific crypto implementation above confirms these allegations.
More details about the ShadowBrokers leak and similarities with Equation group are available to Kaspersky Intelligence Services reports’ subscribers.

For more information, email <intelreports@kaspersky.com>

Leave a Reply