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 提供支持
在本页
  • 基本术语
  • 共识机制
  • 工作量证明(PoW)
  • 权益证明(PoS)
  • 比特币
  • 交易
  • 闪电网络
  • 比特币隐私攻击
  • 共同输入
  • UTXO找零地址检测
  • 社交网络和论坛
  • 交易图
  • 不必要的输入启发式
  • 强制地址重用
  • 其他区块链分析
  • 流量分析
  • 其他攻击以查找地址所有者信息
  • 匿名比特币
  • 匿名获取比特币
  • 混币服务
  • CoinJoin
  • PayJoin
  • 比特币隐私良好实践
  • 钱包同步
  • Tor
  • 避免地址重复使用
  • 多笔交易
  • 避免找零
  • 多个找零输出
  • 门罗币
  • 以太坊
  • Gas
  • 交易
  • 参考资料
  1. Crypto & Stego

Blockchain & Crypto Currencies

上一页Esoteric languages下一页Salseo

最后更新于1年前

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

支持HackTricks的其他方式:

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

  • 获取

  • 探索,我们的独家

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

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

基本术语

  • 智能合约:智能合约简单地说就是存储在区块链上的程序,当满足预定条件时运行。它们通常用于自动化协议的执行,以便所有参与者可以立即确定结果,无需任何中介的参与或时间损失。(来源:)。

  • 基本上,智能合约是一段代码,当人们访问并接受合约时将被执行。智能合约在区块链上运行(因此结果被存储为不可变),人们可以在接受之前阅读它们。

  • dApps:去中心化应用程序是在智能合约之上实现的。它们通常具有用户可以与应用程序交互的前端,后端是公开的(因此可以进行审计)并且实现为智能合约。有时需要使用数据库,以太坊区块链为每个帐户分配一定的存储空间。

  • 代币和硬币:硬币是一种作为数字货币的加密货币,而代币是代表一些价值但不是硬币的东西。

  • 实用性代币:这些代币允许用户稍后访问某些服务(在特定环境中具有某些价值)。

  • 安全性代币:这些代表所有权或某些资产。

  • DeFi:去中心化金融。

  • DEX:去中心化交易平台。

  • DAOs:去中心化自治组织。

共识机制

要使区块链交易得到承认,必须将其附加到区块链上。验证者(矿工)执行此附加操作;在大多数协议中,他们为此获得奖励。为了保持区块链的安全性,必须有一种机制来防止恶意用户或组织接管大多数验证。

工作量证明,另一种常用的共识机制,使用计算能力的验证来验证交易,要求潜在攻击者获取验证者网络大部分计算能力的大部分。

工作量证明(PoW)

这使用计算能力验证来验证交易,要求潜在攻击者获取验证者网络大部分计算能力的大部分。 矿工将选择几笔交易,然后开始计算工作量证明。具有最大计算资源的矿工更有可能更早完成工作量证明并获得所有交易的费用。

权益证明(PoS)

PoS通过要求验证者拥有一定数量的区块链代币来实现这一点,要求潜在攻击者获取区块链上大部分代币以发动攻击。 在这种共识机制中,矿工拥有的代币越多,矿工被要求创建下一个区块的可能性就越大。 与PoW相比,这大大减少了矿工消耗的能量。

比特币

交易

简单的交易是从一个地址向另一个地址的资金转移。 在比特币中,一个地址是公钥的哈希值,因此,为了从地址进行交易,某人需要知道与该公钥(地址)关联的私钥。 然后,当执行交易时,它会使用地址的私钥进行签名,以显示交易的合法性。

在比特币中生成数字签名的第一部分可以用以下数学方式表示: Sig = Fsig(Fhash(m),dA)

其中:

  • _d_A是签名私钥

  • _m_是交易

  • Fhash是哈希函数

  • Fsig是签名算法

  • Sig是生成的签名

签名函数(Fsig)生成一个包含两个值R和S的签名:

  • Sig = (R, S)

一旦计算出R和S,它们将被序列化为一个字节流,然后使用称为Distinguished Encoding Rules(DER)的国际标准编码方案进行编码。为了验证签名的有效性,将使用签名验证算法。验证数字签名需要以下内容:

  • 签名(R和S)

  • 交易哈希

  • 与用于创建交易签名的私钥对应的公钥

签名验证算法有效地意味着只有私钥的所有者(生成公钥的私钥)才能在交易上生成签名。如果签名有效,则签名验证算法将返回“TRUE”。

多重签名交易

