News for hackers. Stuff that matters.
Re:Clang runs in the browser and compiles C++ to WebAssembly by modeless on Tuesday January 02, 2018 @01:29AM (#16050284)
The answer is that browsers provide something that users desperately need and no operating system has ever provided: a sandbox strong enough to run completely untrusted code. The success of browsers is an indictment of the entire field of operating systems research. They have either failed to recognize the need or simply failed to deliver that kind of security.

For one example take WebGL. For decades OpenGL had been a native API prioritizing performance first and security last. It wasn't until browsers decided to expose OpenGL that the necessary work was done to make a graphics API safe for untrusted code. And who did that work? The browsers had to do most of it themselves.

Re:Clang runs in the browser and compiles C++ to WebAssembly by panic on Tuesday January 02, 2018 @08:36AM (#16051741)
> The success of browsers is an indictment of the entire field of operating systems research.

Rob Pike wrote in the year 2000 that systems software research was irrelevant (http://herpolhode.com/rob/utah2000.pdf), and it seems to me that not much has changed since then. How many ideas from the last few decades of operating systems research have actually been put into practice?

The real problem is more fundamental: people want their software to keep working. As Rob Pike put it in the talk linked above, "to be a viable computer system, one must honor a huge list of large, and often changing, standards: TCP/IP, HTTP, HTML, XML, CORBA, Unicode, POSIX, NFS, SMB, MIME, POP, IMAP, X, ... With so much externally imposed structure, there’s little slop left for novelty."

For example, I'm sure some software out there is using the OpenGL API in a fundamentally insecure way. Changing the API to be safe would break this software. And maybe that would be a good tradeoff, if reworking OpenGL were the only thing you needed to do to safely run untrusted code. But almost every part of the system would have to change. You'd be left with a system which breaks or degrades pretty much everything you try to run on it.

Re:Clang runs in the browser and compiles C++ to WebAssembly by bjoli on Tuesday January 02, 2018 @05:51AM (#16051152)
Native apps had a head start: they don't load every asset from a potentially untrusted source.

I would say that the browser most certainly has the biggest attack surface of any software in regular use. Your average browser is insanely complex. In fact, it is the only piece of software on my computer that scares me.

Multiple JITs, font rendering, parsing, layouts, compression, image handling, sound and of course about a billion edge cases because somewhere along the road we decided that faulty code is OK. Everything with tonnes of state that interact in ways that can't ever be fully tested or verified (because of an almost infinite variety). Let's also not forget that a large part of that is done at the very bleeding edge of CS research. I wouldn't trust anyone to do that in a safe way.

To me, a kernel seems simple in comparison.

Re:Clang runs in the browser and compiles C++ to WebAssembly by pjc50 on Tuesday January 02, 2018 @08:47AM (#16051786)
> Native apps had a head start: they don't load every asset from a potentially untrusted source

The whole native app is "untrusted" at the point of install. Even an app store offers a fairly thin guarantee about what apps are actually doing. It's far easier and less risky to open a web page and start doing something than install a native app.

Re:Clang runs in the browser and compiles C++ to WebAssembly by bjoli on Tuesday January 02, 2018 @12:15PM (#16053302)
Yes and no. Trust on first use is a thing. A web page is trust every time.

Sandboxing of native apps are getting easier by the minute , at least for Linux. Flatpack and snappy aren't there yet,though...

Re:Clang runs in the browser and compiles C++ to WebAssembly by jjnoakes on Tuesday January 02, 2018 @11:27AM (#16052854)
I only think this applies to certain ecosystems (ones where the motivation or incentive to provide the software doesn't align with ensuring user's safety or security).

The native apps I run on my Linux laptop, for example, I trust quite a bit. There may be a way for someone to sneak in some obfuscated code that does some harm, but I think the risks are much lower than many of the alternatives.

Re:Clang runs in the browser and compiles C++ to WebAssembly by collinmanderson on Tuesday January 02, 2018 @04:59PM (#16056157)
> biggest attack surface

Sure, but in many modern browsers there's also a OS sandbox around it, so there's two layers of protection.

Re:Clang runs in the browser and compiles C++ to WebAssembly by blub on Tuesday January 02, 2018 @04:22AM (#16050857)
> a sandbox strong enough to run completely untrusted code

No browser has provided that either. In fact, browsers are by definition a security anti-feature because they are always connected to the network and the customer/user data lives on the network.

Even if they manage to solve the problem of computers getting hacked when visiting websites they are very unlikely to solve the problems of tracking and private data vacuuming.

Re:Clang runs in the browser and compiles C++ to WebAssembly by jeremyjh on Tuesday January 02, 2018 @06:48AM (#16051344)
I've been using the web for over twenty years and it has never harmed my computer or invaded my system in any way. I do think I've seen adware and scumware that may have originated on the web on friends computers but I'm pretty sure they did something like allow a toolbar to be installed. Can you give an example of an exploit that did not require user permission,did not use a plugin, and that allowed arbitrary code execution from the internet ?
Re:Clang runs in the browser and compiles C++ to WebAssembly by will4274 on Tuesday January 02, 2018 @02:35PM (#16054748)
> I've been using the web for over twenty years and it has never harmed my computer or invaded my system in any way

How do you know? Basically every browser has a RCE vulnerability a month and has for 20 years. From ancient JPEG vulnerabilities to modern video codecs and DOM manipulation vulnerabilities.

Re:Clang runs in the browser and compiles C++ to WebAssembly by dpwm on Tuesday January 02, 2018 @07:20AM (#16051456)
Anecdotally, I've never experienced remote code execution through a browser either. However, the most widely used browser for many years did have plenty of remote execution vulnerabilities that did not rely on plugins or toolbars [0].

[0] https://www.cvedetails.com/vulnerability-list.php?vendor_id=...

Re:Clang runs in the browser and compiles C++ to WebAssembly by netheril96 on Tuesday January 02, 2018 @10:06AM (#16052201)
Exploiting remote execution vulnerabilities is doable, but why do that when one has the easy route of exploiting gullible users instead?
Re:Clang runs in the browser and compiles C++ to WebAssembly by blub on Thursday January 04, 2018 @06:20AM (#16069482)
Would the recent Spectre vulnerability be an acceptable example for you?

There are a gazillion others, but this one is nice and sweet and exposes the whole web app strategy as completely bankrupt from a security perspective.

Re:Clang runs in the browser and compiles C++ to WebAssembly by TomMarius on Tuesday January 02, 2018 @07:19AM (#16051451)
Yes. The web itself is harmless; it's the stuff you download and run that harms you.
Re:Clang runs in the browser and compiles C++ to WebAssembly by stult on Tuesday January 02, 2018 @09:43AM (#16052060)
Guns aren't dangerous! It's the bullets that will get you!
Re:Clang runs in the browser and compiles C++ to WebAssembly by netheril96 on Tuesday January 02, 2018 @10:10AM (#16052222)
This is not an appropriate analogy. Guns and bullets are designed to kill, but browsers and the download capability are not designed to infect your computer. Rather, they are designed with an opposite goal.
Re:Clang runs in the browser and compiles C++ to WebAssembly by alpos on Tuesday January 02, 2018 @11:16AM (#16052730)
An "infection" in this case would be the execution of some other person's code on my computer. Browsers have been designed specifically to do this since Javascript was invented.

The only difference between malware and "regular-ware" is whether the code meets certain user expectations about what it will and will not do.

Re:Clang runs in the browser and compiles C++ to WebAssembly by TomMarius on Tuesday January 02, 2018 @01:54PM (#16054290)
Yes, exactly. What's your point though?
Re:Clang runs in the browser and compiles C++ to WebAssembly by pcwalton on Tuesday January 02, 2018 @11:07AM (#16052648)
Browsers do a whole lot better than the status quo for apps in the '90s and early 2000s, which was "offer a Windows .EXE to download, and monetize with spyware".
Re:Clang runs in the browser and compiles C++ to WebAssembly by blub on Thursday January 04, 2018 @06:29AM (#16069513)
Yes, they are much better than your example, which is one of the worst things that could happen. :)

But paid software in the 90s and 2000s was fine, no network connectivity, didn't even check for updates. Heck, a lot of freeware was fine.

Then the market changed and spyware as a service became very profitable. The genius of this Spyware 2.0 was that it offered some benefits while not abusing the collected data in any obvious ways, like stealing your money. Browsers are helpless against this, in fact they are enabling the whole business model through their support of web apps and increasingly complex APIs.

Re:Clang runs in the browser and compiles C++ to WebAssembly by pjmlp on Tuesday January 02, 2018 @11:24AM (#16052813)
Web apps are already spyware by default, as everything gets done on a computer I don't have access to.

Just plain pretty TTYs.

Re:Clang runs in the browser and compiles C++ to WebAssembly by pcwalton on Tuesday January 02, 2018 @11:43AM (#16053034)
There is a world of difference between analytics and tracking and, say, CoolWebSearch. You don't see Web apps hijacking your home page, filling your bookmarks with casino ads, installing toolbars, or replacing competitors' banner ads.
Re:Clang runs in the browser and compiles C++ to WebAssembly by lmm on Tuesday January 02, 2018 @06:29AM (#16051275)
> The answer is that browsers provide something that users desperately need and no operating system has ever provided: a sandbox strong enough to run completely untrusted code. The success of browsers is an indictment of the entire field of operating systems research. They have either failed to recognize the need or simply failed to deliver that kind of security.

The JVM more-or-less managed it. Modern hypervisors do it - you could use something like Qubes and run completely untrusted code in its own isolated VM. It's not that academics weren't working on this stuff, adoption is where it fell down.

Re:Clang runs in the browser and compiles C++ to WebAssembly by Goladus on Tuesday January 02, 2018 @08:01AM (#16051593)
The JVM took too long to achieve that ideal in a way that actually worked for end-user applications. Early java-based client applications had a horrible user experience. Version conflicts were very annoying, especially on windows where you didn't have a command-line culture comfortable with simply switching between versions by modifying PATH and JAVA_HOME. And even when you didn't have version conflicts, Java applications had slow, idiosyncratic GUIs that often did not support basic and common features like ability to copy/paste or switch to arrow-key navigation through menus.

And on top of all that, it would still be more memory intensive than an equivalent native win32 application. Developers usually only shipped java-based UIs to Enterprise Software users who had no choice but to use what their bosses told them to use.

Re:Clang runs in the browser and compiles C++ to WebAssembly by vbezhenar on Tuesday January 02, 2018 @11:25AM (#16052827)
Browsers have worse history with compatibility, they are more memory hungry than Java, performance is worse, their UI isn't even trying to mimic system UI (Java could have system L&F for 10 years at least, likely more).
Re:Clang runs in the browser and compiles C++ to WebAssembly by oconnor663 on Tuesday January 02, 2018 @02:31AM (#16050470)
It is a bit of a chicken and egg problem, though. It's not enough for researchers to write a paper about APIs that should exist. The APIs have to get implemented across major platforms, which requires major applications using those APIs to motivate them. I don't see how it would ever have happened with a giant slow incremental process, and the web has been that process for us.
Re:Clang runs in the browser and compiles C++ to WebAssembly by oconnor663 on Tuesday January 02, 2018 @09:58AM (#16052145)
* without
Re:Clang runs in the browser and compiles C++ to WebAssembly by dullgiulio on Tuesday January 02, 2018 @03:57AM (#16050765)
I agree a lot with your comment. But it should also be noted that users have very little choice on what code they run when surfing the web. So in one way, browsers cause the problem they then have to solve.
Re:Clang runs in the browser and compiles C++ to WebAssembly by jrs95 on Tuesday January 02, 2018 @12:30PM (#16053446)
Aren't browsers basically the largest attack surface on most platforms now? Have they really succeeded in doing this?
Re:Clang runs in the browser and compiles C++ to WebAssembly by kibwen on Tuesday January 02, 2018 @12:46PM (#16053605)
Saying browsers are "the largest attack surface" is an indication of ubiquity, not an indictment of the design or implementation of browsers (which are still worth considering separately). And we only make such remarks about browsers (or other apps that execute untrusted code like spreadsheets or PDF readers) because the state of OS security is such that any program running directly can pretty much wreak havoc even without explicit superuser privileges. Even on locked-down mobile OSes, the amount of havoc your Facebook app gets up to is incredible compared to what happens when you merely visit facebook.com on your mobile browser.
Re:Clang runs in the browser and compiles C++ to WebAssembly by jrs95 on Wednesday January 03, 2018 @01:32AM (#16058985)
It seems like most users don’t really understand that they’re really running a lot of code for every page they visit now though. IMO it’s as prevalent as it is because browsers just run code by default. If iOS and Android apps were automatically launched without explicit installation by visiting URLs, they’d probably have just as much security out of necessity.
Re:Clang runs in the browser and compiles C++ to WebAssembly by nickpsecurity on Tuesday January 02, 2018 @03:38PM (#16055391)
" because the state of OS security"

Those not designed for security were like that. Those designed for security had few of those problems. They just weren't popular with the big ecosystems and such since the demand side didn't care about security much. Very little security bolted onto something that was opposite at core. Common solutions were memory-safety for apps with validation on API calls, limiting of API's accessible, mandatory access control, and/or VM's isolating whole systems from apps needing protection.

OS's and browsers are not only becoming similar in functionality: they're similar in why people adopted them and why they're insecure.

"Saying browsers are "the largest attack surface" is an indication of ubiquity, not an indictment of the design or implementation of browsers"

It's actually saying both since browsers were mostly not designed for strong security or apply security engineering techniques of the time. That would be POLA, privilege separation, memory-safe languages, high-quality code in any components integrated, and so on. The first I saw attempt it was Chrome's Native Client imitating some benefits of OP Web Browser [that was designed for security] but weakening them for performance. Latter was Chrome's highest priority IIRC. There's Quantum moving memory-safe code into Firefox. However, browsers are mostly insecure architecture and code that just gets patched as problems are found. And they're ubiquitous. Music to malware authors' ears. :)

I'm including examples below of security-focused, browser architectures applying various methods of security at design and/or implementation stage so you have a mental point of comparison to current ones in terms of techniques employed. They were released as prototypes with nobody putting any effort in past that. So, high-assurance sector just isolated regular browsers in protection domains (eg VM's) on separation kernels or using MAC if browsers had to be there. Otherwise, native apps in memory-safe languages with regular old client-server architecture were much easier to make reliable and secure. Especially if using middleware designed to help with that. That's still true.

DarpaBrowser http://www.combex.com/papers/darpa-review/security-review.pd...

OP and OP2 Browsers https://pdfs.semanticscholar.org/832a/911f97b500cd2df4680186...

Microsoft Gazelle https://www.microsoft.com/en-us/research/publication/the-mul...

Illinois Browser Operating System https://www.usenix.org/legacy/event/osdi10/tech/full_papers/...

Quark Browser http://goto.ucsd.edu/quark/