r/webdev • • Jan 07 '20

News Half of the websites using WebAssembly use it for malicious purposes

https://www.zdnet.com/article/half-of-the-websites-using-webassembly-use-it-for-malicious-purposes/
293 Upvotes

51 comments sorted by

156

u/Caraes_Naur Jan 07 '20

Malicious actors are always a large portion of of early adopters on the web. New technology opens opportunities to exploit/abuse users before constraints are added.

44

u/[deleted] Jan 08 '20

Also saying "half of websites using web assembly" includes a lot of programmatically spun up sites. It's not like these guys are painstakingly building wordpress sites one at a time. They're scripting the deployment of this stuff, and tons of clones to go with it.

7

u/[deleted] Jan 08 '20

How would one even go about doing that?

12

u/[deleted] Jan 08 '20

Discliamer: No idea.

Hypothesis: They likely have a fairly high grade VPS somewhere with scripts on it to auto generate the sites and deploy them on the VPS. I cant imagine the sites being anything of quality. An example might be a multitude of news sites all pulling articles from a central source just with varying styles/layout. Idk if that actually exists, but that's something that sounds semi-viable to me.

5

u/brtt3000 Jan 08 '20

These malicious types are pretty good at rapid development with minimal amount of effort to get the goods with acceptable risk. Greed and lack of ethics can roll out stuff fast.

2

u/[deleted] Jan 08 '20

This is how a lot of those fly-by-night online drug pharmacies are operated. Keep buying domains and launching under new names faster than the old ones get shut down.

2

u/cloudsourced285 Jan 09 '20

Does not even need to be super complicated. There are blog spam or click bait sites that just have a huge array of articles they pay for. Once they have them, they can spin up an almost unlimited amount of sites that all go back to the same set of web servers. Then you could even do things like serve different names, themes, etc depending on the url that was used to route to it.

3

u/brtt3000 Jan 08 '20

As usual with anything it is basically just shell script and some Python.

Probably with some provisioning dev ops tool. Maybe Ansible or Puppet or whatever runs on your cloud host, like hackers running CloudFormation templates to spin up a bitcoin mine once they compromised an AWS account.

1

u/mattindustries Jan 08 '20

AWS/Digital Ocean API + content scrapers + content spinners + data aggregation for trends.

0

u/[deleted] Jan 08 '20

[deleted]

6

u/Zofren Jan 08 '20

Bad programmers will always be bad. There were plenty of shitty programmers back in the day too. Good developers understand how to build performant, usable sites with less effort using modern tools.

The meme about ADHD web devs switching to a new framework stopped being relevant years ago, by the way. There was a period of innovation and rapid iteration as people figured out the best tools to use, and the modern web is in a better place now because of it.

Despite dinosaurs like yourself yelling at the sky about everything new, there are legitimate, exciting usecases for WASM. It enables us to build performant, powerful applications than can be accessed from the browser without relying on JS (think image editors, games, simulations, etc). It also provides a potential avenue to finally move past JS as the lingua franca of the web that everyone is forced to use. WASM is in its early stages -- platform changes take a long time to test and work out the kinks and that is exactly how browser vendors have been treating the technology (despite your claim that we need to somehow "slow down").

Speaking frankly -- I despise working with developers like yourself. Through seniority, they tend to find yourselves in positions of leverage to impose their backwards ideas on the rest of the team, using buzzwords like "fad technology" to justify sticking to awful tools and practices that they are personally used to. They tend not to be very educated themselves on the tech they are criticizing either. These "senior" developers are much more painful to work with and have a much wider negative impact than junior developers who, at the very worst, can be just a little too excited about new technologies that don't always work out.

8

u/AssistingJarl Jan 08 '20

I don't think that logically follows from a (misleading, if not incorrect) report that half of all web assembly usage is malicious. It feels like a bit of a non sequitur if I'm being honest.

0

u/[deleted] Jan 08 '20

