The Hive
GitHubLinkedInEmail
  • ๐Ÿ Home
  • ๐ŸŒRECON
    • ๐Ÿ“กPassive (OSINT)
      • โฉMetadata
      • โฉSocial Platforms
        • Email
        • Tumbler
        • Redit
        • Github
        • Tinder
        • TikTok
        • Snapchat
        • Instagram
        • Facebook
        • Twitter
        • Google
        • LinkedIn
    • ๐Ÿ“กActive
      • โฉHost Discovery / Network Mapping
      • โฉnmap cheat sheet
      • โฉmasscan cheat sheet
    • ๐Ÿ“กWeb Recon
      • โฉWeb Server Discovery
      • โฉHidden Hosts
      • โฉDirectories & Subdomains
      • โฉSSL Certs
      • โฉCMS
      • โฉWAF Detection
    • ๐Ÿ“กFirewall Evasion
  • ๐Ÿ“—Web Attacks
    • ๐ŸŸขServer Side
      • ๐ŸŸฉAuthentication Mechanisms
      • ๐ŸŸฉAccess Control (Authorization)
      • ๐ŸŸฉDirectory Traversal
      • ๐ŸŸฉOS Command Injection
      • ๐ŸŸฉServer-Side Request Forgery (SSRF)
      • ๐ŸŸฉXML External Entity (XXE) Injection
      • ๐ŸŸฉFile Upload
      • ๐Ÿ”งSQL Injection
      • ๐ŸŸฉInformation Disclosure
      • ๐ŸŸฉBusiness Logic
    • ๐ŸŸขClient Side
      • ๐ŸŸฉCross-site request forgery (CSRF)
      • ๐Ÿ”งCross-site scripting (XSS)
  • ๐Ÿ“’Network attacks
    • ๐ŸŸกNetwork Services
      • ๐ŸŸจBrute Force
      • ๐ŸŸจDNS
      • ๐ŸŸจIPv6
      • ๐ŸŸจFTP
      • ๐ŸŸจSSH
      • ๐ŸŸจSMB
      • ๐ŸŸจSNMP
      • ๐ŸŸจSMTP
      • ๐ŸŸจPOP3
      • ๐ŸŸจIMAP
      • ๐ŸŸจMSSQL
      • ๐ŸŸจMySQL
      • ๐ŸŸจMSRPC / RPCbind
      • ๐ŸŸจLDAP
      • ๐ŸŸจNTP
      • ๐ŸŸจNFS
      • ๐ŸŸจTelnet
      • ๐ŸŸจWebDAV
      • ๐ŸŸจRDP
      • ๐ŸŸจRSIP
      • ๐ŸŸจRlogin
      • ๐ŸŸจVPNs
      • ๐ŸŸจEcho
      • ๐Ÿ”งRTP
      • ๐Ÿ”งVOIP
        • SIP
    • ๐ŸŸกNetwork Devices
      • ๐ŸŸจIPv6 Attacks
        • Neighbor Impersonation
        • Router Advertisement Flooding
      • ๐ŸŸจSwitch Attacks
        • Cisco Exploitation
        • STP Spoofing
        • VLAN Hopping
        • MAC Flood
      • ๐ŸŸจRouter Attacks
        • Router Exploitation
        • HSRP Hijacking
        • ๐Ÿ”งRIP Spoofing
        • ๐Ÿ”งOSPF Attacks
        • ๐Ÿ”งVRRP MitM
      • ๐ŸŸจNAC Bypass
        • Captive Portal
        • 802.1X / EAP Bypass
      • ๐ŸŸจPrinter Exploitation
    • ๐ŸŸกMITM & Poisoning
      • ๐ŸŸจBettercap
      • ๐ŸŸจHTTPS Downgrade / HSTS Bypass
      • ๐ŸŸจSession Hijackings
      • ๐ŸŸจMalicious Update
      • ๐ŸŸจRDP Downgrade
      • ๐ŸŸจDNS Spoofing
      • ๐ŸŸจNTP Spoofing
      • ๐ŸŸจARP Spoofing
      • ๐ŸŸจDHCP Poisoning
      • ๐ŸŸจDHCPv6 Spoofing
      • ๐ŸŸจSSDP Spoofing
      • ๐ŸŸจWSUS Spoofing
      • ๐ŸŸจADIDNS Poisoning
      • ๐ŸŸจWPAD Abuse
    • ๐ŸŸกWireless Attacks
      • ๐ŸŸจProtocol Concepts
      • ๐ŸŸจBasics
      • ๐ŸŸจAttacks
    • ๐ŸŸกSniffing
      • ๐ŸŸจWireshark
      • ๐ŸŸจtcpdump
    • ๐ŸŸกDenial of Service
  • ๐Ÿ“•Red Team
    • ๐Ÿ”ดWindows
      • โญ•Security Concepts
        • Windows Security Components
        • Active Directory Components
        • Kerberos
        • Loggon Sessions and Access Tokens
        • Permissions and Access Control
        • Windows Registry
        • Object Management
      • โญ•Physical Attack
      • โญ•Enumeration
      • โญ•Privilege Escalation
        • DLL Hijacking
          • Phantom DLL Hijacking / Replacement
          • Search Order Hijacking ( Preloading )
          • DLL Side-Loading
        • Service Misconfigurations
          • Weak Registry Permissions
          • Insecure Service Executables
          • Insecure Permission
          • Unquoted Service Path
        • Creating a New Service (admin to system)
        • Registry
          • AlwaysInstallElevated
          • AutoRuns
        • Scheduled Tasks
        • Mass Roll-outs
        • Startup Apps
        • Installed Applications
        • Loopback Services
        • Insecure GUI APPs
        • Potatos
        • Printspoofer / SEImpersonate
        • PSEXEC (admin to system)
      • โญ•Credential Dumping
      • โญ•Persistence
        • Invisible Account Forger
        • Add User
        • Scheduled Tasks
        • Run Registry Keys
        • Logon Scripts
        • Screensavers Hijack
        • Powershell Profiles & Modules
        • Service Creation/Modification
        • Shortcut Modification
        • Startup Folder
        • RDP backdoors
        • COM Hijacking
    • ๐Ÿ”ดActive Directory
      • โญ•Domain Enumeration
      • โญ•Tools & Frameworks
        • Evil-WinRM
        • CME cheat sheet
        • SharpSploit
        • impacket cheat sheet
        • DeathStar
      • โญ•Exploitation
        • LLMNR Poisoning
        • SMB/NTLM Relay
        • DNS Takeover + LDAP Relay
        • Cracking Hashes
        • Password spraying
        • ADCS + PetitPotam NTLM Relay
        • EternalBlue
        • ZeroLogon
        • MS Exchange ProxyShell
        • MS Exchange ProxyLogon
        • Java JBOSS
      • โญ•Privilege Escalation
        • Token Impersonation
        • DNS Admins
        • AD CS Abuse
        • ACL Abuse
          • GenericAll
          • Write Property
          • Self-membership
          • ForceChangePassword
          • Managed Security Groups
          • Exchange Windows Permissions
        • Group Policy Objects (GPOs)
        • Custom SSPs
        • PrintNightmare
      • โญ•Lateral Movement
        • RDP Password Decryption
        • RDP Session Hijacking
        • headless RDP with SharpRDP
        • Domain Shares
        • SCF File Attacks
        • Pass the Hash / Password
        • Overpass the Hash / Pass the Key
        • Pass The Ticket
        • Kerberosting / AS-REP Rosting
        • Kerberos Delegation
      • โญ•Credential Dumping
        • CredSSP / TSPKG
        • Wdigest Clear Text
        • DPAPI secrets
        • SAM & Registry
        • NTDS.dit & vshadow
        • comsvcs.dll
        • Meterpreter
        • Procdump & LSASS
        • AD User Comments
        • SYSVOL & Group Policy Preferences
        • LAPS Passwords
        • GSMA Passwords
        • HiveNightmare
        • Mimikatz Cheat sheet
        • Other Tools / Techniques
      • โญ•Persistence
        • Certificates
        • DCSync
        • DCShadow
        • Silver Ticket
        • Golden Ticket
        • Skeleton Key
        • WMI
        • PowerShell Remoting
        • Remote Registry
        • Rights Abuse
        • AdminSDHolder
        • DSRM
        • Kerberos Checksum Validation ( MS14-068 )
    • ๐Ÿ”ดLinux
      • โญ•Physical Attacks
      • โญ•Enumeration
      • โญ•Privilege Escalation
        • SUID / SGID abuse
        • /etc/shadow & /etc/passwd
        • cron/crontab abuse
        • Sudo Abuse
        • Capabilities Abuse
        • Environment Variables
          • LD_LIBRARY_PATH
          • LD_PRELOAD
        • Shared Object Injection
        • NFS
        • man CE Pager Argument
        • MySQL UDF
        • UDEVD
        • STDIN/STDOUT
        • Unix Socket Exploitation
        • Dirty Pipe
        • Docker
          • SUID Docker
      • โญ•Lateral Movement
        • Infecting Running Processes
        • VIM Config File Keylogger
        • SSH Hijacking
        • Samba Secrets to Domain Admin
        • Hiding Processes
        • Simple User-mode Rootkits
        • Vino VNC Server
      • โญ•Credential Dumping
        • Swap Dump
        • mimipinguin
        • unshadow
        • 3snake
      • โญ•Persistence
        • Startup User File Backdoor
        • PHP Backdoor
        • Apache mod_rootme
        • Startup Service Backdoor
        • xdg Backdoor
        • rootbash SUID
        • apt Backdoor
        • Driver Backdoor
        • Core Pattern
        • dash Backdoor
        • Creating an SUID Binary
        • Systemd netcat bind shell
        • Xinetd UDP portnock
        • openSSL reverse shell
        • motd Backdoor
        • Auth Log Backdoor
        • RSYSLOG Backdoor
        • sshd Backdoor
        • VIM Config Backdoor
        • .bashrc Backdoor
        • Adding a Root user
        • Crontab Reverse Shell
        • SSH persistence password-less
      • โญ•Covering Tracks
    • ๐Ÿ”ดCommand & Control (C2)
      • โญ•Cobalt Strike
      • โญ•Metasploit
      • โญ•Empire & Starkiller
      • โญ•Covenant
    • ๐Ÿ”ดShells and Payloads
      • โญ•Shell Escape / Interactive Shell
      • โญ•LOL Binaries
      • โญ•msfvenom
      • โญ•SharpShooter & Ivy
      • โญ•Other Payloads
    • ๐Ÿ”ดPayload Delivery
      • โญ•Powershell Reflective DLL Load
      • โญ•HTML Smuggling
      • โญ•Office Macros
      • โญ•DDE Auto - Word/Excel
      • โญ•.SLK Excel
      • โญ•XLM Macro 4.0
      • โญ•LNK
      • โญ•embedded OLE + LNK objects
      • โญ•JScript
      • โญ•HTA
      • โญ•VBS
      • โญ•VBA
      • โญ•RTF
      • โญ•REG
      • โญ•MSI / MSIEXEC
      • โญ•IQY
      • โญ•CHM / HHC
      • โญ•SCR
    • ๐Ÿ”ดPivoting
      • โญ•SSH Forwarding
      • โญ•Socat Stealth Port Forward
      • โญ•Socat Reverse Shell Relay
      • โญ•HTTP Tunneling
      • โญ•ICMP Tunneling
      • โญ•DNS Tunneling
      • โญ•Metasploit Pivoting
      • โญ•Cobalt Strike Pivoteing
      • โญ•VPN Tunneling
      • โญ•Other Tools
    • ๐Ÿ”ดExfiltration / File Transfer
      • โญ•Encode / Decode Files
      • โญ•TCP / UDP
      • โญ•DNS
      • โญ•SSH
      • โญ•ICMP
      • โญ•SMB
      • โญ•FTP
      • โญ•HTTP
      • โญ•Other Methods
    • ๐Ÿ”ดPassword Attacks
      • โญ•Online Attacks
      • โญ•Offline Attack
      • โญ•Word List
      • โญ•Cheat Sheet
    • ๐Ÿ”ดDefense Evasion
      • โญ•Basic Tricks
      • ๐Ÿ”งPowershell Tricks
      • โญ•Disabling Defenses
      • โญ•UAC Bypass
      • โญ•Process Migration
      • โญ•Dechaining Macros
      • โญ•VBA Sandbox Evasion
      • โญ•AMSI Bypass
      • โญ•SRP & AppLocker Bypass
      • โญ•GPO Bypass
  • ๐Ÿ“˜Blue Team
    • ๐Ÿ”ตThreat Modeling / Hunting / Intelligence
    • ๐Ÿ”ตLinux Hardening
      • ๐Ÿ”นOS Security
        • Update Strategy
        • Service Management
        • Physical Security
        • Grub Hardening
        • Kernel Parameters
        • Process Isolation
      • ๐Ÿ”นAccounts & Passwords
        • Users & Groups
        • Password Security & Sudoers
      • ๐Ÿ”นAccess Control & Ownership
      • ๐Ÿ”นFile System Security
      • ๐Ÿ”นIntegrity Check
      • ๐Ÿ”นSandboxing
      • ๐Ÿ”นNetwork
      • ๐Ÿ”นiptables
        • Rule Sets
      • ๐Ÿ”นService Hardening
        • BIND9
        • vsftpd
        • Nginx
        • Apache
        • SSH
      • ๐Ÿ”นSystem Audit
      • ๐Ÿ”นLogging
        • auditd
      • ๐Ÿ”นEncryption
    • ๐Ÿ”ตSecurity Architecture
      • ๐Ÿ”นLayered Security
  • ๐ŸŸชPurple Teaming
    • ๐ŸŸฃAdversary Emulation
  • ๐ŸŸงprogramming
    • ๐ŸŸ C Programming
      • ๐Ÿ”ธBasic Structure
      • ๐Ÿ”ธGCC Compiler
      • ๐Ÿ”ธPreprocessors
      • ๐Ÿ”ธData Types
      • ๐Ÿ”ธType Qualifiers
      • ๐Ÿ”ธPointers
      • ๐Ÿ”ธDynamic Memory Allocation
      • ๐Ÿ”ธLoops
      • ๐Ÿ”ธConditional Statements
      • ๐Ÿ”ธFunctions
      • ๐Ÿ”ธInput / Output
      • ๐Ÿ”ธMacros
      • ๐Ÿ”ธFiles
      • ๐Ÿ”ธStrings Manipulation
      • ๐Ÿ”ธBit Manipulation
      • ๐Ÿ”ธData Structures
        • Arrays
        • Structures
        • Unions
      • ๐Ÿ”ธAbstract Data Types
        • Stack
        • Queue
        • Linked List
          • Singly Linked List
          • Doubly Linked List
      • ๐Ÿ”ธLibraries & Linking
      • ๐Ÿ”ธError Recovery
    • ๐Ÿ”งAssembly ( NASM )
      • Intel IA-32 Environment
      • Basic Structure
      • Variables and Data Types
      • Most-used Instructions
      • input / output
  • ๐ŸŸซMiscellaneous
    • ๐ŸŸคGNU Screen / tmux
    • ๐ŸŸคSSH Tricks
    • ๐ŸŸคCats
      • netcat
      • ncat
      • pwncat
      • socat
      • ๐Ÿ”งpowercat
    • ๐ŸŸคCurl
    • ๐ŸŸคCross-compiling Binaries
