From mboxrd@z Thu Jan 1 00:00:00 1970 From: AL-KERNEL To: kernel-cve@kernelcve.org Subject: [CVE-2026-64346][MODERATE 7.0] usb: gadget: udc: Fix use-after-free in gadget_match_driver Date: Sat, 25 Jul 2026 14:43:16 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-AL-KERNEL-CVE: CVE-2026-64346 X-AL-KERNEL-Priority: MODERATE 7.0 X-AL-KERNEL-Severity: MODERATE 7.0 X-AL-KERNEL-Base-Severity: MODERATE X-AL-KERNEL-KPANIC: NO X-AL-KERNEL-ActionableScore: 5 X-AL-KERNEL-ActionableScore-Lower: 2 X-AL-KERNEL-Commit: f845852a5a8914277031f47d8de0f350fef52405 List-Id: CVE: CVE-2026-64346 Priority: MODERATE 7.0 AL-KERNEL base severity: MODERATE KPANIC flag: NO Patch: usb: gadget: udc: Fix use-after-free in gadget_match_driver Commit: f845852a5a8914277031f47d8de0f350fef52405 Upstream patch: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f845852a5a8914277031f47d8de0f350fef52405 Original CVE announcement: https://lore.kernel.org/linux-cve-announce/?q=CVE-2026-64346 Analysis date: Sat, 25 Jul 2026 14:43:16 -0400 ActionableScore: 5 ActionableScore lower bound: 2 Actionable bucket: Strong Important candidate / Actionable Moderate at minimum Manual review required: YES Summary: A race in USB gadget UDC lifetime handling allows `usb_del_gadget()` to free `usb_udc` while `gadget_match_driver()` accesses it through configfs, causing a local UAF-triggered kernel crash and requiring manual review for possible reduced-privilege impact. ====================================================================== ABOUT THIS REPORT ====================================================================== The original Linux kernel CVE announcement for CVE-2026-64346 is available here: https://lore.kernel.org/linux-cve-announce/?q=CVE-2026-64346 The original announcement does not normally provide a security severity estimate, CVSS assessment, or enough information to determine whether the reported kernel bug represents a practically relevant security issue. This report was generated by AL-KERNEL, an AI-assisted Linux kernel vulnerability analysis system developed by Alexander Larkin. It combines an autonomous classifier with LLM-assisted technical analysis and a separate ActionableScore mechanism. The purpose of this report is to prioritize Linux kernel CVEs before manual review, identify cases that require prompt investigation, and support automatic closure of issues that are unlikely to have meaningful security impact. Published priority for this report: MODERATE 7.0 Manual review required: YES A detailed explanation of the methodology and priority rules is included at the end of this message. ====================================================================== AL-KERNEL CLASSIFICATION RESULT ====================================================================== CVE-2026-64346 MODERATE CHECK WITH IMPACT FROM ORIG NN LOW Maybe valid. Check manually. Hints by AL-KERNEL: The best (paranoid) CVSS is 'AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H';*CWE-416;CWE-362;**CWE-476;Other CVSS 'AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H';BEST CVSS score: '7';DESCR 'A use-after-free race exists in the USB gadget UDC core because the usb_udc object and the gadget device have decoupled lifetimes. usb_del_gadget() can free the UDC memory during mode switch work while gadget_match_driver() concurrently accesses the same object through the configfs UDC binding path, resulting in a kernel crash. The observed failure is a NULL-pointer dereference in strcmp after the freed memory is zeroed, but the underlying primitive is a race based UAF on a kernel management object. For the CVSS the PR:L is used in the paranoid score because gadget configfs or USB role control can be exposed to reduced capability local services on embedded systems, even though normal administration usually requires root or CAP_SYS_ADMIN. The issue is local and not directly network reachable. Impact is at least denial of service via kernel crash and in worst case may allow confidentiality or integrity impact due to UAF memory corruption risk, so manual review is required.';YES REQUIRES MANUAL CHECK; ,and ActionableScore result is Strong Important candidate / Actionable Moderate at minimum (with actual score 4) YES OOB NULLPTR USB RACE LEAK UAF HARDWARE LINUS INCREASED_TO_MODERATE_FROM_LOW_BASED_ON_GUESSCVSS DECREASED_TO_MODERATEREG_BASED_ON_ACTIONABLESCORELESSTHAN5 NO NO checked ====================================================================== ACTIONABLESCORE ANALYSIS ====================================================================== ActionableScore=5 ActionableScoreLower=2 ## 1. ActionableScore * Conservative score: 2 * Paranoid score: 5 * Final recommended bucket: **Strong Important candidate / Actionable Moderate at minimum** ## 2. Signal breakdown Conservative signals: * Memory corruption, weak primitive: +1 The bug is a real UAF, but it is race-dependent and the patch does not show attacker-controlled reclaim, object replacement, write-after-free, callback hijack, or type confusion. * Real lifetime corruption: +1 The fix explicitly keeps `usb_udc` alive until the gadget device release path completes. * Reliable kernel crash / strong DoS: +1 The report shows a concrete NULL dereference in `__pi_strcmp()` from `gadget_match_driver()`. * Privileged kernel/device-management lifetime path: +1 The issue is in USB gadget UDC core lifetime management. * Hard or unreliable race / special timing required: -1 Triggering requires overlap between gadget deletion or mode-switch work and configfs driver binding. * Requires admin/root/CAP_SYS_ADMIN in typical deployments: -2 USB gadget configfs and mode switching are usually controlled by root or privileged system services. Paranoid additions / adjustments: * Local lower-privileged trigger concern: +1 On embedded or Android-like systems, USB role control or gadget configfs operations may be exposed to reduced-capability local services rather than full host-root operators. * Reduced privilege penalty instead of full admin penalty: 0 instead of -2 In that model, the bug can cross a practical service or capability boundary. * Race-UAF cap applied Because no reclaim or controlled reuse primitive is shown, the paranoid score is capped at 5. ## 3. Reachability analysis The bug is local and not network reachable. A realistic trigger requires access to USB gadget configuration through configfs and a concurrent gadget teardown or mode switch, such as `dwc3` role switching. In ordinary server deployments this path is uncommon and usually root-only. In embedded, mobile, appliance, or USB-device-mode products, gadget management may be performed by system services with reduced privileges, making PR:L a defensible paranoid interpretation. Namespaces normally do not expose this unless configfs and USB gadget control are deliberately delegated. ## 4. Severity interpretation This is not an ordinary NULL dereference only. The observed crash is a NULL dereference, but the root cause is a race-based UAF in a kernel lifetime object. Realistic demonstrated impact is local DoS. Practical privilege escalation is not demonstrated because there is no shown attacker-controlled reclaim, stale callback, writable stale object access, or type confusion. However, because it is a real UAF in device-management lifetime code and may be reachable by reduced-capability local services on embedded systems, it should be treated as Actionable Moderate at minimum and manually reviewed. ## 5. One-sentence report phrase A race in USB gadget UDC lifetime handling allows `usb_del_gadget()` to free `usb_udc` while `gadget_match_driver()` accesses it through configfs, causing a local UAF-triggered kernel crash and requiring manual review for possible reduced-privilege impact. ## 6. Manual review recommendation MANUAL CHECK REQUIRED Reason: real UAF plus race plus device lifetime management. Conservative impact is DoS, but reduced-privilege USB gadget control on embedded systems makes the paranoid ActionableScore high enough to avoid auto-close. ====================================================================== UPSTREAM PATCH SUMMARY ====================================================================== Patch: usb: gadget: udc: Fix use-after-free in gadget_match_driver Commit: f845852a5a8914277031f47d8de0f350fef52405 Upstream URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f845852a5a8914277031f47d8de0f350fef52405 Commit description: The udc structure acts as the management structure for the gadget, but their lifecycles are decoupled. A race condition exists where usb_del_gadget() frees the udc memory (e.g., via mode-switch work) while gadget_match_driver() concurrently accesses the freed udc memory (e.g., via configfs), causing a Use-After-Free (UAF) that triggers a NULL pointer dereference when the freed memory is zeroed: [39430.908615][ T1171] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [39430.911397][ T1171] pc : __pi_strcmp+0x20/0x140 [39430.911441][ T1171] lr : gadget_match_driver+0x34/0x60 ... [39430.911890][ T1171] usb_gadget_register_driver_owner+0x50/0xf8 [39430.911910][ T1171] gadget_dev_desc_UDC_store+0xf4/0x140 [39430.931308][ T1171] configfs_write_iter+0xec/0x134 [39430.957058][ T1171] Workqueue: events_freezable __dwc3_set_mode [39430.957287][ T1171] dwc3_gadget_exit+0x34/0x8c [39430.957304][ T1171] __dwc3_set_mode+0xc0/0x664 Fix this by ensuring the udc structure remains allocated until the gadget is released. To achieve this, introduce a new usb_gadget_release() routine to the core. When the gadget is added, usb_add_gadget() stores the gadget's release routine in the udc structure and takes a reference to the udc. When the gadget is released, usb_gadget_release() drops the reference to the udc and then calls the gadget's release routine. Suggested-by: Alan Stern Cc: stable Signed-off-by: Jimmy Hu Reviewed-by: Alan Stern Link: https://patch.msgid.link/20260625073705.803880-1-hhhuuu@google.com Signed-off-by: Greg Kroah-Hartman Changed files: drivers/usb/gadget/udc/core.c Diff excerpt: Not included in this email. See the upstream URL for the full patch. Full patch: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=f845852a5a8914277031f47d8de0f350fef52405 ====================================================================== DETAILED REPORT METHODOLOGY ====================================================================== The original Linux kernel CVE announcement for CVE-2026-64346 can be found here: https://lore.kernel.org/linux-cve-announce/?q=CVE-2026-64346 The original CVE announcement normally does not include a security-level estimate. In particular, it may not contain a CVSS assessment, an impact level, or enough information to determine whether the reported bug is a practically relevant security issue. One purpose of this parallel CVE list is to provide that missing technical and prioritization information. The original goal of the AL-KERNEL project was to prioritize Linux kernel CVE analysis automatically before manual review. The system can also help identify non-security issues that may be suitable for automatic closure. This report was generated by AL-KERNEL, an AI-assisted Linux kernel vulnerability analysis system developed by Alexander Larkin. The first analysis stage combines an autonomous classifier with additional LLM-based analysis. The autonomous classifier runs locally on a CPU and is based on a backpropagation neural network. Together, these mechanisms produce a technical vulnerability description, identify likely weakness types, estimate CVSS severity, and provide input for ActionableScore. Two CVSS estimates are retained because incomplete kernel vulnerability information often permits more than one defensible interpretation: Conservative CVSS vector: AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H The Best / paranoid CVSS vector: AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H The Best / paranoid CVSS score: 7 The conservative vector represents a lower-impact interpretation. The Best/paranoid vector intentionally represents a plausible upper-bound interpretation and should not automatically be treated as demonstrated real-world impact. CVSS may also need to be adjusted for a particular Linux deployment, because actual reachability, privileges, enabled kernel configuration, hardware, namespaces, exposed device nodes, and other environmental conditions can differ significantly between systems. A separate ActionableScore mechanism evaluates practical remediation urgency. Its analysis may include reachability, attack prerequisites, subsystem exposure, memory-corruption characteristics, denial-of-service reliability, and possible confidentiality, integrity, or privilege-escalation impact. Conservative ActionableScore: 2 Paranoid ActionableScore: 5 The final base severity is taken directly from the second tab-separated field of the AL-KERNEL classification result. ActionableScore does not replace or independently override that final AL-KERNEL decision, and if ActionableScore adjusted impact level of ALKERNEL, then you would see self-readable flags above like INCREASED_TO_HIGH_BASED_ON_ACTIONABLESCOREHIGHEREQTHAN7. For an AL-KERNEL result of MODERATE, this report uses the following additional presentation split: ActionableScore below 5 -> MODERATE REGULAR ActionableScore 5 or more -> MODERATE 7.0 The distinction between MODERATE REGULAR and MODERATE 7.0 makes it possible to identify Moderate issues that should receive manual analysis and fixes before lower-priority MODERATE REGULAR issues. In many cases, MODERATE REGULAR fixes may wait for a later rebase or routine update. There is one override in which MODERATE REGULAR becomes MODERATE 7.0 even when the ActionableScore is below 5. When the AL-KERNEL result contains the KPANIC flag, a MODERATE result is always presented as MODERATE 7.0. The KPANIC flag selected with few regexps without usage of AI at all, so it helps to detect cases when Kernel Crash happens and similar (to filter False-Negative results from the LLM usage). KPANIC indicates that a reliable kernel crash, kernel panic, or similarly serious kernel availability impact was identified by the classification workflow. AL-KERNEL base severity for this report: MODERATE KPANIC detected for this report: NO Published priority for this report (same as in Subject): MODERATE 7.0 These results are intended to support engineering triage. They are machine-generated estimates, and cases marked for manual review should be validated by a human security engineer before final disposition. For more info read docs linked from here: https://kernelcve.org/ (and you can submit you own patch there to generate such a report for non-existant CVE-id yet). Note that in many cases this AI tool selects higher severity, than real is (means you can expect Importants instead of Moderate 7.0 or Moderates 7.0 instead of regular Moderates). If you see such cases, please use reply email interface to add additional manual analyses info to this particular CVE. And please, please, let me know when you see Lows instead of Importants or Important instead of Low (because particular for such cases I need to tune this AI tool to make it better for this one and next similar). My contact email for such notifications is alexanjelausa@gmail.com (and both send reply to CVE record itself too and see "reply" button below for howto reply).