我在 Facebook 上被骗下载了一个混淆脚本

信息安全 开发 Facebook 混淆 路过下载
2021-08-13 03:53:25

我在 Facebook 上收到一条通知:“ (我的一个朋友)在评论中提到了你”。但是,当我单击它时,Firefox 尝试下载以下文件:

评论_24016875.jse

这是一个混淆脚本,它似乎下载了一个可执行文件 ( autoit.exe) 并运行它。

这是我设法去混淆的部分:

['Msxml2.XMLhttp', 'onreadystatechange', 'readyState', 'status', 'ADODB.Stream', 'open',
 'type', 'write', 'position', 'read', 'saveToFile', 'close', 'GET', 'send',
 'Scripting.FileSystemObject', 'WScript.Shell', 'Shell.Application', '%APPDATA%\\',
 'ExpandEnvironmentStrings', 'Mozila', 'https://www.google.com',
 'http://userexperiencestatics.net/ext/Autoit.jpg',   '\\autoit.exe',
 'http://userexperiencestatics.net/ext/bg.jpg',       '\\bg.js',
 'http://userexperiencestatics.net/ext/ekl.jpg',      '\\ekl.au3',
 'http://userexperiencestatics.net/ext/ff.jpg',       '\\ff.zip',
 'http://userexperiencestatics.net/ext/force.jpg',    '\\force.au3',
 'http://userexperiencestatics.net/ext/sabit.jpg',    '\\sabit.au3',
 'http://userexperiencestatics.net/ext/manifest.jpg', '\\manifest.json',
 'http://userexperiencestatics.net/ext/run.jpg',      '\\run.bat',
 'http://userexperiencestatics.net/ext/up.jpg',       '\\up.au3',
 'http://whos.amung.us/pingjs/?k=pingjse346',         '\\ping.js',
 'http://whos.amung.us/pingjs/?k=pingjse3462',        '\\ping2.js', '']

这是 Facebook 上的漏洞利用吗?我的朋友是否有可能感染了病毒,通过在恶意链接上标记他们的联系人来攻击他们?我应该向 Facebook 举报吗?如果是这样,怎么做?

4个回答

这是一个典型的混淆 JavaScript 恶意软件,它以 Windows 脚本主机为目标,下载剩余的有效负载。在这种情况下,它会下载似乎主要是 Chrome 扩展程序 (manifest.jsonbg.js)、autoit Windows 可执行文件以及一些安装它们的 autoit 脚本。所有这些文件都.jpg在它们托管的(可能受损的)服务器上使用扩展名命名,以不那么显眼。

该恶意软件似乎部分不完整或不发达,或者可能基于其他一些恶意软件(质量非常低)。许多 autoit 脚本实际上并没有做任何事情,而且看似包含 Firefox 扩展的 ZIP 实际上是空的。autoit 脚本是将大量包含合并到一个文件中,但实际上只有一个(ekl)在最后有一个有效负载。

一个在感染时运行的活动 autoit 脚本将 Chrome、IE 和可能的其他浏览器快捷方式替换为 Chrome 的快捷方式,并带有运行恶意 Chrome 扩展程序所需的参数。

Chrome 扩展主要是这种恶意软件的传播方式。它会做一些令人讨厌的事情,例如将防病毒软件域列入黑名单,以及自动发送 Facebook 消息。实际上,有一个 web 服务后端来http://appcdn.co/datajs提供一些脚本,这些脚本将根据当前正在查看的 URL 注入到用户访问的任何页面上,这就是 Facebook 消息的发布方式。该服务现已离线,可能已被取消。

这是 Facebook 上的漏洞利用吗?

不完全是,更像是对 Facebook 的滥用。Facebook 的代码没有被利用,您的朋友只是有一个受感染的浏览器代表他们钓鱼他们的联系人。

我的朋友是否有可能感染了病毒,通过在恶意链接上标记他们的联系人来攻击他们?

是的,这正是这种恶意软件传播自身的方式。

我应该向 Facebook 举报吗?如果是这样,怎么做?

是的,请参阅Facebook 帮助中心的如何举报

通过联系他们的主机使以下 URL 脱机也很好。

