Command and Scripting Interpreter

May 1, 2024 · View on GitHub

ID E1059
Objective(s) Execution
Related ATT&CK Techniques Command and Scripting Interpreter (T1059, T1623)
Version 2.2
Created 2 August 2022
Last Modified 30 April 2024

Command and Scripting Interpreter

Malware may abuse command and script interpreters to execute commands, scripts, or binaries. This is often done to carry out various malicious activities, such as exploring the system, escalating privileges, or exfiltrating data. Built-in command-line interpreters or scripting environments of the operating system, such as cmd.exe or Powershell on Windows, or Bash on Unix-like systems, are often used. Additionally, adversaries may use other scripting languages like Python, Perl, or Javascript.

See ATT&CK: Command and Scripting Interpreter (T1059, T1623).

Use in Malware

NameDateMethodDescription
Poison Ivy2005--After the Poison Ivy server is running on the target machine, the attacker can use a Windows GUI client to control the target computer. [1]
WebCobra2018--From the command line, the malware drops and unzips a password-protected Cabinet archive file. [1]
GoBotKR2019--GoBotKR uses cmd.exe to execute commands. [2]
Kovter2016--The malware executes malicious javascript and powershell. [3]
SamSam2015--SamSam uses a batch file for executing the malware and deleting certain components. [4]
Shamoon2012--The wiper component of Shamoon creates a service to run the driver with the command: sc create hdv_725x type= kernel start= demand binpath= WINDOWS\hdv_725x.sys 2>&1 >nul and sends an additional reboot command after completion. Shamoon also accepts command line arguments.[5]
Stuxnet2010--Stuxnet will store and execute SQL code that will extract and execute Stuxnet from the saved CAB file using xp_cmdshell. [6]
EvilBunny2011--EvilBunny executes Lua scripts. [7]
Netwalker2020--Netwalker is written and executed in Powershell. [8]
CryptoLocker2013--The malware accepts command line arguments. [9]
Dark Comet2008--The malware accepts command line arguments. [9]
Gamut2014--Gamut accepts command line arguments. [9]
Hupigon2013--Hupigon accepts command line arguments. [9]
Mebromi2011--Mebromi accepts command line arguments. [9]
Redhip2011--Redhip accepts command line arguments. [9]
Rombertik2015--The malware accepts command line arguments. [9]
SearchAwesome2018--The malware installs a script to inject a JavaScript script and modify web traffic. [10]
TrickBot2016--TrickBot accepts command line arguments. [9]
UP0072016--The malware accepts command line arguments. [9]

Detection

