by stonogo · 10y ago · 0 comments
This document, in short, makes a great to-do list but completely ignores the roadbuilding that needs to happen to get people ready and on board.
I worked in infosec for a while and saw it at the org level:
1. Security recommends something with no concern for how it inconveniences (or worse) the users.
2. Users ignore or even actively work around security.
3. Users get pwned and blame security.
4. Security gets mad, calls users stupid, goes back to making ham fisted recommendations that everyone ignores because they have to get their work done.
5. Goto 1.
In the end I concluded that we (security) were at fault. In many cases there were user sensitive options and I would make an effort to find them, but most of security actively had contempt for anyone outside security and didn't care.
ntpd is clearly not great software, but OpenNTPD is maybe a little bit too minimal. When ntimed is worthy, I'm sure it'll make it into FreeBSD base, but it's most likely going to be in a .0 release, so it'll be a while and people will be impatient.
OpenSSL is hard. software in base needs libcrypto and libssl, so you need to pick a version and stick with it throughout the release cycle; but the FreeBSD release cycle is longer than the OpenSSL cycle; OpenSSL has also historically not been very good at keeping ABI compatibility. There's a lot of smart people working on this, but I think the least bad option is to not use openssl from base for anything outside of base.
Firewall: I don't think default to no firewall is a problem -- if you want something, you can set it up.
> Five months after this document was published, FreeBSD disabled DSA hostkey and SSHv1 server support in their bundled version of OpenSSH. This was done more than a year after upstream OpenSSH removed them, and both will remain enabled the 10.x branch until its end of life date.
This decision upsets the author, but is the right thing to do. You don't turn off things that people may be depending on in a .x release, you do it in a .0 release. 11.0 was the first .0 release since he wrote this, so it was done as fast as possible. As a FreeBSD user, I appreciate that the .x releases do not contain major changes that break things I may have been depending on. I accept that I need to carefully read the release notes for a .0 release, to see what things I can expect to be broken.
I'm very curious about this one ...
As far as I know, any remote holes without a firewall on a default install would be a ground-breaking, DEFCON-1 level security event to server admins. Complete with CVEs, news coverage on various sites, etc ... right? The only time in history I recall this being a problem was with Windows XP, which led to Blaster and Sasser.
Now I'm absolutely in favor of firewalls, but whenever I spin up a new VPS, there's going to be a window of about 20-30 minutes where I need to get in there, upload my SSH public keys, secure SSHD, tweak my sysctls, write out my pf firewall rules, and then activate them. There are also times when I need to test why a connection is failing, and one of the steps to testing is to turn off the firewall momentarily.
I know that attacks are basically incessant against any server on the net. I see dozens of IPs trying brute-force root login SSH attempts a day against my boxes.
How much danger is there, honestly speaking (not hypothetically), in this window? Would it be worth it to petition VPS providers to allow us to specify our own IP address, and have them enable a default "deny everything except from this one IP" firewall setup on new instances, or is that just total overkill?
To me, the attitude of we're not going to change the defaults the neckbeards cut their teeth on 20 years ago regardless of the insane threat environment we exist in today and if you get hacked, owned or worse, it's your own damn fault for not knowing all of the tweaks that could have saved your ass that we decided not to make defaults even if they are defaults upstream is the height of Unix elitism IMHO.
In the world we live in, having defaults stay the same for the sake of not inconveniencing people who already know better is incredibly shortsighted. And it makes it way more difficult for newbies who don't have time to cobble together best practices from all the relevant IRC chat rooms, email lists and blog posts to learn FreeBSD’s best practices.
It doesn't make a lot of sense to have a default install of FreeBSD that allows users new to the platform and who are looking around and kicking the tires that also allows users to shoot themselves in the foot unnecessarily.
Thanks to the author’a article, I now disable the default settings for OpenSSH, use OpenNTPD, encrypt swap and build everything I can against libressl-devel.
The fact that so many of what are mostly common sense proposed defaults are perceived as breaking some kind of FreeBSD oath of obfuscation doesn't help grow the FreeBSD community in the long run. That's something to also consider.
http://adversari.es/blog/2013/06/19/cant-we-all-just-get-alo...
Backwards compatibility is not a reason for insecurity. Even Microsoft deprecated wrong options after some time.
I'm reminded of OpenBSD's move in 6.0 to enforce W^X on binaries. This breaks the use of my cooperative threading library: in order to avoid requiring specific compilers/assemblers (for the portion that's impossible to write in pure C), I use ~50 bytes of pre-compiled code so that it'll compile anywhere. To do that, I have to mark the block R|X. But I can't know with 100% certainty that the codepage doesn't overlap with something that was writable (since there is no mgetprotect), so I have no choice but to set R|W|X.
So probably what I'll have to end up doing is allocate at least three codepages at run-time, set to R|W, copy the code there, then set R|X, and take a performance penalty for needing a pointer to the code block.
What I would like to see FreeBSD do to help with migrating to stronger security is something like "freebsd-harden" that you run once after a new installation or version upgrade, and it will walk you through a series of yes/no prompts, and advise, "if you aren't sure, say no."
For that 50-byte block of code, on most platforms, you could tell the compiler or linker to put it in the text section directly along with the rest of the code, rather than in the data section. A linker script or a section attribute can do that. Then you can just call it using the appropriate symbol.
I just tested this, with a manually assembled array of bytes, using both of those methods, and both of them work.
Here's the linker script approach:
/tmp$ cat main.c
unsigned long long add(unsigned long long, unsigned long long);
int main(void)
{
return add(23, 45);
}
/tmp$ cat add.c
unsigned char add[] = {
0x48, 0x89, 0xf8, /* mov %rdi,%rax */
0x48, 0x01, 0xf0, /* add %rsi,%rax */
0xc3, /* retq */
};
/tmp$ cat demo.ld
SECTIONS {
.text : {
main.o(.text);
add.o(.data);
}
}
/tmp$ gcc -c main.c -o main.o
/tmp$ gcc -c add.c -o add.o
/tmp$ gcc demo.ld -o demo
/tmp$ ./demo ; echo $?
68
While this won't work on every possible platform, in practice it'll work for almost any platform you might care about.It looks like I don't need the main.o(.text) line either, which is good because that would be a large burden on users of the library.
Also, just noting for others, I had to use .text : { libco.o(.rdata); } since my char array was const.
Glad I could help. Thank you for building awesome software.
> Does Clang support this as well?
Clang supports __attribute__((section)).
For linker script support, it'd depend on what linker you use. GNU ld and gold have complete support for linker scripts. LLVM's lld has some support for linker scripts, plenty enough to do things like this, though it may lack some features that GNU ld and gold support.
> It looks like I don't need the main.o(.text) line either, which is good because that would be a large burden on users of the library.
When I attempted to link without that, the linker complained that it couldn't find main. Interesting that it worked for you without that. You can also use wildcards to match all object files, if that helps, and then use "ld -T thescript.ld *.o" to link.
> Also, just noting for others, I had to use .text : { libco.o(.rdata); } since my char array was const.
Sadly, read-only sections vary a bit more; some compilers use .rdata, some use .rodata.
You could use __attribute__((section)) to explicitly put the array in a specific section, then name that section in the linker script; that avoids the warning and any platform-specific inconsistency.
const unsigned char add[] __attribute__((section("text"))) = {
0x48, 0x89, 0xf8, /* mov %rdi,%rax */
0x48, 0x01, 0xf0, /* add %rsi,%rax */
0xc3, /* retq */
};Actually, they now have such a post-install script:
https://reviews.freebsd.org/D6826 https://wiki.freebsd.org/WhatsNew/FreeBSD11#Security
2 - https://hardenedbsd.org/content/freebsd-and-hardenedbsd-feat...
Memory is cheap; mmap 4K of R|W RAM, copy the code, and mprotect it to R|X.
That is a rather odd conclusion. The pre-compiled code is supposed to be a worse solution than having assembler bits.
Also, apologies to HN. I wasn't trying to turn this into a "help me with my problem" discussion. I was just pointing out how adding extra security can have unintended consequences to other applications with an actual example.