> In firefox running on X11, any script from any page can freely write to the primary selection, and that can be easily exploited to run arbitrary code on the user's machine. This is a problem with web browsers. They shall not run untrusted code from the internet. But we are now in the stage "oh, cool, i can access my USB from internet".
With Firefox on X11, any page can pastejack you anytime (middle button paste)
161–170 of 195 posts
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#162Earlier quoted context omitted.
I don’t care about middle-click paste, but having selection auto-copy is also implemented by terminal emulators like Putty on Windows, and I wouldn’t want to miss that. What’s problematic with the Firefox behavior is that content gets copied (pasted) that wasn’t selected by the user.
I don't think selection along is enough to copy in windows terminal or putty. You also need to right click once to trigger the copy. So the moment that triggers actual copy always requires human interaction.
Also in Mintty: https://mintty.github.io/mintty.1.html#%03Text%20selection,%...
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#163Earlier quoted context omitted.
I don’t care about middle-click paste, but having selection auto-copy is also implemented by terminal emulators like Putty on Windows, and I wouldn’t want to miss that. What’s problematic with the Firefox behavior is that content gets copied (pasted) that wasn’t selected by the user.
It's absolutely no different than if the actual HTML contained invisible text though. The patch here would not help security at all. Only using control-x control-e before pasting (so that it comes into a real editor, not directly in the terminal) can help.
Invisible text can add to what you selected, but it can’t replace it.
There’s also an argument to be made that invisible text shouldn’t be copied, though that’s harder to define precisely (you don’t want to copy “display: none”, but you want to copy scrolled-out content).
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#164The X “primary selection”/middle click paste behavior this takes advantage of is one of my least favorite Linux features and I have had it disabled for years, so I didn’t even know it had been changed/removed in Wayland. Having a single mouse button (that often has other functionality like autoscroll in Firefox) cause text highlighted in another app to paste in the focused app is super unintuitive to me, and caused a…
It's not a Linux feature. It's an X11 feature that is super intuitive if you've been using it for 30 years. Wayland tried to remove it but it has been begrudgingly allowed because of it's incredible usefulness since it cuts out all keyboard interaction.
Of course that means I also don't have a horse in the "What should middle click do race".
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#165Earlier quoted context omitted.
Windows has clipboard history
Oh, I missed that! I've been mostly on Linux since before Windows 10.
Poor API design and the inability for APIs like the clipboard to evolve are part of the reason why desktop Linux's security keeps falling behind other operating systems.
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#166The X “primary selection”/middle click paste behavior this takes advantage of is one of my least favorite Linux features and I have had it disabled for years, so I didn’t even know it had been changed/removed in Wayland. Having a single mouse button (that often has other functionality like autoscroll in Firefox) cause text highlighted in another app to paste in the focused app is super unintuitive to me, and caused a…
A colleague of mine once destroyed a customer's system with a middle mouse button fat finger. He was copying a listing all of the executables in various locations on the machine he'd created using ls -l, into a text document (logged in as root). Unfortunately, he accidentally middle-clicked while moving the mouse to the text editor, and it pasted everything into the shell. Since it was mostly symlinks in the standard…
One must be root to be able to do that.
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#167Earlier quoted context omitted.
> Additionally, the Wayland protocol carries an event identifier, so that the compositor can tie the clipboard request to a pointer/keyboard/touch event and take a better decision. That's actually not the case. There's a serial number that the client provides when they want to set the selection (that is, cut/copy)[0][1], but nothing when a client requests a paste[2][3]. I always thought this is weird; while yes, it's…
By "clipboard request", I meant "request to set the clipboard".
I also misinterpreted what this issue was about; my mental assumption of "pastejacking" is when a malicious app grabs the (possibly sensitive) clipboard contents without the user knowing about it (which the Wayland protocol doesn't protect against via a serial number in the request)... but that's the opposite of this issue. And you're right, in this case a compositor could absolutely reject Firefox's set_selection() request here since any serial passed to it would probably be out of date.
And correct me if I'm wrong, but IIRC wlroots does make an effort to check that the serial passed is current enough.
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#168Is there no link to a Firefox bug report for this, or am I just missing it?
I tried hard but could not find a relevant bug on Bugzilla, but that could be because security-related issues are typically kept under wraps until the details are safe to be publically revealed. At least that was the case for the one I submitted a few years ago; as the submitter, I can see it when I'm logged in, but it doesn't show up on anonymous searches.
If Mozilla's stance on this really is as described in the mailing list, I would very much like to add a dissenting opinion. This is clearly a security issue that needs addressing. If the clipboard buffer needs special protection, so does the primary selection buffer.
Whether most people like or dislike copy/pasting this way is irrelevant. Some people use it. The other browsers on X11 are properly protected. Even Edge on Linux gets it right. Firefox is the odd one out here and they should fix it.
Especially these days, where install instructions on web pages often look like this:
curl -o- https://example.com/trust/me/install.sh | sudo bash
EDIT: As per the author's GitHub issues, the bug report is indeed still hidden:https://bugzilla.mozilla.org/show_bug.cgi?id=1855345
https://github.com/turistu/odds-n-ends/issues/1#issuecomment...
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#169Earlier quoted context omitted.
Having two clipboards is a bad decision. Also, trackpad doesn't have middle button.
Yep; I often wish there were three buffers! All trackpads I've tried support middle click via a three-finger tap.
https://superuser.com/questions/90257/what-is-the-difference...
https://www.gnu.org/software/emacs/manual/html_node/emacs/Se...
Re: With Firefox on X11, any page can pastejack you anytime (middle button paste)
#170The X “primary selection”/middle click paste behavior this takes advantage of is one of my least favorite Linux features and I have had it disabled for years, so I didn’t even know it had been changed/removed in Wayland. Having a single mouse button (that often has other functionality like autoscroll in Firefox) cause text highlighted in another app to paste in the focused app is super unintuitive to me, and caused a…
A colleague of mine once destroyed a customer's system with a middle mouse button fat finger. He was copying a listing all of the executables in various locations on the machine he'd created using ls -l, into a text document (logged in as root). Unfortunately, he accidentally middle-clicked while moving the mouse to the text editor, and it pasted everything into the shell. Since it was mostly symlinks in the standard…