Advanced Network Attacks Across OSI Layers

This comprehensive guide details sophisticated attacks at each layer of the OSI model, tailored for Red Team experts. It includes specific attack techniques, command examples, and references to relevant tools and resources.

Layer 1: Physical

Evil Maid Attack

Description: Physical access exploitation of unattended systems.

Example: Using tools like PCILeech for DMA attacks: `pcileech dump -device fpga -max 0x1000000`

Reference: https://github.com/ufrisk/pcileech

Illustration of Evil Maid Attack attack

Fiber Tapping

Description: Intercepting data from fiber optic cables without disrupting the connection.

Example: Using specialized equipment like the Fiber Tapping Kit from Oyster Technologies

Reference: https://www.osec.io/blog/fiber-optic-tapping-101/

Illustration of Fiber Tapping attack

Rogue Access Points

Description: Setting up malicious Wi-Fi access points to intercept traffic.

Example: Using Aircrack-ng suite: `airbase-ng -e "Free WiFi" -c 6 wlan0mon`

Reference: https://www.aircrack-ng.org/doku.php?id=airbase-ng

Illustration of Rogue Access Points attack
Learn more about Layer 1

Layer 2: Data Link

MAC Flooding

Description: Overwhelming a switch's CAM table to force it into hub-like behavior.

Example: Using macof: `macof -i eth0 -n 10000`

Reference: https://github.com/robertdavidgraham/macof

Illustration of MAC Flooding attack

ARP Spoofing

Description: Manipulating ARP tables to redirect traffic for MITM attacks.

Example: Using Ettercap: `ettercap -T -q -i eth0 -M arp:remote /target1/ /target2/`

Reference: https://www.ettercap-project.org/index.html

Illustration of ARP Spoofing attack

VLAN Hopping

Description: Attacking the VLAN infrastructure to access unauthorized VLANs.

Example: Using Yersinia: `yersinia -I`

Reference: https://github.com/tomac/yersinia

Illustration of VLAN Hopping attack
Learn more about Layer 2

Layer 3: Network

IP Spoofing

Description: Forging the source IP address in packets to impersonate trusted systems.

Example: Using Scapy: `send(IP(src="192.168.1.1", dst="192.168.1.2")/ICMP())`

Reference: https://scapy.net/

Illustration of IP Spoofing attack

ICMP Tunneling

Description: Encapsulating other protocols within ICMP to bypass firewalls.

Example: Using ptunnel: `ptunnel -p proxy.example.com -lp 8000 -da internal.example.com -dp 22`

Reference: http://www.cs.uit.no/~daniels/PingTunnel/

Illustration of ICMP Tunneling attack

BGP Hijacking

Description: Manipulating BGP to redirect large portions of Internet traffic.

Example: Simulating with GNS3 or EVE-NG for testing purposes

Reference: https://www.cloudflare.com/learning/security/glossary/bgp-hijacking/

Illustration of BGP Hijacking attack
Learn more about Layer 3

Layer 4: Transport

TCP SYN Flood

Description: Overwhelming a system with TCP SYN packets to exhaust resources.

Example: Using hping3: `hping3 -S -p 80 --flood target_ip`

Reference: http://www.hping.org/

Illustration of TCP SYN Flood attack

UDP Amplification

Description: Exploiting UDP services to generate large amounts of traffic for DDoS.

Example: Using UDPFlooder: `./udpflood target_ip target_port payload_size number_of_packets`

Reference: https://github.com/opsxcq/udp-flood

Illustration of UDP Amplification attack

SSL/TLS Downgrade

Description: Forcing the use of weaker encryption protocols for easier interception.

Example: Using sslstrip: `sslstrip -l 8080`

Reference: https://github.com/moxie0/sslstrip

Illustration of SSL/TLS Downgrade attack
Learn more about Layer 4

Layer 5: Session

Session Hijacking

Description: Taking over an authenticated session to gain unauthorized access.

Example: Using Burp Suite to capture and modify session tokens

Reference: https://portswigger.net/burp

Illustration of Session Hijacking attack

Cross-Site Request Forgery (CSRF)

Description: Tricking users into performing unintended actions on authenticated web applications.

Example: Creating a malicious HTML form that submits to a target site

Reference: https://owasp.org/www-community/attacks/csrf

Illustration of Cross-Site Request Forgery (CSRF) attack

Man-in-the-Middle (MitM)

Description: Intercepting and potentially altering communications between two parties.

Example: Using Bettercap: `bettercap -iface eth0 -caplet http-proxy`

Reference: https://www.bettercap.org/

Illustration of Man-in-the-Middle (MitM) attack
Learn more about Layer 5

Layer 6: Presentation

SSL/TLS Attacks

Description: Exploiting vulnerabilities in SSL/TLS protocols or implementations.

Example: Using sslscan to identify weak ciphers: `sslscan example.com`

Reference: https://github.com/rbsec/sslscan

Illustration of SSL/TLS Attacks attack

Format String Attacks

Description: Exploiting improper use of format string functions in C/C++ programs.

Example: Crafting malicious input like `printf("%s%s%s%s%s%n")`

Reference: https://owasp.org/www-community/attacks/Format_string_attack

Illustration of Format String Attacks attack

XML External Entity (XXE) Injection

Description: Exploiting XML parsers to process malicious external entity references.

Example: Using XXEinjector: `ruby XXEinjector.rb --host=192.168.0.2 --path=/path/to/vulnerable/file --file=/etc/passwd`

Reference: https://github.com/enjoiz/XXEinjector

Illustration of XML External Entity (XXE) Injection attack
Learn more about Layer 6

Layer 7: Application

SQL Injection

Description: Inserting malicious SQL code to manipulate database queries.

Example: Using sqlmap: `sqlmap -u "http://example.com/page.php?id=1" --dbs`

Reference: http://sqlmap.org/

Illustration of SQL Injection attack

Cross-Site Scripting (XSS)

Description: Injecting malicious scripts into web pages viewed by other users.

Example: Testing with payload: `<script>alert(document.cookie)</script>`

Reference: https://owasp.org/www-community/attacks/xss/

Illustration of Cross-Site Scripting (XSS) attack

Server-Side Request Forgery (SSRF)

Description: Abusing server functionality to perform unauthorized actions.

Example: Crafting a request like: `http://vulnerable-server.com/fetch?url=http://internal-server.local/sensitive-data`

Reference: https://portswigger.net/web-security/ssrf

Illustration of Server-Side Request Forgery (SSRF) attack
Learn more about Layer 7

Red Team Considerations

When conducting Red Team operations, consider the following best practices:

  • Always obtain proper authorization before performing any penetration testing or red team activities.
  • Maintain detailed documentation of all actions taken during an engagement.
  • Use a dedicated testing environment when possible to avoid unintended impact on production systems.
  • Stay updated on the latest vulnerabilities, exploit techniques, and security patches.
  • Prioritize stealth and evasion techniques to simulate real-world advanced persistent threats (APTs).
  • Conduct thorough post-engagement analysis and provide actionable recommendations for improving security posture.