Powered by GitBook
On this page
  • HTTPS
  • HTTPS Downgrade Attack
  • SSLStrip
  • Ettercap SSLStrip Plugin
  • Bettercap SSLStrip
  • HSTS
  • HSTS Bypass
  • Bettercap SSLStrip
  1. Network attacks
  2. MITM & Poisoning

HTTPS Downgrade / HSTS Bypass

PreviousBettercapNextSession Hijackings

Last updated 2 years ago

HTTPS

HTTPS or HTTP over SSL is relied upon as a critical network technology for many organizations, used by web browsers and many other applications to protect the confidentiality, integrity, and authenticity of data. Certificate validation for HTTPS has significantly improved in web browsers in the past few years, where earlier browsers would make it too simple for an uninformed user to accept a certificate warning without understanding the impact of doing so.

Modern web browsers such as Firefox demonstrate a significant warning when a certificate is invalid for any reason, as shown on this slide. To bypass this warning and continue with the invalid certificate, the user must click through five options before continuing.

HTTPS Downgrade Attack

SSLStrip

Instead of using an invalid certificate and tricking the user into terminating the SSL session with the attacker, Sslstrip avoids any certificate warnings by rewriting all HTTP traffic to remove references to HTTPS. Sslstrip proxies all traffic intended to use SSL to the legitimate SSL server, but only responds with HTTP traffic to the victim, allowing the attacker to access all content while logging activity such as POST statements. Sslstrip also uses some clever tricks to assuage user concerns about seeing their traffic sent over HTTP instead of HTTPS.

