Unravelled VBE script drops Banking Trojan

August 28, 2015

The Dell Sonicwall Threats Research team have discovered a malicious obfuscated VBE script which is used to drop additional malware onto the infected system. The script is obfuscated and uses encryption in an attempt to hide its inner functionality.

Infection Cycle:

The Trojan makes the following DNS queries:


The Trojan adds the following files to the filesystem:

  • %APPDATA%MicrosoftWindowsTemplatesLb305a.exe [Detected as GAV: Dropper.A_1492 (Trojan)]
  • %APPDATA%MicrosoftWindowsTemplatesTp305iG3N.exe [Detected as GAV: Banker.MMUO (Trojan)]
  • %APPDATA%MicrosoftWindowsTemplatesXp806Np7F.7z [Detected as GAV: Dropper.VBE_2 (Trojan)]
  • %TEMP%tmp.exe [Detected as GAV: Kryptik.CQXR (Trojan)]
  • %TEMP%Zp806b9h.exe (7z utility)

The Trojan adds the following registry key to enable startup after reboot:

  • HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun Tp305iG3N.exe "%APPDATA%MicrosoftWindowsTemplatesTp305iG3N.exe"

The VB script is obfuscated:

Using freely available tools it was easy to deobfuscate the script thus revealing its functionality. It contains code to download a 7z archive from a remote webserver:

It also downloads the 7z utility program that is used to extract files from 7z archives.

The 7z archive is password protected. The script contains the password for the 7z archive:

      pass = "vaio1010"

Using this password it extracts the malicious files contained in the archive:

The script contains the following decryption routine:

      Function fCrypt(sPlainText, sPassword)
        Dim aBox(255), aKey(255), sTemp, a, b, c, i, j, k, iCipherBy, sTempswap, iLength, sO
        i = 0:j = 0:b = 0
        iLength = Len(sPassword)
          For a = 0 To 255
            aKey(a) = Asc(Mid(sPassword, (a Mod iLength)+1, 1))
            aBox(a) = a
          For a = 0 To 255
            b = (b + aBox(a) + aKey(a)) Mod 256
            sTempswap = aBox(a)
            aBox(a) = aBox(b)
            aBox(b) = sTempswap
          For c = 1 To Len(sPlainText)
          i = (i + 1) Mod 256
          j = (j + aBox(i)) Mod 256
            sTemp = aBox(i)
            aBox(i) = aBox(j)
            aBox(j) = sTemp
            k = aBox((aBox(i) + aBox(j)) Mod 256)
            iCipherBy = Asc(Mid(sPlainText, c, 1)) Xor k
            sO = sO & Chr(iCipherBy)
        fCrypt = sO
      End Function

The URL's and filenames to be used are encrypted in the script. The script uses the function above to decrypt this data at runtime. It uses 5F4156472559703C6B6E2B as the decryption key:

      linkA = fCrypt(HexToString("440A21CC6E364E7210D0757DA70C34B7397B47F8035587856AAFCA5196D980FB83DEF77D6BBC725532"), "5F4156472559703C6B6E2B")

      NmFile = fCrypt(HexToString("740E6D8C62571122239F2C66"), "5F4156472559703C6B6E2B")
      linkZip = fCrypt(HexToString("440A21CC6E364E7210D0757DA70C34B7397B47F8035587856AAFCA5196D980FBC7D4F33638B5"), "5F4156472559703C6B6E2B")

      ZipFile = fCrypt(HexToString("760E6D8C627B587D4BD46379"), "5F4156472559703C6B6E2B")

      fileA = fCrypt(HexToString("601C668C61784F701DD4"), "5F4156472559703C6B6E2B")
      fileB = fCrypt(HexToString("780E668C617026262B9F7E64AF"), "5F4156472559703C6B6E2B")

The script runs Tp305iG3N.exe [Detected as GAV: Banker.MMUO (Trojan)]. This banker Trojan announces its presence to its operators by issuing the following HTTP request to a remote webserver:

SonicWALL Gateway AntiVirus provides protection against this threat via the following signatures:

  • GAV: Psyme.KYA (Trojan)
  • GAV: Banker.MMUO (Trojan)
  • GAV: Kryptik.CQXR (Trojan)
  • GAV: Dropper.A_1492 (Trojan)
  • GAV: Dropper.VBE_2 (Trojan)