http://userexperiencestatics.net/ext/Autoit.jpg
http://userexperiencestatics.net/ext/bg.jpg
http://userexperiencestatics.net/ext/ekl.jpg
http://userexperiencestatics.net/ext/ff.jpg
http://userexperiencestatics.net/ext/force.jpg
http://userexperiencestatics.net/ext/sabit.jpg
http://userexperiencestatics.net/ext/manifest.jpg
http://userexperiencestatics.net/ext/run.jpg
http://userexperiencestatics.net/ext/up.jpg
http://whos.amung.us/pingjs/?k=pingjse346
http://whos.amung.us/pingjs/?k=pingjse3462
http://appcdn.co/datajs

不幸的是,尽管我在发布此答案后不久联系了 CloudFlare,但仍然没有删除userexperiencestatics.netURL,而且我不知道实际上是谁在托管这些文件。CloudFlare 刚刚给我发电子邮件说他们限制了对文件的访问,并说他们会通知主机。

更新:

在我和可能的其他人.jse向 Google 报告了该 URL 之后,他们似乎已经删除了该文件。如果您发现更多副本,也应报告这些副本。似乎人们一直在从众多来源接收文件。

更多信息:

这个恶意软件和帖子引起了很多关注,所以我将添加更多信息来解决人们的问题:

这个文件下载后会自动运行吗?

除非您已将浏览器配置为这样做,否则可能不会。它旨在欺骗您打开它。

它会感染我的手机或非 Windows 计算机吗?

据我所知,Windows 是唯一可以运行此恶意软件的操作系统。正如我所提到的,它使用 Windows 脚本宿主。我不相信即使是 Windows phone 也容易受到攻击,尽管我对 Windows phone 了解不多。

勒索软件更新:

以前假设 autoit 脚本包含勒索软件,但经过进一步检查,情况似乎并非如此。只有一堆未使用的加密函数掩盖了实际的有效载荷,我主要对此进行了去混淆处理

Chrome 扩展更新:

解压后的 Chrome 扩展代码可以在这里查看有关它在上面集成的功能的详细信息。

JSE 脚本更新:

我的去混淆comment_24016875.jse脚本可以在这里查看

我没有时间对这个脚本的作用进行完全逆向工程,但它似乎链接到几个.jpg实际上不是图像而是文本的文件,然后引用了一些.au3文件,这表明它实际上将这些.jpg文件保存在该扩展名下。

这些.au3文件似乎与 AutoIt 的文件扩展名相匹配,并且确实它们看起来像有效的 AutoIt 脚本。这是其中的一部分,即ekl.jpg

Func _crypt_startup()
    If __crypt_refcount() = 0 Then
        Local $hadvapi32 = DllOpen("Advapi32.dll")
        If $hadvapi32 = -1 Then Return SetError(1, 0, False)
        __crypt_dllhandleset($hadvapi32)
        Local $iproviderid = $prov_rsa_aes
        Local $aret = DllCall(__crypt_dllhandle(), "bool", "CryptAcquireContext", "handle*", 0, "ptr", 0, "ptr", 0, "dword", $iproviderid, "dword", $crypt_verifycontext)
        If @error OR NOT $aret[0] Then
            Local $ierror = @error + 10, $iextended = @extended
            DllClose(__crypt_dllhandle())
            Return SetError($ierror, $iextended, False)
        Else
            __crypt_contextset($aret[1])
        EndIf
    EndIf
    __crypt_refcountinc()
    Return True
EndFunc

Func _crypt_shutdown()
    __crypt_refcountdec()
    If __crypt_refcount() = 0 Then
        DllCall(__crypt_dllhandle(), "bool", "CryptReleaseContext", "handle", __crypt_context(), "dword", 0)
        DllClose(__crypt_dllhandle())
    EndIf
EndFunc

