- FTP Attacks
- SMB Attacks
- SQL Database Attacks
- DNS Attacks
- RDP Attacks
- Email Services Attacks
- Skills Assessment Scenarios
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
FTP Attacks
π― Overview
This document covers exploitation techniques against FTP services, focusing on practical attack methodologies from HTB Academyβs βAttacking Common Servicesβ module. Unlike enumeration, these techniques aim to gain unauthorized access, escalate privileges, or exploit misconfigurations.βThe File Transfer Protocol (FTP) is a standard network protocol used to transfer files between computers. We can abuse misconfigurations or excessive privileges, exploit known vulnerabilities or discover new vulnerabilities.β
ποΈ FTP Attack Methodology
Attack Chain Overview
Key Attack Objectives
- Unauthorized file access through anonymous authentication
- Credential compromise via brute force attacks
- Network pivoting using FTP bounce attacks
- Remote code execution through file upload capabilities
- Information disclosure via configuration analysis
β οΈ Misconfiguration Exploitation
Anonymous Access Abuse
Anonymous Authentication Attack
Mass Data Extraction
π Authentication Attacks
Brute Force with Medusa
Basic Medusa Usage
Advanced Medusa Attacks
π FTP Bounce Attack Exploitation
HTB Academy FTP Bounce Implementation
Manual FTP Bounce Attack
ποΈ File System Exploitation
Web Shell Upload Attack
Directory Traversal Attacks
π FTP Attack Checklist
Authentication Attacks
- Anonymous authentication - Default access testing
- Brute force with Medusa - Automated password attacks
- Password spraying - Single password, multiple users
- Default credentials - Common username/password combinations
Exploitation Attacks
- FTP bounce scanning - Internal network reconnaissance
- File upload testing - Web shell and malware upload
- Directory traversal - File system exploration
- Configuration exploitation - Modify server settings
Post-Exploitation
- Sensitive file extraction - Configuration, credential files
- Persistence mechanisms - SSH keys, cron jobs, web shells
- Privilege escalation - SUID binaries, configuration abuse
- Lateral movement - Use FTP server as pivot point
π― HTB Academy Lab Scenarios
Scenario 1: Anonymous Access Exploitation
Scenario 2: Brute Force with Medusa
Scenario 3: FTP Bounce Attack
π‘ Key Attack Insights
Attack Effectiveness Factors
- Anonymous access - Immediate exploitation opportunity
- Write permissions - Enable file upload attacks
- Web directory access - Direct path to code execution
- Weak credentials - Entry point for authorized access
- Internal network position - Pivot for lateral movement
Common Attack Patterns
- Reconnaissance β Anonymous testing β File extraction
- Brute force β Credential discovery β Privilege abuse
- Bounce attack β Internal scanning β Lateral movement
- File upload β Web shell β Remote code execution
- Configuration abuse β Persistence β Privilege escalation
This document provides comprehensive FTP attack methodologies based on HTB Academyβs βAttacking Common Servicesβ module, focusing on practical exploitation techniques for penetration testing and security assessment.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
SMB Attacks
π― Overview
This document covers exploitation techniques against SMB services, focusing on practical attack methodologies from HTB Academyβs βAttacking Common Servicesβ module. SMB attacks can lead to remote code execution, credential theft, lateral movement, and complete system compromise.βTo attack an SMB Server, we need to understand its implementation, operating system, and which tools we can use to abuse it. We can abuse misconfiguration or excessive privileges, exploit known vulnerabilities or discover new vulnerabilities.β
ποΈ SMB Attack Methodology
Attack Chain Overview
Key Attack Vectors
- Anonymous Authentication (Null Sessions)
- Brute Force & Password Spraying
- Remote Code Execution (PsExec, SMBExec, atexec)
- Credential Extraction (SAM Database)
- Pass-the-Hash Attacks
- Forced Authentication (Responder, NTLM Relay)
π Service Discovery & Enumeration
Basic SMB Scanning
Key Information to Extract
- SMB Version (Samba vs Windows)
- Hostname (NetBIOS name)
- Operating System (Linux/Windows detection)
- Message Signing status
- SMB Dialect support
π Misconfiguration Attacks
1. Anonymous Authentication (Null Sessions)
Target: SMB servers that donβt require authenticationFile Share Enumeration
Permission Analysis
Directory Browsing
2. RPC Exploitation
Null Session RPC Access
Advanced RPC Operations
- Change user passwords
- Create new domain users
- Create shared folders
- Modify system attributes
3. Automated Enumeration
βοΈ Protocol Specific Attacks
1. Brute Force & Password Spraying
β οΈ WARNING: Brute forcing can lock accounts. Use password spraying for safer approach.
Password Spraying with CrackMapExec
Best Practices
- 2-3 password attempts max
- 30-60 minute delays between attempts
- Monitor account lockout policies
- Use βcontinue-on-success for complete enumeration
2. Metasploit SMB Login Scanner
π» Remote Code Execution
1. PsExec Family Tools
Impacket PsExec
Alternative Impacket Tools
2. CrackMapExec RCE
π·οΈ Credential Extraction & Lateral Movement
1. SAM Database Extraction
2. Pass-the-Hash (PtH) Attacks
3. Logged-on Users Enumeration
οΏ½οΏ½οΈ Forced Authentication Attacks
1. Responder - LLMNR/NBT-NS Poisoning
Setup Responder
Attack Scenario
Captured Credentials Example
2. Hash Cracking
3. NTLM Relay Attacks
Setup NTLM Relay
Advanced Relay with Commands
π Skills Assessment Examples
Example 1: Share Discovery
Task: Find shared folder with READ permissionsExample 2: Password Brute Force
Task: Find password for username βjasonβExample 3: SSH Key Extraction
Task: Login via SSH and find flagπ‘οΈ Defense & Mitigation
SMB Security Hardening
- Disable SMBv1 protocol
- Enable SMB signing (mandatory)
- Restrict anonymous access
- Implement strong authentication
- Monitor SMB traffic
- Segment network properly
Detection Strategies
- Monitor failed authentication attempts
- Alert on suspicious SMB connections
- Track administrative share access
- Log RPC operations
- Detect LLMNR/NBT-NS traffic
π Related Techniques
- SMB Enumeration - Information gathering techniques
- Pass the Hash - Credential reuse attacks
- Network Services - Other protocol attacks
- Active Directory Attacks - Domain exploitation
π References
- HTB Academy - Attacking Common Services Module
- Impacket Documentation - Python SMB tools
- CrackMapExec Wiki - Advanced SMB testing
- Responder Documentation - LLMNR/NBT-NS poisoning
- Microsoft SMB Protocol - Official specifications
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
SQL Database Attacks
π― Overview
This document covers exploitation techniques against SQL databases (MySQL and MSSQL), focusing on practical attack methodologies from HTB Academyβs βAttacking Common Servicesβ module. Database attacks can lead to data extraction, command execution, privilege escalation, and lateral movement.βDatabase hosts are considered to be high targets since they are responsible for storing all kinds of sensitive data, including user credentials, PII, business-related data, and payment information. These services often are configured with highly privileged users.β
ποΈ SQL Attack Methodology
Attack Chain Overview
Key Attack Vectors
- Authentication Bypass (Default credentials, timing attacks)
- Database Enumeration (Tables, schemas, sensitive data)
- Command Execution (xp_cmdshell, UDF functions)
- File Operations (Read/write local files)
- Hash Stealing (SMB integration attacks)
- Privilege Escalation (User impersonation)
- Lateral Movement (Linked servers)
π Service Discovery & Analysis
Default Ports & Scanning
Banner Grabbing Example
Key Information to Extract
- Database Version (vulnerability research)
- Authentication Mode (Windows vs Mixed)
- Domain Information (for privilege escalation)
- SSL Configuration (encryption status)
- Service Account details
π Authentication Mechanisms & Bypass
1. MSSQL Authentication Types
Windows Authentication Mode
- Integrated Security with Windows/Active Directory
- Pre-authenticated Windows users donβt need additional credentials
- Domain-based privilege management
Mixed Mode Authentication
- Windows/AD accounts + SQL Server accounts
- Username/password pairs maintained within SQL Server
- Higher attack surface due to dual authentication
2. MySQL Authentication Methods
- Username/password authentication
- Windows authentication (plugin required)
- Socket-based authentication
3. Historical Vulnerabilities
CVE-2012-2122 - MySQL Timing Attack
π Protocol Specific Attacks
1. Database Connection & Authentication
MySQL Connection
MSSQL Connection Methods
Windows Authentication
ποΈ Database Enumeration & Data Extraction
1. Default System Databases
MySQL System Schemas
- mysql - System database with server information
- information_schema - Database metadata access
- performance_schema - Server execution monitoring
- sys - Performance Schema interpretation objects
MSSQL System Databases
- master - SQL Server instance information
- msdb - SQL Server Agent usage
- model - Template for new databases
- resource - Read-only system objects
- tempdb - Temporary objects storage
2. Database Enumeration Commands
Show Databases
Select Database
Show Tables
Extract Table Data
π» Command Execution Techniques
1. MSSQL Command Execution
xp_cmdshell Usage
Enable xp_cmdshell
2. MySQL Command Execution
User Defined Functions (UDF)
π File Operations
1. Write Local Files
MySQL File Writing
MSSQL File Writing
2. Read Local Files
MSSQL File Reading
MySQL File Reading
π·οΈ Hash Stealing Attacks
1. MSSQL Service Hash Capture
Using xp_dirtree
Using xp_subdirs
2. Capture Setup
Responder Setup
Impacket SMB Server
π€ Privilege Escalation
1. User Impersonation
Identify Impersonatable Users
Check Current Privileges
Impersonate Higher Privileged User
π Lateral Movement
1. Linked Servers
Identify Linked Servers
Execute Commands on Linked Servers
π Skills Assessment Examples
Example 1: Service Hash Capture
Task: Capture MSSQL service hash using xp_dirtreeExample 2: Database Enumeration
Task: Find flag in βflagDBβ databaseExample 3: Privilege Escalation
Task: Escalate to sysadmin via impersonationπ‘οΈ Defense & Mitigation
Database Security Hardening
- Disable unnecessary features (xp_cmdshell, Ole Automation)
- Implement strong authentication
- Use least privilege principles
- Network segmentation for database servers
- Regular security updates
- Monitor file operations
Detection Strategies
- Monitor failed authentication attempts
- Alert on xp_cmdshell usage
- Track file read/write operations
- Log impersonation activities
- Monitor linked server queries
- Detect SMB connection attempts
π Related Techniques
- SMB Attacks - Hash capture integration
- Database Enumeration - Information gathering
- Database Enumeration - MSSQL reconnaissance
- Pass the Hash - Credential reuse
- Active Directory Attacks - Domain exploitation
π References
- HTB Academy - Attacking Common Services Module
- Microsoft SQL Server Documentation - Security best practices
- MySQL Security Documentation - Hardening guidelines
- OWASP Database Security - Common vulnerabilities
- CVE-2012-2122 - MySQL authentication bypass
π― HTB Academy Lab Scenarios
Scenario 1: Initial Database Access
Scenario 2: MSSQL Service Hash Capture
Task: Find password for βmssqlsvcβ user via hash stealingTerminal 1 - Start SMB Server
Terminal 2 - Execute Hash Stealing Attack
Captured Hash Output
Scenario 3: Flag Enumeration with Escalated Privileges
Task: Enumerate βflagDBβ database and extract flagConnect with mssqlsvc Account
Database and Table Enumeration
Flag Extraction
HTB{...}
π SQL Attack Checklist
Authentication Attacks
- Default credentials - admin/admin, sa/sa, root/root
- Anonymous access - NULL or empty password
- Weak passwords - Dictionary attacks
- Windows authentication - Domain credential abuse
Database Exploitation
- System database access - Information_schema, master, sys
- Sensitive data extraction - User tables, configuration data
- Command execution - xp_cmdshell, UDF functions
- File operations - Read system files, write web shells
Post-Exploitation
- Hash capture - xp_dirtree, xp_subdirs SMB attacks
- Privilege escalation - User impersonation, role escalation
- Lateral movement - Linked servers, network pivoting
- Persistence - Backdoor accounts, scheduled jobs
π‘οΈ Defense & Detection
Security Hardening
- Disable xp_cmdshell and dangerous stored procedures
- Implement least privilege database access
- Use strong authentication and password policies
- Network segmentation for database servers
- Regular security updates and patches
Detection Strategies
- Monitor xp_cmdshell usage and command execution
- Alert on file operations (LOAD_FILE, INTO OUTFILE)
- Track authentication failures and unusual login patterns
- Monitor SMB connections from database servers
- Log impersonation activities and privilege changes
π Related Techniques
- SMB Attacks - Hash capture integration
- FTP Attacks - File transfer exploitation
- Pass the Hash - Credential reuse
- Active Directory Attacks - Domain exploitation
This document provides comprehensive SQL database attack methodologies based on HTB Academyβs βAttacking Common Servicesβ module, focusing on practical exploitation techniques for penetration testing and security assessment.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
DNS Attacks
π― Overview
This document covers exploitation techniques against DNS services, focusing on practical attack methodologies from HTB Academyβs βAttacking Common Servicesβ module. DNS attacks can lead to information disclosure, domain takeover, traffic redirection, and man-in-the-middle attacks.βThe Domain Name System (DNS) translates domain names (e.g., hackthebox.com) to the numerical IP addresses (e.g., 104.17.42.72). Since nearly all network applications use DNS, attacks against DNS servers represent one of the most prevalent and significant threats today.β
ποΈ DNS Attack Methodology
Attack Chain Overview
Key Attack Objectives
- DNS zone transfers for information gathering
- Subdomain enumeration to expand attack surface
- Domain/subdomain takeover for content control
- DNS cache poisoning for traffic redirection
- DNS spoofing for man-in-the-middle attacks
π Service Discovery & Enumeration
Default DNS Port Detection
Comprehensive DNS Scanning
Key Information to Extract
- DNS server software (BIND, Microsoft DNS, etc.)
- Version information for vulnerability research
- Zone information (SOA records)
- Recursion capabilities
- DNS security features (DNSSEC status)
ποΈ DNS Zone Transfer Attacks
Understanding Zone Transfers
HTB Academy Zone Transfer Example
Using DIG for AXFR
Alternative Zone Transfer Methods
Fierce for Comprehensive DNS Analysis
π Subdomain Enumeration & Domain Takeover
Subdomain Discovery Techniques
HTB Academy Subfinder Example
Subbrute for Internal Networks
Domain Takeover Attacks
Understanding Subdomain Takeover
HTB Academy Takeover Example
Subdomain Takeover Detection Tools
π·οΈ DNS Spoofing & Cache Poisoning
Understanding DNS Cache Poisoning
HTB Academy Ettercap DNS Spoofing
Step 1: Configure DNS Spoofing
Step 2: Execute MITM Attack
Step 3: Verify DNS Spoofing
Alternative DNS Spoofing Tools
π― HTB Academy Lab Scenarios
Scenario 1: DNS Zone Transfer Exploitation
Task: Find all DNS records for βinlanefreight.htbβ domain and submit flag found as DNS recordHTB Academy Solution Workflow
Step 1: Setup Subbrute ToolAlternative Methods
Advanced DNS Reconnaissance
π DNS Attack Checklist
Discovery & Enumeration
- Port scanning - UDP/53 and TCP/53 detection
- Version enumeration - DNS server software identification
- Zone transfer testing - AXFR query attempts
- Recursion testing - DNS resolver configuration
- DNSSEC validation - Security feature assessment
Information Gathering
- Subdomain enumeration - Subfinder, Subbrute, Gobuster
- DNS record analysis - A, AAAA, CNAME, MX, TXT, NS records
- Reverse DNS lookup - PTR record enumeration
- DNS cache snooping - Cached record identification
- DNS walking - NSEC record exploitation
Exploitation Techniques
- Zone transfer exploitation - Complete DNS data extraction
- Subdomain takeover - CNAME record vulnerability assessment
- DNS cache poisoning - MITM attack implementation
- DNS tunneling - Covert channel establishment
- DNS amplification - DDoS attack potential
Post-Exploitation
- Traffic monitoring - DNS query analysis
- Persistent spoofing - Long-term redirection
- Credential harvesting - Fake login page hosting
- Lateral movement - Internal DNS server targeting
π‘οΈ Defense & Mitigation
DNS Server Hardening
- Disable zone transfers - Restrict AXFR to authorized servers only
- Enable DNSSEC - Cryptographic DNS response validation
- Implement access controls - IP-based query restrictions
- Regular updates - Patch DNS server software
- Rate limiting - Prevent DNS amplification attacks
Network Security
- DNS filtering - Block malicious domains
- Encrypted DNS - DNS over HTTPS (DoH) or DNS over TLS (DoT)
- Split DNS - Separate internal and external DNS
- DNS monitoring - Unusual query pattern detection
- Cache poisoning protection - Source port randomization
Monitoring & Detection
- Zone transfer attempts - Log AXFR queries
- Unusual DNS queries - Detect reconnaissance patterns
- DNS response validation - Monitor for spoofed responses
- Subdomain monitoring - Track new subdomain creation
- Certificate transparency - Monitor SSL certificate logs
π Related Techniques
- Subdomain Enumeration - Information gathering techniques
- Domain Hijacking - Web-based domain attacks
- Man-in-the-Middle - Traffic interception
- Social Engineering - Phishing with spoofed domains
- Network Pivoting - Internal network access
π References
- HTB Academy - Attacking Common Services Module
- RFC 1035 - Domain Names Implementation and Specification
- OWASP DNS Security - DNS attack vectors and mitigations
- Subfinder Documentation - Subdomain discovery tool
- Ettercap Manual - MITM attack framework
- can-i-take-over-xyz - Subdomain takeover reference
This document provides comprehensive DNS attack methodologies based on HTB Academyβs βAttacking Common Servicesβ module, focusing on practical exploitation techniques for penetration testing and security assessment.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
RDP Attacks
π― Overview
This document covers exploitation techniques against RDP services, focusing on practical attack methodologies from HTB Academyβs βAttacking Common Servicesβ module. RDP attacks can lead to unauthorized remote access, privilege escalation, session hijacking, and lateral movement.βRemote Desktop Protocol (RDP) is a proprietary protocol developed by Microsoft which provides a user with a graphical interface to connect to another computer over a network connection. Unfortunately, while RDP greatly facilitates remote administration of distributed IT systems, it also creates another gateway for attacks.β
ποΈ RDP Attack Methodology
Attack Chain Overview
Key Attack Objectives
- Password spraying to avoid account lockouts
- Session hijacking for privilege escalation
- Pass-the-Hash attacks with NT hashes
- GUI access to Windows systems
- Credential dumping from RDP sessions
π Service Discovery & Enumeration
Default RDP Port Detection
Advanced RDP Scanning
Key Information to Extract
- RDP service version (Windows version identification)
- Authentication methods supported
- Certificate information (self-signed vs CA)
- Encryption levels available
- Domain membership status
βοΈ Authentication Attacks
1. Password Spraying Attacks
Why Password Spraying?
HTB Academy Username List
2. Crowbar Password Spraying
Basic Crowbar Usage
Advanced Crowbar Options
3. Hydra Password Spraying
HTB Academy Hydra Example
Optimized Hydra Commands
π RDP Connection Methods
1. rdesktop Client
rdesktop Advanced Options
2. xfreerdp Client
π€ Protocol Specific Attacks
1. RDP Session Hijacking
Attack Prerequisites
HTB Academy Session Hijacking Example
Step 1: Identify Active SessionsAlternative Hijacking Methods
2. RDP Pass-the-Hash (PtH) Attack
Attack Prerequisites & Limitations
Enable Restricted Admin Mode
HTB Academy PtH Execution
Alternative PtH Tools
π― HTB Academy Lab Scenarios
Scenario 1: Initial RDP Access
Scenario 2: Registry Key Knowledge
Scenario 3: Administrator Access
π RDP Attack Checklist
Discovery & Enumeration
- Port scanning - TCP/3389 detection
- Version enumeration - Windows version identification
- Certificate analysis - Self-signed vs CA certificates
- Domain membership - Standalone vs domain-joined
Authentication Attacks
- Default credentials - administrator:password, admin:admin
- Password spraying - Single password, multiple users
- Common passwords - Spring2024!, Password123, company name
- Seasonal passwords - Current year/month variations
Post-Authentication
- Session enumeration - Active RDP sessions
- User privilege checking - Local admin rights
- Session hijacking - Target high-privilege users
- Hash dumping - Extract NT hashes for PtH
Advanced Techniques
- Pass-the-Hash - Registry modification required
- Kerberoasting - Service account targeting
- Golden/Silver tickets - Kerberos ticket attacks
- Lateral movement - RDP to other systems
π‘οΈ Defense & Mitigation
RDP Security Hardening
- Network Level Authentication (NLA) - Enable for all RDP connections
- Strong password policies - Prevent common password usage
- Account lockout policies - Limit failed login attempts
- IP restrictions - Whitelist authorized source IPs
- Non-standard ports - Change from default 3389
- VPN requirements - Require VPN for RDP access
Registry Security
- Disable Restricted Admin - Prevent Pass-the-Hash attacks
- Audit registry changes - Monitor security-related modifications
- Group Policy controls - Centralized RDP security settings
Monitoring & Detection
- Failed authentication logs - Event ID 4625 monitoring
- Successful RDP logins - Event ID 4624 tracking
- Session creation/termination - Event ID 4778/4779
- Unusual source IPs - Geographic/time-based anomalies
- Registry modifications - Monitor Lsa registry changes
π Related Techniques
- SMB Attacks - Credential extraction for RDP PtH
- SQL Attacks - Database access for credential discovery
- Pass the Hash - NT hash exploitation
- Active Directory Attacks - Domain privilege escalation
- Kerberoasting - Service account attacks
π References
- HTB Academy - Attacking Common Services Module
- Microsoft RDP Documentation - Official protocol specifications
- Crowbar Tool - RDP password spraying utility
- FreeRDP Project - Open-source RDP implementation
- NIST Guidelines - Remote access security best practices
This document provides comprehensive RDP attack methodologies based on HTB Academyβs βAttacking Common Servicesβ module, focusing on practical exploitation techniques for penetration testing and security assessment.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Email Services Attacks
π― Overview
This document covers exploitation techniques against Email Services (SMTP/POP3/IMAP), focusing on practical attack methodologies from HTB Academyβs βAttacking Common Servicesβ module. Email attacks can lead to user enumeration, mail relay abuse, credential harvesting, and email-based social engineering.βA mail server handles and delivers email over a network, usually over the Internet. Email servers are complex and usually require us to enumerate multiple servers, ports, and services. Most companies today have their email services in the cloud with services such as Microsoft 365 or G-Suite.β
ποΈ SMTP Attack Methodology
Attack Chain Overview
Key Attack Objectives
- User enumeration via SMTP commands
- Mail relay abuse for spam/phishing
- Credential harvesting through SMTP authentication
- Information disclosure via SMTP banners
- Social engineering using email spoofing
π Service Discovery & Enumeration
MX Record Enumeration
HTB Academy MX Record Examples
Cloud vs Custom Mail Servers
Email Service Port Enumeration
HTB Academy Complete Port List
Email Service Ports Reference
Key Information to Extract
- Mail server type (Cloud vs Custom implementation)
- SMTP server software (Postfix, Sendmail, Exchange)
- Version information for vulnerability research
- Supported authentication methods
- Mail relay configuration
- Domain information from banners
π₯ User Enumeration Attacks
SMTP User Enumeration Commands
VRFY Command (HTB Academy Example)
EXPN Command (HTB Academy Example)
RCPT TO Command (HTB Academy Example)
POP3 User Enumeration (HTB Academy Example)
HTB Academy User Enumeration Example
Using smtp-user-enum Tool (HTB Academy Example)
Alternative Enumeration Methods
βοΈ Cloud Enumeration (Office 365)
O365spray Tool (HTB Academy Example)
Validate Office 365 Domain
Office 365 User Enumeration
Cloud Service Enumeration Tools
π¨ Protocol Specific Attacks
Open Mail Relay Exploitation
Understanding Open Relay
HTB Academy Open Relay Detection
HTB Academy Open Relay Exploitation with Swaks
Manual Open Relay Testing
Additional Relay Testing Tools
π Password Attacks
Traditional Email Service Attacks
HTB Academy Hydra Password Spray Example
Additional Hydra Examples
Cloud Service Password Attacks
HTB Academy O365 Password Spraying
Cloud-Specific Tools
π― HTB Academy Lab Scenarios
Scenario 1: SMTP User Enumeration
Scenario 2: SMTP Relay Testing
Scenario 3: Information Gathering
π SMTP Attack Checklist
Discovery & Enumeration
- Port scanning - TCP/25, 465, 587 detection
- Banner grabbing - Server version identification
- EHLO enumeration - Supported extensions
- Authentication methods - AUTH mechanisms
- Domain information - Mail domain discovery
User Enumeration
- VRFY command - User verification
- EXPN command - Mailing list expansion
- RCPT TO - Recipient checking
- smtp-user-enum - Automated enumeration
- Nmap scripts - smtp-enum-users
Exploitation
- Open relay testing - Mail relay abuse
- Authentication attacks - Credential brute forcing
- Email spoofing - Sender impersonation
- Social engineering - Phishing email crafting
- Data exfiltration - Email-based data theft
Post-Exploitation
- Email harvesting - Contact information gathering
- Persistence - Email forwarding rules
- Lateral movement - Internal email attacks
- Credential harvesting - Phishing campaigns
π‘οΈ Defense & Mitigation
SMTP Server Hardening
- Disable VRFY/EXPN - Prevent user enumeration
- Configure relay restrictions - Prevent open relay
- Implement authentication - Require SMTP AUTH
- Rate limiting - Prevent brute force attacks
- Banner customization - Hide version information
Email Security
- SPF records - Sender Policy Framework
- DKIM signatures - DomainKeys Identified Mail
- DMARC policy - Domain-based Message Authentication
- TLS encryption - Secure mail transmission
- Content filtering - Malware and spam protection
Monitoring & Detection
- Failed authentication logs - Brute force detection
- Unusual mail patterns - Anomaly detection
- User enumeration attempts - VRFY/EXPN monitoring
- Relay abuse detection - External recipient tracking
- Rate limiting alerts - High-volume email detection
π HTB Academy Lab Scenarios
Lab Exercise 1: SMTP User Enumeration
Lab Exercise 2: Email Access & Flag Extraction
Key Lab Learning Points
π§ Tools & Resources
Essential Email Service Tools
Useful Nmap SMTP Scripts
π Related Techniques
- Email Reconnaissance - Information gathering
- Social Engineering - Email-based attacks
- Phishing - Malicious email campaigns
- Domain Attacks - DNS-based email attacks
- Password Attacks - SMTP credential attacks
π References
- HTB Academy - Attacking Common Services Module
- RFC 5321 - Simple Mail Transfer Protocol
- smtp-user-enum - SMTP user enumeration tool
- OWASP Email Security - Email attack vectors
- Postfix Documentation - SMTP server configuration
This document provides comprehensive SMTP attack methodologies based on HTB Academyβs βAttacking Common Servicesβ module, focusing on practical exploitation techniques for penetration testing and security assessment.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter:
Skills Assessment Scenarios
π― Skills Assessment - Attacking Common Services
π― Overview
This document covers the Skills Assessment (Easy) from HTB Academyβs βAttacking Common Servicesβ module. This practical exercise demonstrates a complete attack chain combining multiple service exploitation techniques to achieve the objective.Target Domain:inlanefreight.htb
Objective: βAssess the target server and obtain the contents of the flag.txt fileβ
Skills Tested: Service enumeration, user enumeration, credential attacks, file system access, web shell deployment
π Phase 1: Service Discovery & Enumeration
Initial Nmap Scan
Key Services Identified
π€ Phase 2: User Enumeration (SMTP)
Download User Wordlist
SMTP User Enumeration
fiona@inlanefreight.htb discovered
π Phase 3: Credential Attacks (FTP)
FTP Password Brute Force
fiona:987654321 discovered
π Phase 4: FTP Intelligence Gathering
FTP Access & File Download
Critical Intelligence Analysis
- CoreFTP server running on ports 21 & 443
- Apache web root at
C:\xampp\htdocs\ - Authentication methods available via HTTPS
π Phase 5: Exploitation - Method 1 (CoreFTP Directory Traversal)
Vulnerability Research
Exploit Analysis
Web Shell Upload via Directory Traversal
ποΈ Phase 6: Exploitation - Method 2 (MySQL File Write)
MySQL Access
File Write Privilege Check
Web Shell Creation via MySQL
π― Phase 7: Flag Extraction
Web Shell Execution
π Attack Chain Summary
Complete Attack Flow
Services Utilized
Key Learning Points
π§ Tools & Commands Reference
Complete Tool Chain Used
π Related Documentation
- SMTP Attacks - Email service enumeration
- FTP Attacks - FTP exploitation techniques
- SQL Attacks - MySQL file operations
- HTB Academy - Original module content
π― Skills Assessment - Medium Difficulty
π― Overview - Medium Challenge
This document covers the Skills Assessment (Medium) from HTB Academyβs βAttacking Common Servicesβ module. This advanced exercise demonstrates a complex attack chain involving DNS enumeration, vHost discovery, anonymous FTP access, email exploitation, and SSH key-based authentication.Target Domain:inlanefreight.htb
Objective: βAssess the target server and find the flag.txt fileβ
Skills Tested: DNS zone transfers, vHost enumeration, FTP intelligence gathering, POP3 attacks, SSH key extraction and usage
π Phase 1: Service Discovery & DNS Enumeration
Initial Nmap Scan
DNS Zone Transfer Attack
int-ftp.inlanefreight.htb points to 127.0.0.1 (localhost)
π Phase 2: vHost Configuration & Internal Service Discovery
vHost Addition to Local Hosts
Internal FTP Service Discovery
π Phase 3: Anonymous FTP Access & Intelligence Gathering
Anonymous FTP Connection
File System Exploration
mynotes.txt for user simon
π Phase 4: POP3 Credential Attack
Password List Analysis
POP3 Password Brute Force
simon:8Ns8j1b!23hs4921smHzwn discovered
π§ Phase 5: POP3 Email Access & SSH Key Extraction
POP3 Mail Access
Email Enumeration & Retrieval
simon obtained from email
π Phase 6: SSH Key Processing & Authentication
SSH Key Formatting
Formatted SSH Private Key
SSH Key Permissions & Access
π― Phase 7: Flag Extraction
Final Flag Retrieval
π Attack Chain Summary - Medium Difficulty
Complete Attack Flow
Services & Techniques Utilized
Advanced Learning Points
π§ Complete Tool Chain - Medium Difficulty
Full Command Reference
π Skills Assessment Comparison
Easy vs Medium Difficulty
Easy Skills Assessment- Attack Chain: 7 phases (Service Discovery β Web Shell β Flag)
- Services: FTP, SMTP, HTTP, HTTPS, MySQL (5 services)
- Key Techniques: User enumeration, credential attacks, directory traversal, file upload
- Complexity: Medium - Multiple exploitation paths available
- Attack Chain: 10 phases (DNS β vHost β SSH Key β Flag)
- Services: DNS, FTP, POP3, SSH (4 services + vHost discovery)
- Key Techniques: Zone transfers, internal service discovery, email intelligence, SSH keys
- Complexity: High - Linear attack chain with each phase dependent on previous
Practical CPTS Skills Demonstrated
π― Skills Assessment - Hard Difficulty
π― Overview - Hard Challenge
This document covers the Skills Assessment (Hard) from HTB Academyβs βAttacking Common Servicesβ module. This expert-level exercise demonstrates advanced Windows exploitation involving SMB share enumeration, custom wordlist attacks, RDP authentication, SQL Server user impersonation, and linked server exploitation.Target Domain: Windows environment with multiple services
Objective: βRetrieve user files and obtain administrator flagβ
Skills Tested: SMB enumeration, credential attacks, RDP access, SQL Server impersonation, linked server attacks, xp_cmdshell exploitation
π Phase 1: Service Discovery & Windows Enumeration
Initial Nmap Scan
Key Services Identified
π Phase 2: SMB Share Enumeration & File Collection
SMB Share Discovery
Home share available for anonymous access
SMB Share Exploration
IT department
User File Collection from IT Department
- From Simon:
random.txtβ (Question 1 answer) - From Fiona:
creds.txt - From John:
information.txt,notes.txt,secrets.txt
π Phase 3: Custom Wordlist Creation & Credential Attacks
Password Wordlist Compilation
SMB Credential Attack
fiona:48Ns72!bns74@S84NNNSl discovered β
(Question 2 answer)
π₯οΈ Phase 4: RDP Authentication & SQL Server Access
RDP Connection
fiona
SQL Server Connection via Windows Authentication
π€ Phase 5: SQL Server User Impersonation Discovery
Impersonation Privilege Enumeration
john and simon can be impersonated β
(Question 3 answer: john)
π Phase 6: Linked Server Discovery & Exploitation
Linked Server Enumeration
WINSRV02\SQLEXPRESS(remote server)LOCAL.TEST.LINKED.SRV(linked server)
User Impersonation & Linked Server Access
- User
johncan accessLOCAL.TEST.LINKED.SRV - On linked server,
johnhassysadminprivileges astestadmin - Target server:
WINSRV02\SQLEXPRESS
π» Phase 7: xp_cmdshell Enablement & Command Execution
xp_cmdshell Configuration
Administrator Flag Extraction
π Attack Chain Summary - Hard Difficulty
Complete Attack Flow
Advanced Services & Techniques
Expert Learning Points
π§ Complete Tool Chain - Hard Difficulty
Full Command Reference
π Complete Skills Assessment Trilogy
Difficulty Progression Overview
Easy Skills Assessment- Attack Chain: 7 phases (Basic multi-service exploitation)
- Services: FTP, SMTP, HTTP, HTTPS, MySQL (5 services)
- Complexity: Medium - Multiple exploitation paths
- Key Skills: Service enumeration, credential attacks, directory traversal
- Attack Chain: 10 phases (Advanced linear dependency chain)
- Services: DNS, vHost, FTP, POP3, Email, SSH (6 services)
- Complexity: High - Each phase enables next attack
- Key Skills: Zone transfers, vHost discovery, SSH key extraction
- Attack Chain: 13 phases (Expert Windows enterprise exploitation)
- Services: SMB, RDP, SQL Server, Linked Servers (4+ services)
- Complexity: Expert - Cross-server privilege escalation
- Key Skills: Windows authentication, SQL impersonation, linked server attacks
Complete CPTS Skills Matrix
This complete Skills Assessment trilogy provides comprehensive practical scenarios spanning beginner to expert levels, demonstrating the full spectrum of attack techniques covered in the βAttacking Common Servicesβ module for thorough CPTS exam preparation.
Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question. Perform an HTTP GET request on the current page URL with theask query parameter: