Pastejacking Attack Appends Malicious Terminal Commands To Your Clipboard (softpedia.com)
An anonymous reader writes: "It has been possible for a long time for developers to use CSS to append malicious content to the clipboard without a user noticing and thus fool them into executing unwanted terminal commands," writes Softpedia. "This type of attack is known as clipboard hijacking, and in most scenarios, is useless, except when the user copies something inside their terminal." Security researcher Dylan Ayrey published a new version of this attack last week, which uses only JavaScript as the attack medium, giving the attack more versatility and making it now easier to carry out. The attack is called Pastejacking and it uses Javascript to theoretically allow attackers to add their malicious code to the entire page to run commands behind a user's back when they paste anything inside the console. "The attack can be deadly if combined with tech support or phishing emails," writes Softpedia. "Users might think they're copying innocent text into their console, but in fact, they're running the crook's exploit for them."
This was *always* a mis-feature and it should simply be disabled at the browser level to permanently ignore.
Millennial hackers just don't try very hard.
Terminals/shells that support bracketed paste mode don't have this problem.
When you paste something, it won't execute until you press enter. This helps avoid issues with mistake pastes, and also issues wherein one accidentally copies a newline with the desired text (in this case, you can hit backspace to delete the newline, continue editing the command, and hit enter only when you're done).
There's a ZSH plugin that adds this functionality:
https://cirw.in/blog/bracketed-paste
I love zsh.
I know I shouldn't copy and paste into a terminal, but it is so convenient. I don't even need a malicious website to get myself into trouble. I just forget that I copied hundreds of lines right after I copied that filename that I wanted to use. And then boom!, lots of commands entered that who knows what will happen with.
I've occasionally looked, but never found a terminal to help with this. Probably because they shouldn't encourage my bad habit. But if it would just give me a pop up showing what I am about to paste that would help a bunch.
Subject: Unix virus
You have been attacked by the unix virus. Please forward this mail to everyone in your .mailrc and delete a bunch of files from $home
sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
I remember a kid in second grade who was caught pastejacking in second grade. Sent him away, and never came back. The school had to buy all new paste too.
The shepherds did so well protecting the flock that the sheep no longer believed that wolves existed.
If I ever paste anything into terminal I always paste it into a text editor first.
Then gosh help you if what you paste contains an exploit for your text editor. There's a vi exploit in one of the examples.
This is robust at least against the demo attacks given in the article.