You cannot trust things you copy and paste from the Web - Naked Security

soccer97

Level 11
Thread author
Verified
May 22, 2014
517
Sophos said:
Put away your wget and curl, your SOAP clients and WSDLs, WebDAV servers, REST APIs and JSON callbacks; when it comes to moving data off websites and on to your computer the sticky stuff that greases the wheels is copy and paste.

This side of haptic gloves, Ctrl+C and Ctrl+V is as close as we can get to reaching out and grabbing something off the web. It’s the cyber-grab you cyber-learn in your cyber-infancy and never cyber-forget because you endlessly cyber-repeat it.

Repetition teaches us that what goes in to our hand when we Ctrl+C (grab something) comes out of our hand when we Ctrl+V (let it go).

But what if it didn’t?

What if you reached out to grab one apple but when you opened your hand you had a pear? Or a piranha?

Pastejacking with Javascript
Javascript is a programming language that can be embedded into HTML web pages and, perhaps more than any other technology, it’s what turned the web from a collection of documents you could read into a collection of applications you can use.

It can’t break out from your browser and put things on your computer, but within the sandboxed confines of a web page it can access all sorts of powerful functionality that makes possible everything from Nyan Cat to Gmail (and, when you’re all nyaned-out, Chrome Experiments.)

With your permission it can trigger push notifications and geolocation, and without your permission Javascript can store megabytes of data in your browser’s cache, open windows, move things around the page, draw things on virtual canvases, log your keystrokes and track your mouse.

And, thanks to a function called execCommand('copy') it can paste cyber-pirhanas to your clipboard too.

An excellent demonstration of how to do this and why it’s a bad idea has been put together by hacker Dylan Ayrey on Github and his personal site security.love.

In the demo, users are invited to copy the text echo "not evil" and witness with horror as what they actually paste is the cruelly different echo "evil"\n.

The execCommand('copy') command that performs this magic has to have a trigger, known as an ‘event’ to run, so Ayrey’s code uses the keydown event which happens to be triggered when you use the keyboard shortcut for Ctrl+C. The code then waits 0.8 seconds and switches out the text from your clipboard.

The snippets of text in the example aren’t just words, they’re valid computer commands that can be run inside a terminal window (that mysterious, featureless black window with white text that ‘power users’ never see and real geeks use to get work done).

The \n on the end of echo "evil"\n is a newline and if you type a newline into a terminal window it will run the preceding command immediately.

In other words Ayrey has offered you something that won’t run until you tell it to and then replaced it behind your back with something else that will run as soon as you paste it.

Luckily for anyone using Ayrey’s example it’s a benign command that ends up getting run, but of course it doesn’t have to be; an attacker could just as easily make you think you’re copying something safe and replace it with a command that deletes your home directory and steals your password file.

Due to JavaScript, CSS and JS can contain HTML. Combined they can store extra things in your browser like keystroke loggers. location data, push notifications, potentially executables.


Basically from what I understand, that when it is no longer in the confines of a browser, it doesn't have that sandbox type protection. The article provides more info and more advanced users may be able to expound on the vulnerability this could pose. I believe it may be particularly dangerous for mobile devices.


Source:

Sophos Naked Security
 

Myriad

Level 7
Verified
Well-known
May 22, 2016
349
Due to JavaScript, CSS and JS can contain HTML. Combined they can store extra things in your browser like keystroke loggers. location data, push notifications, potentially executables.


Basically from what I understand, that when it is no longer in the confines of a browser, it doesn't have that sandbox type protection. The article provides more info and more advanced users may be able to expound on the vulnerability this could pose. I believe it may be particularly dangerous for mobile devices.


Source:

Sophos Naked Security

This so-called "pastejacking " has become a hot topic in recent weeks , there's another article here -

Pastejacking Attack Allows Hackers to Execute Malicious Code | SecurityWeek.Com
 

soccer97

Level 11
Thread author
Verified
May 22, 2014
517
This so-called "pastejacking " has become a hot topic in recent weeks , there's another article here -

Pastejacking Attack Allows Hackers to Execute Malicious Code | SecurityWeek.Com


I didn't know this was as prolific. I know when you paste something it generally lists pasted from < > in a line under it (in Office programs). I could see the potential if a specific application, especially one embedded in the OS were involved. That may not go well.

Thanks for the additional information.
 

kaddy

Level 2
Verified
Jan 23, 2016
60
i have source of a Rootkit from Github, i am analyzing it to better understand how to stop it from successfully infecting people. My relatives have been hit by this RK numerous times, it is Zeroaccess.
 

kaddy

Level 2
Verified
Jan 23, 2016
60
i have source of a Rootkit from Github, i am analyzing it to better understand how to stop it from successfully infecting people. My relatives have been hit by this RK numerous times, it is Zeroaccess.
There is a way to avoid the JS problem at least. its similar to click jacking, with the hidden like buttons. Use noscript or Script defender in chrome. Script defender will even block iframes and images. In context of web browser, once it is outside of the browser, it could be a problem.
 
  • Like
Reactions: Cats-4_Owners-2

jamescv7

Level 85
Verified
Honorary Member
Mar 15, 2011
13,070
I've heard pastejacking way back before, well browsers must incorporate special functions on how it should paste the information.

That concept will defeat by paste the information as pure text only.
 

kaddy

Level 2
Verified
Jan 23, 2016
60
w
I've heard pastejacking way back before, well browsers must incorporate special functions on how it should paste the information.

That concept will defeat by paste the information as pure text only.
Easy, Simple fix.
 

soccer97

Level 11
Thread author
Verified
May 22, 2014
517
i have source of a Rootkit from Github, i am analyzing it to better understand how to stop it from successfully infecting people. My relatives have been hit by this RK numerous times, it is Zeroaccess.

Wow, it seems worst than I thought. Zeroaccess was bad, and some companies (Norton) had real trouble detecting it, especially the 64-bit version. I hope it hasn't evolved too much.

Hopefully, the anti-exploit programs will catch these, especially if JS attacks start proliferating Ransomware.
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top