News for hackers. Stuff that matters.
Re:WireGuard: next generation in-kernel modern VPN by Retr0spectrum on Tuesday June 28, 2016 @11:28AM (#11994514)
Can someone explain why being in-kernel is considered a feature?
Re:WireGuard: next generation in-kernel modern VPN by zx2c4 on Tuesday June 28, 2016 @11:31AM (#11994544)
Speed, simplicity.

It's not possible to do highspeed crypto from userspace while still integrating with the usual networking stack. Tun devices result in copies and context switches which makes things quite slow.

This also adds quite a bit of simplicity.

But sure, I agree, it's scary. But not nearly as scary as the obscenely huge xfrm/ipsec layer in the kernel. Or the dozens of other kernel tunneling deivces available. And I dare even say it's not as scary as most userspace VPN solutions like OpenVPN which are massive code bases. WireGuard, in contrast, aims to be quite minimal in its codebase, so that it can be audited by an individual.

I didn't make the title of this HN post, unfortunately. But do note: there _will_ be userspace implementations of WireGuard. It's most certainly not tied to the kernel. It's just that the OP saw me present at a kernel conf about it. :P

Re:WireGuard: next generation in-kernel modern VPN by artie_effim on Tuesday June 28, 2016 @01:17PM (#11995542)
So, everyone needs to take a deep breath here. In kernel VPN is giving me a bit of a security heart attack. As a security professional I would recommend not running this on anything but a sandbox that isn't connected to your environment. A single misstep in the code, a bad implementation of a crypto library or a bad hook could easily lead to ring 0 compromise.

Not trying to discount the author's work, and I haven't reviewed any of the documentation, but until this gets evaluated by a CC lab (or like independent group) I would not implement in anything you care about.

Re:WireGuard: next generation in-kernel modern VPN by tptacek on Tuesday June 28, 2016 @01:28PM (#11995674)
As a "security professional", I kind of don't care whether this is in-kernel or not.

First, this is Linux, and if someone manages to get code execution in your unprivileged userland program, the odds of you keeping them out of your kernel are already pretty low.

Second, and more importantly, this is VPN software. If your VPN gets popped, you probably have bigger problems than whether the attacker got the kernel on the VPN server, as opposed to just being able to create arbitrary network connections from the "inside" of the VPN.

If you don't want to run it, don't run it. If you're going to ask me whether I'd trust OpenVPN more than WireGuard, no, I do not.

Re:WireGuard: next generation in-kernel modern VPN by teacup50 on Tuesday June 28, 2016 @02:12PM (#11996090)
> As a "security professional", I kind of don't care whether this is in-kernel or not.

As a "kernel professional", I'm laughing incredulously at this. A lot.

Re:WireGuard: next generation in-kernel modern VPN by tptacek on Tuesday June 28, 2016 @02:20PM (#11996147)
Do go on.
Re:WireGuard: next generation in-kernel modern VPN by teacup50 on Tuesday June 28, 2016 @02:53PM (#11996434)
What do you want me to say? I'd think it ought to be self-evident that greater risks exist when operating in a single shared memory space at ring 0. If nothing else, the trampoline to privilege is already complete; very little stands between a vulnerability and an active exploit.

The end goal ought to be getting more things out-of-ring 0, not adding more things to it -- I'm never going to say that "I'm not concerned" or that "It's a non-issue" (although I will say that I'm a lot more worried about the massive amounts of crap code in WiFi drivers than I am about a VPN implementation, generally speaking).

In the OpenVPN case, numerous vulnerabilities have been limited to only DoS exploits due to the zealous use of assert(); in the kernel case, that brings down your machine, and quite often, assertions are compiled out of the release kernel due to their overhead in critical paths (whether they should be is another question).

We do have ways to tackle the kernel->userspace performance divide when it comes to packet processing, e.g: https://www.freebsd.org/cgi/man.cgi?query=netmap&sektion=4

  netmap is a framework for extremely fast and efficient packet I/O for
  both userspace and kernel clients. It runs on FreeBSD and Linux, and
  includes VALE, a very fast and modular in-kernel software switch/data-
  plane, and netmap pipes, a shared memory packet transport channel. All
  these are accessed interchangeably with the same API.

  netmap, VALE and netmap pipes are at least one order of magnitude faster
  than standard OS mechanisms (sockets, bpf, tun/tap interfaces, native
  switches, pipes), reaching 14.88 million packets per second (Mpps) with
  much less than one core on a 10 Gbit NIC, about 20 Mpps per core for VALE
  ports, and over 100 Mpps for netmap pipes.

  Userspace clients can dynamically switch NICs into netmap mode and send
  and receive raw packets through memory mapped buffers.  Similarly, VALE
  switch instances and ports, and netmap pipes can be created dynamically,
  providing high speed packet I/O between processes, virtual machines, NICs
  and the host stack.
Re:WireGuard: next generation in-kernel modern VPN by tptacek on Tuesday June 28, 2016 @03:04PM (#11996545)
I addressed CPL0 vs CPL3 elsewhere on the thread. All things are not equal here.

OpenVPN uses TLS. The whole point of WireGuard is to shake off that complex baggage.

Re:WireGuard: next generation in-kernel modern VPN by uudecode on Tuesday June 28, 2016 @09:45PM (#11998976)
It's possible to shake off OpenVPN and TLS without shaking off use of tun/tap. I use a tun/tap based "VPN" (overlay) and I quite like it. One could even add NaCl to it if they were so inclined.

I sometimes think Apple removed /dev/tap from iOS because it provided too much potential freedom.

Not every user needs in-kernel performance for their daily routine but there's certainly an argument that every user could use a decent "VPN" that could run on all their computers.

Alas, OpenVPN mindshare is rather strong, to the detriment of existing or future userspace alternatives.

Re:WireGuard: next generation in-kernel modern VPN by teacup50 on Tuesday June 28, 2016 @03:15PM (#11996649)
> OpenVPN uses TLS.

Granted, but this should generally be behind a shared secret HMAC, according to best practices, limiting the scope to those with the key in hand.

> The whole point of WireGuard is to shake off that complex baggage.

That's great, but also has nothing to do with running in-kernel. I'm not ready to give either product a clear pass on their risk profiles.

Re:WireGuard: next generation in-kernel modern VPN by wepple on Tuesday June 28, 2016 @02:17PM (#11996122)
I'm curious, you don't agree that the complexity of an access vuln + privesc vuln is a better defender position than a single vuln to ring-0?

It kind of seems to fly in the face of the multiple layers of userland and kernel separation engineering we've seen go into other attack surfaces like browsers?

Re:WireGuard: next generation in-kernel modern VPN by tptacek on Tuesday June 28, 2016 @02:20PM (#11996142)
All things being equal I do think it's better to be in the former position than the latter.

But all things are not equal. Any code execution on the VPN server practically implies that the attacker controls the VPN, which is game-over for most VPNs I've ever worked with. So my priority would be "not having those kinds of vulnerabilities at all". I'd rather have simpler, easier-to-audit code than userland, if I have to choose one.

Re:WireGuard: next generation in-kernel modern VPN by Retr0spectrum on Tuesday June 28, 2016 @01:42PM (#11995800)

    "If someone manages to get code execution in your
    unprivileged userland program, the odds of you keeping
    them out of your kernel are already pretty low."
Could you provide some sources/examples for this?
Re:WireGuard: next generation in-kernel modern VPN by tptacek on Tuesday June 28, 2016 @01:46PM (#11995830)
Start here:

https://pax.grsecurity.net/docs/PaXTeam-H2HC15-RAP-RIP-ROP.p...

Are you running the grsecurity patches? If not, everything they do that your kernel doesn't do is another reason your userland will inevitably cough your kernel up to an attacker at some point. Even with those patches, it's still an inevitability; it's just that interval is longer.

I don't run them! I do something easier: I assume that if I lose control of userland on a Linux machine, I've lost the whole box.

It is especially weird, though, to see security people engaging in this kind of risk reasoning. It seems to me that most of the times you lose code execution on your VPN server, the kernel security of the VPN server is pretty far down the list of problems you need to deal with.

Re:WireGuard: next generation in-kernel modern VPN by nickpsecurity on Tuesday June 28, 2016 @02:27PM (#11996207)
For an alternative view, having the apps in user-mode with mandatory controls and such has isolated many real-world vulnerabilities. Even in the shoddy, inadequate implementation that is SELinux. Further, as attackers are battling constraints, they increase odds of generating logs that detect their presence via the unauthorized behaviors. There's also products and prototypes that constantly read memory to find anomolous patterns that depend on kernel or hypervisor layer integrity. The protections get even stronger if using microkernel, capability, pointer, or tainting protection.

So, despite severity of VPN-level compromise, there's advantages mainly in detection and damage limitations if it's a strongly-constrained process. Hell, I've done prototypes that used fixed memory with only networking privileges needed that logged their own behavior to immutable storage. You could compare the execution and logging to a profile. Outside that range, it was a crash or attack. Clive Robinson taught me that last part. Others were Orange and Red Book 101.

Re:WireGuard: next generation in-kernel modern VPN by lawnchair_larry on Wednesday June 29, 2016 @12:20PM (#12002672)
You're thinking too narrowly about who is using VPNs.
Re:WireGuard: next generation in-kernel modern VPN by lobster_johnson on Tuesday June 28, 2016 @02:58PM (#11996480)
> In kernel VPN is giving me a bit of a security heart attack.

You may be surprised, then, that most of the standard VPN tech — IPsec, GRE+PPTP, VxLAN, etc. — operate in the kernel (with some help from userland apps for things like IKE).

Re:WireGuard: next generation in-kernel modern VPN by artie_effim on Tuesday June 28, 2016 @03:31PM (#11996787)
sorry - aren't those all protocols and not applications?
Re:WireGuard: next generation in-kernel modern VPN by lobster_johnson on Tuesday June 28, 2016 @03:41PM (#11996878)
I'm referring to Linux, where the implementations of those protocols are kernel modules. There are user-space implementations, of course, such as Rockhopper (IPsec). But they're not performant.
Re:WireGuard: next generation in-kernel modern VPN by zx2c4 on Tuesday June 28, 2016 @02:27PM (#11996208)
Answered in this thread here: https://news.ycombinator.com/item?id=11995389
Re:WireGuard: next generation in-kernel modern VPN by nickpsecurity on Tuesday June 28, 2016 @11:39AM (#11994606)
It's faster. Performance usually matters more than security for most "security" products. ;) Having extra code in kernel is usually just asking for it. Here's one done closer to high-assurance principles that I'm sure the WireGuard scheme could be ported to:

http://genode-labs.com/publications/mikro-sina-2005.pdf

Far as keeping it in kernel, it might be implemented in SPARK and Rust to see if it gets through static and dynamic (if necessary) checkers. Test and fuzz it heavily. If C, use strong, static tools to show correctness and/or compiler transformations like SAFEcode (or Softbound+CETS) to immunize it. I know Criswell runs Linux kernel on SVA-OS with SAFEcode but not sure if S+CETS can do it. Such approaches will knock out most of the flaws that lead to code injection.

Re:WireGuard: next generation in-kernel modern VPN by zx2c4 on Tuesday June 28, 2016 @11:42AM (#11994633)
We'll actually be producing a Rust implementation for userspace. It'd be interesting to see that work ported back to kernelspace. Cool suggestions.
Re:WireGuard: next generation in-kernel modern VPN by nickpsecurity on Tuesday June 28, 2016 @11:45AM (#11994672)
That sounds good. What's its current implementation language?
Re:WireGuard: next generation in-kernel modern VPN by tptacek on Tuesday June 28, 2016 @03:18PM (#11996674)
It's Linux kernel resident. It's C code.
Re:WireGuard: next generation in-kernel modern VPN by nickpsecurity on Tuesday June 28, 2016 @03:45PM (#11996906)
Wow. Talk about overlooking the obvious. Thanks lol...
Re:WireGuard: next generation in-kernel modern VPN by viraptor on Tuesday June 28, 2016 @08:30PM (#11998677)
Maybe most likely, but not necessarily obvious. While there's no popular module for kernel written in something else than C (as far as I know), there are known ways to write working non-C modules.
Re:WireGuard: next generation in-kernel modern VPN by nickpsecurity on Wednesday June 29, 2016 @05:28AM (#12000435)
C was best assumption as 99+% chance it would be C. Yet, you are right in that I've seen device drivers for Linux done in Ada and ATS languages. It's why I usually don't assume but one was warranter here.