13 Jun 2025
Preparation
-
Bring a USB stick to the lab to save your work
Procedure
Log in using the username l33t and the password opposable thumbs.
-
Using the
/etc/passwdand/etc/groupfiles, as well as theidandfingercommands, identify all of the "real" users (i.e., not system "users" likenobodyormessagebus) on your computer. How can you distinguish "real" users from system "users"? -
Gain privilege
-
Attempt to switch to the
rootuser via thesucommand. Explain why this attempt fails. -
Use
sudoto gain root privilege. Explain, with reference to the/etc/sudoersfile, why this succeeds.
-
-
Exfiltrate password hashes
-
Examine the
/etc/shadowfile. What does this contain? Using information from theshadowmanual page, what does the!in many of the lines from/etc/shadowmean? -
Copy the
/etc/passwdand/etc/shadowfiles to thel33tuser’s home directory and exit your root shell.
-
-
Prepare for cracking
-
Attempt to combine the information in your copies of the
passwdandshadowfiles into one file using theunshadowcommand (which comes with John the Ripper). Explain, with reference to specific Unix permissions, why you receive aPermission deniederror. -
Change the permissions of
shadowto allowunshadowto succeed and output the results into a new file. -
What three characters does each of these password hashes start with? Using
man 5 crypt, what does this signify? -
Copy all of the additional password hash files contained in
/usr/local/share/password-hashesinto your home directory. -
Copy the RockYou wordlist from
/usr/share/wordliststo your home directory and extract it into a.txtfile. How many passwords does it contain?
-
-
Hashcat
-
On this system, the
hashcattool has been compiled to avail of your GPU (an nVidia Quadro P400). Runhashcatin its benchmarking mode (seeman hashcat) to evaluate how many hashes it can check per second with the followinghash-type:-
Plain MD5
-
Salted MD5
-
Plain SHA-1
-
Salted SHA-1
-
HMAC-SHA256
-
Plain SHA-512
-
sha512crypt(a.k.a.,SHA-512(Unix))
-
-
Copy the unshadowed password file into a new file called
hashes.txt. Edit this file so that it contains only password hashes (i.e., no usernames, UIDs, shells, etc.), and that all the hashes are of the same type (sincehashcatcan’t crack more than one hash type at a time). When you’re done, there should be no colon (:) characters in the file. Or you could do this with a one-lineawkscript… -
Crash the hashes in
hashes.txtusing thehashcattool, which on this system has been compiled to avail of your GPU (an nVidia Quadro P400). You may find the-Oand-roptions to be helpful… try looking at some of the rulesets in/usr/share/hashcat/rules. Leave this tool running while you proceed to the next part of the lab; at the end of the lab report how many hasheshashcatwas able to crack (and what they were). You should find your cracking results in~/.local/share/hashcat/hashcat.potfile.
-
-
John the Ripper
-
Run John the Ripper (
john) against the Windows NT password file (ntlm.txt). Use the RockYou wordlist (using the--wordlistargument tojohn). You may need to use the--format=XXXXargument to help John interpret the hash, as it doesn’t include information about its format (e.g.,$6$). Seeman john,john --helpandjohn --list=formatsto find out howjohndescribes the NTLM (Windows NT LAN Manager) hash format. -
Use the
hashidtool to identify the possible hash algorithms for each password hash in each of thehashN.txtfiles that you copied from/usr/share/password-hashes. Crack each password. You may benefit from the--sessionargument tojohnwhen running multiple instances at the same time.
-
-
Crack password-protected files (ENGI 9823 only, may be completed at home)
-
Use
zip2johntogether withjohnto crack the password forsecure.zip. -
Use
rar2johntogether withjohnto crack the password forsecure.rar. -
Use
ssh2johntogether withjohnto crack the passphrase for the SSH public keyid_rsa.
-