Sslstrip takes advantage of a common flaw in HTTPS websites: Many users start with a plain HTTP request, which is later redirected to HTTPS by the server. Consider, for example, logging in to a Gmail account. Very few users will enter "https://www.gmail.com" in the web browser, instead relying on Gmail to redirect HTTP traffic to HTTPS. However, since the user is relying on a weak protocol (HTTP) to redirect them, the security of a stronger protocol (HTTPS) is threatened.

Sslstrip does not allow an attacker to eavesdrop on activity sent exclusively via an HTTPS server without being redirected from an HTTP site.

turn on IP forwarding

echo 1 >/proc/sys/net/ipv4/ip_forward

redirect all HTTP (tcp 80) traffic to the sslstrip process listening on port 8080.

iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8080

start sslstrip listening on port 8080

sslstrip -l 8080

become MitM through ARP spoofing with ettercap

ettercap -TqM arp:remote /10.10.10.1254// /10.10.10.1-254//

monitor sslstrip.log or watch ettercap for passwords

tail -f sslstrip.log

Ettercap SSLStrip Plugin

ettercap -TqM arp:remote -P sslstrip /172.16.0.1// /172.16.0.11//

Bettercap SSLStrip

http.proxy on/off
# enable SSL strip attack
set http.proxy.sslstrip true/false

