Ethical Hacking & Cyber Defense · Unit 6 of 8
Unit 6: Passwords, systems and privilege
How passwords are stored and attacked, patching and hardening, privilege escalation, malware and social engineering, always with the defences that stop them.
Opens the first lesson of this unit in Ethical Hacking & Cyber Defense. Every lesson is open from the start.
Lesson 1: How passwords are stored and attacked
Goal: Explain hashing, salting and slow hash functions, compare password attack types, and calculate a simple keyspace.
Systems should never store passwords as plain text. Instead they store a hash: the result of a one-way function that turns any input into a fixed-length value. At login, the system hashes what you type and compares the hashes. Hashing is not encryption: encryption can be reversed with a key, while a good hash cannot be turned back into the password. Attackers who steal a hash list instead try to crack it: hash millions or billions of guesses and look for matches.
Two defences make cracking far harder. A salt is a random value stored with each password and mixed in before hashing, so two people with the same password get different hashes and precomputed lookup tables are useless. A slow, purpose-built password hash such as bcrypt, scrypt or Argon2 makes every single guess expensive. Fast general hashes like MD5 or SHA-1 are wrong for passwords because modern graphics cards can try billions of them per second.
| Attack | How it works | Main defence |
|---|---|---|
| Brute force | Try every possible combination | Long passwords; slow hashes; lockouts |
| Dictionary attack | Try common words, leaked passwords and variations | Block breached and common passwords |
| Credential stuffing | Reuse username/password pairs from other breaches | Multi-factor authentication; unique passwords |
| Password spraying | Try one common password on many accounts | Block common passwords; alert on patterns |
| Phishing | Trick the user into typing it into a fake page | Phishing-resistant MFA such as passkeys; training |
Worked example: why length beats complexity
- A password of 8 lowercase letters has 26 choices per position: 26^8 ≈ 208.8 billion combinations.
- A fast hash cracked on modern hardware can test that many guesses in seconds to minutes.
- A passphrase of 4 random common words chosen from a list of 7,776 has 7,776^4 ≈ 3.7 × 10^15 combinations, about 17,000 times more, and is far easier to remember.
Each extra character or word multiplies the work. Length, randomness, a slow hash and MFA together make stolen hashes nearly worthless.
- Hash
- The output of a one-way function that turns input into a fixed-length value; used to store passwords safely.
- Salt
- A random value combined with each password before hashing so identical passwords get different hashes.
- bcrypt
- A deliberately slow password-hashing function designed to make cracking expensive; scrypt and Argon2 are similar.
- Password cracking
- Guessing passwords offline by hashing candidates and comparing them with stolen hashes.
- Keyspace
- The total number of possible combinations for a password of a given length and character set.
Remember: Store salted, slow hashes (bcrypt, scrypt, Argon2). Defend users with length, blocked common passwords and MFA.
Lesson 2: Vulnerabilities, patching and hardening
Goal: Describe the vulnerability lifecycle, run a sensible patch process and apply common hardening steps.
A vulnerability usually follows a lifecycle. Someone discovers it; ideally they report it privately to the vendor; the vendor releases a patch and an advisory; the vulnerability gets a CVE; and then attackers study the patch to build attacks against everyone who has not installed it yet. A zero-day is a vulnerability attackers know about before a patch exists. Most breaches, though, use known vulnerabilities whose patches were available for months.
| Patch process step | What it means |
|---|---|
| Inventory | Know every system and piece of software you run. You cannot patch what you do not know exists. |
| Prioritize | Internet-facing systems and actively exploited (KEV) vulnerabilities first. |
| Test | Try patches on a test group so a bad update does not take down the business. |
| Deploy | Roll out on a schedule, with emergency patches for critical exploited issues. |
| Verify | Rescan to confirm the patch is really installed everywhere. |
Hardening reduces the attack surface even when software is fully patched. Common steps: remove or disable services and software you do not need, change every default password, turn off old protocols (Telnet, SMBv1, old TLS versions), require MFA for remote and admin access, limit admin rights, and turn on logging. Organizations often follow published baselines such as the CIS Benchmarks, which list recommended settings for each operating system and application.
Worked example: a patch decision under pressure
- On Monday a vendor releases a fix for a critical flaw in the company's internet-facing VPN, and CISA adds it to the KEV catalog the same week.
- The VPN is exposed to the internet and the flaw is actively exploited: this skips the normal monthly cycle.
- The team tests the update on a spare unit that evening, patches the production VPN that night, then checks the vendor's guidance for signs of earlier compromise.
- Lower-risk patches stay on the normal schedule.
A good patch process is predictable for routine updates and fast for the dangerous few. Checking for prior compromise matters, because attackers may have struck before the patch went in.
- Patch
- A software update that fixes bugs or security vulnerabilities.
- Zero-day
- A vulnerability that attackers know about before the vendor has released a fix.
- Hardening
- Reducing a system's attack surface by removing unneeded features and applying secure settings.
- CIS Benchmarks
- Published secure-configuration guides for operating systems and applications from the Center for Internet Security.
- Asset inventory
- An up-to-date list of the hardware and software an organization runs.
Remember: Know what you have, patch exposed and exploited first, verify, and switch off everything you do not need.
Lesson 3: Privilege escalation and least privilege
Goal: Explain vertical and horizontal privilege escalation, the misconfigurations that cause it, and the defences.
Privilege escalation means gaining more access than you were given. Vertical escalation goes upward: an ordinary user becomes an administrator or root. Horizontal escalation goes sideways: one user gains access to another user's account or data at the same level, like the IDOR from the web unit. In a real attack, the first foothold is often a low-privilege account, so escalation is how a small problem becomes a full breach.
| Common cause | Example | Defence |
|---|---|---|
| Weak file permissions | A root-run script that anyone can edit | Least privilege; regular permission audits |
| Over-broad sudo or admin rights | A user may run any command as root, “just in case” | Grant only specific commands to specific people |
| Stored credentials | Passwords in scripts, config files or shell history | Secrets managers; rotate exposed passwords |
| Unpatched local vulnerabilities | An old kernel or service with a known escalation flaw | Patch; monitor for unusual privilege changes |
| Reused local admin passwords | Every PC shares one admin password | Unique admin passwords per machine (for example, Microsoft LAPS) |
Testers check for these weaknesses after gaining an authorized foothold, usually with checklists and enumeration scripts, and they document the path so the client can break it. Defenders hunt for the same things proactively. In Windows networks, Active Directory is a key target: over-privileged service accounts and too many members of powerful groups like Domain Admins are among the most common findings in internal tests.
The defence is consistent: apply least privilege everywhere, remove standing admin rights where possible (granting them only when needed and for a limited time), keep secrets out of files, patch, and alert on privilege changes, such as a user being added to an admin group or Windows event 4672 (special privileges assigned) for an account that should never have them.
Worked example: mapping an escalation path for the report
- Authorized foothold: the tester logs in as the low-privilege test account the client provided.
- Enumeration finds a backup script in a shared folder that contains a service account's password in plain text.
- That service account is a member of the server's local Administrators group: vertical escalation is possible. The tester confirms access with one harmless command and stops.
- The report shows the chain and three fixes: remove the password from the script, rotate it, and take the service account out of the Administrators group.
Each link in the chain was a small misconfiguration. Breaking any one of them would have stopped the escalation.
- Privilege escalation
- Gaining more access than originally granted.
- Vertical escalation
- Moving from a lower privilege level to a higher one, such as user to administrator.
- Horizontal escalation
- Gaining access to another account or its data at the same privilege level.
- Active Directory
- Microsoft's directory service that manages users, computers and permissions in Windows networks.
- Service account
- An account used by software or a service rather than a person, often with powerful rights.
Remember: Small misconfigurations chain into full control. Least privilege, no secrets in files, alert on new admins.
Lesson 4: Malware and social engineering
Goal: Tell the main malware types apart and explain how social engineering works and how organizations defend against it.
Malware is software designed to harm. Knowing the types helps you read alerts and incident reports correctly. Most malware today arrives through people, not clever technical tricks: an attachment opened, a fake update installed, a password typed into a look-alike page.
| Type | What it does |
|---|---|
| Virus | Attaches to files or programs and spreads when they are run |
| Worm | Spreads by itself across networks, without anyone opening anything |
| Trojan | Pretends to be useful software while doing something harmful |
| Ransomware | Encrypts files and demands payment; often also steals data to threaten publication |
| Spyware and keyloggers | Secretly records activity, such as passwords typed |
| Rootkit | Hides deep in the system to keep access and conceal other malware |
| Botnet agent | Joins the device to a remotely controlled network used for attacks or spam |
Social engineering manipulates people instead of machines. Phishing uses fake emails or messages; spear phishing targets specific people with researched details; vishing uses phone calls and smishing uses text messages. Pretexting invents a believable story (“I'm from IT, I need to verify your account”), and tailgating means following someone through a secure door. The common tricks are urgency, authority, fear and helpfulness, so training teaches people to slow down and verify through a separate channel.
Organizations test their people too, but only with authorization and care. Phishing simulations are approved by leadership, avoid cruel or deceptive lures that damage trust (such as fake bonuses during layoffs), and are used to teach rather than shame. Technical layers support the human ones: email filtering, link and attachment sandboxing, phishing-resistant MFA such as passkeys or security keys, and an easy “report phishing” button with fast feedback.
Worked example: a convincing call
- A help desk agent gets a call: “This is Dana from the CFO's office. She's locked out before a board meeting in ten minutes and needs a password reset now.”
- Red flags: urgency, authority and a request to skip normal steps.
- The agent follows policy: calls the CFO back on the number in the company directory, not the number the caller gives.
- The real CFO is not locked out. The agent reports the call to security, who warn the rest of the help desk.
A simple rule (verify through a known channel) beat a well-researched pretext. Procedures protect people from pressure.
- Malware
- Software designed to damage, disrupt or gain unauthorized access to systems.
- Ransomware
- Malware that encrypts files and demands payment, often after stealing data as well.
- Worm
- Malware that spreads across networks by itself, without user action.
- Social engineering
- Manipulating people into giving access, information or money.
- Pretexting
- Inventing a believable story to persuade someone to share information or grant access.
- Phishing-resistant MFA
- Multi-factor authentication, such as passkeys or security keys, that cannot be captured by a fake login page.
Remember: Urgency, authority, fear: slow down and verify through a channel you already trust.
Practise it in Ethical Hacking & Cyber Defense
Each lesson ends with three questions that check you can use the idea, not just recognise it. Wrong answers explain why and come back in Review. The unit ends with a 6-question quiz; pass it with 80% or more to master the unit.
Every lesson is free: no ads, no lives and no paywall.