多重签名地址是与多个ECDSA私钥关联的地址。最简单的类型是m-of-n地址 - 它与n个私钥关联,并且从该地址发送比特币需要至少m个密钥的签名。多重签名交易是从多重签名地址发送资金的交易。

交易字段

每个比特币交易都有几个字段:

  • 输入:比特币从哪个地址转移

  • 输出:转移到每个输出的地址和金额

  • 费用:支付给交易矿工的金额

  • Script_sig:交易的脚本签名

  • Script_type:交易类型

有2种主要类型的交易:

  • P2PKH:“支付到公钥哈希”:这是交易的执行方式。您要求发送方提供有效的签名(来自私钥)和公钥。交易输出脚本将使用签名和公钥,并通过一些加密函数检查是否与公钥哈希匹配,如果匹配,则资金将是可支配的。这种方法将公钥以哈希形式隐藏,以提供额外的安全性。

  • P2SH:“支付到脚本哈希”:交易的输出只是脚本(这意味着想要这笔钱的人发送一个脚本),如果使用特定参数执行将导致布尔值为true或false。如果矿工使用提供的参数运行输出脚本并结果为true,则资金将发送到您想要的输出。P2SH用于多重签名钱包,使输出脚本成为在接受交易之前检查多个签名的逻辑。P2SH也可用于允许任何人或没有人花费资金。如果P2SH交易的输出脚本只是1表示为true,则尝试在不提供参数的情况下花费输出将导致1,使尝试花费资金的任何人都可以花费。这也适用于返回0的脚本,使输出对任何人都不可花费。

闪电网络

该协议有助于向通道执行多个交易,并仅将最终状态发送到区块链以保存。 这提高了比特币区块链的速度(每秒仅允许7笔支付),并允许创建更难追踪的交易,因为通道是通过比特币区块链的节点创建的:

闪电网络的正常使用包括通过向相关基础区块链(第1层)承诺资金交易来打开支付通道,然后进行任意数量的闪电网络交易,更新通道资金的暂定分配而无需将其广播到区块链,最后通过广播解决交易的最终版本来关闭支付通道以分配通道资金。

请注意,通道的任一成员都可以随时停止并将通道的最终状态发送到区块链。

比特币隐私攻击

共同输入

理论上,一笔交易的输入可以属于不同的用户,但实际上这是不常见的,因为这需要额外的步骤。因此,很多时候可以假定同一笔交易中的2个输入地址属于同一所有者。

UTXO找零地址检测

UTXO表示未花费的交易输出(UTXOs)。在使用来自先前交易的输出作为输入的交易中,整个输出需要被花费(以避免双重花费攻击)。因此,如果意图是仅发送该输出的一部分资金到一个地址并保留另一部分资金,将会出现2个不同的输出:预期的输出和一个随机新的找零地址,剩余资金将保存在其中。

然后,观察者可以假设生成的新找零地址属于UTXO的所有者。

社交网络和论坛

一些人在互联网上的不同网站上提供有关他们比特币地址的数据。这使得很容易识别地址的所有者。

交易图

通过以图形方式表示交易,有可能以一定概率知道账户资金的去向。因此,可以了解与区块链中相关的用户的一些信息。

不必要的输入启发式

也称为“最佳找零启发式”。考虑这笔比特币交易。它有两个价值分别为2 BTC和3 BTC的输入以及价值为4 BTC和1 BTC的两个输出。

2 btc --> 4 btc
3 btc     1 btc

假设其中一个输出是找零,另一个输出是支付。有两种解释:支付输出要么是4 BTC输出,要么是1 BTC输出。但如果1 BTC输出是支付金额,那么3 BTC输入就是不必要的,因为钱包本可以只花费2 BTC输入并支付更低的矿工费用。这表明真正的支付输出是4 BTC,而1 BTC是找零输出。

这对于具有多个输入的交易是一个问题。修复此泄漏的一种方法是添加更多输入,直到找零输出高于任何输入,例如:

2 btc --> 4 btc
3 btc     6 btc
5 btc

强制地址重用

强制地址重用或激励地址重用是指对已在区块链上使用过的地址支付(通常是小额)比特币的对手。对手希望用户或其钱包软件将这些支付用作更大交易的输入,从而通过共同输入所有权启发式揭示其他地址。这些支付可以被理解为一种迫使地址所有者无意中重用地址的方式。

这种攻击有时被错误地称为尘埃攻击。

钱包的正确行为是不要花费已经落入已使用空地址的硬币。

