Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
(unsafehttp.benren.au)87 points by GSGBen 7 days ago
Hey HN, I wanted to get more familiar with C programming, *nix socket programming and C compilation, so I wrote this "web" ""server"". It's running on a tiny SBC in my office, and there's as little as possible between you and it.
Happy for you to try and break it, hopefully with something more interesting than a DoS though :) Please let me know if you find any issues.
If you want to make it actually decently safe, one approach would be to make a list of all the syscalls you critically need after you have loaded all the content in memory (strace can help), then write a seccomp filter to block all the others. Since you don’t need filesystem interaction or pretty much anything except socket I/O, your syscall allowlist can be pretty short. This will ensure that even if an attacker manages to exploit a bug (like a UAF) they’ll be dropped into a sandbox with very little useful functionality.