Func _crypt_derivekey($vpassword, $ialg_id, $ihash_alg_id = $calg_md5)
    Local $aret = 0, $hbuff = 0, $hcrypthash = 0, $ierror = 0, $iextended = 0, $vreturn = 0
    _crypt_startup()
    Do
        $aret = DllCall(__crypt_dllhandle(), "bool", "CryptCreateHash", "handle", __crypt_context(), "uint", $ihash_alg_id, "ptr", 0, "dword", 0, "handle*", 0)
        If @error OR NOT $aret[0] Then
            $ierror = @error + 10
            $iextended = @extended
            $vreturn = -1
            ExitLoop
        EndIf
        $hcrypthash = $aret[5]
        $hbuff = DllStructCreate("byte[" & BinaryLen($vpassword) & "]")
        DllStructSetData($hbuff, 1, $vpassword)
        $aret = DllCall(__crypt_dllhandle(), "bool", "CryptHashData", "handle", $hcrypthash, "struct*", $hbuff, "dword", DllStructGetSize($hbuff), "dword", $crypt_userdata)
        If @error OR NOT $aret[0] Then
            $ierror = @error + 20
            $iextended = @extended
            $vreturn = -1
            ExitLoop
        EndIf
        $aret = DllCall(__crypt_dllhandle(), "bool", "CryptDeriveKey", "handle", __crypt_context(), "uint", $ialg_id, "handle", $hcrypthash, "dword", $crypt_exportable, "handle*", 0)
        If @error OR NOT $aret[0] Then
            $ierror = @error + 30
            $iextended = @extended
            $vreturn = -1
            ExitLoop
        EndIf
        $vreturn = $aret[5]
    Until True
    If $hcrypthash <> 0 Then DllCall(__crypt_dllhandle(), "bool", "CryptDestroyHash", "handle", $hcrypthash)
    Return SetError($ierror, $iextended, $vreturn)
EndFunc

Func _crypt_destroykey($hcryptkey)
    Local $aret = DllCall(__crypt_dllhandle(), "bool", "CryptDestroyKey", "handle", $hcryptkey)
    Local $ierror = @error, $iextended = @extended
    _crypt_shutdown()
    If $ierror OR NOT $aret[0] Then
        Return SetError($ierror + 10, $iextended, False)
    Else
        Return True
    EndIf
EndFunc

Func _crypt_encryptdata($vdata, $vcryptkey, $ialg_id, $bfinal = True)
    Local $ireqbuffsize = 0, $aret = 0, $hbuff = 0, $ierror = 0, $iextended = 0, $vreturn = 0
    _crypt_startup()
    Do
        If $ialg_id <> $calg_userkey Then
            $vcryptkey = _crypt_derivekey($vcryptkey, $ialg_id)
            If @error Then
                $ierror = @error + 100
                $iextended = @extended
                $vreturn = -1
                ExitLoop
            EndIf
        EndIf
        $aret = DllCall(__crypt_dllhandle(), "bool", "CryptEncrypt", "handle", $vcryptkey, "handle", 0, "bool", $bfinal, "dword", 0, "ptr", 0, "dword*", BinaryLen($vdata), "dword", 0)
        If @error OR NOT $aret[0] Then
            $ierror = @error + 20
            $iextended = @extended
            $vreturn = -1
            ExitLoop
        EndIf
        $ireqbuffsize = $aret[6]
        $hbuff = DllStructCreate("byte[" & $ireqbuffsize & "]")
        DllStructSetData($hbuff, 1, $vdata)
        $aret = DllCall(__crypt_dllhandle(), "bool", "CryptEncrypt", "handle", $vcryptkey, "handle", 0, "bool", $bfinal, "dword", 0, "struct*", $hbuff, "dword*", BinaryLen($vdata), "dword", DllStructGetSize($hbuff))
        If @error OR NOT $aret[0] Then
            $ierror = @error + 30
            $iextended = @extended
            $vreturn = -1
            ExitLoop
        EndIf
        $vreturn = DllStructGetData($hbuff, 1)
    Until True
    If $ialg_id <> $calg_userkey Then _crypt_destroykey($vcryptkey)
    _crypt_shutdown()
    Return SetError($ierror, $iextended, $vreturn)
EndFunc