其他区块链分析

  • 确切的支付金额:为了避免带有找零的交易,支付需要等于UTXO(这是非常不寻常的)。因此,没有找零地址的交易可能是同一用户之间的转账。

  • 整数金额:在交易中,如果输出之一是“整数金额”,那么很可能这是支付给将该“整数金额”作为价格的人,因此另一部分必须是剩余部分。

  • 钱包指纹识别:仔细的分析师有时可以推断出哪个软件创建了某个交易,因为许多不同的钱包软件并不总是以完全相同的方式创建交易。钱包指纹识别可用于检测找零输出,因为找零输出是使用相同钱包指纹花费的输出。

  • 金额和时间相关性:如果执行交易的人披露了交易的时间和/或金额,那么这很容易被发现。

流量分析

一些组织窃听您的流量可能会看到您在比特币网络中通信。 如果对手看到一个交易或区块从您的节点发出而之前没有进入,那么几乎可以确定该交易是由您进行的或该区块是由您挖掘的。由于涉及互联网连接,对手将能够将IP地址与发现的比特币信息联系起来。

无法窃听所有互联网流量但拥有大量比特币节点以便更接近源的攻击者可能能够知道宣布交易或区块的IP地址。 此外,一些钱包定期重新广播其未确认的交易,以便更有可能通过网络广泛传播并被挖掘。

其他攻击以查找地址所有者信息

匿名比特币

匿名获取比特币

  • 现金交易:使用现金购买比特币。

  • 现金替代品:购买礼品卡或类似物品,并在线交换它们为比特币。

  • 盗窃:理论上,另一种获取匿名比特币的方式是窃取它们。

混币服务

用户会将比特币发送到混币服务,服务会发送不同的比特币回给用户,扣除一定费用。理论上,观察区块链的对手将无法将进入和离开的交易联系起来。

然而,用户需要信任混币服务将比特币退还,并且不会保存有关接收和发送资金之间关系的日志。 还可以使用其他服务作为混币服务,例如比特币赌场,您可以在那里发送比特币,稍后取回。

CoinJoin

CoinJoin将不同用户的多个交易混合成一个,以使观察者更难找出哪个输入与哪个输出相关。 这提供了新的隐私级别,但是,某些 交易,其中某些输入和输出金额相关或与其他输入和输出非常不同仍然可以被外部观察者关联。

比特币区块链上可能的CoinJoin交易ID示例为402d3e1df685d1fdf82f36b220079c1bf44db227df2d676625ebcbee3f6cb22a和85378815f6ee170aa8c26694ee2df42b99cff7fa9357f073c1192fff1f540238。

PayJoin

在前一节讨论的CoinJoin类型可以通过检查具有相同价值的多个输出来轻松识别。

PayJoin(也称为支付到终点或P2EP)是两方之间的一种特殊类型的CoinJoin,其中一方支付另一方。然后,交易没有具有相同价值的多个输出,因此不会明显显示为具有相同输出的CoinJoin。考虑这个交易:

2 btc --> 3 btc
5 btc     4 btc

比特币隐私良好实践

钱包同步

比特币钱包必须以某种方式获取有关其余额和历史记录的信息。截至2018年底,最实用和私密的现有解决方案是使用完整节点钱包(最大程度上保护隐私)和客户端端区块过滤(非常好)。

  • 客户端端区块过滤: 客户端端区块过滤通过创建包含每个区块中每笔交易的所有地址的过滤器来工作。这些过滤器可以测试一个元素是否在集合中;虽然可能存在误报,但不存在漏报。轻量级钱包会下载区块链中每个区块的所有过滤器,并检查其自己的地址是否匹配。包含匹配项的区块将从点对点网络中完整下载,并且这些区块将用于获取钱包的历史记录和当前余额。

Tor

比特币网络使用点对点网络,这意味着其他节点可以了解您的IP地址。因此,建议您每次与比特币网络交互时都通过Tor连接。

避免地址重复使用

地址被多次使用对隐私非常有害,因为它将更多的区块链交易链接在一起,并证明它们是由同一实体创建的。使用比特币的最私密和安全的方式是向每个付款人发送一个全新的地址。收到的硬币花费后,该地址不应再次使用。此外,在发送比特币时应要求一个全新的比特币地址。所有良好的比特币钱包都有一个用户界面,以防止地址重复使用。

多笔交易

用多笔链上交易支付某人可以大大降低基于金额的隐私攻击的威力,例如金额相关性和整数金额。例如,如果用户想向某人支付5 BTC,并且不希望5 BTC的价值很容易被搜索到,那么他们可以发送两笔价值分别为2 BTC和3 BTC的交易,总共为5 BTC。

