ipv6: BUG() in pskb_expand_head() as part of calipso_skbuff_setattr()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 2917f57b6bc15cc6787496ee5f2fdf17f0e9b7d3 · < 73744ad5696dce0e0f43872aba8de6a83d6ad570| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ipv6: BUG() in pskb_expand_head() as part of calipso_skbuff_setattr()
There exists a kernel oops caused by a BUG_ON(nhead < 0) at net/core/skbuff.c:2232 in pskb_expand_head(). This bug is triggered as part of the calipso_skbuff_setattr() routine when skb_cow() is passed headroom > INT_MAX (i.e. (int)(skb_headroom(skb) + len_delta) < 0).
The root cause of the bug is due to an implicit integer cast in __skb_cow(). The check (headroom > skb_headroom(skb)) is meant to ensure that delta = headroom - skb_headroom(skb) is never negative, otherwise we will trigger a BUG_ON in pskb_expand_head(). However, if headroom > INT_MAX and delta <= -NET_SKB_PAD, the check passes, delta becomes negative, and pskb_expand_head() is passed a negative value for nhead.
Fix the trigger condition in calipso_skbuff_setattr(). Avoid passing "negative" headroom sizes to skb_cow() within calipso_skbuff_setattr() by only using skb_cow() to grow headroom.
PoC: Using `netlabelctl` tool:
netlabelctl map del default netlabelctl calipso add pass doi:7 netlabelctl map add default address:0::1/128 protocol:calipso,7
Then run the following PoC:
From the CVE record · Linux
The Linux kernel can hit a BUG_ON in pskb_expand_head() when calipso_skbuff_setattr() passes a headroom value that becomes negative after an integer cast. A local process can trigger a kernel oops by sending a crafted IPv6 UDP message when the CALIPSO NetLabel configuration shown in the report is in place. The input does not specify authentication requirements.
Engineers running Linux kernels with IPv6 CALIPSO and NetLabel configurations should check their systems; affected versions are not specified.