http://www.vrlsec.com



hackinthebox
 ::  hitb portal  ::  hitb portal (SSL)  ::  hitb forum (SSL)  ::  hitb security conference  ::  hitb training ::  hitb irc  ::  hitb photos  ::  hitb videos :: 
Who's Online
There are 208 unregistered users and 0 registered users on-line.

You can log-in or register for a user account here.



Main Menu

Top Stories for Today
[426] How to Design a Secure DMZ
[406] German ID cards hacked by the CCC
[358] Malware hosted on Google Code project site
[258] Apple's elephant in the cloud
[230] Russian cops cuff 10 ransomware Trojan suspects
[230] Algerian Hackers Attack Wrong Website
[217] How Google attacks changed the security game
[201] Feds crack phone clone scam that cost Sprint $15m
[197] PSJailbreak code leaked online
[194] US undergrads crash NASA satellite into Arctic
[193] How Your Cloud Dream Is Becoming a Security Nightmare
[193] Apple's iOS 4.1 ships Sept. 8
[192] Heartland to pay Discover $5M for 2008 data breach
[185] Malaysian National Institute of Public Administration suffers cyber attack
[162] DARPA launches insider threat detection effort for military
[144] China demands real names from mobile phone users
[140] VMWare Sees Big Business In Becoming The Internet Operating System
[131] Windows Phone 7: Done

View the Top 50 articles

Top 20 of the Last 2 Weeks

Past Articles
Wednesday, September 01
·Moscow police investigate alleged ransomware gang
·Novell rolls cloud-security service
·More IT managers plan to spend less, survey finds
·Twitter Turns to OAuth for Application Authentication
·Verizon Uses VMware for Enterprise Cloud Service
·Five Things You Need To Know About IPv6
·iPhone 4 with New Antenna Coming Soon?
·Mark Zuckerberg fights to keep life private
·Android Tablet flood is imminent
·Hackers Steal $600,000 from Catholic Diocese
·Pirate Bay secures documentary funding from fans in just 3 days
·Darpa’s Star Hacker Looks to WikiLeak-Proof Pentagon
·Hackers Focus on Misconfigured Networks, Survey Finds
·Australian ban on PS3 hack extended to September 3
·Apple to offer live video stream of Wednesday's keynote
·US finally reforming its high-tech export control system
Tuesday, August 31
·Wikileaks moves servers to an underground nuclear bunker
·Indian e-voting critic released on bail
·Skype might be bought by Cisco
·Commonwealth Bank of Australia security upgrade causes ATM outage
·Google aims to wipe smile off Facebook
·Will Intel's Sandy Bridge pose a threat to discrete GPUs?
·3M to buy security firm Cogent for $943 million
·Microsoft to build giant data center
·Apple still hasn't fixed iPhone 4 proximity sensor bug
·7 skills every IT manager needs to survive the 2010s
·Intel buys wireless chip tech in mobile-phone push
·Hackers Port Android to Nokia Phones
·Old Apple QuickTime code puts IE users in harm's way
·India Could Face Onslaught of Pakistani Hackers, Say Intelligence Officials
 Older articles

SAM Files and NT Password Hashes
Posted by L33tdawg on Monday, March 18, 2002 - 11:17 PM (Reads: 383334)
Source:



By: Grifter (2600 Salt Lake City)

§ Introduction

I know that this topic has been covered by others on more than one occasion, but I figured I'd go over it yet again and throw in an update or two. Let me start with what this is all about: SAM Files & NT Password Hashes.

NT Password Hashes - When you type your password into a Windows NT, 2000, or XP login Windows encrypts your password using an encryption scheme that turns your password into something that looks like this:

7524248b4d2c9a9eadd3b435c51404ee

This is a password Hash. This is what is actually being checked against when you type your password in. It encrypts what you typed and bounces it against what is stored in the Registry and/or SAM File.

SAM File - Holds the user names and password hashes for every account on the local machine, or domain if it is a domain controller. Simple enough wouldn't you say?

§ Where do I find the SAM/Hashes?

You can find what you're looking for in several locations on a given machine.

It can be found on the hard drive in the folder %systemroot%system32config. However this folder is locked to all accounts including Administrator while the machine is running. The only account that can access the SAM file during operation is the "System" account.

