Missing break between SIOCSIFDESCR and SIOCSIFFLAGS: fall-through reinterprets description length as interface flags
Summary
SIOCSIFDESCR case ends at :2132 kfree(odescrbuf) with NO break before case SIOCSIFFLAGS at :2134. Fall-through: ifr_buffer.length aliases ifr_flags via ifr_ifru union(if.h:259-261). ifconfig em0 description a (length 2) -> new_flags=2 -> clears IFF_UP -> interface goes DOWN. Length 256 sets IFF_PROMISC. Privileged but bypasses SIOCSIFFLAGS gate. ifconfig -desc already exhibits this bug operationally.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0273 Β· 11 files| File | Type | Description | Size | |
|---|---|---|---|---|
| descr_fallthrough.c | trigger-source | SIOCSIFDESCR ioctl demonstrating flag corruption via fall-through | 4.5 KB | view raw |
| build.sh | build-script | cc build command | 132 B | view raw |
| run.sh | run-script | runs the PoC as root | 75 B | view raw |
| run.log | run-log | decisive run showing IFF_UP cleared | 491 B | view raw |
| VERDICT.md | verdict | full analysis | 2.8 KB | β raw |
| fix.diff | suggested-fix | add break after kfree in SIOCSIFDESCR case | 244 B | view raw |
| fix_build.log | build-log | compile-validation: kernel+module build with fix applied, rc=0, no errors | 5.6 MB | β download |
| README.md | readme | human reproduce doc | 577 B | β raw |
| env.txt | environment | guest uname, modules, HW-gate note | 255 B | view raw |
| ../fix_build_combined.log | build-log | Combined 41-finding kernel build (rc=0, -Werror clean) | 5.6 MB | β download |
| ../fix_build_summary.txt | build-summary | Summary of the combined 41-finding kernel build | 826 B | view raw |
DF-0273 PoC β SIOCSIFDESCR fall-through to SIOCSIFFLAGS
Build
cc -o descr_fallthrough descr_fallthrough.c
Run (as root β SIOCSIFDESCR requires RESTRICTEDROOT)
./descr_fallthrough
Expected (bug present)
[*] lo0 flags BEFORE SIOCSIFDESCR: flags=...<UP,RUNNING,MULTICAST,...> [*] lo0 flags AFTER SIOCSIFDESCR(len=2): flags=...<RUNNING,MULTICAST,...> <-- IFF_UP CLEARED [!] DF-0273 REPRODUCED: IFF_UP cleared by setting a description
Expected (fixed)
Flags unchanged after SIOCSIFDESCR β the break; prevents fall-through.
DF-0273 β SIOCSIFDESCR missing break β fall-through to SIOCSIFFLAGS
Verdict: REPRODUCED
Impact: privileged-ioctl logic corruption (interface flag manipulation).
Setting an interface description via SIOCSIFDESCR corrupts the interface
flags because the case SIOCSIFDESCR block in sys/net/if.c has no break
before case SIOCSIFFLAGS. The fall-through reinterprets
ifr_buffer.length (which aliases ifr_flags via the ifr_ifru union,
sys/net/if.h:259-261) as the new flags value.
Mechanism
sys/net/if.c:2100βcase SIOCSIFDESCR:setsifp->if_descriptionand at line 2131-2132 frees the old description buffer.- No
break;between line 2132 andcase SIOCSIFFLAGS:at line 2134. - Execution falls through into the SIOCSIFFLAGS handler at line 2138:
new_flags = (ifr->ifr_flags & 0xffff) | (ifr->ifr_flagshigh << 16). - Because
ifr_flagsisifr_ifru.ifru_flags[0]which overlaps the low 16 bits ofifr_ifru.ifru_buffer.length(both start at offset 0 of the union,if.h:244-261),new_flagsis driven by the description length. - For a 2-byte description ("a\0"),
new_flags = 2(IFF_BROADCAST, no IFF_UP). Line 2142-2144:if (ifp->if_flags & IFF_UP && (new_flags & IFF_UP)==0)βif_down(ifp)β the interface goes DOWN.
Demonstration
Tested on the guest (root; SIOCSIFDESCR requires caps_priv_check(SYSCAP_RESTRICTEDROOT)):
[*] lo0 flags BEFORE SIOCSIFDESCR:
flags=0xffff8041 <UP,RUNNING,MULTICAST,PPROMISC,>
[*] lo0 flags AFTER SIOCSIFDESCR(len=2):
flags=0xffff8040 <RUNNING,MULTICAST,PPROMISC,>
[!] DF-0273 REPRODUCED: IFF_UP cleared by setting a description
(fall-through SIOCSIFDESCR -> SIOCSIFFLAGS).
[!] new_flags was driven by ifr_buffer.length==2 (IFF_BROADCAST),
bypassing the SIOCSIFFLAGS intent.
Setting a description of length 2 cleared IFF_UP on lo0 β the interface was brought down by a description-set ioctl.
Threat model
This is a privileged bug (SIOCSIFDESCR requires RESTRICTEDROOT = root,
CVSS PR:H). The realistic impact is operational: a root admin action
(ifconfig em0 description "...") has the unintended side effect of
corrupting interface flags β bringing the interface down, or setting
arbitrary flag bits via the description length. On vtnet0 (the management
interface), ifconfig vtnet0 description "a" would drop the admin's SSH
session. This is a logic/operational bug, not a privilege escalation.
Fix
Add break; after the kfree(odescrbuf) in the SIOCSIFDESCR case
(sys/net/if.c:2132). See fix.diff.
PoC changes
Wrote descr_fallthrough.c from scratch (the poc dir was empty). The PoC
creates a throw-away interface, brings it UP, issues SIOCSIFDESCR with a
description whose length aliases to a flag value, and reports the before/after
flags to confirm the fall-through.
Fix verification
fixedvalidated
see evidence pack
Confirmed kernel references
β
Detail
Exploit chain
none
Evidence (decisive lines)
β
Verdict
REPRODUCED (live). Missing break SIOCSIFDESCR->SIOCSIFFLAGS -> IFF_UP cleared by setting description. Root-only ioctl.
No comments yet.