News for hackers. Stuff that matters.
Re:WebUSB API: draft spec to safely expose USB device servic... by pdkl95 on Sunday April 10, 2016 @10:21AM (#11466197)
Apparently some people are trying to open up as much attack surface as possible.

If you're implementing this... please stop. This will cause serious problems. There is no reason whatsoever to allow remote access to USB devices.

Re:WebUSB API: draft spec to safely expose USB device servic... by awalton on Sunday April 10, 2016 @12:09PM (#11466769)
> There is no reason whatsoever to allow remote access to USB devices.

Unless you want to connect your local USB device to some VM in the cloud. Which is the direct use case that came up when this came up in discussion with Reilly Grant when we were both at VMware. It comes up surprisingly often as a requested feature, as IT organizations get increasingly lazy/less funded/laid off and don't want to have to install clients or anything on local machines, just pop open a browser, point it at the VM and connect up the device.

Not that I'm advocating for this in any way... I thought it was pretty out there (along with WebMIDI), but hey, why not, the Web Browser is the One True Platform and everyone and their parent company and sister company has nearly quit doing native application development on any OS (as sad as that makes me).

Re:WebUSB API: draft spec to safely expose USB device servic... by chatmasta on Sunday April 10, 2016 @01:26PM (#11467170)
If you want to connect a USB device to the cloud, that's great. All you need is a usb<->socks proxy running on your local machine, tunneling USB traffic to the remote server.

Why should we build this functionality into the browser? Is it really that much more convenient than installing an app to run the proxy?

The use case you describe is sufficiently rare, that if you need it, downloading an app should not be a high cost to pay. If only 1% of browser users need this USB proxy, why expose an additional attack surface for the 99% who do not need it?

Re:WebUSB API: draft spec to safely expose USB device servic... by Natanael_L on Sunday April 10, 2016 @01:47PM (#11467297)
I'm thinking of HTML5 media tags. There's a standard way to specify that something is a piece of media to play, but the browser needs to also have the right codec for that media.

There could be something similar for USB, where there might not even be any "codecs" (drivers) included by default in browsers, but where there's a defined method of making USB devices available.

You'd still have to install a plugin for each device type that your browser doesn't natively understand, but standardization for how to make specific device types available to the browser would be much simpler. And there could be "rewriting proxy" drivers available for improved security which limits what requests that are possible, preventing most hardware exploits.

Although this might still be too much work for little gain.

Re:WebUSB API: draft spec to safely expose USB device servic... by chatmasta on Sunday April 10, 2016 @02:28PM (#11467468)
If you need to install a plugin, why not install an app? Presumably plugins will need to be written for each different browser, just as apps need to be written for each different OS. So there would be very little gain.
Re:WebUSB API: draft spec to safely expose USB device servic... by awalton on Sunday April 10, 2016 @06:17PM (#11468440)
> Why should we build this functionality into the browser? Is it really that much more convenient than installing an app to run the proxy?

Apparently it is, given how highly requested of a feature it is to have everything you could do with VMRC available through the web browser with no plugins or local software.

Again, I still don't think it's a good idea either, but I also don't like a lot of the crazy shit built into modern web browsers for maybe the 1% users, like the mentioned WebMIDI.

Re:WebUSB API: draft spec to safely expose USB device servic... by robert_foss on Sunday April 10, 2016 @12:31PM (#11466866)
Even if you want to remotely attach a USB device, doing it through the browser is a severely silly way to do it. Why not attach USB devices over IRC? Or SAMBA? Just because it is possible, doesn't mean that it's reasonable or good.
Re:WebUSB API: draft spec to safely expose USB device servic... by voltagex_ on Sunday April 10, 2016 @09:55PM (#11469183)
It's not quite SMB, but Microsoft supports USB-over-RDP: https://blogs.msdn.microsoft.com/rds/2010/06/10/introducing-...
Re:WebUSB API: draft spec to safely expose USB device servic... by BinaryIdiot on Sunday April 10, 2016 @11:34AM (#11466592)
> There is no reason whatsoever to allow remote access to USB devices

Sorta but that's not what this standard is proposing. It's proposing a way of accessing a USB device from a web browser. There isn't any remote access happening here (at least not directly though with this standard you could theoretically do that).

This is simply so web apps can get closer to native apps in functionality.

Re:WebUSB API: draft spec to safely expose USB device servic... by pdkl95 on Sunday April 10, 2016 @12:51PM (#11466983)
> It's proposing a way of accessing a USB device from a web browser.

> There isn't any remote access

If you don't see the contradiction between these two statements, I don't know how to help you.

Stop thinking of what this is supposed to do; it's the failure cases that are the problem. Good security design involves concepts like compartmentalization and defense-in-depth. Finding a browser exploit shouldn't also grant low level access to the USB buss.

> This is simply so web apps can get closer to native apps in functionality.

That's a terrible idea. Blurring the lines between a webpage and a native app simply teaches people to treat webpages as if they were a local app, when the should be learning to treat anything form the network as potentially hostile. If you don't have a clean separation between the remote UI and the local UI, you're creating the perfect situation for phishing attacks.

Re:WebUSB API: draft spec to safely expose USB device servic... by BinaryIdiot on Sunday April 10, 2016 @06:11PM (#11468422)
> If you don't see the contradiction between these two statements, I don't know how to help you.

Alternatively you could be more constructive and try to explain what your position here is because, as I'm reading this standard, I'm not seeing any remote access (it's all client-side). Granted, like I already mentioned, once access is granted you could use something like web sockets to make it accessible remotely but that's a very explicit thing a developer or malicious app has to do. Which, granted, is possible but the user also has to give it access to do such a thing which is no different than allowing camera access which already exists in a similar way.

If you want to argue that anything that can be coded to be accessed remotely is outright remote access then...well just about everything is remote access and it kinda loses its meaning.

> Stop thinking of what this is supposed to do; it's the failure cases that are the problem. Good security design involves concepts like compartmentalization and defense-in-depth. Finding a browser exploit shouldn't also grant low level access to the USB buss.

This shows me you didn't even read the standard. The standard OUTRIGHT says the same thing as you and outlines how their standard WOULD NOT grant low level access to the USB bus.

So why even bother commenting if you're not even going to read what's in the standard and comment, incorrectly, about it? This isn't really typical on Hacker News.

Re:WebUSB API: draft spec to safely expose USB device servic... by ssalazar on Sunday April 10, 2016 @06:38PM (#11468525)
> I'm not seeing any remote access (it's all client-side)

Anything that can be accessed client-side can be easily uploaded via XmlHttpRequest or whatever people use for that now. This is not a new concept.

> Granted, like I already mentioned, once access is granted you could use something like web sockets to make it accessible remotely but that's a very explicit thing a developer or malicious app has to do.

Hardly- user data is incredibly valuable and you can be sure that for many sites, if a page has access to USB info they will upload and track it. Presumably any foreign JS code imported (e.g. Google Analytics) can also access this data and include it in the information it tracks.

Re:WebUSB API: draft spec to safely expose USB device servic... by BinaryIdiot on Sunday April 10, 2016 @07:20PM (#11468677)
> Anything that can be accessed client-side can be easily uploaded via XmlHttpRequest or whatever people use for that now. This is not a new concept.

Correct but this standard is absolutely not "remote access to USB devices" as the parent suggested. If we're going to abstract the meaning of "remote" to anything that can be uploaded by something that can access it then it loses its meaning entirely.

The standard proposes nothing remote from the web to the browser; it's entirely between USB devices and the browser. Saying "allow remote access to USB devices" is entirely misleading hence my original comment.

> Hardly- user data is incredibly valuable and you can be sure that for many sites, if a page has access to USB info they will upload and track it. Presumably any foreign JS code imported (e.g. Google Analytics) can also access this data and include it in the information it tracks.

What's the "hardly" for? You and I don't seem to be disagreeing here.

Re:WebUSB API: draft spec to safely expose USB device servic... by kscz on Sunday April 10, 2016 @11:37PM (#11469478)
I think perhaps the point that the others in this thread are making should be rephrased: you execute untrusted code in the browser, and giving that untrusted code effectively direct access to the USB peripherals is frightening. If you trust some website with "webUSB permissions", and that website has a cross-site scripting vulnerability, you've given a remote actor the ability to manipulate some USB device(s).

That being said, I'm a little confused about your definition of "remote" access. If I have a jetty server with a remotely exploitable hole in it, someone who exploits that hole is depending on me running a local client, but I would still consider it a "remote" exploit. In the same vein, someone running a browser that I can compromise with purely code on external websites is still being "remotely exploited." The attack vector requires the client to visit a specific page or click a specific link, but I didn't have to walk up to their computer and insert a USB stick. That's what makes the attack a "remote" attack for me.

Re:WebUSB API: draft spec to safely expose USB device servic... by BinaryIdiot on Monday April 11, 2016 @01:05AM (#11469734)
> you execute untrusted code in the browser, and giving that untrusted code effectively direct access to the USB peripherals is frightening.

But if you read the linked specification you're not doing that. You're giving them access to an abstraction that is quite limited in what it can do. If you had direct access you could reflash firmware.

> If I have a jetty server with a remotely exploitable hole in it, someone who exploits that hole is depending on me running a local client, but I would still consider it a "remote" exploit.

Yes of course that's "remote". It requires network connections to access.

> In the same vein, someone running a browser that I can compromise with purely code on external websites is still being "remotely exploited." The attack vector requires the client to visit a specific page or click a specific link, but I didn't have to walk up to their computer and insert a USB stick. That's what makes the attack a "remote" attack for me.

That's not remote at all. That's entirely client based. The client just happens to load some sort of exploit on its own. If it was really remote you could push a script to the client using its network address.

The client functions the same with or without internet connectivity. The jetty server example does not.

Re:WebUSB API: draft spec to safely expose USB device servic... by kscz on Monday April 11, 2016 @02:54AM (#11470008)
Well, I think we'll have to agree to disagree here on terminology!

When a browser gets a malicious advertisement or a user gets a malicious cross-site scripting attack, I consider that remote exploit. Yes, it required the client to do something (i.e. visit a malicious page), but there are plenty of things which you can do to create that state without much user interaction. If I might ask, what do you call attacks like these?

I agree though that my Jetty example wasn't a good one, I was just making the point that the exploit was still in client code (i.e. something running on the victim's machine).

Re:WebUSB API: draft spec to safely expose USB device servic... by ybx on Sunday April 10, 2016 @05:58PM (#11468375)
> If you don't see the contradiction between these two statements, I don't know how to help you.

Just because it's in a browser doesn't mean it's remote access. Javascript APIs can be accessed locally.

Re:WebUSB API: draft spec to safely expose USB device servic... by derefr on Sunday April 10, 2016 @05:56PM (#11468364)
> If you don't have a clean separation between the remote UI and the local UI, you're creating the perfect situation for phishing attacks.

I don't know what you're imagining my computer works like, but I don't have a separation between local and remote UI. I have a separation between OS and application UI (e.g. the Windows Ctrl+Alt+Del dialogue) but everything else is untrustworthy, local or no. A local app can be executing untrusted logic "sourced from" the internet just as well as a remote app can. To say otherwise is to presume that all updates to all apps on your PC go through a third-party that verifies that they never add any remotely-accessible "extension points" that weren't there in previous updates. Obviously, this is not the case, even for the strictest corporate device-management release-engineering program.

Re:WebUSB API: draft spec to safely expose USB device servic... by yoklov on Sunday April 10, 2016 @06:11PM (#11468426)
It might be a terrible idea, but keep in mind that practically every development platform aside from the web is becoming more and more locked down as time passes (app stores, etc).

Which sucks, obviously, but it's not surprising that there's an attempt to bring the web closer to parity with native, since it seems to be a more tractable problem than stoping what's happening to native platforms.

Re:WebUSB API: draft spec to safely expose USB device servic... by creshal on Sunday April 10, 2016 @12:30PM (#11466863)
Web apps, and malware injected into adverts. Oh joy.
Re:WebUSB API: draft spec to safely expose USB device servic... by nailer on Sunday April 10, 2016 @10:31AM (#11466247)
The same logic could be applied to local software, which inevitably is also remote in origin.

At least browsers generally have a better permission model than desktop apps: "do you want to allow this web page for access to USB devices?".

Re:WebUSB API: draft spec to safely expose USB device servic... by asjfkdlf on Sunday April 10, 2016 @10:40AM (#11466275)
I am not sure I agree "browsers generally have a better permission model than desktop apps". Yes, browsers ask the user if they would like to allow, but do desktops apps have rampant XSS vulnerabilities? If you allow a site to use USB, you have to be worried that any XSS vulnerability will compromise your USB devices.
Re:WebUSB API: draft spec to safely expose USB device servic... by nailer on Sunday April 10, 2016 @10:57AM (#11466374)
Weirdly enough I was talking a couple of days ago about requiring things like CSP (which would go very far in defeating XSS) for stuff like webcrypto and other sensitive bits of HTML5.

Someone working for one of the major browsers mentioned they'd considered it but decided against it - not sure on the reasons why but if they're reading this they might like to elucidate...

Re:WebUSB API: draft spec to safely expose USB device servic... by asjfkdlf on Sunday April 10, 2016 @12:22PM (#11466825)
That would be a good first step. It would have to be a subset of CSP. Don't allow inline scripts or eval.. Only on https is another step I see as very important.
Re:WebUSB API: draft spec to safely expose USB device servic... by nsgi on Sunday April 10, 2016 @12:44PM (#11466945)
One reason might be that developers would probably just do the minimum possible CSP rather than following the spirit of it. Unlike with HTTPS, a CSP could be created with the exact same security model as no CSP using directives like unsafe-eval.
Re:WebUSB API: draft spec to safely expose USB device servic... by Navarr on Sunday April 10, 2016 @11:09AM (#11466438)
Like buffer overflow or bash injection?
Re:WebUSB API: draft spec to safely expose USB device servic... by asjfkdlf on Monday April 11, 2016 @12:18AM (#11469599)
I am not sure what you are getting at. Those don't occur on the web and are not an issue with desktop apps you install. If a desktop app wants to run a bash command, it can do it. It doesn't need to find a bash injection.

There isn't easily exploitable issues like XSS on the desktop. Meaning, if you run a desktop app you generally don't have to worry that some rogue code is injected into the app, unless the developers keys are stolen which is rare.

Re:WebUSB API: draft spec to safely expose USB device servic... by ZenoArrow on Sunday April 10, 2016 @10:44AM (#11466299)
Exactly. Combine a XSS attack with USB keyboard monitoring and you've got ridiculously powerful password harvesting. That's just one potential attack of many.
Re:WebUSB API: draft spec to safely expose USB device servic... by justinschuh on Sunday April 10, 2016 @10:52AM (#11466349)
That's not at all an accurate framing. I'm not aware of any implementation that plans to allow access to HID devices (keyboard, mouse, etc.) or other device classes that are already handled natively by the browser/OS. Even ignoring security, just think of what a mess the user experience would be if sites could unbind and override native devices.
Re:WebUSB API: draft spec to safely expose USB device servic... by pdkl95 on Sunday April 10, 2016 @11:04AM (#11466415)
Implementations are always perfect?

When - not if - someone finds an implementation bug in either the browser or the USB hardware, we will see exploits far worse than keylogging passwords. The bug could be in any USB device, not just the subset you're thinking about. Do you really want to trust your host-controller, every USB device, and the browser interface to be bug free? Are you sure there are no subtle non-bug interactions between devices? Have you even seen how USB devices are designed?

Limitations like "no HID devices" are how it's supposed to work, which is different from how it will actually work.

edit:

Also, did everyone forget about BadUSB?

Re:WebUSB API: draft spec to safely expose USB device servic... by justinschuh on Sunday April 10, 2016 @11:37AM (#11466602)
Sorry, but I'm at a loss for what you believe you're responding to here. I made a clear, factual statement regarding the handling of bound USB devices for known devices and classes. Specifically, HID and other native device classes that are already bound by the OS should not be exposed to WebUSB -- the reasons for and robustness of that guarantee should be self-evident to anyone moderately familiar with USB in modern OSes.

Now, if you have a specific argument to make against my statement, then please share it. I have direct experience with the subject here, and ideally can provide context to address such arguments or clear up confusion. However, I really don't think it's productive to respond with non sequitur arguments and personal attacks.

Re:WebUSB API: draft spec to safely expose USB device servic... by cm3 on Sunday April 10, 2016 @12:50PM (#11466975)
The way USB devices work, they can pretend to be something else and still manage to achieve the ulterior goal. There are some very interesting USB devices on the market which look like one thing, pretend to be something else, and actually are anything but.
Re:WebUSB API: draft spec to safely expose USB device servic... by justinschuh on Monday April 11, 2016 @10:12AM (#11471586)
Mentioning BadUSB very much implies confusion about the threat models at play. That is, the threat model for BadUSB is a malicious device that attacks the host OS, drivers, or applications. Whereas, the threat model for WebUSB is concerned with malicious sites attacking or abusing physical devices attached to the system.

So, the scenario you seem to be implying would require coordination between a malicious WebUSB site and a malicious device. While I can't claim that it would be impossible, it sure seems to approach de minimis if only given the extent of user interactions and preconditions.

Re:WebUSB API: draft spec to safely expose USB device servic... by erikpukinskis on Sunday April 10, 2016 @07:11PM (#11468654)
You could say all the same things about every piece of desktop software.
Re:WebUSB API: draft spec to safely expose USB device servic... by ZenoArrow on Sunday April 10, 2016 @11:31AM (#11466567)
So we're limiting based on USB device type are we? What about USB keyboards with USB ports in them (which are fairly common). They could be registered as USB hubs. One of the main reasons USB security is so poor is that the barriers between device types are not strictly enforced, which has led to problems in the past (for example, USB device spoofing is trivial to do, you can probably imagine the sort of hijinks you can get up to with that).
Re:WebUSB API: draft spec to safely expose USB device servic... by justinschuh on Sunday April 10, 2016 @11:54AM (#11466692)
Sorry, you seem to have misread my statement. Everything you just listed are devices that the OS already natively binds. I'm not aware of anyone considering WebUSB implementations that would unbind native devices and expose them to the Web. Rather, the device-level risks for WebUSB primarily center around devices/interfaces that are not in well-known classes or otherwise are not natively bound and may expose dangerous interfaces (e.g. security credentials, unsigned firmware flashing, etc.).
Re:WebUSB API: draft spec to safely expose USB device servic... by ZenoArrow on Sunday April 10, 2016 @12:03PM (#11466741)
Every USB device that the browser has access to will have a driver that the OS uses to expose its functionality. It doesn't matter whether that driver is built into the OS or not, the OS driver would still exist. The only other option is if the browser is managing hardware outside of the control of the OS by running with lower level privileges, but that opens up an even bigger security risk.

You suggested in another comment that you had some prior background in this area, are you involved in the development of this new web API?

Re:WebUSB API: draft spec to safely expose USB device servic... by pcwalton on Sunday April 10, 2016 @02:48PM (#11467554)
> You suggested in another comment that you had some prior background in this area, are you involved in the development of this new web API?

Justin Schuh is a Chrome security engineer and is one of the most knowledgeable people on the planet when it comes to browser security. He knows what he's talking about more than virtually anyone else in this thread.

Re:WebUSB API: draft spec to safely expose USB device servic... by bobwaycott on Sunday April 10, 2016 @02:54PM (#11467580)
I'm not saying I disagree, but this reeks of argument from authority. Plenty of knowledgeable people make mistakes—because they're all fallible.
Re:WebUSB API: draft spec to safely expose USB device servic... by kibwen on Sunday April 10, 2016 @09:11PM (#11469050)
This is not argument from authority. You're free to believe that Justin Schuh is a fraud, or a moron, or just plain wrong in this one instance, but when a person who is an expert in a subject makes a statement that is pertinent to that subject, that is merely called "expertise".
Re:WebUSB API: draft spec to safely expose USB device servic... by justinschuh on Monday April 11, 2016 @09:59AM (#11471487)
This response just doesn't make sense given that modern OSes expose USB through much higher-level device management and communication APIs. Those are the APIs browsers use, and I've already explained that browsers shouldn't unbind and then expose a device that the OS or another native application has already bound. So, I really don't understand what argument you're trying to make here.
Re:WebUSB API: draft spec to safely expose USB device servic... by donatj on Sunday April 10, 2016 @10:49AM (#11466332)
> At least browsers generally have a better permission model than desktop apps

The flaw with that is desktop apps have the ultimate permission model, you choose to have them, and don't just stumble across them.

Re:WebUSB API: draft spec to safely expose USB device servic... by nsgi on Sunday April 10, 2016 @12:56PM (#11467012)
How are users supposed to know whether they can trust a desktop app with near-unlimited access to their computer? Generally they don't, but blindly install it anyway because it seems to do something they need.
Re:WebUSB API: draft spec to safely expose USB device servic... by erikpukinskis on Sunday April 10, 2016 @07:13PM (#11468657)
Yes, that's called "opt in" and it's the same security model this standard is proposing.
Re:WebUSB API: draft spec to safely expose USB device servic... by cm3 on Sunday April 10, 2016 @12:48PM (#11466964)
And your local apps don't self-modify the code all the time, whereas that's exactly what the dynamic browser environment with 3rd-party scripting is.
Re:WebUSB API: draft spec to safely expose USB device servic... by mtgx on Sunday April 10, 2016 @12:43PM (#11466935)
Do they, though?

I just tested this on the phone today - it sees even my damn ambient light, in real-time. Why the hell is stuff like this allowed to be seen by default in a browser?

http://webkay.robinlinus.com/

Re:WebUSB API: draft spec to safely expose USB device servic... by pests on Sunday April 10, 2016 @10:21PM (#11469255)
That website is not using specific browser features to find other devices. It is using standard JavaScript networking functions to check for known classes of devices on your internal network.

Might be splitting hairs, but it's not like the browser is providing a direct API to that data.

Re:WebUSB API: draft spec to safely expose USB device servic... by spriggan3 on Sunday April 10, 2016 @11:41AM (#11466627)
> The same logic could be applied to local software, which inevitably is also remote in origin.

One big difference is that one chooses to download the software and install it on a computer. In a browser, everything gets downloaded and executed automatically, including scripts. It's just a matter of opening or being redirected to a URL.

Re:WebUSB API: draft spec to safely expose USB device servic... by abjorn on Sunday April 10, 2016 @11:54AM (#11466693)
For the average user the two concepts are not so different. Most people wouldn't think twice about downloading an executable, just like they wouldn't think twice about clicking a link.
Re:WebUSB API: draft spec to safely expose USB device servic... by cm3 on Sunday April 10, 2016 @12:46PM (#11466955)
Which is why it's even more dangerous to browse the web with all receptors (features) enabled.

Add preloading of links on pages, and you have yourself a constant modifying environment (browser) which is controlled by third parties that don't first require a permission dialog.

So, this is much unsafer than consciously running an executable you've downloaded.

Re:WebUSB API: draft spec to safely expose USB device servic... by nsgi on Sunday April 10, 2016 @12:47PM (#11466961)
You have to give it permission to use USB, though. The USB functionality might also be something included in software you downloaded for another purpose, without your knowledge.
Re:WebUSB API: draft spec to safely expose USB device servic... by ZenoArrow on Sunday April 10, 2016 @10:35AM (#11466259)
The sensible alternative is to not enable this functionality at all. USB security is a joke, the risks for this API are too high.
Re:WebUSB API: draft spec to safely expose USB device servic... by pdkl95 on Sunday April 10, 2016 @10:52AM (#11466351)
> The sensible alternative is to not enable this functionality at all.

Far too many people seem to think the solution to security problems to ignore security and only consider the features you want.

This is such a bad idea that I'm starting to question the motives behind it. If I wanted to break the security of an important class of software, it would look something like this "standard".

> USB security is a joke

Most hardware security - USB or otherwise - doesn't exist. Local peripherals were never designed with security in mind.

Re:WebUSB API: draft spec to safely expose USB device servic... by icebraining on Sunday April 10, 2016 @01:03PM (#11467047)
Local peripherals won't be exposed unless they specific declare they support WebUSB.
Re:WebUSB API: draft spec to safely expose USB device servic... by makomk on Sunday April 10, 2016 @03:25PM (#11467721)
In order for this to be even vaguely secure, every single device that declares support for WebUSB has to refrain from allowing firmware updates over WebUSB despite how incredibly convenient this is, and despite how much of a support nightmare it would be to roll out bugfixes to users without it, and despite them being developed by hardware manufacturers who generally don't give a fuck about security. I can't see this happening. (Allowing remote firmware updates effectively gives full remote code execution on the host PC to the website behind the device, since it can then emulate USB input devices.)
Re:WebUSB API: draft spec to safely expose USB device servic... by icebraining on Sunday April 10, 2016 @06:45PM (#11468553)
Oh, I don't disagree; I would bet some of those devices will get owned. My only hope is that the manufacturers will set the "origin allowed" field that says what domains may access the devices.
Re:WebUSB API: draft spec to safely expose USB device servic... by ZenoArrow on Sunday April 10, 2016 @01:59PM (#11467363)
To see all potential security issues, you need to look at the whole tech stack. A single USB device can have multiple drivers, and although only one is active at any given time the decision over which one to use can be influenced by applications.

https://msdn.microsoft.com/en-gb/library/windows/hardware/hh...

"A USB configuration defines the capabilities and features of a device, mainly its power capabilities and interfaces. The device can have multiple configurations, but only one is active at a time. The active configuration isn't chosen by the USB driver stack, but might be initiated by an application, a driver, the device driver. The device driver selects an active configuration.

A configuration can have one or more USB interfaces that define the functionality of the device. Typically, there is a one-to-one correlation between a function and an interface. However, certain devices expose multiple interfaces related to one function."

So let's say I want to exploit this new WebUSB API. If I infect your computer with malware that installs a second USB driver for the hardware I want access to, and this second driver has support for WebUSB, I could theoretically control the driver being used by making a WebUSB request for the device, thereby exposing the hardware for further exploits.

Re:WebUSB API: draft spec to safely expose USB device servic... by icebraining on Sunday April 10, 2016 @02:42PM (#11467523)
This is what Raymond Chen calls "being on the other side of the airtight hatchway". If you can install an USB driver on my machine, it's because you can run native code on my machine, and so you can use that to talk to the USB device without requiring WebUSB.
Re:WebUSB API: draft spec to safely expose USB device servic... by ZenoArrow on Sunday April 10, 2016 @03:11PM (#11467658)
The difference between using the malware itself to communicate via the web and using WebUSB to do so would be in malware detection. If an unidentified EXE hidden in your Windows partition is communicating via the web that's going to look a lot more suspect than a driver which is trusted by the system. The malware that installed the driver could remove itself after installing the driver, taking out another way to track it down.
Re:WebUSB API: draft spec to safely expose USB device servic... by icebraining on Sunday April 10, 2016 @04:38PM (#11468053)
An unidentified process talking to the 'net is more suspicious than one installing drivers?

But fine, let's say the malware installs the driver and deletes itself. What then? How are they going to get the browser to navigate to their site, and the user to click the authorization button?

Re:WebUSB API: draft spec to safely expose USB device servic... by ZenoArrow on Sunday April 10, 2016 @05:44PM (#11468322)
> "But fine, let's say the malware installs the driver and deletes itself. What then? How are they going to get the browser to navigate to their site, and the user to click the authorization button?"

You could do it a number of different ways. For example, could edit the hosts file (a.k.a. etc/hosts) to point to an amended site for a popular website address, could configure proxy settings on default web browser, could alter the browser shortcut to run a script in the background when the browser starts that scans for WebUSB-enabled devices, could set the driver up to check for updates and disguise the authorisation as the driver update confirmation, etc...

Re:WebUSB API: draft spec to safely expose USB device servic... by icebraining on Sunday April 10, 2016 @06:23PM (#11468467)
So this antivirus lets the malware install drivers, edit system files and/or replace shortcuts created by other applications, but not talk to the web, when nowadays almost every program connects to the web to check for updates. Do you know how far-fetched that sounds?

The reality is that if this malware gets enough permissions to install drivers, it can certainly talk to a regular device driver and communicate with the web. It doesn't need WebUSB for anything.

Re:WebUSB API: draft spec to safely expose USB device servic... by pdkl95 on Sunday April 10, 2016 @01:52PM (#11467325)
Do you really think attackers will respect that limitation after they overflow a buffer in the browser? You're only looking at how it's supposed to work. What matters is how it will be exploited.
Re:WebUSB API: draft spec to safely expose USB device servic... by icebraining on Sunday April 10, 2016 @02:47PM (#11467548)
With or without WebUSB, browsers can already talk to USB devices, and so if you can exploit the browser to run your own code, you can too.
Re:WebUSB API: draft spec to safely expose USB device servic... by pdkl95 on Sunday April 10, 2016 @04:07PM (#11467920)
Then show me the USB interface code in firefox. As far as I know, it doesn't exist.
Re:WebUSB API: draft spec to safely expose USB device servic... by icebraining on Sunday April 10, 2016 @05:31PM (#11468284)
It's in the Win32 DLLs that Firefox links against.
Re:WebUSB API: draft spec to safely expose USB device servic... by sneak on Sunday April 10, 2016 @10:25AM (#11466220)
FIDO U2F. Hardware Bitcoin wallets. HSMs in general.

Seriously though, wired connections are out. Bluetooth is the thing.

Re:WebUSB API: draft spec to safely expose USB device servic... by jjoonathan on Sunday April 10, 2016 @10:58AM (#11466378)
Great, now all my devices can share the bandwidth and reliability characteristics of a stoned boy scout trying to send smoke signals with a flammable blanket!

EDIT: and the less said about pairing difficulties the better.

EDIT2: From the downvotes it seems that many people have had a radically different experience from mine, which is good, because mine has been awful.

    HTCOne-Dell: 1MB file will transfer ~50% of the time, pairing took several tries. 
    HTCOne-MBP: complete no-go, doesn't even pair.
    Nexus6-MBP: paired first try, works reliably at a blazing 100kb/s.
    Nexus6-Dell: doesn't even pair.
    Nexus6-Fitbit: takes minutes to download a day's activity over bluetooth classic, stalls out completely 50% of the time. BLE doesn't seem to work at all.
    MBP-Fitbit: requires dongle, synced once, has had 100% failure rate ever since.
    Dell-Fitbit: requires dongle, 100% failure rate.
Compare to USB which delivers tens of MB/s in bandwidth with 100% reliability and no pairing process (RIP plug and play). I love the promise of bluetooth, but in my experience it has consistently fallen spectacularly short of that promise in every regard.
Re:WebUSB API: draft spec to safely expose USB device servic... by creshal on Sunday April 10, 2016 @12:34PM (#11466884)
APIs to access HSMs exist already, though – PKCS11 and friends. And HSMs are designed to deal with accesses questionable sources, so if you wanted to improve their accessibility with a HSM-specific standard, it'd be not much of a headache.

All other bazillion USB devices ever made are not designed to deal with security, and exposing them over the internet will blow up spectacularly.

Re:WebUSB API: draft spec to safely expose USB device servic... by icebraining on Sunday April 10, 2016 @01:00PM (#11467029)
All other bazillion USB devices ever made are not designed to deal with security, and exposing them over the internet will blow up spectacularly.

Which is why the devices have to announce they support WebUSB to be exposed to any web apps, and can even restrict their usage to specific domains.

Re:WebUSB API: draft spec to safely expose USB device servic... by monocasa on Monday April 11, 2016 @11:07AM (#11471991)
> and can even restrict their usage to specific domains

Because there's no such thing as a XSS attack?

Re:WebUSB API: draft spec to safely expose USB device servic... by lucid00 on Sunday April 10, 2016 @12:39PM (#11466912)
> Seriously though, wired connections are out. Bluetooth is the thing.

...and that's why we have Web Bluetooth, which is already in the Chrome Dev Channel.

https://webbluetoothcg.github.io/web-bluetooth/

Re:WebUSB API: draft spec to safely expose USB device servic... by kuschku on Sunday April 10, 2016 @01:11PM (#11467103)
Okay, this is getting ridiculous.

Seriously, this is the moment where we should just stop, kill all existing browsers, and start from scratch.

This is NOT acceptable, and this is probably the dumbest thing I’ve ever seen.

WebBluetooth, WebUSB, WebGL?

God I hope that this shit will never appear on any of the websites I visit, as I’ll make sure to patch it out of my browser.

Re:WebUSB API: draft spec to safely expose USB device servic... by breakingcups on Sunday April 10, 2016 @01:53PM (#11467329)
This is just Google trying to reinforce their everything-in-the-cloud-as-web-app model, which they are in a position to do considering they make one of the leading browsers, especially amongst developers.

It's shoehorning everything into ancient technology ill-suited for any of these applications, which is not exclusively Google's fault of course. First HTML was augmented with Javascript, which was augmented with XHTTPRequest, which led to an increased usage of Javascript (Here's where Google comes in), which led to a lot of manpower being invested in optimizing the Javascript engines (trying to run a quirky dynamic language as fast as possible) and then augmenting the browser with "native" OS features like:

* Full-screen mode

* Clipboard control

* Native notifications, with background workers, etc.

* WebMIDI

* OpenGL

* etc.

Which is basically like building a second operating system on top of the already existing architectures. Google tried to further push people this way by coming up with Chromebooks, which in reality actually serve to reinforce my point, since most (not all!) users find them just not sufficient enough.

Re:WebUSB API: draft spec to safely expose USB device servic... by kowdermeister on Sunday April 10, 2016 @02:17PM (#11467434)
WebGL is one of the best things that appeared in browsers few years back.
Re:WebUSB API: draft spec to safely expose USB device servic... by kuschku on Sunday April 10, 2016 @02:40PM (#11467517)
And allowed applications to dump full VRAM without any permissions request for quite some time.
Re:WebUSB API: draft spec to safely expose USB device servic... by datenwolf on Friday April 15, 2016 @03:17AM (#11502738)
Which didn't surprise seasoned OpenGL developers at all, because it happens to us all the time, that we see old memory contents in uninitialized buffer objects.
Re:WebUSB API: draft spec to safely expose USB device servic... by sneak on Sunday April 10, 2016 @06:15PM (#11468435)
> God I hope that this shit will never appear on any of the websites I visit, as I’ll make sure to patch it out of my browser.

That's what they said about JavaScript, and look how that turned out.

Re:WebUSB API: draft spec to safely expose USB device servic... by Natanael_L on Sunday April 10, 2016 @01:53PM (#11467327)
Lynx is still available
Re:WebUSB API: draft spec to safely expose USB device servic... by kuschku on Sunday April 10, 2016 @03:00PM (#11467609)
I wish to be able to browse websites, which contain (a) text, (b) associated images, (c) low forms of interactivity, say, comments, or interactive graphics.

This is pretty much the web 2012, or most of German-language web today still.

For browsergames, let’s just use the same paradigm as with apps instead: Bundle them via node+webkit, and integrate a "run locally" API into browsers that automatically downloads a program and runs it locally in a sandbox, but seperately.

In the long term, for games we’ll need to develop a different concept anyway.

But there’s a good reason why no one develops 3D games in PDF, despite PDF supporting 3D objects, scripting, and modification of the document via scripts.

Re:WebUSB API: draft spec to safely expose USB device servic... by makomk on Sunday April 10, 2016 @03:10PM (#11467652)
Allowing access to FIDO U2F devices via this would fundamentally break the security model of U2F. It relies on websites being forced to go through a U2F-specific layer in the browser that ensures websites can only request authentication to that site. Without that, any website could do a forwarding attack where it forwarded the authentication request from any other website to the device and used the response to authenticate as you. In order for this to be used for a second factor, you'd basically have a separate authentication dongle for every website.
Re:WebUSB API: draft spec to safely expose USB device servic... by oakwhiz on Sunday April 10, 2016 @07:20PM (#11468683)
Some USB devices can be firmware-flashed over USB. They expose secret commands or additional descriptors for doing this. A popular method is to expose an HID endpoint that is actually used for uploading firmware.

If the implementation allows access to these endpoints in a way that allows them to upload firmware, this is very bad for security.

If you accidentally plug your USB device into an unknown computer on a webpage, it's reasonable to expect that the device could have been reprogrammed. And a reprogrammed USB device may very well expose any descriptor(s) it wants to - HID keyboard, mass storage device, ethernet connection...

Re:WebUSB API: draft spec to safely expose USB device servic... by josephg on Sunday April 10, 2016 @08:39PM (#11468960)
Section 2 of the spec names and addresses exactly this concern:

> USB hosts and devices historically trust each other. There are published attacks against USB devices that will accept unsigned firmware updates. These vulnerabilities permit an attacker to gain a foothold in the device and attack the original host or any other host to which they are later connected. For this reason WebUSB does not attempt to provide a mechanism for any web page to connect to arbitrary devices.

...

> For this reason this specification outlines two mechanisms that can be combined by the UA before a site is granted access to a device. First, so that the device can protect itself from malicious sites it can provide a set of origins that are allowed to connect to it. These are similar to the [CORS] mechanism and can conceptually be thought of as treating USB devices as their own origins in the "usb" scheme. For devices manufacturered before this specificiation is adopted information about allowed origins and landing pages can also be provided out of band by being published in a public registry. Second, so that the user's privacy is protected the UA may prompt the user for authorization to allow a site to detect the presense of a device and connect to it.

Re:WebUSB API: draft spec to safely expose USB device servic... by username223 on Sunday April 10, 2016 @09:30PM (#11469104)
> USB hosts and devices historically trust each other...

We've seen this exact recipe for years of pain play out again and again. C was designed when programmers wrote code for themselves and other people who weren't trying to break that code; if you manage to overflow a buffer in some command-line utility that uses "gets()", you're basically punching yourself in the face. SMTP was designed to send messages between non-commercial entities who wanted to communicate; then the people who stuffed your mailbox with ads realized they could stuff your internet mailbox with ads almost for free. In both cases, a system built for a trusting environment was used in an untrusting one, and there was much pain.

A public registry and an optional nag about an on-by-default feature won't come close to addressing the problem. With thousands of types of USB devices out there, who will go through and audit them all, and keep the registry up to date? And how many users will see the nag and just do the easiest thing to make it go away, or even have the knowledge to make the decision? It seems like browsers need an "annoying/harmful Web 3.0 features" tab with an ever-growing list of check boxes for WebGL, notifications, geolocation, USB, etc., with all of them set by default to "deny without asking."

Re:WebUSB API: draft spec to safely expose USB device servic... by oakwhiz on Sunday April 10, 2016 @10:13PM (#11469229)
This doesn't really fix the problem though. If WebUSB exists in peoples' browsers, and if a game on a web page asks to connect to your joystick, or some other peripheral, people are going to do it anyway, regardless of the risks. And plenty of USB devices already exist that will never be maintained by their manufacturers again. There are huge quantities of USB devices in existence where software support is completely limited to the driver CD that comes in the box - those manufacturers don't care about adding their devices to a public registry, or controlling how firmware is updated.

Furthermore, this public registry idea also implies that a USB VID/PID directly correlates with a device. There are USB devices in existence that emulate another USB device in order to utilize built-in drivers (inbox drivers) and maintain compatibility with existing software. There are also different USB devices that use the same VID/PID to identify themselves, because in order to obtain a VID/PID, you have to pay a licensing fee, which is not always feasible to everyone. If this public registry is used, it may create conflicts. If the CORS-like public registry entries are always trusted by the browser, it could even create security concerns where remote computers are allowed to seize control of local USB devices.

It would certainly be concerning if USB devices were firmware updated without users' consent, simply by going to the website of the manufacturer. Or even a web advertisement that connects to USB devices...

In the future we may even see some kind of attack on web servers in order to gain access to the USB devices of unsuspecting users...

Re:WebUSB API: draft spec to safely expose USB device servic... by Matthias247 on Sunday April 10, 2016 @03:45PM (#11467812)
Fully agree. I don't even see the use cases. For most things that are mentioned in the comments (mostly something like connecting proprietary USB devices to the browser) a native application that proxies the related data to browsers seems like a much better approach. For well understood device classes that would be used by a bigger number of websites it makes far more sense to standardize high level APIs which covers exactly these devices (like it happened for webcam and other stuff).

The WebUSB approach also limits each device to be connected and controlled by exactly one browser frame which makes it not very desirable for sensor and other input applications.

Re:WebUSB API: draft spec to safely expose USB device servic... by erikpukinskis on Sunday April 10, 2016 @07:16PM (#11468666)
> a native application that proxies the related data to browsers seems like a much better approach

Why do you think that? It seems needlessly complex to me when you could just have a simple permission pop up in the web app. What's the benefit of downloading an executable?

Re:WebUSB API: draft spec to safely expose USB device servic... by Matthias247 on Monday April 11, 2016 @03:23AM (#11470084)
And then you get the permission popup each time you open the page? Seems needlessly annoying to me. Or only once? Then most users would not have an idea on how to revoke the access right. Uninstalling the application they installed for the purpose seems more straightforward.

Besides the permissions stuff giving a single browser window access to raw usb data seems also technically wrong. There are lots of reasons why we now have drivers instead of applications directly using the hardware like 30 years before. A driver or dedicated application can allow multiple clients (browser windows) to access the devices functionality. A driver directly embedded in a web page can't. A driver in the webpage even means that once you close that page the communication state between PC and USB device is in any state (can't see a way for automatically doing anything meaningful on goaway), so the only thing that could be done is disconnect and reconnect the device. So some further implications are: Multiple tabs for your web app are not possible. And even other stuff like Ctrl-R would not work as desired (disconnect device, reconnect device, wait, wait, wait, ...).

Re:WebUSB API: draft spec to safely expose USB device servic... by mellis on Sunday April 10, 2016 @06:55PM (#11468591)
There are use cases for things like Arduino (a microcontroller development board). We'd like to allow uploading to Arduino boards from an online IDE. We'd also like to allow for interaction between sensors and actuators on an Arduino board and websites (e.g. programs written in the Scratch visual programming language). Yes, we can do much of this by having the user install a local application that communicates via web sockets, but that has its own security implications and adds an additional step for the user.
Re:WebUSB API: draft spec to safely expose USB device servic... by makomk on Monday April 11, 2016 @11:28AM (#11472143)
Unfortunately the obvious way of doing this with WebUSB is, from a security perspective, equivalent to giving the online IDE the ability to install arbitrary code. The Arduinos with sophisticated enough USB stacks to support WebUSB can also be reprogrammed by sketches to emulate a keyboard and inject keystrokes, including a series of keystrokes that downloads and executes a malicious executable.
Re:WebUSB API: draft spec to safely expose USB device servic... by jonathankoren on Sunday April 10, 2016 @07:36PM (#11468730)
Why are you trying to connect to the web at all?

> Yes, we can do much of this by having the user install a local application that communicates via web sockets, but that has its own security implications and adds an additional step for the user.

You're target audience is arduino hackers, and you're worried about them installing an app? You need to seriously reassess your assumptions.

Re:WebUSB API: draft spec to safely expose USB device servic... by voltagex_ on Sunday April 10, 2016 @10:00PM (#11469192)
Or the target is someone teaching a class of newbies how to start with Arduino. Same device, different audience, different needs.
Re:WebUSB API: draft spec to safely expose USB device servic... by jonathankoren on Sunday April 10, 2016 @11:44PM (#11469499)
It still doesn't make any sense. Who that's not intimidated with soldering irons and wiring circuits up that can literally burst into flames if you do it wrong, is going to say, "Heavens to Betsy! I have to click an installer! My word, I'm comin' down with the vapors!"?
Re:WebUSB API: draft spec to safely expose USB device servic... by voltagex_ on Sunday April 10, 2016 @11:53PM (#11469520)
Strawman. I can teach an Arduino class with no soldering at all.
Re:WebUSB API: draft spec to safely expose USB device servic... by monocasa on Monday April 11, 2016 @11:06AM (#11471984)
"and wiring circuits up that can literally burst into flames if you do it wrong"
Re:WebUSB API: draft spec to safely expose USB device servic... by staticvar on Sunday April 10, 2016 @06:10PM (#11468416)
Thanks to all those who are concerned about security aspects of this spec. We must always be asking "what if". But do understand that there is no fundamental difference between installing a 3rd party app on your phone and granting a website access to USB. There is some code, you are granting it permission to mess with your life. The only thing difference here is the context, which you will get used to.
Re:WebUSB API: draft spec to safely expose USB device servic... by api on Sunday April 10, 2016 @11:15AM (#11466471)
What about the ways this could improve security, such as by really making hardware 2fa easy to do online?
Re:WebUSB API: draft spec to safely expose USB device servic... by pdkl95 on Sunday April 10, 2016 @11:18AM (#11466486)
Find another way to access that kind of security hardware. That's the kind of thing that should be mediated through a strictly limited API in the browser anyway, where standardized UI can be provided.
Re:WebUSB API: draft spec to safely expose USB device servic... by avian on Sunday April 10, 2016 @11:31AM (#11466579)
Many people have been using two factor authentication for some web pages through SSL, PKCS11 modules and client side certificates on USB cryptokeys or smartcards for ages.

I always find it funny how each new browser and OS release makes it a little more hidden and a bit more convoluted to set it up. All while more and more web developers complain what a big problem secure authentication on the web is.

Re:WebUSB API: draft spec to safely expose USB device servic... by Freak_NL on Sunday April 10, 2016 @02:31PM (#11467479)
That is probably one of the driving forces behind this and similar technologies (NFC and Bluetooth LTE integration with the browser). All technologies supported by 2FA standard Fido U2F incidentally.

So yeah, I understand why adding this to a web browser seems unwanted, but as long as the API is well-defined and built with security as its first and primary concern, this could actually improve the overall security of on-line services significantly by making two-factor authentication something your browser just does, and does right. I can recommend skimming the Fido U2F spec [1] to anyone with doubts about the applicability and necessity of this standard.

The linked article basically starts with a section on privacy and security concerns though, so that is somewhat reassuring.

1: https://fidoalliance.org/specifications/overview/ (look for U2F in particular)

Re:WebUSB API: draft spec to safely expose USB device servic... by userbinator on Sunday April 10, 2016 @11:27AM (#11466541)
All you really need for that is a smartcard and a (USB) card reader to plug it into. Those could be integrated into one USB device also. That is an existing technology which is already deployed and in widespread use.
Re:WebUSB API: draft spec to safely expose USB device servic... by lucid00 on Sunday April 10, 2016 @12:46PM (#11466953)
I'm unsure if Smartcards classify as NFC, but there's also WebNFC.

https://w3c.github.io/web-nfc/

Re:WebUSB API: draft spec to safely expose USB device servic... by Natanael_L on Sunday April 10, 2016 @01:53PM (#11467331)
Yubikey NEO?
Re:WebUSB API: draft spec to safely expose USB device servic... by bobwaycott on Sunday April 10, 2016 @02:50PM (#11467564)
This was my immediate thought, as well. Stop. Just stop.
Re:WebUSB API: draft spec to safely expose USB device servic... by guidedlight on Monday April 11, 2016 @03:48AM (#11470174)
Proprietary technologies are doing this already, we would actually be safer if it was done in an open and transparent manner.