Func _crypt_decryptdata($vdata, $vcryptkey, $ialg_id, $bfinal = True)
    Local $aret = 0, $hbuff = 0, $htempstruct = 0, $ierror = 0, $iextended = 0, $iplaintextsize = 0, $vreturn = 0
    _crypt_startup()
    Do
        If $ialg_id <> $calg_userkey Then
            $vcryptkey = _crypt_derivekey($vcryptkey, $ialg_id)
            If @error Then
                $ierror = @error + 100
                $iextended = @extended
                $vreturn = -1
                ExitLoop
            EndIf
        EndIf
        $hbuff = DllStructCreate("byte[" & BinaryLen($vdata) + 1000 & "]")
        DllStructSetData($hbuff, 1, $vdata)
        $aret = DllCall(__crypt_dllhandle(), "bool", "CryptDecrypt", "handle", $vcryptkey, "handle", 0, "bool", $bfinal, "dword", 0, "struct*", $hbuff, "dword*", BinaryLen($vdata))
        If @error OR NOT $aret[0] Then
            $ierror = @error + 20
            $iextended = @extended
            $vreturn = -1
            ExitLoop
        EndIf
        $iplaintextsize = $aret[6]
        $htempstruct = DllStructCreate("byte[" & $iplaintextsize & "]", DllStructGetPtr($hbuff))
        $vreturn = DllStructGetData($htempstruct, 1)
    Until True
    If $ialg_id <> $calg_userkey Then _crypt_destroykey($vcryptkey)
    _crypt_shutdown()
    Return SetError($ierror, $iextended, $vreturn)
EndFunc

Func _crypt_hashdata($vdata, $ialg_id, $bfinal = True, $hcrypthash = 0)
    Local $aret = 0, $hbuff = 0, $ierror = 0, $iextended = 0, $ihashsize = 0, $vreturn = 0
    _crypt_startup()
    Do
        If $hcrypthash = 0 Then
            $aret = DllCall(__crypt_dllhandle(), "bool", "CryptCreateHash", "handle", __crypt_context(), "uint", $ialg_id, "ptr", 0, "dword", 0, "handle*", 0)
            If @error OR NOT $aret[0] Then
                $ierror = @error + 10
                $iextended = @extended
                $vreturn = -1
                ExitLoop
            EndIf
            $hcrypthash = $aret[5]
        EndIf
        $hbuff = DllStructCreate("byte[" & BinaryLen($vdata) & "]")
        DllStructSetData($hbuff, 1, $vdata)
        $aret = DllCall(__crypt_dllhandle(), "bool", "CryptHashData", "handle", $hcrypthash, "struct*", $hbuff, "dword", DllStructGetSize($hbuff), "dword", $crypt_userdata)
        If @error OR NOT $aret[0] Then
            $ierror = @error + 20
            $iextended = @extended
            $vreturn = -1
            ExitLoop
        EndIf
        If $bfinal Then
            $aret = DllCall(__crypt_dllhandle(), "bool", "CryptGetHashParam", "handle", $hcrypthash, "dword", $hp_hashsize, "dword*", 0, "dword*", 4, "dword", 0)
            If @error OR NOT $aret[0] Then
                $ierror = @error + 30
                $iextended = @extended
                $vreturn = -1
                ExitLoop
            EndIf
            $ihashsize = $aret[3]
            $hbuff = DllStructCreate("byte[" & $ihashsize & "]")
            $aret = DllCall(__crypt_dllhandle(), "bool", "CryptGetHashParam", "handle", $hcrypthash, "dword", $hp_hashval, "struct*", $hbuff, "dword*", DllStructGetSize($hbuff), "dword", 0)
            If @error OR NOT $aret[0] Then
                $ierror = @error + 40
                $iextended = @extended
                $vreturn = -1
                ExitLoop
            EndIf
            $vreturn = DllStructGetData($hbuff, 1)
        Else
            $vreturn = $hcrypthash
        EndIf
    Until True
    If $hcrypthash <> 0 AND $bfinal Then DllCall(__crypt_dllhandle(), "bool", "CryptDestroyHash", "handle", $hcrypthash)
    _crypt_shutdown()
    Return SetError($ierror, $iextended, $vreturn)
EndFunc

