Hacker News new | past | comments | ask | show | jobs | submit login

> How? The torrent program needs read and write access to create whatever files it needs to, which can't be predicted ahead of time.

The same way it was handled in Firefox, for example; unveil the output dir. At least my torrent program doesn't shit files all throughout my file system. Maybe yours does?




I meant arbitrary files within the dir. Not including any other dirs/files it has to read. So basically, it's marginally more effective than a chroot, without any real granularity.

Besides, you avoided the hard question:

Imagine a worst case scenario for an RCE in a torrent program, and then what is your best case scenario for pledge and unveil being able to confine an attacker?

Because I'm pretty sure it would be a lot less restrictive than what proper sandboxing can provide.


> Imagine a worst case scenario for an RCE in a torrent program, and then what is your best case scenario for pledge and unveil being able to confine an attacker?

Preventing exfiltration of any data outside of the downloads dir. Preventing execution of new programs. Preventing inspection, tracing, and signaling of existing ones. Preventing mmap of writable executable memory for shell code. And preventing pivoting exploits using system interfaces like vulnerable sysctls, large subsystems like drm, and so on.

This much can be done without touching the program code, or even binary, at all, using unveil and exec pledges.

If you're willing to refactor the code a bit, you can also prevent new sockets from being opened and new addresses from being listened on if the code doing networking is isolated from the code doing disk I/O.


> Preventing exfiltration of any data outside of the downloads dir.

Except for all the data it needs access to. I'm not so sure torrent programs will continue to function correctly if they can't re-read their config file, in my experience most want access to a temp directory, the ability to run a few external applications like rar or zip, etc. Most torrent programs need access to more than just the directory where downloads end up when complete.

> Preventing execution of new programs.

This gets spicy if the torrent program is written in an interpreted language like python, no?

I honestly don't have much faith in how far unveil/pledge can restrict in this scenario, but as a result of this discussion I now have an OBSD box again so I can test and play around with it.

> If you're willing to refactor the code a bit

That's beyond the scope of the question. It's bad enough there is no mechanism to sandbox binaries where you don't have access to the code, talking about rewriting programs to solve the issue is some kobayashi maru nonsense.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: