Readit News logoReadit News
Posted by u/tylerflint 4 months ago
Show HN: Using eBPF to see through encryption without a proxygithub.com/qpoint-io/qtap...
Hi HN, I'm Tyler Flint, one of the creators of qtap.

For a while now, my team and I at Qpoint.io have been grappling with the challenge of understanding what's actually happening inside the encrypted traffic leaving our production systems. Modern apps rely heavily on third-party APIs (think payment processors, data providers, etc.), but once TLS kicks in, figuring out exactly what data is being sent, identifying PII exposure, or debugging integration issues becomes incredibly difficult without resorting to complex and often brittle solutions.

Traditional approaches like forward proxies require terminating TLS (MITM), managing certificates, and often introduce performance bottlenecks or single points of failure. Network firewalls usually operate at L3/L4 and lack payload visibility. We felt there had to be a better way.

That's why we built qtap. It's a lightweight agent that uses eBPF to tap into network traffic at the kernel level. The key idea is to hook into common TLS libraries (like OpenSSL) before encryption and after decryption. This gives us deep visibility into the actual request/response payloads of HTTPS/TLS traffic without needing to terminate the connection or manage certs. Because it leverages eBPF, the performance impact is minimal compared to traditional methods.

With qtap, we can now see exactly which external services our apps are talking to, inspect the payloads for debugging or security auditing (e.g., spotting accidental PII leaks), monitor API performance/errors for third-party dependencies, and get a much clearer picture of our egress traffic patterns.

We've found this approach really powerful for improving reliability and security posture. We've packaged qtap as a Linux Binary, Docker container, and Helm chart for deployment.

This is still evolving, but we're excited about the potential of using eBPF for this kind of deep, yet non-intrusive, visibility.

We'd love to get the HN community's feedback:

    Do you face similar challenges monitoring encrypted egress traffic?
    What are your thoughts on using eBPF for this compared to other methods?
    Any suggestions or potential use cases we haven't considered?
Happy to answer any questions!

brendangregg · 4 months ago
To everyone building these things: Please add a disclaimer to say something like:

"This is not a vulnerability: eBPF currently requires root access to do this. Also, eBPF makes this easy but does not make it possible, as debuggers, interposers/shims, and other tools can also attach to pre-encryption points, and therefore banning eBPF (as some people want to do after seeing projects like this) would not actually improve security, but it would instead _reduce_ security as it would prevent eBPF-based security solutions from being used."

tylerflint · 4 months ago
Great idea!

On an unrelated note, your work has inspired most of my career in Solaris/Illumos/Linux systems and honestly this project likely wouldn't have happened if it wasn't for all of your books/blogs/projects to help me along the way. Thank you!

brendangregg · 4 months ago
Thanks, glad it's useful!
bbkane · 4 months ago
Does this work for Go binaries? My understanding is that Go programs do all the encryption "in the process" so the data is encrypted before eBPF can intercept it. I'd love to be wrong about that!
tylerflint · 4 months ago
We have Go support, but it is not open sourced yet. Go is a bit more complicated but we were able to get it after some cave diving in the ELF formats. To give you a little insight on how this works, because Go is statically linked, we need to pull several different offsets of the functions we are going to hook into.

We do this by scanning every version of Go that is released to find offsets in the standard library that won't change. Then when we detect a new Go process, we use an ELF scanner to find some function offsets and hook into those with uprobes. Using both of these, we have all the information we need to see Go pre-encryption content as well as attribute it to connections and processes.

chatmasta · 4 months ago
Great approach. I love the choice of practicality over generalization.

Are these offsets consistent across compilation targets, and they vary only by version of the Go binary? Or do you need to do this scan for every architecture?

lelanthran · 4 months ago
I think you only need to use the eBPF approach for statically linked programs.

ISTR, at some point in the far past, using LD_PRELOAD with my own shims to capture TLS traffic before encryption/after decryption. I might have it lying around somewhere here.

bbkane · 4 months ago
Ok, that's exciting, and thanks for the insight!
lights0123 · 4 months ago
Most programs do encryption without syscalls! eBPF can intercept userspace execution, which they do as mentioned in the post:

> The key idea is to hook into common TLS libraries (like OpenSSL) before encryption and after decryption

bbkane · 4 months ago
I saw that, but Go doesn't use dynamically linked libraries for encryption, so I don't think it helps in this particular case.
Retr0id · 4 months ago
If I want to do something similar, do you know where the relevant parts of the eBPF docs are?

Deleted Comment

