flak rss random www

rethinking openbsd security

OpenBSD aims to be a secure operating system. In the past few months there were quite a few security errata, however. That’s not too unusual, but some of the recent ones were a bit special. One might even say bad. The OpenBSD approach to security has a few aspects, two of which might be avoiding errors and minimizing the risk of mistakes. Other people have other ideas about how to build secure systems. I think it’s worth examining whether the OpenBSD approach works, or if this is evidence that it’s doomed to failure.


Posted 31 Mar 2020 04:20 by tedu Updated: 04 Apr 2020 09:15
Tagged: openbsd programming security thoughts

changing defaults and removing options

Times change and programs must change with them. Altering or removing functionality however risks breaking backwards compatibility. A few examples.


Posted 08 Aug 2019 18:14 by tedu Updated: 08 Aug 2019 18:53
Tagged: openbsd programming

random ip id comments

There’s a new paper, From IP ID to Device ID and KASLR Bypass, which I liked. It’s at the intersection of networking, old but not obsolete standards, random, security, and implementation defined behavior. By all means, read the paper, but the really short version is they accomplished two things. They reverse engineered a per host random seed from network traffic on Windows and Linux, allowing fingerprinting, and more surprising, turned this into a KASLR break on Linux. Pretty wild.


Posted 01 Jul 2019 01:23 by tedu Updated: 01 Jul 2019 01:23
Tagged: networking openbsd security

ssh in https

The wifi network at BSDcan, really the UOttawa network, blocks a bunch of ports. This makes it difficult to connect to outside machines using “exotic” protocols, basically anything except http or https. There are many ways to resolve this, here’s what I did.


Posted 17 May 2019 17:32 by tedu Updated: 15 Jul 2019 21:15
Tagged: openbsd software web

syzkaller found a bug

Common problem for operating system fuzzers is breaking the system they’re running on. Some forms of damage are expected, some are not, and sometimes it’s difficult to tell which is which.

A few days ago, a stack leak bug was fixed in FreeBSD. A similar fix for OpenBSD was committed. And then syzkaller came kalling just a few days later.

panic: bad dir

There’s a few possible causes for this, but inspection revealed that the most likely case might be a directory entry missing the nul terminator. The timing certainly seemed suspicious. Could there be an off by one?

memset(newdirp->d_name + (cnp->cn_namelen & ~(DIR_ROUNDUP-1)), 0, DIR_ROUNDUP);

Actually no. syzkaller had found a way to create filesystem corruption through one of the “expected” damage paths, but the test case was a little obfuscated. More study revealed it was calling mknod to create a new device that happened to be equal to /dev/sd0c and opening it, and then calling pwrite to write some garbage to a random spot.

mknod("banana", 0777, 0x0402);
pwrite(3, "oops", 4, 0x9000);

Not recommended.

Further complicating the matter was that syzkaller didn’t know that pwrite is one of the magic syscalls that takes a padding argument before off_t. This didn’t affect the test, per se, but makes it harder to interpret because syzkaller calls things directly. (The actual syscall in use was the iovec variant, pwritev.)

syscall(SYS_pwritev, r[0], 0x200002c0, 1, 0);

If you read the man page for pwritev that looks correct. But inspecting src/sys/kern/syscalls.master reveals that the fourth argument is actually a pad argument, and the offset is the fifth argument. So the call above was writing to an offset that was not zero.

Not the first fuzzer to encounter this oddity. More details here.

In the end, it was just coincidence that syzkaller found a new way to corrupt its filesystem a few days after a filesystem commit.

Posted 10 May 2019 16:02 by tedu Updated: 10 May 2019 16:02
Tagged: openbsd

toying with wireguard on openbsd

New year, new network. WireGuard promises to be a simpler more secure alternative to IPsec, and there’s a beta iOS client, so I thought I’d try my hand at setting up a server endpoint.


Posted 01 Jan 2019 15:45 by tedu Updated: 16 May 2019 19:30
Tagged: openbsd

protectli router

My ERL melted itself. Again. Time for a replacement. I went with a Protectli FW4A. It’s a small industrial enclosure, fanless, with four ethernet ports.


Posted 29 Nov 2018 18:39 by tedu Updated: 12 Dec 2018 18:39
Tagged: computers openbsd

commands without magic

Is a magic command without magic still a command? And if a feature was a bug, can a new bug be a feature?


Posted 29 Oct 2018 19:27 by tedu Updated: 29 Oct 2018 19:27
Tagged: openbsd programming

hard state soft state confusion

A few thoughts after reading The History of a Security Hole about a series of bugs in the OpenBSD kernel. It’s a good explanation of an instance of a problem I’ll call hard state soft state confusion, which can lead to some serious bugs, occurs with some regularity, but doesn’t seem to be often discussed.


Posted 02 Sep 2018 22:51 by tedu Updated: 02 Sep 2018 22:55
Tagged: openbsd programming

openbsd changes of note 629

This is the end, beautiful friend; this is the end, my only friend, the end.

Note that octeon supports a few more machines.

Add support for isochronous transfers to xhci. Remains disabled.

Some of the i386 assembly implementations of math functions in compiler-rt use SSE2. Switch to using generic C code.

Use getrusage to measure CPU time in md5 benchmarking.

Add guard pages at the end of kernel stacks so overflows don’t run into important stuff.

Close the default syslogd 514 port.

Add dwxe driver for ethernet found on Allwinner A64, H3 and H5 SoCs.

Fix buffer overflow in perl regexp. Errata.

Fix a regression caused by removal of SIGIO from some devices.

In relayd, use EVBUFFER_EOL_CRLF so that “\r” by itself at the end of a chunk won’t be treated as end of line, causing the following “\n” to be interpreted as a blank line.

In malloc, always delay freeing chunks and change ‘F’ option to perform a more extensive check for double free.

EuroBSDcon happened. There are talks and slides.

Change sendsyslog prototype to take a string, since there’s little point logging not strings.

Validate the TCB (thread control block) pointer which lives in the GS register. Errata.

Removing DDB_STRUCTINFO broke the kernel makefiles by removing too many dependencies, leading to some bad kernels. Put back the good stuff.

Add a kill command to ddb.

Update to unbound 1.6.6.

Add preliminary kabylake support to inteldrm(4) by backporting the relevant commits from linux-4.8.x.

OpenSSH is now version 7.6.

62.html is under construction.

The config program tries to modify zero initialized variables. Previous versions of gcc were patched to place these in the data segment, instead of the bss, but clang has no such patches. Long long ago, this was the default behavior for compilers, which is why gcc was patched to maintain that existing behavior, but now we want a slightly less unusual toolchain. Fix the underlying issue for now by annotating such variables with a data section attribute.

The xrstor instruction will fault if it’s unhappy. Handle this properly. Errata.

6.2-current, back to work.

Posted 06 Oct 2017 16:09 by tedu Updated: 06 Oct 2017 16:09
Tagged: openbsd