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.
If people are running shit without checking to see what's actually input first, then I dont feel bad.
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.
So, this hack uses document.execCommand('copy')
It doesn't work in Safari nor Chrome. What browser DOES it work in?
It warns of commands containing newlines which seems to be the obvious solution to this. Having to confirm it when you actually want pasted commands to automatically execute is annoying, but better than the alternative.
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
Reminds me a bit of a hack we used to do in the late 80s/early 90s on the old terminals at uni. For a few seconds during login on the old unix machines, your terminal was world writable. There was an escape sequence that let you bind key sequences to keys (like macros I guess). So we'd sit there watching for that login and blap the terminal with macros, and then take control from there.
Fortunately it was a more innocent time, so we'd just use it to spam academics with frank zappa lyrics and stupid shit like that, although one guy did write a sort of shell virus that got out of hand *very* quickly.
Excuse the Unicode crap in my posts. That's an apostrophe, and slashdot is busted.
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.
Copy and paste into an empty file first. Then chmod to allow running.
Allowing Javascript access to the clipboard was known to be a stupid idea back in the days of Internet Explorer 4, along with allowing Javascript to create bookmarks and other such functionality for overriding the user.
Which moronic browser has still not fixed this gaping security hole?
Terminals/shells that support bracketed paste mode don't have this problem.
Which should be the default behaviour for all Terminals.
We suffer more in our imagination than in reality. - Seneca
"It has been possible for a long time
"The attack can be deadly
Fucking A. Fuddot.
Why not a story about how to post a comment you have to enable your browser to access...
www.googletagservices.com
trackerapi.truste.com
tag.crsspxl.com
sourceforgemedia-computing.t.domdex.com
s.ntv.io
rpxnow.com
partner.googleadservices.com
consent.truste.com
consent-st.truste.com
cdn.taboola.com
cdn-social.janrain.com
api.stacksocial.com
analytics.slashdotmedia.com
ads.pro-market.net
a.fsdn.com
I mean everybody trusts all that shit of course. Obviously. Dicks.
If you have common sense enough to use a console you have common sense enough to read what you paste before you press Enter. Humoring the FUD story though, you can paste shady links into a text file first THEN read them in case you paste a ^M.
Dicks.
Did I miss something about making this attack 'deadly?' Is my pacemaker vulnerable to this? Just in case, I have disconnected my mouse from my pacemaker just to be sure. No right-click pasting for me!
I have noticed that every sometimes I will see a copy or paste text when I am on FB on my android phone. Ever see this happen to you?