Total Pageviews

Wednesday 29 April 2020

WebAssembly 的安全问题


  不晓得“WebAssembly”的同学可以先看维基百科的“这个页面”。
  这玩意儿已经在去年(2019)成为 W3C 的标准。也就是说,它成为继“HTML、CSS、JS”之后的第4种“标准化的 Web 语言”;也是继 JS 之后的第2种“标准化的 Web 编程语言”。
  有了它,程序员可以使用其它编程语言编写 Web【前端】应用,然后使用编译器把代码编译成 WebAssembly 并部署到网站上。
  它的【好处】至少包括:
1、要想编写(标准化的)Web 客户端应用,可以使用各种语言(以前只能用 JS)
2、WebAssembly 类似于某种“字节码”,浏览器执行它的速度比执行 JS 要快很多
  有好处当然也有坏处:因为 WebAssembly 是面向机器,而不是面向人。要理解某个页面上的一坨 WebAssembly 代码是用来干啥,就很困难——“理解 WebAssembly 代码”比“理解混淆后的 JS 代码”还要难。
  因此,某些动机不良的人,就会使用 WebAssembly 来干一些动机不良的事情。具体参见如下这篇报道:
Half of the websites using WebAssembly use it for malicious purposes @ ZDNet
two categories of Wasm code stood out as inherently malicious.

The first category was WebAssembly code used for cryptocurrency-mining. These types of Wasm modules were often found on hacked sites, part of so-called cryptojacking (drive-by mining) attacks.

The second category referred to WebAssembly code packed inside obfuscated Wasm modules that intentionally hid their content. These modules, the research team said, were found part of malvertising campaigns.

No comments:

Post a Comment