Tool: capaMappingAPIs
accept command line argumentsCommand and Scripting Interpreter (E1059)GetCommandLine, CommandLineToArgv, System.Environment::GetCommandLineArgs
run PowerShell expressionCommand and Scripting Interpreter (E1059)System.Management.Automation.PowerShell::Create, System.Management.Automation.PowerShell::AddScript, System.Management.Automation.PowerShell::Invoke
Tool: CAPEMappingAPIs
office_postscriptCommand and Scripting Interpreter (E1059)NtWriteFile
js_suspicious_redirectCommand and Scripting Interpreter (E1059)CDocument_write, JsEval, COleScript_ParseScriptText, COleScript_Compile
odbcconf_bypassCommand and Scripting Interpreter (E1059)--
regsvr32_squiblydoo_dll_loadCommand and Scripting Interpreter (E1059)LdrLoadDll
squiblydoo_bypassCommand and Scripting Interpreter (E1059)--
squiblytwo_bypassCommand and Scripting Interpreter (E1059)--
exe_dropper_jsCommand and Scripting Interpreter (E1059)JsEval
persistence_registry_scriptCommand and Scripting Interpreter (E1059)RegSetValueExA, RegSetValueExW, NtSetValueKey
ie_martian_childrenCommand and Scripting Interpreter (E1059)--
bcdedit_commandCommand and Scripting Interpreter (E1059)ShellExecuteExW, NtCreateUserProcess, CreateProcessInternalW
office_martian_childrenCommand and Scripting Interpreter (E1059)--
js_phishCommand and Scripting Interpreter (E1059)JsEval, COleScript_ParseScriptText, COleScript_Compile
disables_winfirewallCommand and Scripting Interpreter (E1059)--
script_tool_executedCommand and Scripting Interpreter (E1059)--
cmdline_obfuscationCommand and Scripting Interpreter (E1059)--
cmdline_switchesCommand and Scripting Interpreter (E1059)--
cmdline_terminateCommand and Scripting Interpreter (E1059)--
cmdline_forfiles_wildcardCommand and Scripting Interpreter (E1059)--
cmdline_http_linkCommand and Scripting Interpreter (E1059)--
cmdline_long_stringCommand and Scripting Interpreter (E1059)--
cmdline_reversed_http_linkCommand and Scripting Interpreter (E1059)--
long_commandlineCommand and Scripting Interpreter (E1059)--
powershell_renamed_commandlineCommand and Scripting Interpreter (E1059)--
wmi_script_processCommand and Scripting Interpreter (E1059)NtCreateUserProcess, CreateProcessInternalW
disables_mappeddrives_autodisconnectCommand and Scripting Interpreter (E1059)ShellExecuteExW, NtCreateUserProcess, CreateProcessInternalW
system_account_discovery_cmdCommand and Scripting Interpreter (E1059)--
system_currently_loggedin_user_cmdCommand and Scripting Interpreter (E1059)--
system_info_discovery_cmdCommand and Scripting Interpreter (E1059)--
system_info_discovery_pwshCommand and Scripting Interpreter (E1059)--
system_network_discovery_cmdCommand and Scripting Interpreter (E1059)--
system_network_discovery_pwshCommand and Scripting Interpreter (E1059)--
system_user_discovery_cmdCommand and Scripting Interpreter (E1059)--
powershell_network_connectionCommand and Scripting Interpreter (E1059)URLDownloadToFileW, HttpOpenRequestW, send, WSAConnect, InternetCrackUrlW, InternetCrackUrlA, InternetReadFile
powershell_scriptblock_loggingCommand and Scripting Interpreter (E1059)--
powershell_command_suspiciousCommand and Scripting Interpreter (E1059)--
powershell_renamedCommand and Scripting Interpreter (E1059)--
powershell_reversedCommand and Scripting Interpreter (E1059)--
powershell_variable_obfuscationCommand and Scripting Interpreter (E1059)--
office_com_loadCommand and Scripting Interpreter (E1059)LdrGetDllHandle, LdrLoadDll
office_vb_loadCommand and Scripting Interpreter (E1059)LdrGetDllHandle, LdrLoadDll
office_wmi_loadCommand and Scripting Interpreter (E1059)LdrGetDllHandle, LdrLoadDll
document_script_exe_dropCommand and Scripting Interpreter (E1059)NtWriteFile
windows_defender_powershellCommand and Scripting Interpreter (E1059)--
office_suspicious_processesCommand and Scripting Interpreter (E1059)NtCreateUserProcess, CreateProcessInternalW
script_created_processCommand and Scripting Interpreter (E1059)NtCreateUserProcess, CreateProcessInternalW
script_network_activityCommand and Scripting Interpreter (E1059)URLDownloadToFileW, HttpOpenRequestW, send, WSAConnect, InternetCrackUrlW, InternetCrackUrlA, SslEncryptPacket, InternetReadFile
suspicious_js_scriptCommand and Scripting Interpreter (E1059)JsEval, COleScript_ParseScriptText

E1059 Snippet

Execution::Command and Scripting Interpreter SHA256: 905b9db8cf5a3001318b28ee5dc674f8f65ca1e4306aab9e331b3bba24e7b8a8 Location: 0x41B7A6
call    dword ptr [->KERNEL32.DLL::GetCommandLineW]

References

[1] https://www.cyber.nj.gov/threat-center/threat-profiles/trojan-variants/poison-ivy

[2] https://www.welivesecurity.com/2019/07/08/south-korean-users-backdoor-torrents/

[3] https://www.bleepingcomputer.com/virus-removal/remove-kovter-trojan

[4] https://www.sophos.com/en-us/medialibrary/PDFs/technical-papers/SamSam-ransomware-chooses-Its-targets-carefully-wpna.pdf

[5] https://www.mcafee.com/blogs/other-blogs/mcafee-labs/shamoon-returns-to-wipe-systems-in-middle-east-europe/

[6] https://docs.broadcom.com/doc/security-response-w32-stuxnet-dossier-11-en

[7] https://web.archive.org/web/20150311013500/http://www.cyphort.com/evilbunny-malware-instrumented-lua/

[8] https://www.trendmicro.com/en_us/research/20/e/netwalker-fileless-ransomware-injected-via-reflective-loading.html

[9] capa v4.0, analyzed at MITRE on 10/12/2022

[10] https://www.malwarebytes.com/blog/news/2018/10/mac-malware-intercepts-encrypted-web-traffic-for-ad-injection

[11] https://www.mcafee.com/blogs/other-blogs/mcafee-labs/webcobra-malware-uses-victims-computers-to-mine-cryptocurrency/

[12] https://blog.malwarebytes.com/threat-analysis/2016/07/untangling-kovter/

[13] https://www.cyber.nj.gov/threat-center/threat-profiles/trojan-variants/poison-ivy