Reading your Twitter time-line can make you worry sometimes. Little more than a week ago I stumbled across a Tweet from a very trustworthy software engineer, stating passwords on any operating system could be cracked easily.
Introduction
Henceforth the shorthand MATHIS will be used for the blog post referenced by the above Tweet, as his author’s name is Blair Mathis.
As MATHIS dates from early 2009, we have to see if all details stated in it still hold true for today’s versions of the operating systems concerned.
I will verify all attacks mentioned in MATHIS, with the exception of OS X-related exposures. Although I give some attention to the more trivial attacks, the main focus of this article is on password cracking, using Philippe Oechslin’s rainbow tables (pdf). An alternative introduction to the subject – using less math – is available on Wikipedia.
While it is straightforward to verify the password cracking exposure concerning Windows, considerations for a similar attack against a state of the art Linux installation will not be validated by experiment here.
Trivial attacks
Beware of mounts! The distinction between data access in general and data access obtained with a cracked password is not too clearly made in MATHIS. Still today for NTFS (Windows) and Linux file systems, given physical access to the disk, a simple mount is sufficient to gain access to all data on partitions, be it by attaching the disk hardware to another machine, or by booting the machine under attack from USB storage or the like.
Therefore, file system access rights are not impregnable, independently of passwords known, and the cracking with rainbow tables depends on them not being impregnable anyway!
For an attack using GRUB (one of Linux’s boot-loaders), MATHIS states:
To change the password, turn on the computer and press the ESC key when GRUB appears. Scroll down and highlight ‘Recovery Mode’ and press the ‘B’ key; this will cause you to enter ‘Single User Mode’.
You’re now at the prompt, and logged in as ‘root’ by default. Type ‘passwd’ and then choose a new password. This will change the root password to whatever you enter.
This clearly holds not true for my Debian Squeeze workstation. Since MATHIS has been published, the configuration of GRUB appears to have been hardened beyond gaining access to recovery mode without knowing the root password.
Attacking Windows with Ophcrack
Ophcrack implements a rainbow table attack against windows and is freely available on SourceForge. I downloaded it, burnt it to disk, booted a Windows XP Professional workstation and got these results:
- The entire attack took under 10 minutes.
- Two passwords (alphanum) were cracked.
- From further two passwords (alphanum & special characters) the alphanumeric parts were uncovered.
Interpretation:
- Free Ophcrack comes with alphanumeric tables. Other tables can be bought or calculated.
- Passwords (default settings up to Windows XP) are split up and stored in two so-called LM-hashes. Thence the cracking of alphanumeric parts.
I failed in beating MATHIS‘ 10 seconds for this attack. But results are still impressive. Now how does this compare to Linux?
State of the art Linux and rainbow tables
Let us take a random user entry from my Debian Squeeze test machine and look at its password hash:
tester:$6$uJft3Fyu$Li/scOEkr9cY6IxP/HiJ98TlRr4OkFqC1O6/w6mAqoPGxr6juUugTP3xXQ2jgJK8Y3IcCGkbb9ZSoUgwnEGPP.:14875:0:99999:
The $6$ part in it indicates the use of a SHA-512 hash. Here its cryptograpic salt is 8 bytes long ($uJft3Fyu$) and uses an alphabet comprising the set [a-zA-Z0-9./].
More clearly, we are talking about 64 distinct symbols to reuse on 8 bytes. Calculating the number of possible values for any salt to expect gives us 64 ^ 8 ≈ 2.81e14 – a very big number.
There is a specificity about rainbow tables and salted hashes: for every possible salt value a table has to be calculated, leading to infeasible storage requirements in our example.
But there is a way around this. Assume accessing the password hashes by mounting the attacked machine’s file systems (as discussed above). Since one salt occurs for every single hash and is not secret, we could just pick the root user’s salt, calculate rainbow tables for it and crack root’s password within reasonable amounts of space and time.
Conclusions
- Encrypted file systems forestall all attacks described here.
- Windows is clearly the loser when using LM-hashes, as these enhance the feasibility of the attack.
- Linux is only at advantage if a large number of values for the salt must be considered.
Anagram of the day: “Pit cited smog” – must be Brad Pit!