News for hackers. Stuff that matters.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by captainmuon on Wednesday May 24, 2017 @07:18AM (#14409123)
Wow, that is bad. I'm always amazed by such vectors in supposedly passive formats, like fonts, images, and so on.

There is no excuse that these kind of applications are not completely sandboxed. All you need is some kind of DLL, raw data in, raw pixels out. In case of hardware accelerated codecs, raw pixels in, surface pointer in, nothing out. There is no need to be able to access the filesystem, etc.. To render subtitles on top of the video it's the same.

I wish a fraction of the energy we put into DRM would go into sandboxing instead.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @07:43AM (#14409234)
Ha, the famous sandboxing remark. I wish it was that simple!

So, let me share some light on the sandboxing for multimedia (I work on VLC).

If you sandbox an application like VLC, in the current way of doing sandboxing, which we've done for macOS, WinRT/UWP, and snaps, you still need a lot of permissions.

Namely:

- you need to be able to open files without user interactions (no file picker), in order to open playlist, MXF or MKV files;

- you need the same if ever you have a database of files (media center oriented);

- you need raw access to /dev/* to play DVD, CD and other optical disk (and the equivalent on Windows);

- you need ioctl on such devices, to pass the MMC for DVD/Bluray;

- you need raw access to /dev/v4l* for your webcams and be able to control them;

- you need access to the GPU stack, which is running in kernel-mode, btw, to output video and get hw acceleration;

- you need access to the audio stack, also in low-level mode;

- you need access to the DSP acceleration (not always the GPU);

- on linux, you have access to x11 for the 3 above features, which is almost root;

- you need access to /etc/ (registry) for proxy informations, fonts configuration and accessibility;

- many OpenGL client libraries need access to the /etc too;

- you need access to the network, as input and output (think remote control);

- you need access to the system settings to disable screensavers, and adjust brightness;

- you need access to mounts to be able to see the insertion of DVD/Bluray/USB/SD cards and such;

- you need to expose an IPC (think MPRIS on Linux);

- you need to unzip, untar, decrypt, decipher and so on;

- you need access to the fonts and the fonts configuration (see fontconfig).

and I probably forgot one or another case.

The point is, all those features have good reasons to exist and very good use cases; but the issue is that for a media player, it will request almost all permissions except GPS and address book.

And quite a few of them are very close to kernel mode.

So, what is the solution?

Probably do a multi-process media player, like Chrome is doing, with parsers and demuxers in a different process, and different ones for decoders and renderers. Knowing that you probably need to IPC several Gb/s between them.

I've been working on such a prototype, but it's a lot of work... I accept donations :)

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by phkahler on Wednesday May 24, 2017 @09:49AM (#14409963)
Thanks for that. This type of thing comes up all the time. I used to wonder how web sites could be so dangerous, but it becomes clear when you think about all the extra access developers wanted for good reasons - imagine a web browser that didn't have access to the file system, and so on. I still don't like this state of affairs, but I don't have an alternative solution. Wayland should be more secure than X, but they're starting to poke holes in there for various reasons (color picker, warp pointer for compat, etc...).
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by viraptor on Wednesday May 24, 2017 @07:51AM (#14409275)
Not even multi-process. Threads on Linux can have their own seccomp profiles. You don't need to sandbox absolutely everything at the same time either. In this case opening the file in the main, unrestricted app and spawning a new thread that will read from the existing FD and only send you simple, time sorted messages over a shared IPC/pipe is not that crazy.

Other points may be more tricky, and it's a good list of potential issues, but we can start chipping away some stuff right now. There's a lot we can fix without fixing everything at the same time.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @07:57AM (#14409312)
> Threads on Linux can have their own seccomp profiles.

Not on Windwows or on macOS.

> new thread that will read from the existing FD and only send you simple, time sorted messages over a shared IPC/pipe is not that crazy.

Of course that does not solve anything, because your demuxer|decoders|output needs access to the FS, have access to kernel-mode and those are the dangerous parts.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by zeveb on Wednesday May 24, 2017 @02:58PM (#14412518)
> > Threads on Linux can have their own seccomp profiles.

> Not on Windwows or on macOS.

It's a shame, then, that Windows & macOS are holding back security improvements for software running on Linux. I understand (& even agree with!) your desire to have a sandboxing mechanism which runs acceptably on all supported systems; it's just sad that this security mechanism in the Linux kernel can't be taken advantage of in vlc.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Thursday May 25, 2017 @11:03AM (#14417745)
Well, no. Because you can do it per-process. I don't see the reason of doing it per threads here.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by viraptor on Wednesday May 24, 2017 @08:01AM (#14409339)
I'm not sure what you're trying to say. Yes, I meant Linux. Yes, it can solve the issue of separate subtitle files, which this article is about. Read access to an existing FD is not the same as full FS access, and there's no demux involved here.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:04AM (#14409354)
> Yes, I meant Linux

The demo is on Windows. The goal is to do a sandbox that works on most OSes.

And, it will not solve the decoder issue, since it is on the decoding side, which still has access to the GPU/Aout and the kernel.

> Read access to an existing FD is not the same as full FS access, and there's no demux involved here.

You're totally missing the point here. The issue is demuxers/decoders/output, not really the access.

Reading from an FD or not would not solve the buffer overflow exploitation (if it was actually exploitable).

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by dom0 on Wednesday May 24, 2017 @07:53AM (#14409283)
> Not even multi-process. Threads on Linux can have their own seccomp profiles.

Feels kinda pointless, since all threads in a process share the same memory protection.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by viraptor on Wednesday May 24, 2017 @07:57AM (#14409311)
They don't have to. Clone can do a lot of magic without full processes.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:06AM (#14409362)
But then you need to copy the memory from the decoder to the video output or you get back to the same problem to work-on.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by Filligree on Wednesday May 24, 2017 @08:26AM (#14409477)
No, you can use a shared memory segment for a buffer just for that.

It's more coding, certainly, but it's possible. Security is an option if we wanted it.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:42AM (#14409556)
That's exactly the point above. See my above comment.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by Filligree on Wednesday May 24, 2017 @08:57AM (#14409639)
I'm not sure, it sounds like you're saying we'd need to copy memory.

The shared memory segment can be a GPU image buffer, so I don't think that's true.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @09:03AM (#14409684)
See comment above with "the solution".

Either you need to have multi-process and correct IPC, or you need to copy.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by johncolanduoni on Wednesday May 24, 2017 @08:10AM (#14409380)
> Probably do a multi-process media player, like Chrome is doing, with parsers and demuxers in a different process, and different ones for decoders and renderers. Knowing that you probably need to IPC several Gb/s between them.

That's not actually how Chrome's renderer sandboxing works. Both Windows and OS X allow you to share a GPU-resident texture between processes (DXGI shared surfaces and IOSurface respectively), so there's no need to copy any video data.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:49AM (#14409598)
But you need to pass data from the access to the stream_filter, from the stream_filter to the demuxer, from the demuxer to several decoders, from the decoders to potentially a few video-filters and chroma-converters, and then finally to the output. Each of them need different access policies, and several of them require FS access.

The last part is just one of the issues, very far from all of them.

Seriously, stop thinking that noone has given a thought to the question...

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by rossy on Wednesday May 24, 2017 @09:52AM (#14409984)
These shouldn't require IPC at GB/s speed either. Modern sandboxes, like the one in Chrome, have a broker process which can open filesystem objects, device objects and sockets (file descriptors or handles) and pass them to a sandboxed decoder/renderer process, so there would be no need to stream filesystem data to the sandbox when the sandbox could do the file I/O itself. Even for Matroska ordered chapters, where the demuxer would have to tell the broker which files to open, the broker could enforce certain rules, such as enforcing that local mkv files only reference other local files, the files are all in the same directory, and that the files are always opened in read-only mode.

As for isolating decoders from video filters and chroma conversion, I'm not sure why that would be necessary, since those shouldn't require any additional privileges. I understand that retrofitting an existing program to use a multi-process sandboxing model is far from easy, and I'm definitely not volunteering to do it, but I don't think there is anything specific about a video player that is harder to sandbox than a web browser.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @11:38AM (#14410797)
> I understand that retrofitting an existing program to use a multi-process sandboxing model is far from easy, and I'm definitely not volunteering to do it,

Yes, that's the core of the issue.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by johncolanduoni on Wednesday May 24, 2017 @09:07AM (#14409706)
I don't think nobody has thought about it, but since you were apparently unaware that there was an alternative to performing several GB/s of IPC for moving buffers around there's obviously some options that haven't been considered. The Chromium sandbox has to deal with every issue you've listed (it's even calibrated to run ffmpeg inside the sandbox, since that's something Chromium needs to do).
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @09:16AM (#14409745)
> but since you were apparently unaware that there was an alternative

I will refrain from answering to such attacks. As you seem to know better, I'm waiting for your patches.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by johncolanduoni on Wednesday May 24, 2017 @09:35AM (#14409876)
It's not an attack. Each platform's methods of GPU IPC are pretty sparsely documented. Two months ago I wouldn't have known about them; I only learned by working on integrating Chromium's sandbox into an application that needed to work with the GPU within a sandboxed process.

That doesn't change the fact that none of the things you listed are unsupported by Chrome's sandbox model, and if you only need to establish a barrier around the video pipeline (and not e.g. VLC's ability to notice device status or interact with webcams) you don't even need 3/4 of what Chromium's sandbox has implemented. Like I said, I've actually walked the walk when it comes to using their sandbox for Windows and Linux with a process that needed to access certain user files, the GPU, and even each platform's font server equivalent, so this isn't me just spitballing about some theoretical solution.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by justin66 on Wednesday May 24, 2017 @09:29AM (#14409836)
What features could the OS offer you (to help your program be "sandboxed") that it currently does not?
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @09:30AM (#14409844)
I think we can do everything now for the majors OSes, but I'd guess this is a 50-100 man-month work for VLC.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by fulafel on Wednesday May 24, 2017 @10:22AM (#14410189)
You don't need special fast IPC. Even uncompressed video is fine over standard IPC.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @10:52AM (#14410416)
Blurays are 60Mbps.

Then with 40k60 + HDR, displaying is quite a lot of bandwidth.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by fulafel on Wednesday May 24, 2017 @04:12PM (#14413068)
A 10 year old PC carries 2.1 GiB/s (= 17 Gbps) over bog standard pipes without tuning or parallelism, as measured by "pv /dev/zero | cat > /dev/null". Uncompressed full HD is 1.5-3 Gbps. (Less actually, since codec output is going to be 4:2:2 or similar)

Yeah, you can come up with high bandwidth scenarios like stereo VR 144 Hz 4k HDR running on barely capable hardware. But 99% of users don't require such tricks and never see any upside from the performance-over-security compromise.

Even if you decide basic IPC is not fast enough, a shared memory buffer for raw frame data is reasonably secure too.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Thursday May 25, 2017 @11:05AM (#14417754)
Knowing that today we still see bandwidth issues in VLC, even without IPC, I kind of doubt it.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by FrozenVoid on Wednesday May 24, 2017 @09:16AM (#14409747)
All this means Linux is misdesigned for user apps, forcing low-level code instead of proper APIs. Maybe stuffing everything into the kernel isn't a good idea after all? All these things are exploit attack surfaces.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by adgasf on Wednesday May 24, 2017 @08:11AM (#14409382)
Interesting.

I am only interested in these features:

- you need access to the GPU stack, which is running in kernel-mode, btw, to output video and get hw acceleration;

- you need access to the audio stack, also in low-level mode;

- you need access to the DSP acceleration (not always the GPU);

- you need access to the system settings to disable screensavers, and adjust brightness;

- you need to unzip, untar, decrypt, decipher and so on;

- many OpenGL client libraries need access to the /etc too;

Is there a lighter version where these features are cut?

- you need to be able to open files without user interactions (no file picker), in order to open playlist, MXF or MKV files;

- you need the same if ever you have a database of files (media center oriented);

- you need raw access to /dev/* to play DVD, CD and other optical disk (and the equivalent on Windows);

- you need ioctl on such devices, to pass the MMC for DVD/Bluray;

- you need raw access to /dev/v4l* for your webcams and be able to control them;

- on linux, you have access to x11 for the 3 above features, which is almost root;

- you need access to /etc/ (registry) for proxy informations, fonts configuration and accessibility;

- you need access to the network, as input and output (think remote control);

- you need access to mounts to be able to see the insertion of DVD/Bluray/USB/SD cards and such;

- you need to expose an IPC (think MPRIS on Linux);

- you need access to the fonts and the fonts configuration (see fontconfig).

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:21AM (#14409442)
The first part are the dangerous parts.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbverschoor on Wednesday May 24, 2017 @08:13AM (#14409403)
You actually don't NEED a lot of these things I'm perfectly fine with a default / embedded font. I don't have an optical drive A database can be in the local app storage. I'm fine opening a subtitle file myself. Why would I need IPC? Why would I need to unzip anything? If it's subtitle files, it can be done in-memory. Are you sure we need low-level audio?

I don't have a remote, so I'd like it to be disabled by default. I don't need any access to the network.

etc. etc. etc

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by stordoff on Wednesday May 24, 2017 @08:44AM (#14409566)
Those restrictions work for you, but would make VLC borderline useless for me.

> I don't need any access to the network.

90+% of what I use it for comes from my NAS or the Internet.

> I don't have an optical drive

Most of the rest is from optical discs.

> I'm perfectly fine with a default / embedded font. [...] I'm fine opening a subtitle file myself.

It's _fine_ but far from ideal. Both are useful quality of life features.

> Why would I need to unzip anything?

Non-essential, but being able to play video from a ZIP is a useful feature.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by Brockenstein on Wednesday May 24, 2017 @09:16AM (#14409751)
Let's play, "why isn't my use case the only use case."
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by oblio on Wednesday May 24, 2017 @08:18AM (#14409426)
Congratulations, you don't need those things. What about the other 19.999.999* users? Are you sure they don't need any of those things? :)

* Arbitrary number.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by thirdsun on Wednesday May 24, 2017 @08:26AM (#14409476)
That's you. Most users expect one or more of the other mentioned features.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by simias on Wednesday May 24, 2017 @09:34AM (#14409871)
I don't understand why sandboxing the userland is not a thing on the linux desktop at least. When you sanely configure a un*x server you generally at least create a user per application. The web server runs as www, the database with its own user, the ssh process runs as the logged-in user (the daemon runs as root obviously, but only for just as long as it needs before forking a less priviledged child) etc...

But when it comes to the desktop everything runs at $user and that's the end of it. While this makes sense for multi user "mainframe"-style systems, for modern desktops it's an anti-pattern almost. I wish I could run my browser as its own user, my password manager as an other, my code editor/toolchain in an other, the closed source spotify client in a third etc...

It's kind of doable today but it's not exactly friendly to setup. In particular Xorg is not exactly designed with client isolation in mind as far as I can tell, preventing one window from overtaking an other without being too cumbersome is left as as exercise to the reader.

But really, at the OS level I feel like we already have all the functionality we need and we just completely ignore it. On a desktop the critical account isn't really root per se, rather it's the user account that contains all of my data.

Maybe we've just been doing it wrong the entire time and we should just log into our single-user desktop computers as root and then spawn our shells and other applications as various unpriviledged users as necessary (this could easily be scripted in launcher scripts). I wonder if anybody has attempted to do that, but again I don't expect that Xorg would work very well in this configuration.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by Mister_Snuggles on Wednesday May 24, 2017 @10:30AM (#14410255)
> Maybe we've just been doing it wrong the entire time and we should just log into our single-user desktop computers as root and then spawn our shells and other applications as various unpriviledged users as necessary (this could easily be scripted in launcher scripts). I wonder if anybody has attempted to do that, but again I don't expect that Xorg would work very well in this configuration.

Replace '...as various unprivileged users' with '...as completely isolated virtual machines' and you've got the gist of what QubesOS does. I haven't tried it personally, but it sounds really interesting.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by simias on Wednesday May 24, 2017 @11:01AM (#14410483)
Thanks to your and andrian's comment I'm currently downloading a QubeOS ISO, I'm curious to see how usable it is.

Using VMs sound a bit more heavy handed than what I had in mind, but I guess on modern machines with good hardware support it should be pretty workable.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by WrtCdEvrydy on Wednesday May 24, 2017 @11:50AM (#14410908)
If that doesn't work (i've had issues with newer hardware), take RancherOS for a spin.

It's dockerized applications (as close as a VM as possible).

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by leni536 on Wednesday May 24, 2017 @09:53AM (#14409993)
Well, there is firejail now. It does Xorg sandboxing through xpra, I don't know how it affects hardware acceleration though.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by simias on Wednesday May 24, 2017 @09:57AM (#14410026)
Oh that looks grand, thank you for pointing that out. I'll give it a try.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by adrianN on Wednesday May 24, 2017 @10:02AM (#14410055)
Maybe you'll like QubesOS.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by zer0tonin on Wednesday May 24, 2017 @10:38AM (#14410320)
QubesOS, while being a very interesting project, is much more extreme that running different application as different users.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by Tepix on Wednesday May 24, 2017 @08:44AM (#14409563)
"There is no excuse that these kind of applications are not completely sandboxed."

Woah, what a sense of entitlement! What's your excuse for not having submitted a patch years ago?

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by weberc2 on Wednesday May 24, 2017 @10:40AM (#14410339)
Not the OP, but valid responses range from "I have a life" to "it's not my project" to "I don't want to". Odd that you think criticism depends on contribution.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by riffraff on Wednesday May 24, 2017 @10:56AM (#14410447)
those are likely most of the same reasons these apps are not sandboxed (switching "not my project" with "I'm not payed work on this").
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by weberc2 on Wednesday May 24, 2017 @12:52PM (#14411438)
Those are valid reasons not to improve a project, but it doesn't make your project immune to criticism. If you're not going to take the time to make your project better, that's fine, but other people are still free to point out that your project isn't very good or that your project could be much better if you managed your time differently.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by nebabyte on Wednesday May 24, 2017 @01:07PM (#14411553)
Tepix's point was about entitlement, not criticism.

"There is no excuse for ___" definitely crosses the line from criticism to entitlement. :^)

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by weberc2 on Wednesday May 24, 2017 @02:08PM (#14412123)
I can't figure out how anyone could read entitlement into that statement.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by EpicEng on Wednesday May 24, 2017 @02:48PM (#14412436)
So open source always gets a free pass? "You should be doing X as what you're doing represents a security threat." "Well, submit a patch then neener neener."

C'mon.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by riffraff on Thursday May 25, 2017 @02:11PM (#14419007)
they don't, it's just that the statement "there is no reason for this software not to have a sandbox" is wrong, because, well, there are many reasons.

A correct statement might have been "there is no technical reason that prevents sandboxing, given a ton of work".

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by ajross on Wednesday May 24, 2017 @11:38AM (#14410796)
Video players are among the most difficult of applications to sandbox. The codecs involved may be in-app software or hardware reached via one of a dozen abstraction APIs. The same is true for audio and frame buffer access. There is a huge amount of code that needs holes poked in the sandbox walls to function.

And realistically once you do that you have another component out there with all that complexity and permissions to exploit. That's exactly what happened with Android. The apps have a clean sandbox, so all the exploits target the mediaserver process instead.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by etix on Wednesday May 24, 2017 @08:00AM (#14409330)
Moving 4K / 10-bit buffers at 30 or 60 fps (because 3D) between processes is not as easy as it sounds.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by johncolanduoni on Wednesday May 24, 2017 @08:06AM (#14409364)
Both Windows and OS X provide ways for a sandboxed process to draw directly to a GPU-resident texture owned by another process. Chrome's renderer sandbox is a good example of this technique.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by etix on Wednesday May 24, 2017 @08:13AM (#14409401)
A media player is rarely that simple. Before writing to the GPU you have to access the content (file, network), demux, then decode and finally display.

The most dangerous areas are the demuxers and decoders so they have to be sandboxed.

So yes, you're right, but this doesn't solve the problem of moving the buffers between processes.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by johncolanduoni on Wednesday May 24, 2017 @08:18AM (#14409417)
You can share file handles/sockets on Windows/OSX/Linux via IPC without giving the renderer process the ability to open the files/sockets themselves.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:47AM (#14409577)
But that's just ONE of the issues. The issue here is that the decoder/parser is in a process that has a too many privileges...
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:12AM (#14409391)
Sure, but then you need a multi-process sandbox, and it's not easy to do.

And the performance is not easy to obtain.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by johncolanduoni on Wednesday May 24, 2017 @08:25AM (#14409471)
You can co-opt Chromium's. I've been doing that with a project I'm working on and it has worked quite well.

I'm also not sure where you'd lose much performance. If you hand the file handles/sockets and backbuffer to the renderer, you only need enough IPC to synchronize the drawing. Sending small messages on the order of 100 times per second between processes is not going to be a bottleneck.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:46AM (#14409573)
But you need to pass data from the access to the stream_filter, from the stream_filter to the demuxer, from the demuxer to several decoders, from the decoders to potentially a few video-filters and chroma-converters, and then finally to the output. Each of them need different access policies, and several of them require FS access.

It is not easy. If it was, people would have done it already.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by johncolanduoni on Wednesday May 24, 2017 @08:59AM (#14409659)
You can get most of the security people are asking for without that level of granularity. If the decoder is exploited and is able to attack the demuxer, that's still worlds better than the decoder being able to run with full user privileges.

Do any of those components need unrestricted/unpredictable file access? Because if they don't you can just open the files in the main process that handles the UI and send them to the sandboxed process via IPC. None of Windows/OSX/Linux do permission checks when file handles are read from, they only check when the file is initially opened.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @09:07AM (#14409704)
But the issue is not only file access. File access is a small part of the main problem.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by zelphir_kalt on Wednesday May 24, 2017 @01:19PM (#14411670)
So far I did not know that there is anything in video subtitles, that needs interpretation. What is needed is not a sandbox, but simply code, which stops trying to do weird stuff with something as static as subtitles. They should be a timestamp for the time in the video where the text shall appear plus text itself nothing more. If it does not parse according to a specific format throw that stuff away and read the next line in a subtitles file or simply declare the whole file invalid and be done with it.

Don't try and start doing weird things with something like subtitles and we are fine.

Why does VLC or one of the other programs feel the need to do anything more than that, resulting in gaping security vulnerabilities? Is there any good justification? Or is this again about some overflow with unexpectedly long strings or something like that? (In such case it is the not so careful programming on VLC side that is the problem)

Furthermore the subtitles are often inside the video graphical data itself. I've actually never used a subtitles file. I tried a few times, but every single damn time they were off, and not only off but exponentially off, which made it impossible to get the correct text for all play positions in the video. If you ask me, so far all the subtitle files I tried for any movie suck anyway.

(This is ignoring any subtitle file specifications, which might exist.)

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by thaumasiotes on Wednesday May 24, 2017 @01:26PM (#14411754)
> They should be a timestamp for the time in the video where the text shall appear plus text itself nothing more.

I think the option to have positioning information was a good idea.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by cesarb on Wednesday May 24, 2017 @08:22AM (#14409452)
AFAIK, fonts aren't a passive format, they contain code which executes in a VM.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by marcosdumay on Wednesday May 24, 2017 @08:31AM (#14409507)
At least SRT files are a purely declarative sequence of lines with "time time text".
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by Khao on Wednesday May 24, 2017 @10:24AM (#14410209)
"Officially", SRT files are only timecodes and text, but most players support html codes directly like <b> <i> <u> to support more formatting options than the basic SRT. I wonder if some of them simply render the text as html and could be vulnerable to similar attacks. I say "Officially" because SRT has no standard, it just evolved through usage and it's a fucking mess, as I'm a software dev working on a subtitling editor software.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by olau on Wednesday May 24, 2017 @11:42AM (#14410837)
I seen a similar problem in another context where a browser engine is used to render some simple HTML in an app for convenience, but then suddenly turns into something exploitable because nobody is thinking about updating the engine when a bug is found in an esoteric (for the app) feature.

Embedded web engines should probably have a minimalistic safe mode.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by jbk on Wednesday May 24, 2017 @08:44AM (#14409564)
But SSA is not. It's specifying a font and sometimes even shipping a font inside the SSA file.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by MereInterest on Wednesday May 24, 2017 @07:44AM (#14409244)
I get equally confused anytime Microsoft Office gives the "Files from the internet may contain viruses." warning. How do you mess up a document editor so badly that the document can affect the computer? I know that the answer is Visual Basic, and I know that there are legacy reasons why it will never be removed, but holy cow, it is ridiculous.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by RobAley on Wednesday May 24, 2017 @07:56AM (#14409301)
It's not just VB. Any code in a program which parses any kind of data, including "passive" data like images, docs and even plain text, is vulnerable to bugs in it's own code. It's often not related to what the data is, but the way in which it is handled.
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by bsandert on Wednesday May 24, 2017 @08:08AM (#14409374)
Please don't fall into the Dunning-Kruger[0] trap by assuming a straightforward task is also easy to perform. These things may very well be complex and include aspects that are not immediately obvious. And even if they don't, even simple code executing simple tasks can be vulnerable to bugs or flawed reasoning without the authors (or tooling) being stupid or naive.

[0]: https://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by innocenat on Wednesday May 24, 2017 @08:26AM (#14409479)
And I find this especially true for anything media-related. I am amazed it even works for most user without problem [0]

[0] Obvious problems, like unplayable, etc. Minor problems (chroma placement error, transfer function, etc) seems to occur very frequently.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by 3chelon on Wednesday May 24, 2017 @10:19AM (#14410166)
Basically, regardless of VMs etc, parsing any kind of binary data is inherently dangerous. Old binary formats were bespoke, there weren't always standard libraries to read the headers etc, so everyone wrote their own, with their own bugs. A common attack vector was simply using invalid lengths on header fields, causing a stack or buffer overflow to fool the host into executing the binary data as code.

That's one of the reasons these days there's a tendency to use text-based representations like JSON, but of course anything size-sensitive such as images and movies is still generally binary.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by tomp on Wednesday May 24, 2017 @09:23AM (#14409798)
Well, M$ Office makes sense, since it's macros.

What I really don't understand is Acrobat Reader. It has a "Protected View", which is the first WTF - .pdf-s are read-only, so there should be absolutely zero active code running anyways. What's the next, much bigger WTF WTF WTF is that you need to exit protected view to print the document.

How can the program read and render the document on screen, but not print it?! How is this even possible?

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by izacus on Wednesday May 24, 2017 @10:01AM (#14410050)
PDF can contain executable code (JavaScript to be exact), access remote URLs, and has several separate modes of display (which means that document rendered for printing is different than what you see on the screen).

PDF is an old complex format with a lot of features used in a lot of special cases that go light years beyond looking at a simple text file. It's the reason for all the issues, but keeping it useful as it is and magically waving away all issues is not really easy.

Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by leni536 on Wednesday May 24, 2017 @10:01AM (#14410046)
Javascript is part of the PDF standard (yeah...).
Re:Malicious Subtitles Threaten Kodi, VLC and Popcorn Time U... by rocqua on Wednesday May 24, 2017 @10:22AM (#14410188)
PDF is a very fancy wrapper around post-script (massive over-simplification). Post script is a Turing complete language. As such, PDF is essentially code.