You may also be able to find the SAM file stored in %systemroot% epair if the NT Repair Disk Utility a.k.a. rdisk has been run and the Administrator has not removed the backed up SAM file.

The final location of the SAM or corresponding hashes can be found in the registry. It can be found under HKEY_LOCAL_MACHINESAM. This is also locked to all users, including Administrator, while the machine is in use.

So the three locations of the SAMHashes are:

- %systemroot%system32config

- %systemroot% epair (but only if rdisk has been run)

- In the registry under HKEY_LOCAL_MACHINESAM

§ Obtaining the SAMPassword Hashes

Wow, how wonderful. Now we know where the goods are, and the problem is this... "How do I get my hands on those hashes?" The answer is "One of four ways."

1) Probably the easiest way to do this is to boot your target machine to an alternate OS like NTFSDOS or Linux and just copy the SAM from the %systemroot%system32config folder. It's quick, it's easy, and it's effective. You can get a copy of NTFSDOS from Sysinternals(http://www.sysinternals.com) The regular version of NTFSDOS is freeware, which is always nice, but only allows for Read-Only access. This should be fine for what you want to do, however, if you're the kind of person that just has to have total control and has some money to burn. NTFSDOS Pro, which is also by Sysinternals has read/write access but it'll cost you $299.

2) Once again, you may be able to obtain the SAM from %systemroot% epair if rdisk has been run and you are lucky enough to have a sloppy admin.

3) You can also get password hashes by using pwdump2. pwdump uses .DLL injection in order to use the system account to view the password hashes stored in the registry. It then pulls the hashes from the registry and stores them in a handy little text file that you can then import into a password cracking utility like l0phtcrack.

4) The final way to obtain password hashes is to listen directly to the network traffic as it floats by your computer and grab hashes using the above mentioned l0phtcrack.

§ Cracking Password Hashes

With the hashes in hand and an eagerness to find out what passwords lie waiting. Let's get cracking. While there are numerous programs available for the use of password cracking I will quickly cover two of the most popular ones.

John the Ripper - John the Ripper is to many, the old standby password cracker. It is command line which makes it nice if you're doing some scripting, and best of all it's free. The only real thing that JtR is lacking is the ability to launch Brute Force attacks against your password file. But look at it this way, even though it is only a dictionary cracker, that will probably be all you need. I would say that in my experience I can find about 85-90% of the passwords in a given file by using just a dictionary attack. Not bad, not bad at all.

L0phtCrack - Probably the most wildly popular password cracker out there. L0phtCrack is sold by the folks at @Stake. And with a pricetag of $249 for a single user license it sure seems like every one owns it. Boy, @Stake must be making a killing. :) This is probably the nicest password cracker you will ever see. With the ability to import hashes directly from the registry ala pwdump and dictionary, hybrid, and brute-force capabilities. No password should last long. Well, I shouldn't say "no password". But almost all will fall to L0phtCrack given enough time.

§ Injecting Password Hashes into the SAM

Probably one of my favorite and easiest ways to gain Administrator privileges on a machine, is by injecting password hashes into the SAM file. In order to do this you will need physical access to the machine and a brain larger than a peanut. Using a utility called "chntpw" by Petter Nordhal-Hagen you can inject whatever password you wish into the SAM file of any NT, 2000, or XP machine thereby giving you total control. I would suggest backing up the SAM file first by using an alternate OS. Go in, inject the password of your choosing. Login using your new password. Do what you need to do. Then restore the original SAM so no one knows you were there.

§ Password Strength

By looking at the methods above, you can see the importance in keeping strong passwords. Someone may be able to get there hands on your hashes, but it's whether or not they can crack them that is the real test. Don't make it easy on them.

When I create a password I like to use the first letter of each word in a phrase. Like "Password Strength is important so I pick good passwords" would be "psiisipgp". Now you have a 9 character password that isn't in any dictionary I know of. Bye Bye John the Ripper.

Now I like to flank passwords in special characters like "@$%?", now your password is ?psiisipgp?. This will ensure L0phtCrack takes a long time cracking it, giving you time to change it if you discover a breach, or just change your passwords regularly.

