Resources

People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!

Every known way to get references to windows, in javascript- 1351

Daniel BrainPosted 2 Years Ago
  • This article is a list of different ways to get window references. When doing client side security, getting a reference to a window is big way to cause havoc.
  • First, looking at the window. Using window.open() on both a new window and an existing window. Second, if you're inside of a popup window you can get a reference to the parent with window.opener(), even with a cross domain setup.
  • Next, we have iFrames! window.top can get the reference to the top level window when in an iFrame. window.frames shows all frames within a given window. Additionally, if it's named, then windows.frames['frameName'] can be used too.
  • A window object can be sent via a postMessage even in the cross domain case. If a window has the same domain as another window, you can reference globals on that window.
  • Most of these rules can be chained together as well. The author mentions that it's not always possible to get a reference to something. In particular, a cross-domain iframe or an iframe that opens a popup window.
  • Good article on a very esoteric JavaScript concept!