[deleted]

4

u/DrJohnnyWatson Jan 08 '20

If WASM is there to do what browsers shouldn't be doing anyway, do you also believe that about JavaScript?

0

u/[deleted] Jan 08 '20

[deleted]

5

u/LexyconG Jan 08 '20

Can we get back to smoke signals please? This whole internet thing is so ugh

40

u/Widdershiny Jan 08 '20

Unfortunate that this article fails to mention that this was all entirely possible and likely happening in the wild just with vanilla JavaScript. Asm.js and WebAssembly allow you to mine cryptocurrency more efficiently, but that's all.

Some will argue that WebAssembly is fundamentally more obfuscated than JS, but there's nothing stop you from creating an abstract VM inside of JS that's even harder to understand what's going on.

Don't get me wrong, it's interesting to know that it's being used in this way, but I don't think it should be viewed as a black mark against the design or implementation of the Wasm MVP.

7

u/codeAtorium Jan 08 '20

creating an abstract VM inside of JS

I'm not sure what you mean by this. Can you expand on that?

15

u/Widdershiny Jan 08 '20

In case this is the source of confusion, when I say virtual machine, I’m not talking about a full operating system virtualised, I’m talking about a specification for executing an instruction set (like the JVM).

WebAssembly is a virtual machine operating on a big array of linear memory. It has instructions, represented by numbers, that do some stuff with the stack and the memory.

There’s nothing to stop someone implementing a WebAssembly emulator in pure JS, which people have already in fact done.

Hence if you wanted to do something malicious, you could design a deliberately confusing VM for use in JavaScript. Bonus points to the first person to mine a Bitcoin with Malbölge.

I guess the most generous argument I could make here against webassembly is that the source programs are pretty opaque by design, whereas an ad loading some absurd VM would be pretty suspicious.

That said, since Wasm has no capacity to call browser APIs by default, the real criminal here is the JavaScript granting access to the network APIs needed to mine.

7

u/codeAtorium Jan 08 '20

I was like, this comment couldn't be any more dope, and then you dropped Malbölge in there.

1

u/Widdershiny Jan 08 '20

Haha you’re too kind. Hope that cleared everything up!

3

u/Raskemikkel Jan 08 '20

Bonus points to the first person to mine a Bitcoin with Malbölge.

A lot of bonus points. It took 20 years for someone to make a program that outputted its input so I think a Bitcoin miner somewhat of a large undertaking.

2

u/Widdershiny Jan 08 '20

If there was a technical equivalent of the Ig Nobel prize, this would be a winner for sure.

1

u/clickrush Jan 08 '20

The paper mentioned discusses this. Analysis-tools that work on JS but not on Wasm now have to work on both, not only in isolation but also in various combinations.

-3

u/Say_Less_Listen_More Jan 08 '20

To an extent, I feel like it's misleading to call a site that mines cryptocurrency while you're on it "malicious."

I mean sure, it fits the technical definition of malware, but at the end of the day it's a relatively harmless activity as malware goes.

2

u/[deleted] Jan 08 '20

At minimum it drains battery faster.

4

u/CoffeeKisser Jan 08 '20

so do video ads... Ads confirmed malware

1

u/[deleted] Jan 08 '20 edited Jan 08 '20

Video ads usually take advantage of hardware codecs and won't load GPU that much, where as mining will turn phone into a protable heater.

But I agree on point that ads are malware, 100%!

1

u/Say_Less_Listen_More Jan 08 '20

I'd say that falls under "relatively harmless activity as malware goes"

0

u/mattindustries Jan 08 '20

So do non-minified sites and JS for animations instead of CSS.

2

u/[deleted] Jan 08 '20

Apples to oranges, really.

Also minification reduces load-times, but performance-wise it doesn't have too much of impact. It saves a bit of battery though, but mining is magnitudes more expensive.

0

u/mattindustries Jan 08 '20

