Hacker Kayra
  • 📍Introduction Page
  • ⭐Learning Process
    • 🧠Learning Mindset
    • 🖇️Learning Dependencies
    • 🧮Learning Process
  • 🔠Fundamentals
    • 🛜Networking Fundamentals
    • 🐧Linux Fundamentals
    • 🪟Windows Fundamentals
    • 🕵️Active Directory
    • 🕸️Introduction to Web Applications
    • 🗃️Other Useful Concepts
      • Regular Expressions (RegEx)
    • Cyber Security Products
      • Lab Setup
      • ✅Fortigate Firewall
      • MDM Lab
      • IAM Lab
      • PAM Lab
      • DLP Lab
  • 🧰Tools
    • Nmap
    • Nessus
    • Ffuf
    • Hydra
    • John The Ripper
  • ✍️Write Ups
    • 🗃️Hack The Box Machines
      • 🐧Linux
        • Code
    • 🗃️Proving Grounds Boxes
      • 🐧Linux
        • Stapler
        • eLection
        • Loly
        • Blogger
        • Potato
        • Amaterasu
        • Exfiltrated
        • Pelican
        • Astronaut
        • Cockpit
        • Levram
        • Extplorer
        • LaVita
        • pc
        • Scrutiny
        • Zipper
        • Flu
        • Twiggy
        • Codo
        • Crane
        • Hub
        • BlackGate
        • Boolean
        • ClamAV
        • PayDay
        • Snookums
        • Bratarina
        • Nibbles
      • 🪟Windows
        • Algernon
        • AuthBy
        • Craft
        • Kevin
        • Squid
        • Jacko
        • DVR4
        • Hepet
        • Shenzi
        • Nickel
        • Slort
        • MedJed
        • Active Directory
          • Access
          • Vault
    • 🪪Certificates
      • Certified Professional Penetration Tester (eCPPTv3)
      • Web Application Penetration Tester eXtreme (eWPTXv3)
    • 🚩CTF Events
      • Cyber Hub 2025 CTF
  • 📚Study Notes
    • Penetration Tester (HTB CPTS)
      • Penetration Testing Process
      • Reconnaissance, Enumeration & Attack Planning
        • Network Enumeration with Nmap (Continue Here)
        • Footprinting (Just Do Formatting)
        • Vulnerability Scanning (Check)
        • File Transfers
        • Using the Metasploit Framework
        • Web Information Gathering
        • Shells & Payloads
      • Exploitation & Lateral Movement
        • Attacking Common Services (Just Do Formatting)
        • Password Attacks
        • Active Directory Enumeration & Attacks (TBC)
        • Pivoting, Tunneling, and Port Forwarding
      • Web Exploitation
        • Using Web Proxies (Check)
        • Attacking Web Applications With Ffuf (Check)
        • Login Bruteforcing
        • Cross-Site Scripting (XSS)
        • Command Injection
        • SQL Injection
        • File Upload Attacks
        • File Inclusion
        • Web Attacks (Check)
        • Attacking Common Applications (Check)
      • Post-Exploitation
        • Linux Privilege Escalation
        • Windows Privilege Escalation (TBC)
      • Documentation & Reporting
  • 🧑‍💻Other
    • Leet Code
      • Quick Guide: Big-O Notation
      • Problem 01 - Two Sum
    • Data Structure & Algorithms (DSA)
  • 🗄️Archive/Backup/Bin
    • Sysmon Usecases (IBM)
    • 🐧Linux Fundamentals (TryHackMe)
      • Introduction
      • Basic Commands
      • Wildcards & Operators
      • Permissions
      • Common Directories
      • Terminal Text Editors
      • General/Useful Utilities
    • 🪟Windows Fundamentals (TryHackMe)
      • Introduction
      • The File System
      • User Accounts
      • Settings & Control Panel & Task Manager
      • System Configuration
    • Active Directory (TryHackMe)
      • Breaching Active Directory
    • FOR508: Advanced Incident Response, Threat Hunting, and Digital Forensics
      • Book 2 - Intrusion Analysis
        • Credential Theft
        • Event Log Analysis for Responders and Hunters
    • Certified Threat Hunting Professional (eCTHPv2)
      • Threat Hunting: Hunting the Endpoint & Endpoint Analysis
        • Event IDs, Logging, & SIEMs
    • OSCP
      • Report Writing
      • ✅Passive Information Gathering
      • ✅Active Information Gathering
      • ✅Vulnerability Scanning
      • Introduction to Web Application Attacks
      • Common Web Application Attacks
        • ✅Cross-Site Scripting (XSS)
        • ✅Directory Traversal
        • ✅File Inclusion
        • ✅File Upload Vulnerabilities
        • Command Injection
        • SQL Injection Attacks
        • Client Side Attacks
      • ✅Locating Public Exploits
      • ✅Exploiting Walkthrough
      • Fixing Exploits
      • ✅Antivirus Evasion
      • Password Attacks
      • Windows Privilege Escalation
      • Linux Privilege Escalation
      • Port Redirection and SSH Tunneling
      • Tunneling Through Deep Packet Inspection
      • The Metasploit Framework
      • Active Directory Introduction & Enumeration
      • Attacking Active Directory Authentication
      • Lateral Movement in Active Directory
      • Assembling the Pieces
      • Other General Information
    • ⚡Port Swigger (Web Penetration Testing)
      • ✅Information Disclosure
      • ✅Path Traversal (Directory Traversal)
      • ✅OS Command Injection
      • Business Logic Vulnerabilities
      • ✅Authentication
      • ✅Access Control
    • Certified Bug Bounty Hunter (CBBH)
      • Web Requests
        • HTTP Fundamentals
    • Getting Started
      • Introduction
      • Pentesting Basics
    • Certified Penetration Testing Specialist (CPTS)
      • Introduction
        • ✅Penetration Testing Process
          • Penetration Testing Overview
          • Laws & Regulations
          • Penetration Testing Process
          • Pre-Engagement
          • Information Gathering
          • Vulnerability Assessment
          • Exploitation
          • Post-Exploitation
          • Lateral Movement
          • Proof-of-Concept
          • Post-Engagement
          • Practice
          • Academy Module Layout
        • Getting Started with Hack The Box (HTB)
      • Reconnaissance, Enumeration & Attack Planning
        • ✅Network Enumeration with Nmap
          • Enumeration & Introduction to Nmap
          • Host Discovery
          • Host and Port Scanning
          • Saving The Results
          • Service Enumeration
          • Nmap Scripting Engine
          • Scanning Performance
          • Firewall and IDS/IPS Evasion
        • Footprinting
        • ✅Information Gathering - Web Edition
          • Introduction
          • Passive Information Gathering
          • Active Information Gathering
        • Vulnerability Assessment
        • File Transfers
        • Shells & Payloads
        • Using the Metasploit Framework
      • Exploitation & Lateral Movement
        • Password Attacks
        • Attacking Common Services
        • Pivoting, Tunneling, and Port Forwarding
        • Active Directory Enumeration & Attacks
      • Web Exploitation
        • Using Web Proxies
        • ✅Attacking Web Applications with Ffuf
        • ✅Login Brute Forcing
        • SQL Injection Fundamentals
        • SQLMap Essentials
        • Cross-Site Scripting (XSS)
        • File Inclusion
        • File Upload Attacks
        • Command Injections
        • Web Attacks
        • Attacking Common Applications
      • Post-Exploitation
        • Linux Privilege Escalation
        • Windows Privilege Escalation
      • Reporting & Capstone
        • Documentation & Reporting
        • Attacking Enterprise Networks
    • Old Active Directory
    • Tib3rius Privilege Escalation
      • Linux Privilege Escalation
    • HTB Archived Write-Ups (Check)
      • Irked
      • Nibbles
      • Brainfuck
      • Lame (Check)
    • 📋Cheat Sheets
      • Penetration Testing Cheat Sheet (In Progress)