Func _crypt_hashfile($sfile, $ialg_id)
    Local $btempdata = 0, $hfile = 0, $hhashobject = 0, $ierror = 0, $iextended = 0, $vreturn = 0
    _crypt_startup()
    Do
        $hfile = FileOpen($sfile, $fo_binary)
        If $hfile = -1 Then
            $ierror = 1
            $vreturn = -1
            ExitLoop
        EndIf
        Do
            $btempdata = FileRead($hfile, 512 * 1024)
            If @error Then
                $vreturn = _crypt_hashdata($btempdata, $ialg_id, True, $hhashobject)
                If @error Then
                    $ierror = @error
                    $iextended = @extended
                    $vreturn = -1
                    ExitLoop 2
                EndIf
                ExitLoop 2
            Else
                $hhashobject = _crypt_hashdata($btempdata, $ialg_id, False, $hhashobject)
                If @error Then
                    $ierror = @error + 100
                    $iextended = @extended
                    $vreturn = -1
                    ExitLoop 2
                EndIf
            EndIf
        Until False
    Until True
    _crypt_shutdown()
    If $hfile <> -1 Then FileClose($hfile)
    Return SetError($ierror, $iextended, $vreturn)
EndFunc

Func _crypt_encryptfile($ssourcefile, $sdestinationfile, $vcryptkey, $ialg_id)
    Local $btempdata = 0, $hinfile = 0, $houtfile = 0, $ierror = 0, $iextended = 0, $ifilesize = FileGetSize($ssourcefile), $iread = 0, $breturn = True
    _crypt_startup()
    Do
        If $ialg_id <> $calg_userkey Then
            $vcryptkey = _crypt_derivekey($vcryptkey, $ialg_id)
            If @error Then
                $ierror = @error
                $iextended = @extended
                $breturn = False
                ExitLoop
            EndIf
        EndIf
        $hinfile = FileOpen($ssourcefile, $fo_binary)
        If @error Then
            $ierror = 2
            $breturn = False
            ExitLoop
        EndIf
        $houtfile = FileOpen($sdestinationfile, $fo_overwrite + $fo_createpath + $fo_binary)
        If @error Then
            $ierror = 3
            $breturn = False
            ExitLoop
        EndIf
        Do
            $btempdata = FileRead($hinfile, 1024 * 1024)
            $iread += BinaryLen($btempdata)
            If $iread = $ifilesize Then
                $btempdata = _crypt_encryptdata($btempdata, $vcryptkey, $calg_userkey, True)
                If @error Then
                    $ierror = @error + 400
                    $iextended = @extended
                    $breturn = False
                EndIf
                FileWrite($houtfile, $btempdata)
                ExitLoop 2
            Else
                $btempdata = _crypt_encryptdata($btempdata, $vcryptkey, $calg_userkey, False)
                If @error Then
                    $ierror = @error + 500
                    $iextended = @extended
                    $breturn = False
                    ExitLoop 2
                EndIf
                FileWrite($houtfile, $btempdata)
            EndIf
        Until False
    Until True
    If $ialg_id <> $calg_userkey Then _crypt_destroykey($vcryptkey)
    _crypt_shutdown()
    If $hinfile <> -1 Then FileClose($hinfile)
    If $houtfile <> -1 Then FileClose($houtfile)
    Return SetError($ierror, $iextended, $breturn)
EndFunc

Func _crypt_decryptfile($ssourcefile, $sdestinationfile, $vcryptkey, $ialg_id)
    Local $btempdata = 0, $hinfile = 0, $houtfile = 0, $ierror = 0, $iextended = 0, $ifilesize = FileGetSize($ssourcefile), $iread = 0, $breturn = True
    _crypt_startup()
    Do
        If $ialg_id <> $calg_userkey Then
            $vcryptkey = _crypt_derivekey($vcryptkey, $ialg_id)
            If @error Then
                $ierror = @error
                $iextended = @extended
                $breturn = False
                ExitLoop
            EndIf
        EndIf
        $hinfile = FileOpen($ssourcefile, $fo_binary)
        If @error Then
            $ierror = 2
            $breturn = False
            ExitLoop
        EndIf
        $houtfile = FileOpen($sdestinationfile, $fo_overwrite + $fo_createpath + $fo_binary)
        If @error Then
            $ierror = 3
            $breturn = False
            ExitLoop
        EndIf
        Do
            $btempdata = FileRead($hinfile, 1024 * 1024)
            $iread += BinaryLen($btempdata)
            If $iread = $ifilesize Then
                $btempdata = _crypt_decryptdata($btempdata, $vcryptkey, $calg_userkey, True)
                If @error Then
                    $ierror = @error + 400
                    $iextended = @extended
                    $breturn = False
                EndIf
                FileWrite($houtfile, $btempdata)
                ExitLoop 2
            Else
                $btempdata = _crypt_decryptdata($btempdata, $vcryptkey, $calg_userkey, False)
                If @error Then
                    $ierror = @error + 500
                    $iextended = @extended
                    $breturn = False
                    ExitLoop 2
                EndIf
                FileWrite($houtfile, $btempdata)
            EndIf
        Until False
    Until True
    If $ialg_id <> $calg_userkey Then _crypt_destroykey($vcryptkey)
    _crypt_shutdown()
    If $hinfile <> -1 Then FileClose($hinfile)
    If $houtfile <> -1 Then FileClose($houtfile)
    Return SetError($ierror, $iextended, $breturn)
