diff --git a/index.html b/index.html index 88b9f64..32e4407 100644 --- a/index.html +++ b/index.html @@ -1381,140 +1381,306 @@

Security Considerations

- Separate from the fingerprinting concerns of identifying the available - ports are concerns around sending and receiving [=MIDI - messages=]. Those issues are explored in more depth below. -

-

- In brief, the general categories of things you can do with MIDI ports - are: -

-
    -
  1. Sending short messages (all messages except SysEx) -
  2. -
  3. Receiving short messages (all messages except SysEx) -
  4. -
  5. Sending SysEx messages. SysEx messages include both commonly - recognized MIDI Time Code and MIDI Sample Dump Standard, as well as - device-specific messages (like “patch control data for a Roland - Jupiter-80 synthesizer”) that do not apply to other devices. -
  6. -
  7. Receiving SysEx messages. -
  8. -
-

- The impact of each of these is: -

-
    -
  1. Sending short messages: sending note-on/note-off/controller - messages would let you cause sounds to be played by attached devices, - including (on Mac and Windows) any default virtual synthesizers. This - by itself does not cause any concerning exposure - you can already - make sounds without interaction, through <audio>, Flash, or Web - Audio. Some attached devices might be professional lighting control - systems, so it’s possible you could control stage lighting; however, - this is extremely rare, and no known system has the ability to cause - lasting damage or information leakage based solely on short messages; - at worst, a malicious page could flash lights, and the user could - close the page and reset their lighting controller. -
  2. -
  3. Receiving short messages: receiving note-on/note-off/controller - messages would not cause any information exposure or security issues, - as there is no identifying data being received, just a stream of - controller messages - all of which must be initiated by the user on - that [=MIDI device=] (except clock-type messages). This is very - analogous to receiving keyboard or mouse events. -
  4. -
  5. Sending and Receiving SysEx. This is the biggest concern, because - it would be possible to write code that looked for system-specific - responses to sysex messages, which could identify the hardware - available, and then use it to download data - e.g. samples stored in a - sampler - or replace that data (erasing sample data or patches in the - device), although both these scenarios would have to be coded for a - particular device. It is also possible that some samplers might enable - a [=System Exclusive=] message to start recording a sample - so if the - sampler happened to have a dedicated microphone attached (uncommon in - practice, but possible), it would be possible to write code specific - to a particular device that could record a short sample of sound and - then upload it to the network without further user intervention. (You - could not stream audio from the device, and most samplers have fairly - limited memory, and MIDI Sample Dump sysex is a slow way to transfer - data - it has to transcode into 7-bit - so it’s unlikely you could - listen in for long periods.) More explicit fingerprinting is a - concern, as the patch information/stored samples/user configuration - could uniquely identify the system (although again, this requires much - device-specific code; there is not standardized “grab all patches and - hash it” capability.) This does suggest that [=System Exclusive=] - messages are in a security category of their own. -
  6. -
-

- It's also useful to examine what scenarios are enabled by MIDI, - mapped against these features: -

-
    -
  1. Receiving short messages. This is the most attractive scenario for - Web MIDI, as it enables getting input from keyboards, drum pads, - guitars, wind controllers, DJ/controllerist controllers, and more, and - use those messages as input to control instruments and features in - the [=Web Audio API=] as well as other control scenarios (MIDI is - the protocol of choice for the multi-billion-dollar music production - industry for getting physical controllers like knobs and buttons - attached to your computer, both in pro/prosumer audio and media - applications as well as consumer applications like Garageband.) -
  2. -
  3. Sending short messages - it’s tempting to say sending is - significantly less interesting, as the scenario of attached output - devices like hardware synthesizers is less common in today's market. - The major exception to this is that many of the MIDI controllers have - external host control of their indicator lights, and this makes them - dramatically more useful. For example, the very popular Novation - Launchpad controller uses MIDI note on/off messages sent to it to - turn on/off and change colors of the buttons. The same is true of - nearly all DJ controllers. -
  4. -
  5. Sending and receiving SysEx - obviously, for more advanced - communication with high-end hardware devices, SysEx is required. - Unfortunately, some common MIDI commands are also sent as [=System - Exclusive=] messages (MIDI Machine Control, for example - generic - start/stop/rew/ffw commands) - and many devices use [=System - Exclusive=] to program patches, send advanced controller messages, - download firmware, etc., which are much-demanded scenarios for Web - MIDI. Some devices use sysex as a direct control protocol, as they can - pack more data into a single “message”, and most devices use SysEx as - way to save and restore patches and configuration information on - less-expensive computer storage. Several of the major music hardware - producers have expressed strong interest in using Web MIDI to provide - web-based configuration and programming interfaces to their hardware. - In short, disabling sysex altogether does not only disable high-end - scenarios. -
  6. -
