A timing attack with CSS selectors and JavaScript
blog.sheddow.xyz
blog.sheddow.xyz
No. Actually I have never seen a website do that. What sites do that? What is the actual use of grabbing an element that has an ID that matches the URL hash?
And this attack will only work on those sites.
This is just one more variation of the best practice: don't trust user/client supplied data.
Edit: Though academically I actually find how this was implemented to be really interesting. I'm just not sure what uses it would have in the wild.
Well normally when you load such a page the browser will scroll down to that element. Perhaps this JavaScript wants to do something like highlight the section or extract the heading to send to some analytics?
I'm assuming that using X-Frame-Options to prevent the page from appearing in a frame prevents this type of attack.
That works out of the box, it's a native HTML/browser feature.
Why do you pass location.hash to jQuery?
In scenarios where you can’t redesign the html structure or css to give the element more padding, you pretty much have to use javascript to get the window-x position of the element.
I only read it on my phone without following along but if that’s the case then the text seems to hint at potentially brute forcing the authentication tokens? At least judging from the variable names.
Ha! Browsers do that by default. On page load, they scroll to an anchor tag with the id of the URL fragment.
I could imagine some JS-driven dynamic loading/scrolling using the same convention.
Edit: Also, word of advise. Lose the "Ha!"... it could potentially make your comment come across as arrogant.
Edit 2: Leaving my original comment intact even though I was wrong. Apparently my knowledge is out of date on this one. Thank you "re" for correcting me.
Fragment identifiers can refer to elements by ID; this has been supported by browsers for over a decade and is the preferred way to specify a target: https://www.w3.org/TR/html4/struct/links.html#h-12.2.3
In fact, `<a name="">` is now considered obsolete: https://www.w3.org/TR/html5/obsolete.html#obsolete
Edit: I see how this works. It will allow you to exfiltrate data from 3rd party websites that pass the URL hash into jQuery. An interesting idea but limited in scope.
How are you getting a successful request and a page render for the 3rd party site, but not able to query the 3rd party DOM?
If you phished someone, there's probably better things you can do to lead to a fuller compromise.
May be it is time for browsers to disable iframes by default and ask the end user if they want to run them via the standard browser confirmation mechanisms site by site.
it will show a checkered pattern with a link to open the frame in another window. so you don't even have to whitelist sites or anything. if you care about the frame, like for a embedded video, just open it on its own tab with a single click
That said, uMatrix, from what I remember, uses the webRequest api which does work from urls. So if you know JS, you can always create an extension and add your own filter.
See https://security.googleblog.com/2018/07/mitigating-spectre-w...