Backdooring
Backdooring .exe Files
If a shared file is a Windows binary, such as putty.exe, it's possible to download it from the share and inject a backdoor using msfvenom. This backdoored binary will continue to function as expected but will also silently execute an additional payload. To create a backdoored putty.exe, you can use the following command:
The resulting puttyX.exe will execute a reverse_tcp meterpreter payload without the user's awareness. Once the file is generated, you can replace the original executable on the Windows share and wait for connections using the exploit/multi/handler module from Metasploit.
Backdooring .vbs Scripts
If the shared resource is a VBS script, you can place a copy of nc64.exe on the same share and inject the following code into the shared script:
This code copies nc64.exe from the share to the user's workstation's %tmp% directory and initiates a reverse shell to the attacker whenever a user opens the shared VBS script.
Creating Backdoor Services
To create a reverse shell and associate it with a newly created service, you can use msfvenom. Note that service executables must adhere to specific protocols to be handled by the system. To generate an executable compatible with Windows services, use the exe-service format in msfvenom:
You can then copy this executable to the target system, for example, to C:\Windows, and configure the service's binPath:
Making Sticky Keys Spawn a Terminal
To replace sethc.exe, you first need to take ownership of the file and grant your user permission to modify it. Only then can you replace it with a copy of cmd.exe.
The same steps can be applied to replace utilman.exe if needed.
Last updated