-

- The additional security concern for receiving short messages is also - small - it’s analogous to listening to keyboard, mouse, mobile/laptop - accelerometer, touch input or gamepad events; there is no additional - information exposed, and all messages other than clock signals must - be initiated by the user. -

-

- The additional concerns about sending short messages are analogous to - any audio output - you cannot overwrite user information or expose - use information, but you can make sounds happen, change patches, or - (in rare configurations) toggle lights - but non-destructively, and - not persistently. -

-

- [=System Exclusive=], on the other hand, has a much less bounded - potential, and it seems that distinguishing requests for SysEx - separately in the API is a good idea, in order to more carefully - provide user security hooks. The suggested security model explicitly - allows user agents to require the user's approval before giving access - to [=MIDI devices=], although it is not currently required to prompt - the user for this approval - but it also detailed that [=System - Exclusive=] support must be requested as part of that request. + The first [=MIDI devices=] were released in 1983, before the + web platform and its security risks existed. Many [=MIDI + devices=] are still in use long after their manufacturers + stopped supporting them. [=MIDI=] has adapted to transports + beyond the original serial connection, such as FireWire, + USB, and Bluetooth. This poses a security challenge, with a + long tail of devices from different eras that do not have + official support but are still actively in use, connected to + computers and the web in ways their designers did not + expect.

+
+

+ Malicious Firmware Updates +

+

+ One concerning theoretical attack involves malicious + firmware updates for USB-[=MIDI devices=]. USB devices in + general can do things based on their device descriptor, + which is sent from the USB device itself. If a USB-[=MIDI + device=]'s firmware can modify what descriptor is sent, it + could make itself act as a human interface device. This + could allow a malicious website to read or inject + keystrokes or other events on the host computer, which + could lead to a total compromise of the system. +

+

+ The attack would proceed as follows: +

+
    +
  1. + A malicious site tricks the user into granting Web MIDI + permission. +
  2. +
  3. + The malicious site enumerates the [=MIDI devices=] + connected to the user's machine, and identifies a + vulnerable device. +
  4. +
  5. + The malicious site sends a pre-crafted set of [=MIDI + messages=] to the vulnerable device, compromising the + device by overwriting its firmware and adding a human + interface device to its USB descriptor. +
  6. +
  7. + The compromised device injects keystrokes to download or + otherwise reproduce a pre-crafted security exploit and + execute it, compromising the system. +
  8. +
+

+ In order to enable to the above attack, a [=MIDI device=] + would need all of the following to be true: +

+ +

+ [=MIDI devices=] that are vulnerable to malicious firmware + updates but do not satisfy the other conditions cannot be + used with this attack to compromise the host system. A + malicious firmware update could still cause these [=MIDI + devices=] to stop working or behave in undesired ways. +

+

+ To mitigate this risk, implementers should emphasize the + following in their implementations: +

+ +

+ Explicitly allowing or blocking lists of known MIDI + devices may also help mitigate this specific attack, but + many small companies and individuals build MIDI devices, + and many MIDI devices are no longer supported, so doing + this would significantly reduce the usability of the Web + MIDI API. +

+
+
+

+ Additional Security Considerations +

+

+ Separate from the fingerprinting concerns of identifying + the available ports are concerns around sending and + receiving [=MIDI messages=]. Those issues are explored in + more depth below. +

+

+ MIDI messages can be divided into [=System Exclusive=] + messages, and short (non-[=System Exclusive=]) messages. + [=System Exclusive=] messages can be further subdivided + into Universal System Exclusive messages such as the + commonly recognized MIDI Time Code and MIDI Sample Dump + Standard, and device-specific messages like “patch control + data for a Roland Jupiter-80 synthesizer” that do not + apply to other devices. +

+

+ Before discussing security concerns, it's useful to + examine what scenarios are enabled by MIDI using these + features: +

+ +

+ The potential security impact of each of these is as + follows: +

+ +