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

isc_soc: NULL deref in so_input pdu_alloc retry uses M_NOWAIT (comment says WAITOK) derefs unchecked

Summary

so_input at 540 pdu_alloc(M_NOWAIT); if NULL retry pdu_alloc(M_NOWAIT) comment OK to WAIT but actual M_NOWAIT; then 545 pq->pdu.ipdu.bhs=sp->bhs derefs NULL unchecked. Pool MAX_PDUS=MAX_SESSIONS*256=65536 shared across all sessions; each in-flight PDU holds pduq from receipt through slow SCSI/CAM dispatch. Remote malicious target floods NOP_IN/READ_DATA at line rate with valid StatSN ordering -> 65536 in-flight -> pool exhausted -> NULL -> panic write at small offset from NULL. No auth beyond established login. Remote kernel DoS. Fix: M_WAITOK on retry + if NULL return ENOBUFS.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1828 Β· 2 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able unified diff; validated as part of combined 41-finding kernel build (rc=0, -Werror clean) 714 B view raw
VERDICT.md verdict source-only confirmation + HW/module gating explanation 1.4 KB ↓ raw
VERDICT.md verdict source-only confirmation + HW/module gating explanation
↓ download raw

DF-1828 Verification

Verdict

SOURCE-CONFIRMED, INCONCLUSIVE-RUNTIME (HW/module gated).

The cited defect exists in the audited source at sys/dev/disk/iscsi/initiator/isc_soc.c:540-545. Reproduction on the running guest is not possible because the affected code path is gated behind hardware that is not present in the audit QEMU/KVM guest (no AMD/i915 GPU, no LSI MegaRAID, no MMC/SDHCI controller, no FireWire, no ATAPI floppy, etc.) and/or lives in a kernel module that is not loaded on the GENERIC-running guest.

Mechanism (source-only confirmation)

iscsi_initiator (loaded as module, not in GENERIC). Source: so_input at L540 pdu_alloc(M_NOWAIT); retry at L543 is also M_NOWAIT (comment says OK to WAIT). pq->pdu.ipdu.bhs=sp->bhs at L545 derefs NULL pq on allocation failure.

Change both pdu_alloc calls to M_WAITOK, add explicit NULL check returning ENOBUFS before dereferencing pq.

The full git apply-able diff lives in fix.diff in this folder; it was applied as part of a single combined 41-finding kernel build that compiled cleanly (rc=0, -Werror clean) β€” see ../fix_build_summary.txt.

Build validation

  • git apply --check on this fix.diff: OK
  • Combined kernel build (X86_64_GENERIC, INVARIANTS ON) with all 41 findings' fix.diffs applied: rc=0, no warnings, no errors.
  • The patched kernel was not booted/run because the affected code path requires hardware that the audit guest does not have.

Confirmed kernel references

Detail

Exploit chain

none β€” non-corruption classes (info leak / DoS / div0 / logic) or HW/module gated. No memory-corruption primitive reachable from userspace on this guest.

Evidence (decisive lines)

Source-only confirmation. Combined kernel build with all 41 fix.diffs applied: === NK_DONE rc=0 === at Wed Jul 22 18:05:21 UTC 2026 (no errors, no warnings). See findings/poc/fix_build_summary.txt.

PoC changes

Authored findings/poc/DF-1828/fix.diff (minimal targeted guard). VERDICT.md and manifest.json written. fix.diff validated by combined build.

Verified recommended fix

Use M_WAITOK in both pdu_alloc calls; add explicit NULL check returning ENOBUFS before dereferencing pq. Full git-apply-able diff in findings/poc/DF-1828/fix.diff; validated as part of combined 41-finding kernel build (rc=0).

Verdict

SOURCE-CONFIRMED, INCONCLUSIVE-RUNTIME. The cited defect exists at sys/dev/disk/iscsi/initiator/isc_soc.c:540-545. iscsi_initiator (module, not in GENERIC). so_input at L540 pdu_alloc(M_NOWAIT); retry L543 also M_NOWAIT (comment says OK to WAIT). pq->pdu.ipdu.bhs=sp->bhs at L545 derefs NULL pq on allocation failure. Module gated.