News for hackers. Stuff that matters.
Re:OpenBSD Recent Security Innovations by anaphor on Wednesday June 05, 2019 @07:57PM (#20110273)
https://man.openbsd.org/pledge.2 is also pretty damn cool. It effectively lets you make your program use a least authority model of execution, and then you can grant it the capabilities it actually needs to run. I would love to see something similar on Linux (there is capsicum-linux, but it seems like it's abandoned).
Re:OpenBSD Recent Security Innovations by roryrjb on Thursday June 06, 2019 @02:03AM (#20112000)
So like seccomp? Or do you mean a simpler interface like pledge? I haven't really used the seccomp syscall or eBPF directly but I have used libseccomp (https://github.com/seccomp/libseccomp) successfully.
Re:OpenBSD Recent Security Innovations by anaphor on Thursday June 06, 2019 @09:48AM (#20114481)
seccomp and eBPF will let you build something like this but it does not do the same thing as pledge.
Re:OpenBSD Recent Security Innovations by roryrjb on Thursday June 06, 2019 @11:15AM (#20115320)
I'm not saying you're wrong, but at least in terms of the default behaviour of pledge with regard syscalls and configuring seccomp so the kernel kills your whole process when it hits a syscall you haven't whitelisted, it sounds the same, so it would be good to know what the differences are.
Re:OpenBSD Recent Security Innovations by anaphor on Thursday June 06, 2019 @01:03PM (#20116503)
I think the difference is just that seccomp/eBPF is lower level and more powerful in terms of what it can do. So pledge gives you a simpler interface to manage things, whereas with eBPF you have much more flexibility (since you're writing in a subset of C) but with that flexibility also comes more complexity. I.e., eBPF is its own scripting language for the kernel, pledge is just a way of managing fine-grained capabilities.
Re:OpenBSD Recent Security Innovations by rurban on Thursday June 06, 2019 @12:36AM (#20111628)
Totally uncool and a dead end. Nobody else will do it that way. "The promises argument is specified as a string, with space separated keywords". caps as strings to be tokenized at runtime are slow, insecure and not validated at compile-time. Never trust a parser in core. This needs to be a bitmask of course. Don't let ruby programmers add OS API's.
Re:OpenBSD Recent Security Innovations by gpvos on Thursday June 06, 2019 @12:50AM (#20111682)
The intended ad hominem in the last sentence does very much not apply.
Re:OpenBSD Recent Security Innovations by unixhero on Thursday June 06, 2019 @02:57AM (#20112199)
Nah no ad hominem taken! I thought it was funny. I write Ruby, and love it, and wouldn't go near OS API design with a tenth foot pole.
Re:OpenBSD Recent Security Innovations by jabot on Thursday June 06, 2019 @04:18AM (#20112556)
That's about 3cm. Pretty close ;-)
Re:OpenBSD Recent Security Innovations by gpvos on Thursday June 06, 2019 @05:37AM (#20112935)
I wouldn't touch it, but watching it up close is quite interesting.
Re:OpenBSD Recent Security Innovations by ksec on Thursday June 06, 2019 @02:56AM (#20112196)
What has it got to do with Ruby ?
Re:OpenBSD Recent Security Innovations by rurban on Thursday June 06, 2019 @07:33AM (#20113477)
Just an example. Could be perl also, but ruby was the fashion then.
Re:OpenBSD Recent Security Innovations by enriquto on Thursday June 06, 2019 @03:55AM (#20112451)
> Never trust a parser in core.

So, we have to part ways with our dear printk ?

Re:OpenBSD Recent Security Innovations by rurban on Thursday June 06, 2019 @07:34AM (#20113488)
That would be fantastic, sure. It's a security nightmare. Know about the printf_s extensions? Maintainability?
Re:OpenBSD Recent Security Innovations by cperciva on Wednesday June 05, 2019 @07:48PM (#20110227)
Wait, OpenBSD didn't have MAP_NOCORE? FreeBSD added that in February 2000... I always assumed that the other BSDs had long since picked it up.

Huh.

Re:OpenBSD Recent Security Innovations by wahern on Wednesday June 05, 2019 @08:04PM (#20110302)
Pretty sure they've deliberately kept it out on principle: better to encrypt swap, ensure permissions on core files are strict, etc, rather than hope all applications correctly set MAP_NOCORE on every bit of sensitive data. Sounds like it just became too inconvenient to avoid, though.
Re:OpenBSD Recent Security Innovations by Someone on Wednesday June 05, 2019 @08:58PM (#20110597)
”better to encrypt swap, ensure permissions on core files are strict”

I don’t think that’s entirely true. A risk this mitigates against is that system administrators read a user’s most sensitive data when they help them debug a crash.

Encrypting the disk won’t protect against that.

Making the core dump owned by the user running the executable won’t, either, because a) the user will have to make the file readable by the system administrators to get help fixing the crash problem, and b) one can assume the system administrators have root privileges, anyways.

On the other hand, a) programs can’t know what a user’s most sensitive data is (for example, they might be writing in their diary), and b) why would users trust a program to protect their most sensitive data in that way, given that it doesn’t even manage to “not crash“?

Re:OpenBSD Recent Security Innovations by tedunangst on Wednesday June 05, 2019 @08:57PM (#20110589)
Deliberate makes it sound like we wanted secrets to appear in the core files. I don't think that's the case, but otherwise yes, there's been a certain amount of care to making core files secure.
Re:OpenBSD Recent Security Innovations by throwaway2048 on Wednesday June 05, 2019 @11:16PM (#20111266)
Why even bother with core files if you aren't a developer? they are completely useless for an average user and are really nothing but a risk.
Re:OpenBSD Recent Security Innovations by asveikau on Thursday June 06, 2019 @12:42AM (#20111651)
I feel like this kind of culture may be dying in most places. But it used to be a common thing that you could pass a core file around to someone knowledgeable who knew what to do with it. In a workplace or university, maybe someone on staff who is technical. In a piece of software, either open source or commercial, maybe its developer. Obviously there is trust implicit in that, because core files contain your data.

On Windows, their equivalent of core files gets sent to Microsoft and they run analysis on them to get most common stack traces for crashing bugs. If you're opted in.

Re:OpenBSD Recent Security Innovations by bluGill on Thursday June 06, 2019 @10:26AM (#20114842)
Why doesn't the system automatically pass core files to someone who knows how to deal with them. I work on an embedded system and our system to get core files back from the users has meant a lot of crashes go from "no idea what happened, closed" to "found the bug and fixed it".

Of course there are security implications. Developers are not allowed to see core files from real customers unless the customer agrees. However our test department and our beta tests agree to this. I don't think anyone has ever looked into a core file to see sensitive data not related to the crash but the possibility exists.

Re:OpenBSD Recent Security Innovations by SmellyGeekBoy on Thursday June 06, 2019 @05:39AM (#20112944)
To be fair, I'm not sure OpenBSD is targeted at the "average user".
Re:OpenBSD Recent Security Innovations by tedunangst on Wednesday June 05, 2019 @08:22PM (#20110403)
Do you know of anything using it? I haven't seen it come up before.
Re:OpenBSD Recent Security Innovations by cperciva on Wednesday June 05, 2019 @08:45PM (#20110531)
There's a few utilities in the FreeBSD base system which use MAP_NOCORE -- I think mostly as a "this isn't useful so don't waste time dumping it" flag: mkimg, sort, grep. The libsodium we have imported into sys/contrib also mention it, but I don't know if those parts of libsodium are ever used by the FreeBSD userland.

Grepping the ports distfiles on my laptop, I see MAP_NOCORE mentioned in Cython, rust, qemu, firefox, and thunderbird; again, no idea how it's being used in those.

In the interest of compatibility, can I suggest

    #define MAP_NOCORE MAP_CONCEAL
for now, and in the future if MAP_CONCEAL adds new functionality define it as MAP_NOCORE|MAP_CONCEAL_EXTRA? Since you have the capability to exclude regions from core dumps, you might as well expose it to programs which are aware of MAP_NOCORE.

PS. Linux has MADV_DONTDUMP and FreeBSD has MADV_NOCORE; I'd suggest handling those as well if you don't already do so.

Re:OpenBSD Recent Security Innovations by tedunangst on Wednesday June 05, 2019 @08:55PM (#20110583)
I don't think the intention was to be incompatible. I'll see about adding aliases.
Re:OpenBSD Recent Security Innovations by hedora on Wednesday June 05, 2019 @10:06PM (#20110928)
Clarification in the documentation about what happens with swap files would be nice, especially as aliases are added.

“Conceal” (but not the manpage) suggests it won’t ever be written to swap, but “nocore” as a performance optimization suggests paging to swap is fine.

If dirty concealed pages can’t be swapped, then it starts to look like mlock(), which requires escalated privileges on linux, at least...

(Though, paging dirty mmapped pages to swap is kind of confusing in the first place.)

Re:OpenBSD Recent Security Innovations by tedunangst on Wednesday June 05, 2019 @10:57PM (#20111195)
So the name conceal was chosen to allow some flexibility, like prohibiting ptrace. The idea is to keep secrets from escaping into other programs. Other programs generally can't read swap, so that's not a concern.
Re:OpenBSD Recent Security Innovations by cperciva on Wednesday June 05, 2019 @08:58PM (#20110598)
Thanks!
Re:OpenBSD Recent Security Innovations by darkhelmet on Thursday June 06, 2019 @03:50AM (#20112429)
It dates back to a hack at Yahoo. We originally excluded all mmap data from core dumps, but switched to using MAP_NOCORE extensively when it came in from upstream FreeBSD.

For us it was a performance issue as we used large mmap files in our distributed shared memory system.

Re:OpenBSD Recent Security Innovations by notaplumber on Wednesday June 05, 2019 @08:37PM (#20110489)
Survey says, in the past ~20 years..

https://github.com/freebsd/freebsd/search?q=MAP_NOCORE&unsco...

Pretty much bupkis. But still more than Capsicum!

Re:OpenBSD Recent Security Innovations by mjg59 on Thursday June 06, 2019 @12:00AM (#20111467)
https://codesearch.debian.net/search?q=MADV_DONTDUMP suggests MADV_DONTDUMP is used in various places, including OpenSSL.
Re:OpenBSD Recent Security Innovations by jedisct1 on Thursday June 06, 2019 @05:50AM (#20112989)
libsodium uses it.
Re:OpenBSD Recent Security Innovations by aomix on Wednesday June 05, 2019 @08:56PM (#20110586)
The PROT_WRITE tweak is interesting. Being able to enforce a bit of Write XOR Execute behavior in Write OR Execute arenas is nifty. It took this change for me to read into W^X and exactly what it entailed because my naive understanding was that the new no-syscall-from-writeable-page behavior would be almost identical in effect to the strict W^X behavior.
Re:OpenBSD Recent Security Innovations by Lt_Riza_Hawkeye on Thursday June 06, 2019 @12:05AM (#20111488)
If you have data you don't want written to a core dump, then MAP_CONCEAL will literally only help you if that memory is in an mmap'd region. If it's in regular old virtual memory, you're fucked.

So if you're going to add a flag to something to let users conceal a region of memory from a core dump, add it to madvise, adding it to mmap is just adding arbitrary restrictions on the programmer.

Linux got it right with MADV_DONTDUMP

Re:OpenBSD Recent Security Innovations by quotemstr on Thursday June 06, 2019 @01:22AM (#20111823)
All memory is mmaped, especially on OpenBSD, which deprecated basically-mmap-with-a-mustache brk. There's no such thing as "regular old virtual memory".
Re:OpenBSD Recent Security Innovations by davidcuddeback on Thursday June 06, 2019 @02:26AM (#20112082)
There’s also malloc_conceal() and calloc_conceal(), as discussed in the article.
Re:OpenBSD Recent Security Innovations by cmurf on Wednesday June 05, 2019 @07:28PM (#20110122)
Anyone know why this link works in Chrome but not in Firefox? I get Peer could not decode an SSL handshake message. Error code: SSL_ERROR_DECODE_ERROR_ALERT
Re:OpenBSD Recent Security Innovations by sam_bristow on Wednesday June 05, 2019 @07:48PM (#20110228)
Are you on running on Fedora by any chance? You might've hit this issue:

https://www.mail-archive.com/[email protected]/msg167825.html

Re:OpenBSD Recent Security Innovations by cmurf on Wednesday June 05, 2019 @08:11PM (#20110341)
Yep, thanks.
Re:OpenBSD Recent Security Innovations by adioe3 on Thursday June 06, 2019 @04:04AM (#20112484)
Re:OpenBSD Recent Security Innovations by snazz on Wednesday June 05, 2019 @07:34PM (#20110161)
Works here on Firefox. Something to do with your internet connection or certificate store in particular?
Re:OpenBSD Recent Security Innovations by newnewpdro on Wednesday June 05, 2019 @07:37PM (#20110173)
Works in FF just fine over here.
Re:OpenBSD Recent Security Innovations by joosters on Thursday June 06, 2019 @02:29AM (#20112089)
Why don’t they just default to not writing core dumps, and forcing the sysadmin to explicitly enable them when debugging an app?

This setup seems like the worst of both worlds. Core dumps get written but now probably lack the information critical to debugging, making them worthless.