Places to steal NTLM creds

Automatic Payloads Creation & Other lists

This tool will create several documents/files that if accessed by the user somehow they will start a NTLM authentication with the attacker.

ntlm_theft supports the following attack types:

Browse to Folder Containing:

  • .url – via URL field

  • .url – via ICONFILE field

  • .lnk - via icon_location field

  • .scf – via ICONFILE field (Not Working on Latest Windows)

  • autorun.inf via OPEN field (Not Working on Latest Windows)

  • desktop.ini - via IconResource field (Not Working on Latest Windows)

Open Document:

  • .xml – via Microsoft Word external stylesheet

  • .xml – via Microsoft Word includepicture field

  • .htm – via Chrome & IE & Edge img src (only if opened locally, not hosted)

  • .docx – via Microsoft Word includepicture field

    -.docx – via Microsoft Word external template

    -.docx – via Microsoft Word frameset webSettings

    -.xlsx - via Microsoft Excel external cell

    -.wax - via Windows Media Player playlist (Better, primary open)

    -.asx – via Windows Media Player playlist (Better, primary open)

    -.m3u – via Windows Media Player playlist (Worse, Win10 opens first in Groovy)

    -.jnlp – via Java external jar

    -.application – via any Browser (Must be served via a browser downloaded or won’t run)

Open Document and Accept Popup:

  • .pdf – via Adobe Acrobat Reader

Click Link in Chat Program:

  • .txt – formatted link to paste into Zoom chat

Example :

Cheatsheet

This is a list of techniques to force NTLM authentications to steal credentials from the victim.

Force NTLM Privileged Authentication

You may be able to force a windows machine to authenticate to an arbitrary machine using a privileged account. Read the following page to learn more:

Force NTLM Privileged Authentication

LFI

The include() in PHP will resolve the network path for us.

XXE

In here I’m using “php://filter/convert.base64-encode/resource=” that will resolve a network path.

XPath Injection

Usually, doc() is used in out-of-band XPath injections, thus can be applied in resolving a network path.

MySQL Injection

I have written a complete post on MySQL out-of-band injections which can be applied over the internet. You can also use ‘INTO OUTFILE’ to resolve a network path.

MSSQL

Since stacked queries are supported we can call stored procedures.

Regsvr32

Accidently found this one while experimenting with .sct files.

Batch

There are many possible ways you can explore

Auto-Complete

You just need to type ‘\host\’ the auto-complete will do the trick under the explorer and the run dialog box.

Autorun.inf

Starting from Windows 7 this feature is disabled. However you can enable by changing the group policy for Autorun. Make sure to hide the Autorun.inf file to work.

Shell Command Files

You can save this as something.scf and once you open the folder explorer will try to resolve the network path for the icon.

Desktop.ini

The desktop.ini files contain the information of the icons you have applied to the folder. We can abuse this to resolve a network path. Once you open the folder you should get the hashes.

In Windows XP systems the desktop.ini file uses ‘IcondFile’ instead of ‘IconResource’.

Shortcut Files (.lnk)

We can create a shortcut containing our network path and as you as you open the shortcut Windows will try to resolve the network path. You can also specify a keyboard shortcut to trigger the shortcut. For the icon you can give the name of a Windows binary or choose an icon from either shell32.dll, Ieframe.dll, imageres.dll, pnidui.dll or wmploc.dll located in the system32 directory.

The Powershell version.

Internet Shortcuts (.url)

Another shortcut in Windows is the Internet shortcuts. You can save this as something.url

Autorun with Registry

You can add a new registry key in any of the following paths.

Powershell

There are probably many scriptlets in Powershell that would resolve a network path.

IE

IE will resolve UNC paths. For example

You can inject under XSS or in scenarios you find SQL injection. For example.

VBScript

You can save this as .vbs or can be used inside a macro that is applied to Word or Excel files.

You can apply in web pages but this works only with IE.

Here’ the encoded version. You can encode and save this as something.vbe

You can apply this in html files too. But only works with IE. You can save this as something.hta which will be an HTML Application under windows, which mshta.exe will execute it. By default it uses IE.

JScript

You can save this as something.js under windows.

You can apply the same in html files but only works with IE. Also you can save this as something.hta.

Here’s the encoded version. You can save this as something.jse.

The html version of this.

Windows Script Files

Save this as something.wsf.

Shellcode

Here’s a small shellcode I made. This shellcode uses CreateFile and tries to read a non-existing network path. You can use tools such as Responder to capture NetNTLM hashes. The shellcode can be modified to steal hashes over the internet. SMBRelay attacks can also be performed.

https://packetstormsecurity.com/files/141707/CreateFile-Shellcode.html

Shellcode Inside Macros

Here’s the above shellcode applied inside a Word/Excel macro. You can use the same code inside a VB6 application.

https://github.com/OsandaMalith/Shellcodes/blob/master/CreateFile/CreateFile.vba

Shellcode Inside VBS and JS

subTee has done many kinds of research with JS and DynamicWrapperX. You can find a POC using the DynamicWrapperX DLL. http://subt0x10.blogspot.com/2016/09/shellcode-via-jscript-vbscript.html Based on that I have ported the shellcode to JS and VBS. The fun part is we can embed shellcode in JScript or VBScript inside html and .hta formats. Note the following shellcode directs to my IP.

JScript

https://github.com/OsandaMalith/Shellcodes/blob/master/CreateFile/CreateFile.js

VBScript

https://github.com/OsandaMalith/Shellcodes/blob/master/CreateFile/CreateFile.vbs

There might be many other ways in Windows. You never know! 🙂

References

Last updated