288 points · by paride5745 · 10y ago · 132 comments
I love this defense in depth, buried in the release notes... https://www.openbsd.org/60.html
So in practice, this doesn't really deter anything. Information leaks are everywhere.
With this patch, the order of symbols are randomized every boot, so the offsets that were previously fixed and public aren't.
It's probably still possible, if you have multiple adaptive memory reads, to traverse the datastructures that legitimate programs use to find the order of the symbols, but a) not all information leaks can be used to read arbitrary addresses multiple times, and b) the traversal code becomes more complicated for the attacker to {write,maintain} relative to the simple arithmetic that was previously possible.
The above analysis is for remote exploits, local privilege escalation exploits can just read libc to determine the order (since it's re-linked on boot, not per process).
The string format attack is the one I remember most clearly which basically renders ASLR useless.
int main() {
char buf[20];
fgets(buf, sizeof buf, stdin);
printf(buf);
return 0;
}
An attacker writing to the program's stdin can read at offsets to the stack (e.g. "%42$x"), read the contents of arbitrary non-null memory (e.g. "ABCD%5$s", where ABCD is a 32-bit memory address, and 5 is the positional parameter corresponding to the start of buf), and write an arbitrary value to an arbitrary address (e.g. "ABCD%38x%5$n", to write the value 42 to address 0x44434241).A significant limitation of the vulnerability in the above program is the attacker can't, in a single execution of the program, read a value, then do computations on it locally, then write a value based on those computations. This flexibility is needed in order to bypass ASLR.
This change is basically free and makes certain things more difficult for attackers, so why not?
One thing to note: this will be the last version of OpenBSD to be pressed on CD. The project will now focus on internet-only distribution, giving much more flexibility in the release schedule.
It's a niche concern of course, but I suspect it's a little bit more common in the OpenBSD community than in many others. Of course it shouldn't be too hard for those users to build their own install boot CDs with the tarballs for installation, just skip the big package sets and install them later if the whole won't fit on the disc.
ps: a bit like vynil lovers who take their player out for similar reasons.
One thing that drives me mad is that computer manufacturers still distribute recovery images as DVDs, even though the computers the discs are for don't have drives.
The part about OpenBSD 6.0 not being on CD? I have no idea - this is the first I heard about it. Couldn't really find anything on the site either other than the song lyrics referenced above...
On one hand I've seen threads on HN and Reddit saying how OpenBSD works flawlessly, esp. on various Thinkpads. OTOH I read in-depth reports like these, by OpenBSD insiders who know far more than I ever will, and even their results seem insufficient:
* https://gist.github.com/reyk/80dca43c8bcfa76d2a7ff147ea64d44...
e.g., "The [wlan] connection is sometimes not stable or the firmware shows errors when switching the AP configuration. But stsp@ is actively working on improving it!"
* http://www.tedunangst.com/flak/post/Thinkpad-Carbon-X1-2015
* https://marc.info/?l=openbsd-misc&m=145275871714024&w=2
EDIT: For those interested in this topic, I would start with tedunangst's excellent summary from earlier this year. Thank you Ted!:
The main problem is software that is outdated, unavailable, or buggy on non-Linux platforms.
I came crawling back to Linux in the end.
> The main problem is software that is outdated, unavailable, or buggy on non-Linux platforms
What kinds of applications could you not find a good solution for?
* LibreOffice Writer (lowriter) had an annoying bug where it would sometimes take over a second to redraw the toolbar buttons, and the editor was unavailable during that time. This happened on save, resize, or unhiding the window.
* Konsole's logic to identify the name of the foreground process would occasionally go into an infinite loop and all the konsole windows would lockup and need to be kill -9'd. It can be avoided by using tmux but that's inconvenient. This is sad because it's the most featureful and user-friendly terminal emulator I know of.
* No good C++ IDEs.
* No support for cargo in the rust packages.
* No workable virtualization.
Also, if you use OpenBSD on a laptop, you'd be crazy not to use GNOME 3 in my opinion. Support for the other DEs are not on par.
I think there's a new one out now (DS67*), I haven't tried it yet. But I might buy one. Or wait for the next gen of intel CPUs.
http://dmesgd.nycbug.org/index.cgi?action=dmesgd&do=view&id=... http://dmesgd.nycbug.org/index.cgi?action=dmesgd&do=view&id=...
Note that I swapped the wlan card on one of these, for an Intel one. I don't know if the original card would've worked; I never tried it.
> "Unfortunately there is important third-party code, such as just-in-time compilers, that still uses mmap(2) to make memory both writable and executable, so for the time being, we have to arrange ourselves with it."
If a program wants to JIT on OpenBSD, how should it do it in a secure, OpenBSD-approved way?
This is good portable programming practise anyway...
How does this stop an attacker doing the same via ROP?
ADDED: The approach that comes to my mind is that they could have two processes. One process has the sourcecode, and pages where it can write code. The other process can execute the code. The code updates performance counters which the JITing process can read, so the JITter has feedback to know what to optimise.
However, this sounds a large architectural change, prevents programs JITting programs they generate on the fly, and causes the JIT to lack behind somewhat.
On the Mill CPU (disclaimer: I'm on the Mill team) the CPU can change processes ("turfs" in Mill terms) using a "portal" function call. This alleviates somewhat the performance concerns, as the JITted program can call into the JITer process synchronously and cheaply.
Wait, isn't that backwards? Doesn't the use of W^X necessitate the use of ROP? Right now a JIT has lots of memory that is W&X so you just need a memory exploit to inject some code and then find a way to jump to it, no need for ROP.
But if you implement W^X this won't work because now you can't inject code with just a memory exploit, you also have to set it to executable with mprotect(2). So instead you use ROP, and inject only data which includes jumps to carefully selected sections of code in libc, etc, that implements an exploit. I mean you could probably use ROP to run mprotect, but by that point it's pointless because you're already running code on the system right?
Seems some other people were confused. I've been told in other places that it's Xen. OpenBSD has had working virtio-blk and virtio-net drivers since about 5.3/5.4/5.5 IIRC. hmm...
Lots of excellent CBA research comes from the CHERI project http://www.cl.cam.ac.uk/research/security/ctsrd/
However, they struggle to run lots of very routine C programs; its surprising how many normal programs you run happen to have been written in C and happen to rely on unions and memory unsafety etc!
For example, if you read http://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/201503-... and look at Table 1, you'll see common programs and libraries such as libc and Python which cause trouble for 'memory-safe C'.
The way it works is that the C89 spec defines memory in terms of objects, and it's illegal to even think about a pointer that doesn't point into an object (or to the byte after). That is, it's not just illegal to dereference it, you're not even allowed to create one.
So, because you know that every pointer must point at an object (or NULL), you encode the object and length of the object into the pointer. So pointers end up being a tuple of three words: object, object length, and offset. Now you have enough information to bounds check all accesses while still allowing pointer arithmetic within an object.
Of course, in real life, people do all kinds of wrong things which de-facto C allows but which de-jure C doesn't, such as pointer arithmetic between objects. But the spec does allow bounds checking.
(I abused this to implement a C to Perl compiler.)
Incidentally, fun fact: the 286 memory segmentation system supports mostly-bounds-checked pointer accesses in hardware.
Take a look at VST for an example already in the wild. I'm currently working on a somewhat different approach that does not have the severe license restrictions that CompCert has.
https://news.ycombinator.com/item?id=12407156
Difference between memory safety and full, formal verification of correctness. You're describing the latter. Definitely check out Myreen et al's CakeML work, COGENT at NICTA, and AutoCorres/Simpl used in seL4. They might have stuff to speed up your own tool development. I wish you great luck on your project. :)
https://www.cis.upenn.edu/acg/softbound/
https://github.com/santoshn/softboundcets-3.6.1
http://safecode.cs.illinois.edu/
https://github.com/jtcriswell/safecode-llvm37
When overhead is too high, there's also tools like CPI to at least stop code injections:
http://dslab.epfl.ch/proj/cpi/
There were also safer variants of C to make rewrites for safety easier:
https://www.cs.uic.edu/pub/Main/PhDQualifyingExam/Sample4.pd...
http://www.eg.bucknell.edu/~lwittie/research/Clay.pdf
Note: Clay was used in device drivers and garbage collectors in partnership with Microsoft Research. Some Cyclone techniques were adopted in Rust.
So, the tooling has been around in different forms for a long time. OpenBSD presentation even mentioned a few. They avoid safer languages and these tools on purpose in favor of C, a review process aiming to find all vulnerabilities before hackers, and their after-the-attack mitigations for when they don't. Improving something like Softbound with checks disabled on known-good modules for performance gain would be so much better in terms of time invested and benefits gained. Plus, even average app developers could make memory safe code with same tool.
Not going to happen, though. It's not how mainstream "security" works. They default on using worst tools for the job for what seems to be political/social reasons more than anything. CompSci and private sector innovations long knocked out the technical ones. There's at least niche projects like Redox, GenodeOS, and Muen applying different aspects of best, known methods.
Question: If I am building a custom hardware device (and we will be in the future, I believe) can we run OpenBSD on it using the ARM port, but also invoke binaries created for linux?
It appears that support was removed.
In the near term I need to build for Linux, But eventually we'll be able to target our own hardware, and one of our toolchain items doesn't support BSD right now (and is closed source, though we are considering an open source alternative.)
Any thoughts?
The support for this isn't in NetBSD either but there has been a request to add it in order to run a Citrix app.
Probably not going to happen, but it runs on some other ARM7 SBCs. Mine is running FreeBSD currently, but where is the geek cred in that?
For my pi I want something that I don't have to think about. A colleague pwned my rpi because I hadn't updated it in ages. OpenBSD seems like a better choice...
For convenient laptop use I prefer allowing my user account to mount USB drives and have that done by mouseclicks in some way.
Antoine Jacoutot's toad package is not in the 6.0 packages collection, but xfce4-mount is, so I assume I can set up the appropriate doas rule for a user and then configure xfce4-mount to ignore the local drive. I shall have a play on Sunday.
I still partition with NetBSD. It just feels right; even if not necessary.
There is only one entry in http://www.openbsd.org/plus60.html so I would assume you don't have to change your rules. Also pfctl -n should tell you.
"In pf.conf(5), change the parser to make af-to on pass out rules an error. This fixes a bug where a nonworking configuration could be loaded."
If you want to run Linux apps, run them on your Linux box and use your OpenBSD machine to firewall it off