EndFunc

Func _crypt_genrandom($pbuffer, $isize)
    _crypt_startup()
    Local $aret = DllCall(__crypt_dllhandle(), "bool", "CryptGenRandom", "handle", __crypt_context(), "dword", $isize, "struct*", $pbuffer)
    Local $ierror = @error + 10, $iextended = @extended
    _crypt_shutdown()
    If $ierror OR (NOT $aret[0]) Then
        Return SetError($ierror, $iextended, False)
    Else
        Return True
    EndIf
EndFunc

Func __crypt_refcount()
    Return $__g_acryptinternaldata[0]
EndFunc

Func __crypt_refcountinc()
    $__g_acryptinternaldata[0] += 1
EndFunc

Func __crypt_refcountdec()
    If $__g_acryptinternaldata[0] > 0 Then $__g_acryptinternaldata[0] -= 1
EndFunc

Func __crypt_dllhandle()
    Return $__g_acryptinternaldata[1]
EndFunc

Func __crypt_dllhandleset($hadvapi32)
    $__g_acryptinternaldata[1] = $hadvapi32
EndFunc

Func __crypt_context()
    Return $__g_acryptinternaldata[2]
EndFunc

Func __crypt_contextset($hcryptcontext)
    $__g_acryptinternaldata[2] = $hcryptcontext
EndFunc

如您所见,有与加密相关的代码表明这是一个(相当糟糕和业余的)勒索软件。随意对其他所有内容进行逆向工程。

从外观上看,恶意行为者利用了所谓的 XML 外部实体漏洞 ( XXE ),然后是服务器端请求伪造 (SSRF)。

Facebook 的服务器被诱骗链接来自另一个域的恶意 XML 文件,对其进行处理并将其提供给您。这是XXE 备忘单SSRF 圣经的备忘单,如果您有兴趣可以研究一下。

想一想...您的混淆脚本具有以下内容(msxml2.XMLhttp 方法并声明它来自谷歌)。

具体来说,它使用“ ADODB.Stream 对象通过 ASP 将二进制文件发送到浏览器”。

简而言之,是的,它利用了 XXE(通过 asp 编写 xml 文档)并伪造(SSRF)它声明它来自谷歌。

这是 Facebook 上的漏洞利用吗?

最有可能的。肆无忌惮的人总是想方设法获得银行账户、密码、朋友列表以及他们可以做的任何事情来赚钱。

我的朋友是否有可能感染了病毒,通过在恶意链接上标记他们的联系人来攻击他们?

没有理由不这么认为。大多数计算机用户甚至不知道什么是病毒,如何“捕获”病毒,或者一旦被感染该做什么。如果是我,我会找到这位朋友,给他们发送一个防病毒程序的链接,并主动提供帮助。当然,取决于你的朋友,你可能不会那么善良,但我坚信我会尽我所能帮助人类。

我应该向 Facebook 举报吗?

确实。它不会给您的朋友带来麻烦,但它可以帮助他们追踪共享并最终减少受此病毒/恶意软件/诈骗影响的人数。

如果是这样,怎么做?

转到原始帖子,单击标记帖子的选项,然后通过向导。我相信,如果他们采取行动,你会收到通知。

最后一点:微软似乎已经意识到了这个文件;当我尝试在 IE Edge 中下载它时,我收到一个警告,该文件很危险,无法保存。任何使用 SmartScreen 的人都可能是安全的,而且这种病毒似乎并不针对非 Microsoft 系统。最有可能的是,您的大多数不太懂行的朋友和家人应该没问题,除非他们仍在运行 XP,在这种情况下,您应该建议他们至少升级到 7。