🐧Password Spraying from Linux

πŸ“‹ Overview

Password spraying is one of the most effective methods for gaining initial domain credentials in Active Directory environments. This technique involves testing a small number of common passwords against a large list of usernames, staying below account lockout thresholds while maximizing the chance of success.

🎯 Attack Methodology

⚠️ Critical Prerequisites

  • Password Policy Knowledge: Essential for safe execution

  • Valid User List: Accurate username enumeration completed

  • Lockout Threshold: Must stay below the limit (typically 3-5 attempts)

  • Attack Timing: Space attempts based on lockout duration

πŸ” Attack Flow

  1. User List Preparation: Clean, validated username list

  2. Password Selection: Common, policy-compliant passwords

  3. Attack Execution: Systematic credential testing

  4. Success Validation: Verify discovered credentials

  5. Documentation: Log all activities and results


πŸ”§ rpcclient Password Spraying

πŸ“ Basic Methodology

  • Success Indicator: Authority Name in response

  • Bash One-Liner: Efficient automation approach

  • Filtering: Grep for successful authentications only

πŸš€ Single Password Spray

πŸ“Š Example Successful Output

πŸ”§ Enhanced Script with Logging


🎫 Kerbrute Password Spraying

⚑ Key Advantages

  • Speed: Fastest password spraying method

  • Stealth: Minimal event generation

  • Kerberos-Based: Uses native authentication protocol

  • Clear Output: Easy to identify successful logins

πŸš€ Basic Kerbrute Spraying

πŸ“Š Example Kerbrute Output

πŸ”„ Multiple Password Spraying


πŸ”¨ CrackMapExec Password Spraying

πŸ’ͺ Key Features

  • SMB-Based: Uses SMB protocol for authentication

  • Bulk Testing: Efficient user list processing

  • Success Filtering: Easy identification of valid credentials

  • Immediate Validation: Built-in credential verification

πŸš€ Basic CrackMapExec Spraying

πŸ“Š Example Successful Output

βœ… Credential Validation

πŸ”§ Advanced CrackMapExec Script


🏠 Local Administrator Password Reuse

🎯 Attack Concept

Local administrator accounts often have the same password across multiple systems due to:

  • Gold Images: Automated deployments using templates

  • Management Ease: Admins using same password everywhere

  • Legacy Practices: Old password policies still in effect

πŸ” Target Prioritization

  • High-Value Servers: SQL, Exchange, file servers

  • Domain Controllers: If accessible (high impact)

  • Management Systems: SCCM, monitoring tools

  • Jump Boxes: Administrative workstations

πŸ’₯ Hash-Based Spraying

Example Output:

πŸ”§ Comprehensive Local Admin Hunting

⚠️ Important Flags

  • --local-auth: Prevents domain account lockouts

  • --threads: Controls connection speed

  • -H: Uses NTLM hash instead of password


🎯 HTB Academy Lab Walkthrough

πŸ“ Lab Question

"Find the user account starting with the letter 's' that has the password Welcome1. Submit the username as your answer."

πŸš€ Step-by-Step Solution

1️⃣ Connect to Attack Host

2️⃣ Gather User List with enum4linux

3️⃣ Method 1: rpcclient Password Spray

5️⃣ Method 3: CrackMapExec

6️⃣ Expected Results

Based on the lab content, you should see:

enum4linux output (userlist creation):

Password spraying results:

βœ… Answer: sgage

7️⃣ Verification


πŸ“Š Tool Comparison

Tool

Speed

Stealth

Accuracy

Features

Best Use Case

rpcclient

Medium

Medium

High

Simple, reliable

Script automation

Kerbrute

Fast

High

High

Kerberos-based, minimal logs

Large-scale spraying

CrackMapExec

Medium

Low

High

Validation, local auth

Comprehensive testing


πŸ›‘οΈ Security Considerations

🚨 Event Generation

Tool

Event IDs Generated

Detection Risk

rpcclient

4625 (failures), 4624 (success)

Medium

Kerbrute

4768 (TGT requests), 4771 (Pre-auth failed)

Low

CrackMapExec

4625 (failures), 4624 (success), 4648 (explicit logon)

High

πŸ” Defense Evasion

  • Timing: Space attempts based on lockout policy

  • User Selection: Avoid high-privilege accounts initially

  • Password Selection: Use policy-compliant passwords

  • Monitoring: Watch for defensive responses

πŸ“ˆ Detection Indicators

  • Multiple authentication failures from single source

  • Sequential login attempts across user list

  • Unusual authentication timing (outside business hours)

  • High volume of Event ID 4625 in short timeframe


πŸ” Password Selection Strategy

🎯 Common Effective Passwords

πŸ“‹ Password Policy Compliance


πŸ“ Attack Documentation Template

πŸ“Š Spray Session Log

🎯 Success Tracking


⚑ Quick Reference Commands

πŸ”§ One-Liner Sprays

πŸ” Result Extraction


πŸ”‘ Key Takeaways

βœ… Attack Best Practices

  • Know the Policy: Essential for safe execution

  • Multiple Tools: Use different methods for verification

  • Proper Timing: Space attempts to avoid lockouts

  • Documentation: Log everything for client reporting

⚠️ Critical Warnings

  • Never Exceed Lockout Threshold: Typically 3-5 attempts max

  • Monitor Bad Password Counts: Check account status before spraying

  • Avoid High-Value Accounts: Don't target admin accounts initially

  • Space Attempts: Wait lockout duration + buffer between sprays

🎯 Post-Success Actions

  1. Immediate Validation: Verify all discovered credentials

  2. Privilege Assessment: Check user permissions and group memberships

  3. Access Expansion: Use credentials for further enumeration

  4. Documentation: Record all findings for reporting


Password spraying success requires patience, methodology, and respect for account lockout policies - one successful credential can open the entire domain.

Last updated