Powered by GitBook
On this page
  • Attacking Network Services Logins
  • Password Cracking Fundamentals
  • Symmetric Encryption
  • Asymmetric Encryption
  • Hashing
  • Password Cracking Theory
  • Calculating Cracking Time
  • Having the Right Word List
  • Password Cracking Process
  • Working with Password Hashes
  1. Archive/Backup/Bin
  2. OSCP

Password Attacks

Attacking Network Services Logins

  • Brute-force attacks attempt every possible password variation, working systematically through every combination of letters, digits and special characters.

  • Dictionary attacks attempt to authenticate to services with passwords from lists of common words (wordlists). If the correct password is not contained in the wordlist, the dictionary attack will fail.

  • Hydra is an open-source tool that can be used to do bruteforce/dictionary attacks.

  • Hydra can be used to brute force network services, such as, SSH, RDP, etc.. And it can also be used to brute force HTTP login forms.

Password Cracking Fundamentals

  • Encryption is a two-way function, in which data is "scrambled" (encrypted) or "unscrambled" (decrypted) with at least one key.

Symmetric Encryption

  • Symmetric encryption algorithms use the same key for both encryption and decryption.

  • To send a message to another person, both sides need to know the key (password).

  • If they exchange the key via an insecure channel, an attacker may intercept it.

  • The Advanced Encryption Standard (AES) is an example of a symmetric encryption algorithm.

Asymmetric Encryption

  • Asymmetric encryption uses distinct key pairs containing private and public keys.

  • Each user in this transaction has their own key pair.

  • To receive an encrypted message, a user provides their public key to the communication partner, which they use to encrypt their message for us.

  • When the message is sent, only the corresponding private key can decrypt the message.

  • A common asymmetric encryption algorithm is Rivest–Shamir–Adleman (RSA).

