Repository navigation
openssl: resolve BoringSSL keylog symbols on Linux - #1107
Conversation
Use ordinary ELF symbols or a matching GNU debug companion for the existing label-based hook, while retaining Android mini debug support and fallback.
📄 Knowledge review✏️ Suggested updates1 page suggestion needs review.
|
There was a problem hiding this comment.
🟡 Changes recommended
Debug-symbol discovery can miss valid companions after mini-debug failures or when the library path is a symlink, causing unnecessary handshake fallback and loss of handshake-secret records.
2 open issues
What changed in this PR
This PR enables eCapture’s existing BoringSSL label-based keylog hook on Linux by expanding symbol discovery, without changing the BPF extraction code.
Changes:
- Adds ordinary ELF symbols and local GNU debug companions alongside Android mini-debug support.
- Validates companion filenames, read limits, and CRCs while retaining the existing handshake fallback.
- Adds fixture-based tests for supported symbol sources and invalid or missing companions.
| File | Description |
|---|---|
internal/probe/openssl/config.go |
Enables keylog-hook discovery for Linux BoringSSL in applicable capture modes. |
internal/probe/openssl/boringssl_symbol.go |
Expands symbol resolution and adds validated GNU debug-companion lookup. |
internal/probe/openssl/boringssl_symbol_test.go |
Tests ordinary, split-debug, and mini-debug symbols plus companion rejection cases. |
Review effort: Balanced
| section := lib.Section(".gnu_debugdata") | ||
| if section == nil { | ||
| debugData, err = boringSSLDebugLink(lib, path) |
There was a problem hiding this comment.
a093835 removes the GNU debug-link companion search, so this path is gone. The resolver now reads the ordinary ELF symbol table and then Android's .gnu_debugdata.
| candidates := []string{ | ||
| filepath.Join(filepath.Dir(path), name), | ||
| filepath.Join(filepath.Dir(path), ".debug", name), | ||
| filepath.Join("/usr/lib/debug", filepath.Dir(absolute), name), | ||
| } |
There was a problem hiding this comment.
a093835 removes the GNU debug-link companion search, so this path is gone. The resolver now reads the ordinary ELF symbol table and then Android's .gnu_debugdata.
Remove the GNU debug-link companion search. An unstripped Linux library exposes ssl_log_secret in its ordinary symbol table; stripped libraries keep Android's .gnu_debugdata path or the SSL_do_handshake fallback.

Problem
On Linux, eCapture tries BoringSSL's label-based keylog hook only when
IsAndroidis true, and the resolver reads only Android's.gnu_debugdata. An unstripped Linux BoringSSL keepsbssl::ssl_log_secretin its ordinary ELF symbol table, yet keylog and pcapng modes take theSSL_do_handshakereturn fallback, which emits only the application and exporter secrets.Change
.gnu_debugdataas before..gnu_debugdatakeeps the existing fallback and its diagnostic.The BPF code is unchanged.
Verification
objcopy --strip-allit returns an error, so configuration keeps the fallback. With master's resolver the first check fails withBoringSSL ELF has no .gnu_debugdata section.go test -race -count=1 ./internal/probe/openssl/passes;gofmtandgo vetreport nothing.android-libboringssl14.0.0+r45-2 amd64 (libssl.so.0, SHA256b86b018e…) with its symbol table merged back from the matching-dbgsympackage byeu-unstrip; the LOAD headers are unchanged. The resolver returns file offset0x465e0.make build_core) of master9c00018and this branch,tls -m keylog --ssl_version boringssl_a_14against that library. The TLS 1.3 client logs its reference keys withSSL_CTX_set_keylog_callback, five records:ssl_log_secretand writes all 5 (both handshake secrets, both application secrets and the exporter), byte-equal under the same labels.