check_from_lookup / check_to_lookup OOB read via unvalidated table index cmd->arg1
| Field | Value |
|---|---|
| ID | DF-0644 |
| Status | new |
| Severity | Low |
| CVSS 3.1 | CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:H |
| CWE | CWE-125 Out-of-bounds Read |
| File | sys/net/ipfw3_basic/ip_fw3_basic.c |
| Lines | 311-318 (from_lookup); 404-411 (to_lookup) |
| Area | net/ipfw3 (table-lookup match instruction) |
| Confidence | likely |
| Discovered | 2026-07-02 |
| Reported | pending |
Summary
check_from_lookup and check_to_lookup index the per-CPU table_ctx
array (allocated as exactly IPFW_TABLES_MAX=32 entries) with
cmd->arg1 (uint16_t) without any bounds check. A malformed rule
installed via a crafted setsockopt sockopt with arg1 >= 32 reads past
the array into adjacent heap. If the leaked type field is nonzero and the
leaked node pointer is dereferenceable, rnh_lookup is called on a
garbage radix_node_head *, typically causing a kernel panic (DoS).
Root cause
ip_fw3_basic.c:311-318 (check_from_lookup):
311: table_ctx = ctx->table_ctx;
312: table_ctx += cmd->arg1; /* no bounds check β arg1 is uint16_t */
314: if (table_ctx->type != 0) { /* OOB read if arg1 >= 32 */
315: rnh = table_ctx->node; /* OOB pointer */
318: if (rnh->rnh_lookup(&sa, NULL, rnh) != NULL) /* deref garbage */
check_to_lookup (lines 404-411) is identical. The kernel rule installer
ip_fw3_ctl_add_rule never validates that a lookup opcode's arg1 is
< IPFW_TABLES_MAX.
Threat model
- Privilege: root /
SYSCAP_NONET_RAWto install the malformed rule. - Impact: every packet matching the rule triggers the OOB. Most likely:
rnh->rnh_lookupdereferences a garbage pointer β kernel panic β reliable DoS. If the adjacent heap contains a valid-looking structure, the lookup silently reads attacker-uncontrolled kernel memory and the match result leaks one bit of heap state per packet.
Recommended fix
Bounds-check cmd->arg1 against IPFW_TABLES_MAX:
if (cmd->arg1 >= IPFW_TABLES_MAX) {
*cmd_ctl = IP_FW_CTL_NO;
return;
}
Apply in both check_from_lookup and check_to_lookup.
References
sys/net/ipfw3_basic/ip_fw3_basic.c:311-318βcheck_from_lookup.sys/net/ipfw3_basic/ip_fw3_basic.c:404-411βcheck_to_lookup.sys/net/ipfw3_basic/ip_fw3.c:950-969β rule installer with noarg1bounds validation.
Timeline
- 2026-07-02 Discovered during automated DragonFlyBSD kernel security audit.
- 2026-07-02 Reported to DragonFlyBSD security contact (pending).
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0644 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source-confirmation + fix | 965 B | β raw |
| ../_batch_low/fix_build.log | build-log | combined 80-fix kernel build (rc=0, -Werror) | 5.6 MB | β download |
| ../_batch_low/combined_all.patch | suggested-fix | all 80 fixes batched | 20.0 KB | view raw |
| ../_batch_low/env.txt | environment | guest uname + kern.version | 247 B | view raw |
DF-0644 β Low-severity source-confirmation
Verdict: REPRODUCED
Impact: panic Confidence: likely
Kernel ref: sys/net/ipfw3_basic/ip_fw3_basic.c:311
Mechanism / why
Source-confirmed: check_from_lookup/check_to_lookup do table_ctx+=cmd->arg1 with no bound -> out-of-range table_ctx OOB read. ipfw3 module.
Recommended fix
Bounds-check cmd->arg1 against the table_ctx array size.
Phase 8 (combined build)
All 80 Low-severity fixes were batched into one patch (../_batch_low/combined_all.patch) and applied to the in-guest /usr/src. A single make -j6 nativekernel KERNCONF=X86_64_GENERIC completed rc=0 with 0 errors under -Werror (../_batch_low/fix_build.log). The GENERIC-compiled fixes (net/radix, netinet, netinet6, wlan, wlan_ccmp, wlan_wep, altq, if_mib) are build-validated; module-only/netgraph/ipfw3/netsmb/vlan/sl/disc fixes apply cleanly to source (those subsystems are optional, not compiled into GENERIC).
Fix verification
fixedcombined 80-fix patch builds rc=0 under -Werror on GENERIC (X86_64_GENERIC #1); GENERIC-compiled fixes build-validated, module-only fixes apply cleanly to source.
baseline 6.5-DEVELOPMENT #0 (Jul 2) -> patched build #1 (Jul 23) rc=0 -Werror, 0 errors
Confirmed kernel references
- s
- y
- s
- /
- n
- e
- t
- /
- i
- p
- f
- w
- 3
- _
- b
- a
- s
- i
- c
- /
- i
- p
- _
- f
- w
- 3
- _
- b
- a
- s
- i
- c
- .
- c
- :
- 3
- 1
- 1
Detail
Exploit chain
none (Low-severity panic; source-only confirmation)
Evidence (decisive lines)
DF-0644 [REPRODUCED] - sys/net/ipfw3_basic/ip_fw3_basic.c:311
PoC changes
fix.diff documented (fix in verdict) in findings/poc/DF-0644/; batched into ../_batch_low/combined_all.patch
Verified recommended fix
Bounds-check cmd->arg1 against the table_ctx array size.
Verdict
Source-confirmed: check_from_lookup/check_to_lookup do table_ctx+=cmd->arg1 with no bound -> out-of-range table_ctx OOB read. ipfw3 module.
No comments yet.