Hacker News new | ask | show | jobs
by polpo 972 days ago
There are guardrails around access to the clipboard (and the post talks about the circumstances around it) but this exploit takes advantage of the fact that simply selecting text on X11 puts it in the primary selection buffer. The code just tells Firefox to select the text.
1 comments

Not that it matters, but it does not really put it into a buffer at least not in the sense that there is a place within X11 that is storing your selection. I think that when you paste the primary selection. X11 directs your application to the application that last selected something and you ask it for the selected bit in a specific (usually text) format.

More on topic, this works fine within the trusted green zone of local desktop applications. but the browser is(or should be) a high security zone. with a really tricky security policy. which to paraphrase would be "Allow passing information to the rest of the os. but only as a result of a direct user request." You don't really want to disallow the browser to script selecting anything, this is useful for editors. but you probably want to maintain a flag on that selection as to if it was done by the user or not.

Well there is my useless pedantry for the day done. My apologies and thank you for letting me get that off my chest.

So in X11 if you select something then close the application then middle click paste into another application nothing will happen?
There are "clipboard managers" that will internally copy the last copied thing as best it can from the clipboard owner, and then when the application exits, will mark its copy as the clipboard owner going forward. If you aren't running a clipboard manager, then yes, nothing will happen.
Yep.

Lose selection === unable to copy. And it's at all times up to source app to decide what it will allow to be copied.

Some programs (such as xterm) will also use "cut buffers" (in addition to the primary selection, which is what is usually used for the middle button paste) which are retained even if the program is terminated. (Cut buffers are properties of the root window.)
The same thing happens with normal ctrl c + ctrl v. One of the oddities of the Linux desktop of X and Wayland is that for some reason the display server is also in charge of letting people use the clipboard instead of it being done by a dedicated clipboard service.
Correct