Hashing

  • Hash algorithms are one-way functions, meaning that it's trivial to generate a hash, but a proper algorithm's implementation makes it prohibitively difficult to get the plaintext from the hash.

  • Within the scope of password attacks, application and user passwords are often encrypted or hashed to protect them.

Password Cracking Theory

  • To decrypt an encrypted password we must determine the key used to encrypt it.

  • To determine the plaintext of a hashed password, we must run various plaintext passwords through the hashing algorithm and compare the returned hash to the target hash.

  • These attacks are collectively known as password cracking, and are often performed on a dedicated system.

  • Since the process can take a considerable amount of time, we often run it in parallel with other activities during a penetration test.

  • Hashcat and John the Ripper (JtR) are two of the most popular password cracking tools.

  • In general, JtR is more of a CPU-based cracking tool, which also supports GPUs, while Hashcat is mainly a GPU-based cracking tool that also supports CPUs.

  • JtR can be run without any additional drivers using only CPUs for password cracking.

  • Hashcat requires OpenCL or CUDA for the GPU cracking process. For most algorithms, a GPU is much faster than a CPU.

Calculating Cracking Time

  • The cracking time can be calculated by dividing the keyspace with the hash rate.

  • The keyspace consists of the character set to the power of the amount of characters or length of the original information (password). (For example if a password is limited to numbers (0 to 9) which is 10 distinct characters, and the password should be of length 6, the keyspace will be 10 to the power of 6)

  • For the hash rate, we can use Hashcat's benchmark mode to determine the hash rates for various hash algorithms on our particular hardware.

  • Note that increasing password length increases cracking duration by exponential time, while increasing password complexity (charset) only increases cracking duration by polynomial time.

  • This implies that a password policy encouraging longer passwords is more robust against cracking, compared to a password policy that encourages more-complex passwords.

Having the Right Word List

  • Password policies have grown in prevalence in recent years.

  • Most passwords in the commonly-used wordlists will not fulfill these requirements.

  • We can address this by automating the process of changing (or mutating) our wordlist before sending them to this target in what is known as a rule-based attack.

  • In this type of attack, individual rules are implemented through rule functions, which are used to modify existing passwords contained in a wordlist.

  • When attempting to create rules to mutate an existing wordlist, we should always consider human behaviour and convenience with regard to passwords.

  • When an upper case letter is required, most users capitalize the first letter.

  • When generating a password with a numerical value, many users simply add a "1" at the end of an existing password.

  • When special characters are required, most users add the special character at the end of the password and rely on characters on the left side of the keyboard since these digits are easy to reach and type.

  • Instead of creating rules ourselves, we can also use rules provided by other sources. (For example, Hashcat includes a variety of effective rules in /usr/share/hashcat/rules)

Password Cracking Process

  1. Extract hashes: In a penetration test we'll find hashes in various locations. For example, if we get access to a database system, we can dump the database table containing the hashed user passwords.

  2. Format hashes: To do this we'll need to know the hashing algorithm used to create the hash. Then Depending on the hashing algorithm and the source of the hash, we may need to check if it is already in the correct format for our cracking tool.

  3. Calculate the cracking time: Here we determine the feasibility of our cracking attempt. If the calculated cracking time exceeds our expected lifetime, we might reconsider this approach. More realistically, we should consider the duration of the current penetration test.

  4. Prepare wordlist: In nearly all cases we should mutate our wordlist and perform a rule-based attack, instead of a straight dictionary attack. In this step, we should investigate potential password policies and research other password vectors, including online password leak sites.

  5. Attack the hash: After all the preparation, we can start our tool and begin the cracking process. At this point, we must take special care in copying and pasting our hashes. An extra space or a newline could render our efforts worthless.

Working with Password Hashes

  • Windows stores hashed user passwords in the Security Account Manager (SAM) database file, which is used to authenticate local or remote users.

  • To deter offline SAM database password attacks, Microsoft introduced the SYSKEY feature in Windows NT 4.0 SP3, which partially encrypts the SAM file.

  • The passwords can be stored in two different hash formats: LAN Manager (LM) and NTLM.

    • LM: Based on DES, and is known to be very weak. Disabled by default beginning with Windows Vista and Windows Server 2008.

    • NTLM: Addresses many weaknesses of LM. However, it's not salted.

  • We cannot just copy, rename, or move the SAM database from C:\Windows\system32\config\sam while the Windows operating system is running because the kernel keeps an exclusive file system lock on the file. However, there are tools that can bypass this, like Mimikatz.

  • Keep Going

Salts are random bits appended to a password before it is hashed. They are used to prevent an attack in which attackers pre-compute a list of hashes and then perform lookups on these precomputed hashes to infer the plaintext password. A list or table of precomputed passwords is called a Rainbow Table and the corresponding attack is called a Rainbow Table Attack.

PreviousAntivirus EvasionNextWindows Privilege Escalation

Last updated 3 months ago

🗄️