zxilly · 4 months ago
There's a similiar tool https://github.com/gojue/ecapture
dilyevsky · 4 months ago
Grafana's Beyla also basically works the same way https://github.com/grafana/beyla
mrbluecoat · 4 months ago
Thanks for sharing. I didn't know about this one.

> Beyla supports a wide range of programming languages (Go, Java, .NET, NodeJS, Python, Ruby, Rust, etc.)

Although "gRPC and HTTP2 are not supported at the moment"

https://grafana.com/docs/beyla/latest/distributed-traces/

ebb_earl_co · 4 months ago
I was just about to ask what the difference is here with `ecapture`
jonfriesen · 4 months ago
`ecapture` has been around for a while and do a lot of great stuff and a lot of functionality overlaps.

Our aim is to make Qtap extensible and via a plugin system. We have http1/2 streaming capabilities and a plugin engine to run these in what we call a stack. Our goal is to add more protocols, like gRPC in the near future.

We have a few example plugins that do things like report request/response's and push access information to standard out in a console or structure log format. Our Pro version has a few more plugins like the ability to report errors (eg. an AI agent is getting HTTP 429 errors). These can be pushed to a service or log aggregator.

To summarize, we do a lot of the same things that ecapture does. We'd like to be less of a tool and more of a "always running" that ops, opsec, and devs use to answer tough questions. We look forward to open sourcing more of plugins as they mature!

devinbernosky · 4 months ago
Qtap works with Java too, which ecapture hasn't figured out yet
compscidr · 4 months ago
Have been following this project for a while, cool stuff!

I work a bunch with vpn-like networking on Android phones and it would be cool to have a bit of info on how I might get something like working on phones. I guess its probably not your typical usecase.

Currently since the project is a VPN client, I already intercept all of the packets, I have a pcap writer and can write to files or a tcp sockets and connect wireshark to it - but it needs a bunch of complication to setup the keys so that I can see through encryption, so anything that would make that process easier would be great.

PcChip · 4 months ago
I'm curious what your product does

I've seen that type of behavior for apps that inject ads and add affiliate marketing links

compscidr · 4 months ago
Its an internet sharing app that uses Wi-Fi direct and BLE

The wireshark stuff is only for when I'm debugging

eptcyka · 4 months ago
I know that arguing that SSLKEYLOGFILE is all you need will just be a different version of the rsync/dropbox comment, but I do wonder under what circumstances is one able to strace a binary and isn’t able to make it dump session keys? I read the headline and set high hopes on finding a nifty way to mitm apps on Android - alas, I’m not sure this would work there necessarily.
formerly_proven · 4 months ago
Mostly that SSLKEYLOGFILE has only been an (disabled by default) OpenSSL feature for a few weeks (literally), apart from that it's something implemented by some other libraries (notably libcurl) on top. But it's very far from "just set this env var and the keys will pop out of any app using TLS".
delusional · 4 months ago
The big usecase for me would be if you could attach the trace after starting the binary. The idea of coming into a production system that's behaving unexpectedly and getting a network sniff without having to fiddle with certificates is very attractive.

There's an alternative implementation where SSLKEYLOGFILE is more "dynamic" and permits being toggled on an off during runtime, but that doesn't currently exist.

linsomniac · 4 months ago
My big use case is watching on the SERVER side, my coworkers will be asking me to help them debug something and I just want to see the HTTP plaintext, I don't really want to try running Apache under SSLKEYLOGFILE or something, I just want to see the data. ;-)
worldsavior · 4 months ago
Isn't there already mechanisms for patching specific SSL libraries to view encrypted requests (e.g. frida)? What is the benefit of using eBPF?
tylerflint · 4 months ago
The main benefit is complete coverage. In production systems there are many different workloads with many different binaries, each with different build processes. Leveraging eBPF enables seeing everything on a system without having to adjust the build pipeline.
pclmulqdq · 4 months ago
To hook into OpenSSL, don't you either need dynamic linking or userspace programs to compile your hooks in? Go and many Rust and C++ binaries tend to prefer static linking, so I wonder if this solution is workable there.
tylerflint · 4 months ago
Great point! Yes it supports both scenarios. Qtap scans the binary ELF (curl, rust, etc) and looks for the TLS symbols. If they were statically compiled the eBPF probes will be attached directly to the binary, if dynamically linked the probes will be attached to the symbols in the library (.so).
pclmulqdq · 4 months ago
Yeah, so -O2 and -O3 are likely to be problems for you, and the ELF surgery is very invasive.
kristopolous · 4 months ago
Just found out about a related things: https://github.com/cle-b/httpdbg

Anyone have any experience with it?

markasoftware · 4 months ago
this looks like it hooks into python libs, not all openssl traffic system-wide.