避免找零

避免找零是指仔细选择交易输入和输出,以完全不需要找零输出。没有找零输出对隐私非常有利,因为它破坏了找零检测启发式。

多个找零输出

如果避免找零不可行,则创建多个找零输出可以提高隐私。这也会破坏通常假定只有一个找零输出的找零检测启发式。由于此方法使用的区块空间比通常多,因此避免找零更可取。

门罗币

当门罗币开发时,它试图解决的迫切需求是完全匿名,在很大程度上,它填补了这一空白。

以太坊

Gas

Gas指的是衡量以太坊网络上执行特定操作所需的计算工作量的单位。Gas是成功进行以太坊交易所需的费用。

Gas价格以gwei表示,gwei本身是ETH的一个单位 - 每个gwei等于0.000000001 ETH(10的-9次方ETH)。例如,您可以说您的gas费用为1 gwei,而不是说您的gas费用为0.000000001 ether。'gwei'这个词本身意味着'吉博-韦',它等于1,000,000,000 wei。Wei本身是ETH的最小单位。

要计算交易将花费的gas,请阅读以下示例:

假设Jordan必须向Taylor支付1 ETH。在交易中,gas限制为21,000单位,基本费用为100 gwei。Jordan还包括10 gwei的小费。

使用上述公式,我们可以计算为21,000 * (100 + 10) = 2,310,000 gwei或0.00231 ETH。

当Jordan发送资金时,将从Jordan的账户中扣除1.00231 ETH。Taylor将收到1.0000 ETH。矿工将获得0.00021 ETH的小费。基本费用0.0021 ETH被销毁。

此外,Jordan还可以为交易设置一个最大费用(maxFeePerGas)。实际费用与最大费用之间的差额将退还给Jordan,即refund = max fee - (base fee + priority fee)。Jordan可以设置一个最大支付交易执行的金额,并在交易执行时不必担心支付超出基本费用的费用。

由于基本费用是根据对区块空间的需求由网络计算的,因此最后一个参数:maxFeePerGas有助于控制将支付的最大费用。

交易

请注意,在以太坊网络中,交易是在2个地址之间执行的,这些地址可以是用户或智能合约地址。 智能合约通过特殊的交易存储在分布式分类账中。

改变EVM状态的交易需要广播到整个网络。任何节点都可以广播要求在EVM上执行交易;发生这种情况后,矿工将执行交易并将结果状态更改传播到网络的其余部分。 交易需要费用,必须进行挖矿才能变得有效。

提交的交易包括以下信息:

  • recipient – 接收地址(如果是外部拥有的账户,则交易将转移价值。如果是合同账户,则交易将执行合同代码)

  • signature – 发件人的标识符。当发件人的私钥签署交易并确认发件人已授权此交易时,将生成此标识符

  • value – 从发件人转移到接收方的ETH金额(以WEI为单位,是ETH的一个单位)

  • data – 包含任意数据的可选字段

  • gasLimit – 交易可以消耗的最大gas单位数量。gas单位代表计算步骤

  • maxPriorityFeePerGas - 包含为矿工提供的小费的最大gas数量

  • maxFeePerGas - 为交易愿意支付的最大gas数量(包括baseFeePerGas和maxPriorityFeePerGas)

请注意,没有任何字段用于原始地址,这是因为这可以从签名中推断出来。

参考资料

有关更多攻击,请阅读

挖矿:挖矿是获取比特币最匿名的方式。这适用于独立挖矿,因为通常知道哈希者的IP地址。

类似于CoinJoin但更好,对于以太坊,您可以使用 (资金来自矿工,因此它只会出现在您的钱包中)。

完整节点: 完整节点下载包含比特币上发生的每笔的整个区块链。因此,监视用户的互联网连接的对手将无法了解用户感兴趣的交易或地址。

🔮
htARTE(HackTricks AWS红队专家)
订阅计划
官方PEASS & HackTricks周边产品
PEASS家族
NFTs
Discord群
电报群
@hacktricks_live
HackTricks
HackTricks Cloud
这里
https://en.bitcoin.it/wiki/Privacy
挖矿池
https://coinjoin.io/en
Tornado Cash
交易
https://en.wikipedia.org/wiki/Proof_of_stake
https://www.mycryptopedia.com/public-key-private-key-explained/
https://bitcoin.stackexchange.com/questions/3718/what-are-multi-signature-transactions
https://ethereum.org/en/developers/docs/transactions/
https://ethereum.org/en/developers/docs/gas/
https://en.bitcoin.it/wiki/Privacy