fix: keep GnuTLS and NSS probing enabled by default in sslsniff - #227
fix: keep GnuTLS and NSS probing enabled by default in sslsniff#227yunwei37 wants to merge 6 commits into
Conversation
Commit 337af70 (add hook of ssl_ex version) flipped the default provider flags to off. The --no-gnutls and --no-nss options only clear the same flags, so GnuTLS and NSS probing became unreachable and the documented default behavior (sniff OpenSSL and GnuTLS functions) stopped holding. Restore the gnutls/nss defaults to on, and warn instead of attaching against a NULL library path when a provider library is not present on the system.
There was a problem hiding this comment.
🟡 Changes recommended
The new/updated provider path lookups still pass unescaped patterns into a grep-based resolver, which can produce non-literal matches and should be corrected to avoid selecting unintended libraries.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes the sslsniff example’s provider enablement defaults so GnuTLS and NSS probing are enabled again by default, and it avoids attempting uprobe attaches when a provider library can’t be located via ldconfig, aligning runtime behavior with the documented intended usage.
Changes:
- Restore default provider flags to enable GnuTLS and NSS probing.
- Skip provider attach when
find_library_path()returnsNULL, emitting a warning instead of passing aNULLpath into uprobe attach.
File summaries
| File | Description |
|---|---|
| src/30-sslsniff/sslsniff.c | Re-enables default providers and adds NULL-path guarding with warnings before attaching provider uprobes. |
Review details
Suppressed comments (2)
src/30-sslsniff/sslsniff.c:419
find_library_path()runsgrepin basic-regex mode; the dot in this pattern is a wildcard. Escaping it avoids accidental matches against unrelated library names.
char *nss_path = find_library_path("libnspr4.so");
src/30-sslsniff/sslsniff.c:410
find_library_path()usesgrepwith basic regex, so the dot inlibgnutls.sois treated as a wildcard. Escape it to make the match literal (or changefind_library_path()to usegrep -F).
char *gnutls_path = find_library_path("libgnutls.so");
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Update the lesson-30 README code excerpts (English and Chinese) to the current sslsniff.c provider-attach block, which now warns and skips a provider whose library is not present instead of attaching against a NULL path.
|
Final exact-head review for 9ca1d31 is complete.
Ready for maintainer review; no merge was performed. AI-generated response; a maintainer will review and follow up later |
Since #164 (
337af70), the default provider flags for the sslsniff example aregnutls = falseandnss = false. The command line only offers--no-gnutlsand--no-nss, which clear those same flags, so on currentmainthere is no way to enable GnuTLS or NSS probing at all. That contradicts the documented default usage (./sslsniff # sniff OpenSSL and GnuTLS functions), and applications that use GnuTLS or NSS are not captured even when the libraries are installed.Changes:
gnutls = trueandnss = trueas the defaults insrc/30-sslsniff/sslsniff.c.ldconfig, print a warning to stderr and skip that provider instead of passing a NULL path into the uprobe attach.ldconfig.Validation:
make -B -C src/30-sslsniffbuilds the BPF object, skeleton, and user-space binary.Related to #121 and #99.