If you want to get insane, like I do, you can add non-printable ascii characters to your passwords. Using the Alt key and the numbers on your number pad, hold Alt and key in 149. you should get a character like this "ò". Flank your password with this before your question marks and now you've got a secure password. ?òpsiisipgpò? can't be cracked by L0phtCrack since it doesn't allow for non-printable ascii characters. Bye Bye L0phtCrack.

I know this may seem like a lot to do, but let's face it, a weak password is a cracked password.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

NTFSDOS - (http://www.sysinternals.com)

pwdump2 - (http://www.webspan.net/~tas/pwdump2/)

John the Ripper - (http://www.openwall.com/john/)

L0phtCrack - (http://www.atstake.com/research/lc3/)

chntpw - (http://home.eunet.no/~pnordahl/ntpasswd/)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-

© 2600SLC.ORG 2002

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



1.) The Linux Hackers Intro to assembly language (Pt. 1) - argc
2.) Intro to PGP on Windows - madirish
3.) Hacking Windows Shares from Linux with Samba - madirish
4.) DVD Ripping the Right Way - A
5.) SAM Files and NT Password Hashes - Grifter
6.) SQL Interjection Attack - Fiend
7.) Raw Socket Access in Windows XP - Tierra
8.) The Tuxtendo's Tuxkit Rootkit Analysis - Spoonfork

(Printer-friendly page Send this story to someone)

 
Top 10 Articles from the last 2 weeks for Articles

· Articles Postings

· Postings by L33tdawg


Login
 



 


 Log in Problems?
 New User? Sign Up!

HITB eZine Issue 003

Last 15 Postings to HITB Forum

Topics
· All topics
· AMD News (Aug 10, 2010)
· Apple News (Sep 02, 2010)
· Articles (Mar 03, 2009)
· Ask Us (Feb 01, 2003)
· Audio/Video (Sep 01, 2010)
· Encryption (Aug 30, 2010)
· Games (Aug 27, 2010)
· Hardware (Sep 01, 2010)
· HITB News (Aug 19, 2010)
· Industry News (Sep 02, 2010)
· Intel News (Aug 31, 2010)
· Law and Order (Sep 02, 2010)
· Linux (Aug 30, 2010)
· Microsoft (Sep 02, 2010)
· Networking (Sep 01, 2010)
· PDAs (Feb 09, 2007)
· Privacy (Sep 02, 2010)
· Red Hat (Mar 30, 2010)
· Science (Aug 30, 2010)
· Security (Sep 02, 2010)
· Software & Programming (Sep 02, 2010)
· Spam (Sep 01, 2010)
· Technology (Aug 30, 2010)
· Transmeta (Jul 07, 2007)
· Viruses & Malware (Sep 02, 2010)
· Wireless (Aug 26, 2010)

Packet Storm Security Latest
· nullconGoa2011-CFP.txt
The Call For Papers for nullcon Dwitiya 2.0 is now open. It takes place February 25th through the 26th, 2011 in Goa, India.
· amirocmsfaq-xss.txt
Amiro.CMS version 5.8.4.0 suffers from a stored cross site scripting vulnerability.
· advanced-xss.pdf
Whitepaper called Advanced XSS. Written in Arabic.
· moaub01-cpanel.pdf
Month Of Abysssec Undisclosed Bugs - Cpanel suffers from a PHP restriction bypass vulnerability. Versions 11.25 and below are affected.
· moaub01-adobe.pdf
Month Of Abysssec Undisclosed Bugs - Adobe Acrobat Reader and Flash Player suffer from a newclass invalid pointer vulnerability.
· MDVSA-2010-168.txt
Mandriva Linux Security Advisory 2010-168 - Double free vulnerability in the ssl3_get_key_exchange function in the OpenSSL client in OpenSSL 1.0.0a, 0.9.8, 0.9.7, and possibly other versions, when using ECDH, allows context-dependent attackers to cause a denial of service and possibly execute some sources refer to this as a use-after-free issue. The updated packages have been patched to correct this issue.
· ZSL-2010-4961.txt
LEADTOOLS version 16.5.0.2 suffers from buffer overflow, integer overflow and denial of service vulnerabilities related to Active-X Common Dialogs.
· cpanelcp-xss.txt
cPanel Customer Portal suffers from a cross site scripting vulnerability.

Follow us
Join our Facebook Group

Follow us on Twitter

Follow our RSS feed


HITB Affiliates

Page created in 0.808397054672 seconds.