To be really dangerous, I think this would need to defeat client-side cache strategies. If the browser caches each resource, the server-side reads wouldn't account for repeated characters or overall length with perfect accuracy. Consider palindromes like "racecar." This would still put many, if not most, passwords within guessable striking distance, for anyone able to intercept plain-text HTTP traffic, between Alice…
The server just returns a 400, causing the browser to no longer cache it.
Show HN: A CSS Keylogger
111–120 of 173 posts
Re: Show HN: A CSS Keylogger
#112Couldn't Content Security Policy (CSP) [1] be used to mitigate this attack? [1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
It actually can't. Instagram does use this protect java-script injection from extensions, but clearly injecting CSS is allowed.
Re: Show HN: A CSS Keylogger
#113Earlier quoted context omitted.
If you use React, updating the value on every change is a very common pattern.
So with frameworks like React/Vue, every change to a field generates a request? Or are those handled locally in the shadow dom?
Basically, the value of the input is tied to a "state engine" that acts as a single source of truth and when the user types in the input you'll update the state so that the rest of the application can know what's going on in the form without accessing the DOM.
The state engine is a fancy word for a variable that has a special setter function so that the changes can be reflected globally.
Re: Show HN: A CSS Keylogger
#114Re: Show HN: A CSS Keylogger
#115Earlier quoted context omitted.
I think it would work against password managers like LastPass which fill in passwords using JS.
It would only give you the last character of the password though. You can use CSS selectors to check the start [value^=a] and anything in the middle [value*=a] as well though which can be revealing I imagine.
In something like 13000 selectors you could easily get the first 2, last 2, and any characters in the middle that are in the password making targeted attacks significantly easier. (This is based on very-very rough napkin math assuming an ~80 character dictionary for upper/lower, numbers, and "symbols" since I didn't want to count)
That's a lot, but it's well within the realm of possibility (it looks like that would end up as about a 1mb css file)
Re: Show HN: A CSS Keylogger
#116Earlier quoted context omitted.
Is there even a use case where CSS needs to read any field's value? (Checkboxes and radio buttons have :checked.)
Something like conditional formatting maybe? Eg. make negative values red? Make an input field red when it contains an invalid character?
Re: Show HN: A CSS Keylogger
#117Earlier quoted context omitted.
Where does 41000 come from?
It's 8! (8 factorial) which is 40320. This is 127,286,426,869 (~128bn) times smaller than 92^8. Edit: Note that if you have a repeated character in your 8 charcter password then the number of permutations of the set of 8 (7 distinct) characters is further halved to 20,160.
Re: Show HN: A CSS Keylogger
#118Earlier quoted context omitted.
Assuming the server receives the requests in the same order as the requests were sent, which on mobile networks isn't anywhere near so certain.
It'd be simple enough to add an 'order' identifier (request timestamp, etc) to the requests. Edit: nm. My mistake, not as easy as that using only css!
Re: Show HN: A CSS Keylogger
#119Re: Show HN: A CSS Keylogger
#120Earlier quoted context omitted.
Not an efficient keylogger, however, if you know the pressed keys, you can just generate permutations ordered using probabilities, and that would be a lot faster than brute force. The real deal here is, it depends on some js code updating the dom for each key press, which is BAAAD. Not an useless keylogger, because it reminds a vulnerability product of choosing a bad decision.
> it depends on some js code updating the dom for each key press Like React with JSX?