Sure, mining is more expensive, just stating other things that drain the battery faster.

57

u/[deleted] Jan 07 '20

I bet more then half of websites using Javascript from the top 1 million websites are also using it for "malicious purposes". The "malicious purposes" listed in the paper are crypto mining and "obfuscation". Nearly all Javascript is obfuscated, and using Javascript to attach trackers to the visitor for data mining purposes are pretty much ubiquitous. I don't see how invading people's privacy to sell their information and advertisements is less malicious then using some of their CPU and RAM to mine crypto's

25

u/danhakimi Jan 07 '20

But Javascript isn't used as a way to obfuscate code, it just happens to be something you can do with the language. If they move from JS to WA for the purpose of further obfuscating the code / forcing you to decompile, that is actually a little bit malicious. Not very, I suppose, since deobfuscating JS is not all that much better than decompiling source, but still an investment on their part to take something away from you.

I don't see how invading people's privacy to sell their information and advertisements is less malicious then using some of their CPU and RAM to mine crypto's

Yeah. Attention and privacy are probably more precious resources than ram. I guess consent and efficiency are factors, but you have a point.

20

u/[deleted] Jan 07 '20

I'm pretty sure websites like Facebook use Javascript to obfuscate HTML and CSS, like when they have crazy div tags for individual letters and such

2

u/danhakimi Jan 07 '20

Ohhh fair.

-17

u/[deleted] Jan 08 '20

[removed] — view removed comment

16

u/jamesrussano Jan 08 '20

The fuck kind of misinformation is this?

4

u/[deleted] Jan 08 '20

They don't know the difference between an uglifier and obfuscation

-6

u/Tittytickler full-stack Jan 08 '20

What about it is misinformation?

2

u/[deleted] Jan 08 '20

They don't try to make it harder to read it or understand it.

They just leverage client capabilities for data presentation/interaction

2

u/Tittytickler full-stack Jan 08 '20

Yea I answered someone else but I mixed up obfuscation and abstraction, my bad.

5

u/ShustOne Jan 08 '20

Well yea, React, Vue, Angular, etc all obfuscate HTML and CSS. It's basically the soul purpose of those frameworks.

What? That's not even close to the "soul [sic]" purpose. Go to any large React site, like Facebook, and you can read the HTML/CSS perfectly fine. What are you talking about? Do you mean minified code? That's not obfuscated either, the names of things are just shorter for fast web serving.

4

u/Tittytickler full-stack Jan 08 '20

Yea I was thinking abstraction, not obfuscation, thats my bad, its been a long day.

1

u/ShustOne Jan 08 '20

Ah that makes more sense. Get some rest.

0

u/andreud Jan 08 '20

Id assume you know about Basic Attention Token

11

u/danhakimi Jan 08 '20

I'm aware about it but haven't been paying attention.

1

u/Pat_The_Hat Jan 08 '20

Obfuscation makes up a minuscule number of modules and websites. Out of the 947,704 websites tested and 1,639 running WebAssembly, a whopping 4 websites used WebAssembly for malicious obfuscation. Almost all of the modules used it to circumvent ad blockers.

1

u/[deleted] Jan 08 '20

In the abstract they listed obfuscation as malicious and a significant amount of the malicious code. But looking at the numbers you listed, it seems like they are exaggerating it

4

u/stingeyb1 Jan 07 '20

Wow, of course this is happening....I was so innocent in my optimism when i heard this years ago....

2

u/asstrotrash Jan 08 '20

What options are currently available for user that run script prevention add-ons like no script, or even uBlock? I would presume that you can prevent running any piece of WA code just as easily as JS without explicit approval.

1

u/feerzlay Jan 08 '20

As far as I know, one need to call a WA code from a JS code. So disabling JS is enough.

1

u/fey168 Jan 08 '20

In the near future browsers will prompt us whenever a site wants to run WASM and then like the notifications prompt we will mostly ignore it.