☼
⌃
☰

Brute Force Attack

Table of Contents

Brute Force Attack

Description

A brute force attack is the most direct and least sophisticated method of password cracking or key recovery. It involves exhaustively checking every possible combination of characters for a target secret. While simple in concept, its effectiveness is entirely dependent on the speed of the cracking system and the entropy (complexity and length) of the target password.

How It Works

The core of a brute force attack is iteration:

  1. Scope Definition: The attacker defines the set of characters to be used (e.g., all lowercase letters, all alphanumeric characters, or all symbols).
  2. Generation: The cracking tool systematically generates every single combination, starting from the shortest possible length and incrementally increasing the length and complexity.
  3. Testing: Each generated string is tested against the target system or the target password hash.
    • Online Attack: Directly attempting to log into a service (slow, often leads to account lockout).
    • Offline Attack: Cracking a stolen hash file (fast, limited only by hardware speed).
  4. Success: The attack stops when the tested combination successfully matches the target (e.g., the hash of the generated string matches the stolen hash).

Limitations and efenses

  • Time Complexity: The time required to complete a brute force attack grows exponentially with the length and complexity of the password. A password of sufficient length (e.g., 16 characters with high entropy) can take trillions of years to crack, even with powerful hardware.
  • Defenses:
    • Rate Limiting: Implementing network controls to limit the number of failed login attempts per second/minute (mitigates online attacks).
    • Account Lockout: Temporarily disabling an account after a specified number of failed attempts.
    • Strong Hashing Algorithms: Using slow, memory-hard hashing algorithms (like bcrypt or Argon2) that make each guess computationally expensive, even for offline attacks using GPUs.
    • Multi-Factor Authentication (MFA): Requires a second factor, rendering a compromised password insufficient for access.

Examples

. Simple Brute Force Example (4-digit PIN)

  • Goal: Crack a 4-digit numeric PIN.
  • Characterspace: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (10 characters).
  • Combinations: \(10^4 = 10,000\) possible combinations (from 0000 to 9999).
  • Time: This is extremely fast, taking seconds even on a standard CPU.

2. Complex Brute Force Scenario

  • Goal: Crack a password that is 10 characters long, using lowercase, uppercase, and digits (62 characterspace).
  • Characterspace: \(26 (\text{a-z}) + 26 (\text{A-Z}) + 10 (\text{0-9}) = 62 \text{ characters}\).
  • Combinations: \(62^{10} \approx 8.39 \times 10^{17}\) possibilities.
  • Time: While computationally expensive, modern GPUs can crack this in weeks, highlighting why passwords must be longer than 10 characters to be secure against modern offline brute force attacks.

3. Hashcat Brute Force Command

The following command demonstrates a pure brute-force attack using Hashcat (-a 3) targeting a password with a maximum length of 8, using all possible characters (?a).

```bash hashcat -a 3 -m 0 hashes.txt ?a?a?a?a?a?a?a?a