Swallowing the Snake’s Tail: Tracking Turla Infrastructure
®, membre du groupe Insikt de Recorded Future, a développé de nouvelles méthodes de détection des logiciels malveillants et de l'infrastructure Turla dans le cadre d'une enquête approfondie sur les activités récentes de Turla. Les sources de données comprenaient la plateforme Recorded Future®, ReversingLabs, VirusTotal, Shodan, BinaryEdge et diverses autres sources. Outils OSINT. Cette étude s'adresse aux professionnels de la sécurité, aux défenseurs des réseaux et aux experts en Threat Intelligence intéressés par les activités des réseaux informatiques de l'État russe.
Executive Summary
Turla, également connu sous les noms de Snake, Waterbug et Venomous Bear, est un groupe de cyberespionnage bien établi, sophistiqué et stratégiquement orienté qui, depuis plus d'une décennie, est lié à des opérations contre des organisations de recherche, diplomatiques et militaires dans le monde entier, avec une attention particulière pour les entités appartenant à l'Organisation du Traité de l'Atlantique Nord (OTAN) et aux pays de la Communauté des États indépendants (CEI).
While many nation-state threat actor groups are becoming more reliant on open source and commodity software for operations, Turla continues to develop its own unique, advanced malware and tools and adopts new methods of attack and obfuscation. It uses these TTPs alongside older techniques and generic, open source tools. For these reasons, Insikt Group assesses that Turla Group will remain an active, advanced threat for years to come that will continue to surprise with unique operational concepts.
However, the group’s consistent patterns and use of stable and periodically updated versions of unique malware for lengthy campaigns may allow defenders to proactively track and identify Turla’s infrastructure and activities. This research examines the history of Turla’s operations and provides our methodology for identifying infrastructure currently being used by Turla, focusing on several Turla-associated malware types. Details on two of them — the composite Mosquito backdoor and the hijacked Iranian TwoFace ASPX web shell — are provided in this report.
Recorded Future has provided a detailed report to our clients with further research and detections for additional Turla-related malware families, which is available in the Recorded Future platform.
Key Judgments
- Turla Group can be tracked based on unique features of their malware and C2 communication. Additionally, Turla’s use of open source tools when avoiding detection and confusing attribution attempts also allows researchers to quickly analyze and build detections, as the source code is readily available for analysis and testing.
- In June 2019, Turla Group was found to have infiltrated the computer network operations infrastructure of APT34, an Iranian threat group. This amounted to the effective takeover of the computer network operations of a nation-state group by state actors from another country — an unprecedented action. Insikt Group assesses that Turla Group’s use of APT34 infrastructure was primarily opportunistic in nature and was not coordinated between Iranian and Russian organizations.
- Recorded Future assesses with high confidence that TwoFace is the Iranian APT34 ASPX shell Turla was scanning for to pivot to additional hosts, as documented in the NSA/NCSC report. We assess that any live TwoFace shells as of late January 2020 could also be potential operational assets of the Turla Group.
- In 2019, Turla began relying heavily on PowerShell scripts for malware installation. Previously, it had also heavily targeted Microsoft vulnerabilities as well as email servers. Turla also often uses compromised WordPress websites as the foundation of its C2 infrastructure.
- Among the malware that we researched, Turla mainly uses HTTP/S for their command and control (C2) communication.
Background
Turla a été impliqué dans des opérations visant le Pentagone dès 2008 et continue de cibler les pays de l'OTAN à ce jour. Les principales cibles de Turla sont les entreprises de publication et de médias, les universités/milieux universitaires et les organisations gouvernementales, souvent en ciblant spécifiquement la recherche scientifique et énergétique, les affaires diplomatiques locales et à distance, ainsi que les données militaires. Turla cible activement les pays européens et ceux de la CEI, en se concentrant traditionnellement sur les ministères des Affaires étrangères ou de la Défense, ainsi que sur des organisations gouvernementales similaires et des instituts de recherche affiliés.
Turla is known for its use of watering hole attacks (compromising websites to target visitors) and spearphishing campaigns to precisely attack specific entities of interest. Turla has also used inventive, out-of-the box techniques, including using satellites to exfiltrate data from remote areas in North Africa and the Middle East. The group is known for the use of both unaltered and customized versions of open source software such as Meterpreter and Mimikatz, as well as bespoke malware such as Gazer, IcedCoffee, Carbon, and Mosquito.
Turla operators have also commandeered third-party infrastructure or used false flags in order to further their purposes. In many cases, this group has used compromised websites (typically WordPress sites) as both an infection vector and as operational infrastructure for C2 communications.
En juin 2019, Turla a été identifié par des chercheurs de Symantec comme ayant infiltré l'infrastructure informatique du groupe de cybercriminels APT34, basé en Iran, afin de collecter et d'exfiltrer des informations opérationnelles iraniennes, tout en accédant aux victimes actives des cybercriminels iraniens.
Turla’s hijacking of Iranian APT34 operations in part consisted of scanning for and discovering their web shells using existing APT34 victim networks to scan for a specific web shell on IP addresses across at least 35 different countries. Once identified, Turla used these shells to gain an initial foothold into victims of interest and then deployed further tools.
TwoFace, first observed in 2015, is the primary APT34 web shell, and Recorded Future assesses with high confidence that TwoFace is the shell Turla was scanning for to pivot to additional hosts. We assess that any live TwoFace shells as of late January 2020 could also be potential operational assets of the Turla Group.
Turla also directly accessed C2 panels of the APT34 Poison Frog tool from their own infrastructure and used this access to task victims with downloading Turla tools.
Threat Analysis
To date, Turla Group’s hijacking of Iranian computer network operations resources has been unique among known threat actors; this action amounted to the effective takeover of the computer network operations of a nation-state group by state actors from another country.
Although it is possible that the Iranian and Russian organizations were cooperating in some manner, the evidence available to Insikt Group does not support this theory. For example, while Turla had significant insight into APT34 tools and operations, they were required to scan for Iranian web shells in order to find where these tools were deployed. We assess that Turla’s interposition into Iranian operations was likely an uncoordinated, and thus hostile, act.
Bien qu'Insikt Group estime que l'utilisation de l'infrastructure APT34 par le groupe Turla était principalement de nature opportuniste, les opérateurs ont probablement tiré un avantage supplémentaire de la possibilité de tromper les intervenants chargés de répondre aux incidents, qui auraient pu identifier les outils comme étant d'origine iranienne. Turla a réutilisé des logiciels malveillants provenant d'autres acteurs malveillants avant d'utiliser des outils iraniens, notamment le logiciel malveillant Quarian attribué à la Chine en 2012. Dans ce cas précis, les chercheurs de Kaspersky ont estimé que les acteurs de Turla avaient téléchargé puis désinstallé le malware Quarian dans le but de détourner et de tromper les intervenants après sa découverte.
En dehors de leur audacieuse aventure iranienne, Turla a mené simultanément d'autres activités opérationnelles et de développement. En 2019, Turla a commencé à utiliser intensivement des scripts PowerShell, probablement dans le but d'éviter la détection de fichiers malveillants sur le disque. Au cours de l'année, ils ont accru leur utilisation des scripts PowerShell, en utilisant PowerSploit et PowerShell Empire, et ont également développé leur propre porte dérobée Powershell, PowerStallion.
Bien que Turla cible le plus souvent les systèmes d'exploitation Microsoft Windows, ses auteurs ont également exploité de manière ciblée des serveurs de messagerie électronique. La porte dérobée LightNeuron est spécialement conçue pour fonctionner sur les serveurs de messagerie Microsoft Exchange, tandis que la porte dérobée Outlook est conçue pour fonctionner sur les serveurs de messagerie Exchange et The Bat! (populaire en Europe de l'Est). La compromission des serveurs de messagerie permet à Turla de contrôler le trafic de courriels sur un réseau cible, y compris la possibilité non seulement de surveiller les courriels, mais également de créer, d'envoyer et même de bloquer des courriels.
Turla utilise des sites WordPress compromis comme C2. Ils utilisent également régulièrement des noms d'URL axés sur WordPress pour la livraison de charges utiles depuis 2014, voire avant. Cette tendance permet de profiler leurs C2 et leurs URL de charge utile afin de découvrir de nouvelles infrastructures Turla.
Turla operations have been associated with a variety of custom malware. Insikt Group performed deeper analysis on several of these malware types in an effort to create scanning rules to detect live Turla-associated infrastructure active from December 2019 to January 2020.
Turla Advanced Detection Analysis
The focus of our analysis was the development of identification methods for Turla, focusing on several Turla-associated malware types. Details of our analysis of both the composite Mosquito backdoor and the hijacked Iranian TwoFace web shell are provided in this report.
Mosquito Controller Detection
En janvier 2018, ESET a signalé l'existence d'une nouvelle porte dérobée appelée Mosquito, qu'ils ont observée lors d'une analyse d'intrusion. La livraison et l'installation du Mosquito comportaient plusieurs éléments, notamment :
- Use of a trojanized Adobe installer
- Use of Metasploit shellcode to download a legitimate copy of the Adobe Flash installer and a copy of Meterpreter in order to enable the download and installation of the Mosquito installer
- Installer with encrypted payload
- Launcher which executes the primary backdoor, “Commander”
Mosquito est un cheval de Troie d'accès à distance (RAT) pour Windows. Le logiciel malveillant comprend trois composants principaux : un programme d'installation, un lanceur et le composant de porte dérobée parfois appelé CommanderDLL. Le logiciel malveillant Mosquito a été supprimé après l'utilisation initiale du shellcode Metasploit et l'installation de Meterpreter afin de prendre le contrôle de la victime. Il offre les fonctionnalités suivantes :
- Download file
- Create process
- Delete file
- Upload file
- Execute shell commands
- Execute PowerShell commands
- Add C2 server
- Delete C2 server
Commander est le composant principal de la porte dérobée Mosquito. Dans cette étude, nous avons principalement axé notre analyse sur la communication C2 du commandant. Pour plus de détails sur les autres aspects du package Mosquito, une analyse approfondie a été menée par les chercheurs d'ESET.
L'analyse d'ESET des communications entre Commander et son C2 montre que les communications vers et depuis le contrôleur sont envoyées via HTTP ou HTTPS. Du côté client, les données peuvent être envoyées en tant que paramètre dans la requête GET, en tant que cookie ou en tant que paramètre et charge utile d'une requête POST (comme illustré dans l'image ci-dessous). Du côté du contrôleur, les réponses et les commandes sont envoyées sous forme de charge utile HTTP.
Beacon from the Mosquito “Commander” backdoor with encrypted data sent in the POST parameter and payload.
Comme indiqué ci-dessus, les données envoyées au contrôleur ne sont pas en texte clair. Il est d'abord protégé par une routine de chiffrement qui utilise un générateur de nombres pseudo-aléatoires Blum Blum Shub pour créer un flux d'octets qui sont utilisés pour encoder les données en clair à l'aide d'une fonction XOR. Les données obtenues sont ensuite encodées en Base64.
Pour crypter ou décrypter, le processus de cryptage nécessite une clé et un module. Comme l'a signalé ESET et comme l'a observé Insikt Group lors de son analyse, le module « 0x7DFDC101 » est codé en dur. La clé n'est pas codée en dur et est générée de manière aléatoire à chaque échange entre le client et le contrôleur, de sorte que la clé est différente pour chaque transmission. Cette clé aléatoire est transmise dans le cadre de la communication C2 et peut être facilement extraite. Les analystes d'Insikt Group ont inversé cette implémentation du générateur de nombres pseudo-aléatoires et ont créé un script de décodage en Python disponible dans notre référentiel GitHub.
Mirroring analysis from ESET, Insikt Group found there is header information prepended to the data being sent. The header, when decrypted, consists of the following fields:
-
Informations décryptées de l'en-tête de Mosquito Commander.
Une analyse plus poussée de la porte dérobée Commander montre que la réponse attendue du contrôleur est un paquet HTTP/S dans lequel la charge utile est codée en Base64, puis chiffrée de la même manière que le paquet de balises C2. Si la réponse est décodée avec succès, le premier octet est vérifié et, s'il est égal à 28, les autres octets de données sont analysés. Si le premier octet est égal à 0x27, rien d'autre n'est fait avec la réponse C2.
Mosquito Commander C2 response-handling code.
Commander Passive Scans
Using open source tools like urlscan.io, as well as proprietary scanning methodologies developed by Insikt Group, the passive scans look for evidence of compromised hosts beaconing back to the controller. The queries search for the static aspects of the GET or POST resource string “/scripts/m/query.php?id=” as demonstrated in the link below:
Examples of recent results from this query with urlscan.io include:
- 204.193.62.62/scripts/m/query.php?id=eQV0AKBGOorB%2FsB6ZkIU0e%2BKQO…
- 204.193.62.62/scripts/m/query.php?id=eQV0AKBGOorB/sB6ZkIU0e+KQOWiwulq…
- 77.232.99.77/scripts/m/query.php?id=eQV0AKBGOorB%2FsB6ZkIU0e%2BKQ…
The URLs above match the typical Mosquito URL pattern perfectly. Using our Python decoder script mentioned above, we can attempt to decode the encrypted portion of the URL, “eQV0AKBGOorB%2FsB6ZkIU0e%2BKQO…” The results of our script are shown below.
Decrypted urlscan.io Commander URL string.
After running the decode script, we can determine that the beginning of the header is decoded correctly since we are able to extract the ID, string values, and MAC address of the compromised device. For both IPs, the data section cannot be decoded, but this is expected, considering that the ID is 0x87, which indicates that this was a HTTP POST and the actual data we would want to decode is in the HTTP payload and not in the parameter. Based on this analysis, we assess with medium confidence that these IPs are Mosquito Controllers.
TwoFace Web Shell Detection
Le shell web TwoFace a été découvert et analysé pour la première fois par l'équipe de recherche Palo Alto Unit42, puis attribué au groupe qu'ils associent à OilRig, généralement lié à APT34. Comme indiqué précédemment, Turla a recherché la présence des shells Web ASPX TwoFace, puis a tenté d'accéder à Snake ou à d'autres logiciels malveillants et de les télécharger. Nous estimons que bon nombre de ces shells Web sont désormais des actifs opérationnels de Turla et ne sont plus sous le contrôle d'APT34.
The TwoFace web shell is actually two shells: an initial loader shell, and a second, fully functional web shell that gives the operator much more control of the website. Both components were written in C# and designed to function on web servers supporting ASP.NET, using Active Server Page Extended (ASPX) files to operate. TwoFace is a remote access trojan with the following capabilities:
- Execute program
- Execute shell command
- Upload file
- Modify file
- Delete file
- Download file
- Timestomping (modification of file timestamps)
Accessing the web shell is done through a control panel similar to the image below. The threat actors would then have to authenticate in order to perform additional actions. However, even without authentication, the presence of this specific .aspx file is determination enough of the presence of the TwoFace web shell.
TwoFace web shell panel.
TwoFace Web Shell Discovery Details
Insikt Group created a proprietary tool to scan URLs for the TwoFace web shell. The configuration used to scan for TwoFace web shell using the tool is in the table below.
-
Configuration du scanner pour le shell web TwoFace.
Cette configuration rassemble d'abord toutes les URL de notre liste de sources dont le chemin d'accès contient un nom de fichier "*.aspx". Le scanner Recorded Future se connectera à chaque URL. En nous connectant, nous extrayons le contenu du fichier .aspx comme le montre l'image ci-dessous.
Récupération automatique des fichiers .aspx fichiers.
Nous recherchons ensuite dans la réponse les chaînes de caractères connues du shell web TwoFace afin de déterminer si l'URL mène à un shell web TwoFace. Les analystes d'Insikt Group ont utilisé l'extrait de code JavaScript dans l'image ci-dessous comme indicateur de la présence du shell web TwoFace.
JavaScript code used in TwoFace web shell detection.
Outlook
Le groupe Turla est un acteur malveillant sophistiqué. Malgré le fait que de nombreux groupes nationaux s'appuient de plus en plus sur des logiciels open source et standard pour mener leurs opérations, Turla a continué à développer ses propres logiciels malveillants avancés et uniques. Le Reductor RAT, une nouvelle souche de logiciel malveillant pour Turla observée pour la première fois fin 2019, est un exemple de cette innovation. Insikt Group s'attend à ce que l'utilisation de Reductor RAT se poursuive en 2020.
While still using effective older techniques like virtual file systems with Gazer and the Outlook backdoor, Turla has consistently adopted newer methods like Reductor’s alteration of browser pseudo-number generation, and continually developed new tools, such as their recent .NET and PowerShell backdoors.
As mentioned earlier, this does not mean Turla does not use any generic tools; Turla has used open source tools regularly, including Mimikatz and Metasploit as delivery mechanisms for the Mosquito backdoor.
Turla Group is assessed by Insikt Group to be a well-funded, advanced nation-state group that has been active and improving its tools and practices for many years. Although we expect its targeting and practices to shift over time, Insikt Group assesses that Turla Group will remain an active, advanced threat for years to come that will continue to surprise with unique operational concepts. However, the group’s consistent patterns and use of stable and periodically updated versions of unique malware for lengthy campaigns may allow proactive tracking and identification of its infrastructure and activities in the future.