In the Linux kernel, the following vulnerability has been resolved:
ipv6: prevent UAF in ip6sendskb()
syzbot reported an UAF in ip6sendskb() [1]
After ip6localout() has returned, we no longer can safely dereference rt, unless we hold rcureadlock().
A similar issue has been fixed in commit a688caa34beb ("ipv6: take rcu lock in rawv6sendhdrinc()")
Another potential issue in ip6finishoutput2() is handled in a separate patch.
[1] BUG: KASAN: slab-use-after-free in ip6sendskb+0x18d/0x230 net/ipv6/ip6_output.c:1964 Read of size 8 at addr ffff88806dde4858 by task syz.1.380/6530
CPU: 1 UID: 0 PID: 6530 Comm: syz.1.380 Not tainted 6.11.0-rc3-syzkaller-00306-gdf6cbc62cc9b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: <TASK> _dumpstack lib/dumpstack.c:93 [inline] dumpstacklvl+0x241/0x360 lib/dumpstack.c:119 printaddressdescription mm/kasan/report.c:377 [inline] printreport+0x169/0x550 mm/kasan/report.c:488 kasanreport+0x143/0x180 mm/kasan/report.c:601 ip6sendskb+0x18d/0x230 net/ipv6/ip6output.c:1964 rawv6pushpendingframes+0x75c/0x9e0 net/ipv6/raw.c:588 rawv6sendmsg+0x19c7/0x23c0 net/ipv6/raw.c:926 socksendmsgnosec net/socket.c:730 [inline] _socksendmsg+0x1a6/0x270 net/socket.c:745 sockwriteiter+0x2dd/0x400 net/socket.c:1160 doiterreadvwritev+0x60a/0x890 vfswritev+0x37c/0xbb0 fs/readwrite.c:971 dowritev+0x1b1/0x350 fs/readwrite.c:1018 dosyscallx64 arch/x86/entry/common.c:52 [inline] dosyscall64+0xf3/0x230 arch/x86/entry/common.c:83 entrySYSCALL64afterhwframe+0x77/0x7f RIP: 0033:0x7f936bf79e79 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f936cd7f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007f936c115f80 RCX: 00007f936bf79e79 RDX: 0000000000000001 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007f936bfe7916 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f936c115f80 R15: 00007fff2860a7a8 </TASK>
Allocated by task 6530: kasansavestack mm/kasan/common.c:47 [inline] kasansavetrack+0x3f/0x80 mm/kasan/common.c:68 unpoisonslabobject mm/kasan/common.c:312 [inline] kasanslaballoc+0x66/0x80 mm/kasan/common.c:338 kasanslaballoc include/linux/kasan.h:201 [inline] slabpostallochook mm/slub.c:3988 [inline] slaballocnode mm/slub.c:4037 [inline] kmemcacheallocnoprof+0x135/0x2a0 mm/slub.c:4044 dstalloc+0x12b/0x190 net/core/dst.c:89 ip6blackholeroute+0x59/0x340 net/ipv6/route.c:2670 makeblackhole net/xfrm/xfrmpolicy.c:3120 [inline] xfrmlookuproute+0xd1/0x1c0 net/xfrm/xfrmpolicy.c:3313 ip6dstlookupflow+0x13e/0x180 net/ipv6/ip6output.c:1257 rawv6sendmsg+0x1283/0x23c0 net/ipv6/raw.c:898 socksendmsgnosec net/socket.c:730 [inline] _socksendmsg+0x1a6/0x270 net/socket.c:745 _syssendmsg+0x525/0x7d0 net/socket.c:2597 _syssendmsg net/socket.c:2651 [inline] _syssendmsg+0x2b0/0x3a0 net/socket.c:2680 dosyscallx64 arch/x86/entry/common.c:52 [inline] dosyscall64+0xf3/0x230 arch/x86/entry/common.c:83 entrySYSCALL64afterhwframe+0x77/0x7f
Freed by task 45: kasansavestack mm/kasan/common.c:47 [inline] kasansavetrack+0x3f/0x80 mm/kasan/common.c:68 kasansavefreeinfo+0x40/0x50 mm/kasan/generic.c:579 poisonslabobject+0xe0/0x150 mm/kasan/common.c:240 _kasanslabfree+0x37/0x60 mm/kasan/common.c:256 kasanslabfree include/linux/kasan.h:184 [inline] slabfreehook mm/slub.c:2252 [inline] slabfree mm/slub.c:4473 [inline] kmemcachefree+0x145/0x350 mm/slub.c:4548 dstdestroy+0x2ac/0x460 net/core/dst.c:124 rcudobatch kernel/rcu/tree.c:2569 [inline] rcu_core+0xafd/0x1830 kernel/rcu/tree. ---truncated---
[
    {
        "signature_type": "Function",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-0a6c01ef",
        "digest": {
            "length": 326.0,
            "function_hash": "32998977632468613677402630653963631188"
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cb5880a0de12c7f618d2bdd84e2d985f1e06ed7e",
        "target": {
            "function": "ip6_send_skb",
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Function",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-0acbe0ff",
        "digest": {
            "length": 326.0,
            "function_hash": "32998977632468613677402630653963631188"
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@af1dde074ee2ed7dd5bdca4e7e8ba17f44e7b011",
        "target": {
            "function": "ip6_send_skb",
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Line",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-20e50a8c",
        "digest": {
            "line_hashes": [
                "65743994217003011962064820734081368083",
                "202077242910975826062906890391541784313",
                "212051232032126469436814176887090639249",
                "106149158658955179711477228118953810730",
                "198941237347511578621006359196690533385",
                "94387736910348796387184514462124102026"
            ],
            "threshold": 0.9
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@af1dde074ee2ed7dd5bdca4e7e8ba17f44e7b011",
        "target": {
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Function",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-2125bb15",
        "digest": {
            "length": 326.0,
            "function_hash": "32998977632468613677402630653963631188"
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce2f6cfab2c637d0bd9762104023a15d0ab7c0a8",
        "target": {
            "function": "ip6_send_skb",
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Line",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-23d96f41",
        "digest": {
            "line_hashes": [
                "65743994217003011962064820734081368083",
                "202077242910975826062906890391541784313",
                "212051232032126469436814176887090639249",
                "106149158658955179711477228118953810730",
                "198941237347511578621006359196690533385",
                "94387736910348796387184514462124102026"
            ],
            "threshold": 0.9
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9a3e55afa95ed4ac9eda112d4f918af645d72f25",
        "target": {
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Line",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-377fa3db",
        "digest": {
            "line_hashes": [
                "892908473408294245120397586863903933",
                "289875713109391338439751884645859036484",
                "212051232032126469436814176887090639249",
                "106149158658955179711477228118953810730",
                "198941237347511578621006359196690533385",
                "94387736910348796387184514462124102026"
            ],
            "threshold": 0.9
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@faa389b2fbaaec7fd27a390b4896139f9da662e3",
        "target": {
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Line",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-51398dd0",
        "digest": {
            "line_hashes": [
                "65743994217003011962064820734081368083",
                "202077242910975826062906890391541784313",
                "212051232032126469436814176887090639249",
                "106149158658955179711477228118953810730",
                "198941237347511578621006359196690533385",
                "94387736910348796387184514462124102026"
            ],
            "threshold": 0.9
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@24e93695b1239fbe4c31e224372be77f82dab69a",
        "target": {
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Line",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-802716b9",
        "digest": {
            "line_hashes": [
                "892908473408294245120397586863903933",
                "289875713109391338439751884645859036484",
                "212051232032126469436814176887090639249",
                "106149158658955179711477228118953810730",
                "198941237347511578621006359196690533385",
                "94387736910348796387184514462124102026"
            ],
            "threshold": 0.9
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e44bd76dd072756e674f45c5be00153f4ded68b2",
        "target": {
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Function",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-920c349f",
        "digest": {
            "length": 327.0,
            "function_hash": "22670389052189624675373074339347588112"
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@faa389b2fbaaec7fd27a390b4896139f9da662e3",
        "target": {
            "function": "ip6_send_skb",
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Function",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-a102bad6",
        "digest": {
            "length": 326.0,
            "function_hash": "32998977632468613677402630653963631188"
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9a3e55afa95ed4ac9eda112d4f918af645d72f25",
        "target": {
            "function": "ip6_send_skb",
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Function",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-b5c20bcf",
        "digest": {
            "length": 327.0,
            "function_hash": "22670389052189624675373074339347588112"
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e44bd76dd072756e674f45c5be00153f4ded68b2",
        "target": {
            "function": "ip6_send_skb",
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Line",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-c39a097a",
        "digest": {
            "line_hashes": [
                "65743994217003011962064820734081368083",
                "202077242910975826062906890391541784313",
                "212051232032126469436814176887090639249",
                "106149158658955179711477228118953810730",
                "198941237347511578621006359196690533385",
                "94387736910348796387184514462124102026"
            ],
            "threshold": 0.9
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cb5880a0de12c7f618d2bdd84e2d985f1e06ed7e",
        "target": {
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Line",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-cb4c066d",
        "digest": {
            "line_hashes": [
                "65743994217003011962064820734081368083",
                "202077242910975826062906890391541784313",
                "212051232032126469436814176887090639249",
                "106149158658955179711477228118953810730",
                "198941237347511578621006359196690533385",
                "94387736910348796387184514462124102026"
            ],
            "threshold": 0.9
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@571567e0277008459750f0728f246086b2659429",
        "target": {
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Function",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-e2a7be89",
        "digest": {
            "length": 326.0,
            "function_hash": "32998977632468613677402630653963631188"
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@24e93695b1239fbe4c31e224372be77f82dab69a",
        "target": {
            "function": "ip6_send_skb",
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Function",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-e3c0941d",
        "digest": {
            "length": 326.0,
            "function_hash": "32998977632468613677402630653963631188"
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@571567e0277008459750f0728f246086b2659429",
        "target": {
            "function": "ip6_send_skb",
            "file": "net/ipv6/ip6_output.c"
        }
    },
    {
        "signature_type": "Line",
        "signature_version": "v1",
        "deprecated": false,
        "id": "CVE-2024-44987-f918658e",
        "digest": {
            "line_hashes": [
                "65743994217003011962064820734081368083",
                "202077242910975826062906890391541784313",
                "212051232032126469436814176887090639249",
                "106149158658955179711477228118953810730",
                "198941237347511578621006359196690533385",
                "94387736910348796387184514462124102026"
            ],
            "threshold": 0.9
        },
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce2f6cfab2c637d0bd9762104023a15d0ab7c0a8",
        "target": {
            "file": "net/ipv6/ip6_output.c"
        }
    }
]