Previously unknown Kapeka backdoor linked to Russian Sandworm APT
April 18, 2024
Russia-linked APT Sandworm employed a previously undocumented backdoor called Kapeka in attacks against Eastern Europe since 2022.
WithSecure researchers identified a new backdoor named Kapeka that has been used in attacks targeting victims in Eastern Europe since at least mid-2022. The backdoor is very sophisticated, it serves as both an initial toolkit and as a backdoor for maintaining long-term access to compromised systems. The nature of the targets, low detection rate, and sophisticated malware-supported features suggest that an APT group developed it.
WithSecure noticed overlaps between Kapeka and GreyEnergy and the Prestige ransomware attacks which are attributed to the Russia-linked Sandworm APT group. WithSecure believes that Kapeka is likely part of the Sandworm’s arsenal.
The Sandworm group (aka BlackEnergy, UAC-0082, Iron Viking, Voodoo Bear, and TeleBots) has been active since 2000, it operates under the control of Unit 74455 of the Russian GRU’s Main Center for Special Technologies (GTsST). The group is also the author of the NotPetya ransomware that hit hundreds of companies worldwide in June 2017. In 2022, the Russian APT used multiple wipers in attacks aimed at Ukraine,including AwfulShred, CaddyWiper, HermeticWiper, Industroyer2, IsaacWiper, WhisperGate, Prestige, RansomBoggs, and ZeroWipe.
“Kapeka contains a dropper that will drop and launch a backdoor on a victim’s machine and then remove itself. The backdoor will first collect information and fingerprint both the machine and user before sending the details on to the threat actor.” states WithSecure. “This allows tasks to be passed back to the machine or the backdoor’s configuration to be updated. WithSecure do not have insight as to how the Kapeka backdoor is propagated by Sandworm.”
The researcher speculates that Kapeka is a successor to GreyEnergy, which itself was likely a replacement for BlackEnergy in Sandworm.
Kapeka includes a dropper that acts as a launcher for a backdoor component on the infected host, after which it removes itself. The dropper also sets up persistence for the backdoor through a scheduled task (if admin or SYSTEM) or autorun registry (if not).
The Kapeka backdoor is a Windows DLL, which has a single exported function. The malware masqueraded as a Microsoft Word Add-In (.wll) file. It is written in C++ and compiled with Visual Studio 2017 (15.9). Upon execution, it requires the “-d” argument in the initial run but not for subsequent executions. The malware has a multi-threaded implementation, utilizing event objects for thread synchronization and signaling.
The backdoor employs the WinHttp 5.1 COM interface (winhttpcom.dll) for its network communication module. It interacts with its C2 server to fetch tasks and relay fingerprinted data and task outcomes. The malware uses JSON for C2 communication. Two distinct threads manage network communication: one for sending fingerprinted data and fetching tasks, and another for transmitting completed task results to the C2. Both threads utilize the same request/response mechanism.
The backdoor can update its C2 configuration dynamically by receiving a new JSON configuration (with the key “GafpPS”) from the C2 server during polling. If the received configuration differs from the current one, the backdoor updates its configuration on-the-fly and stores the latest C2 configuration in the registry value (“Seed”). The backdoor can also perform various tasks on the infected system by receiving a list of tasks as a JSON response (with the key “Td7opP”) from its C2 server during polling. The malicious code spawns a separate thread to execute each task.
“The backdoor’s victimology, infrequent sightings, and level of stealth and sophistication indicate APT-level activity, highly likely of Russian origin. However, due to sparsity of data at the time of writing the infection vector, the threat actor, and the actor’s ‘actions on objectives’ cannot be conclusively stated. Nevertheless, we examined multiple data points that strongly suggests a link between Kapeka and Sandworm”
Pierluigi Paganini
Follow me on Twitter: @securityaffairs and Facebook and Mastodon
(SecurityAffairs – hacking, Sandworm)