https.proxy on/off
# enable SSL strip attack
set https.proxy.sslstrip true/false

HSTS

To address the prevalent exposure to Sslstrip attacks, the IETF introduced RFC 6797 (https://tools.ietf.org/html/rfc6797), which introduced the HTTP Strict-Transport-Security (HSTS) header option for websites. When the Strict-Transport-Security header is set on any response from a website, the browser records that the server expects all activity with the server to be transmitted over HTTPS.

The HSTS option partially mitigates Sslstrip attacks. If the victim previously visited a website that set the HSTS header and an attacker attempts to rewrite links and content to remove the https:// prefix, the browser refuses to visit the site over HTTP. In addition, sites marked as using HSTS do not show users certificate warnings with an option to continue the transaction; instead, the browser indicates an error and refuses to communicate with the HTTPS site until the certificate issue has been resolved (also eliminating the attacker's option to mount SSL MitM attacks against an HSTS site).

HSTS Bypass

browsers match the hostname of the server requested to the list of sites that use HSTS. If the hostname of the requested URL matches a hostname known to use HSTS, the browser refuses to load the content if the URL is rewritten by Sslstrip as an HTTP link (or display a certificate error with a continue option if there is a certificate error).

when an initial page is loaded over HTTP, an attacker can rewrite links to strip the HTTPS links, and it can change the requested hostnames as well. In the example shown on this page, the victim starts the browser by visiting http://www.kickstarter.com. The Kickstarter website returns content and links over HTTP, which the attacker modifies in two ways: First, HTTPS links are rewritten as HTTP links, and, second, the hostname in HTTPS links is changed slightly, such as adding another "w" in "www" ("www" to "wwww") or any other modification that changes the hostname.

If the victim clicks a modified link (https://www.facebook.com from Kickstarter is modified by Sslstrip2 to be http://wwww.facebook.com), the request is automatically forwarded to the upstream site as https://www.facebook.com, but the content is delivered to the victim downstream over HTTP (again, rewriting links and hostnames to avoid HTTPS and HSTS policies). The victim's browser never raises an error about an insecure site because the HSTS policies are never matched due to modified hostnames observed by the victim.

A new twist on this attack was released by Jose Selva. He demonstrated spoofing NTP traffic to force the HSTS record to be expired by the victim browser.

Bettercap SSLStrip

(for older versions)

bettercap --proxy -T 1172.16.0.186 -P POST

(for newer versions)

bettercap
ยป hstshijack/hstshijack
๐Ÿ“’
๐ŸŸก
๐ŸŸจ
How to Decrypt HTTPS Traffic with bettercap on Linux | ITIGICITIGIC | Technical How-tos, Tips, and Tricks
Logo