β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-3421

DDB 802.11 pretty-printers dump raw wlan key material (wk_key bytes) to the console β€” WEP/TKIP-temporal/CCM keys and RSC/TSC exposed in serial-console captures and crash-dump sessions

Summary

_db_show_key prints the unredacted wk->wk_key bytes of every programmed key to the DDB console: full WEP keys (5/13 B), TKIP temporal key (32-16 B; only MIC excluded), full AES-CCM PTK/GTK (16 B), plus station RSC/TSC for non-WEP. Reached by 'show vap' (iterates iv_nw_keys), 'show com /s' (station table -> ni_ucastkey), and 'show sta'. Keys land in serial-console logs and any crash-dump/debug session transcript; inherited from FreeBSD's ieee80211_ddb.c. Not runnable on the audit guest (no wifi hardware) - code-certain. Ceiling: full session-key recovery from a captured console transcript of a crash session (console access normally privileged -> Low/hardening). Fix: print key presence/length/flags, never the bytes.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-3421 Β· 1 files
FileTypeDescriptionSize
README.md β€” 2.7 KB ↓ raw

DF-3421 β€” DDB 802.11 pretty-printers dump raw key material (ieee80211_ddb.c:810-816)

_db_show_key() prints the unredacted wk->wk_key bytes of every programmed wlan key straight to the DDB console:

810 if (memcmp(wk->wk_key, zerodata, keylen) != 0) {
811     int i;
812
813     db_printf(" <");
814     for (i = 0; i < keylen; i++)
815         db_printf("%02x", wk->wk_key[i]);   /* raw key bytes */
816     db_printf(">");

Coverage per cipher (same switch, :779-807): - WEP: full key (5/13 bytes) - TKIP: temporal key (32-16 = 16 bytes; only the MIC bytes are excluded) - AES-CCM: full 16-byte PTK/GTK - station unicast keys additionally expose RSC/TSC (:817-822)

Reachable DDB commands (compiled when DDB + wlan): show vap <addr> (iterates iv_nw_keys[0..IEEE80211_WEP_NKID-1] at :488-489), show com <addr> /s (station table β†’ _db_show_sta β†’ ni_ucastkey at :292), show sta <addr>.

Impact

Cryptographic key material written to the debug console β€” and therefore into any serial-console capture, dmesg-adjacent console log, or a crash dump taken while DDB output is on the console. Requires reaching DDB (break on panic, debug.kdb.enter sysctl as root, or a physical/serial console break) β€” console access is normally privileged, which is why this is Low and hardening-grade rather than a general info leak. The identical code is present upstream (FreeBSD ieee80211_ddb.c), so this is an inherited issue.

Not testable on this guest

The audit guest (vtnet0 lo0) has no 802.11 hardware and QEMU does not emulate any wifi chipset, so no ieee80211com/ieee80211vap with keys can exist to run show vap against. Verification: code-level (cited lines), not executed. No panic/leak run performed; no verdict.json.

Fix

Print key presence/length, never the bytes:

--- a/sys/netproto/802_11/wlan/ieee80211_ddb.c
+++ b/sys/netproto/802_11/wlan/ieee80211_ddb.c
@@ -807,13 +807,8 @@ _db_show_key(const char *tag, int ix, const struct ieee80211_key *wk)
    default:
        db_printf(" UNKNOWN (0x%x) %u:%u-bit",
            cip->ic_cipher, wk->wk_keyix, 8*keylen);
        break;
    }
-   if (memcmp(wk->wk_key, zerodata, keylen) != 0) {
-       int i;
-
-       db_printf(" <");
-       for (i = 0; i < keylen; i++)
-           db_printf("%02x", wk->wk_key[i]);
-       db_printf(">");
-       if (cip->ic_cipher != IEEE80211_CIPHER_WEP &&
-           wk->wk_keyrsc[IEEE80211_NONQOS_TID] != 0)
-           db_printf(" rsc %ju", (uintmax_t)wk->wk_keyrsc[IEEE80211_NONQOS_TID]);
-       if (cip->ic_cipher != IEEE80211_CIPHER_WEP &&
-           wk->wk_keytsc != 0)
-           db_printf(" tsc %ju", (uintmax_t)wk->wk_keytsc);
-       db_printf(" flags=%pb%i", IEEE80211_KEY_BITS, wk->wk_flags);
-   }
+   if (memcmp(wk->wk_key, zerodata, keylen) != 0)
+       db_printf(" <set> flags=%pb%i",
+           IEEE80211_KEY_BITS, wk->wk_flags);
    db_printf("\n");
 }

Confirmed kernel references

Detail

Exploit chain

ddb> show vap with programmed keys prints full key material into the serial/crash transcript.

Evidence (decisive lines)

['findings/poc/DF-3421/README.md']

PoC changes

verdict.json reconstructed by the orchestrator (analysis-only Low finding, no runtime harness possible without wifi hardware).

Verified recommended fix

Replace the hex dump of wk_key with a ' flags=%pb' presence print (full diff in pack README).

Verdict

Code-certain: _db_show_key hex-dumps wk->wk_key bytes (WEP/TKIP temporal/CCM keys + RSC/TSC) to the DDB console via show vap / show com /s / show sta. Not runnable on the audit guest (no 802.11 hardware). Console access normally privileged -> Low/hardening.