CVE-2022-49505

Source
https://cve.org/CVERecord?id=CVE-2022-49505
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49505.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-49505
Downstream
Related
Published
2025-02-26T02:13:37.496Z
Modified
2026-04-11T12:44:09.342451Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
NFC: NULL out the dev->rfkill to prevent UAF
Details

In the Linux kernel, the following vulnerability has been resolved:

NFC: NULL out the dev->rfkill to prevent UAF

Commit 3e3b5dfcd16a ("NFC: reorder the logic in nfc_{un,}registerdevice") assumes the deviceisregistered() in function nfcdevup() will help to check when the rfkill is unregistered. However, this check only take effect when devicedel(&dev->dev) is done in nfcunregisterdevice(). Hence, the rfkill object is still possible be dereferenced.

The crash trace in latest kernel (5.18-rc2):

[ 68.760105] ================================================================== [ 68.760330] BUG: KASAN: use-after-free in __lockacquire+0x3ec1/0x6750 [ 68.760756] Read of size 8 at addr ffff888009c93018 by task fuzz/313 [ 68.760756] [ 68.760756] CPU: 0 PID: 313 Comm: fuzz Not tainted 5.18.0-rc2 #4 [ 68.760756] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 68.760756] Call Trace: [ 68.760756] <TASK> [ 68.760756] dumpstacklvl+0x57/0x7d [ 68.760756] printreport.cold+0x5e/0x5db [ 68.760756] ? __lockacquire+0x3ec1/0x6750 [ 68.760756] kasanreport+0xbe/0x1c0 [ 68.760756] ? __lock_acquire+0x3ec1/0x6750 [ 68.760756] __lockacquire+0x3ec1/0x6750 [ 68.760756] ? lockdephardirqsonprepare+0x410/0x410 [ 68.760756] ? registerlockclass+0x18d0/0x18d0 [ 68.760756] lock_acquire+0x1ac/0x4f0 [ 68.760756] ? rfkillblocked+0xe/0x60 [ 68.760756] ? lockdephardirqsonprepare+0x410/0x410 [ 68.760756] ? mutexlockionested+0x12c0/0x12c0 [ 68.760756] ? nlagetrangesigned+0x540/0x540 [ 68.760756] ? rawspinlockirqsave+0x4e/0x50 [ 68.760756] rawspinlockirqsave+0x39/0x50 [ 68.760756] ? rfkillblocked+0xe/0x60 [ 68.760756] rfkillblocked+0xe/0x60 [ 68.760756] nfcdevup+0x84/0x260 [ 68.760756] nfcgenldevup+0x90/0xe0 [ 68.760756] genlfamilyrcvmsgdoit+0x1f4/0x2f0 [ 68.760756] ? genlfamilyrcvmsgattrsparse.constprop.0+0x230/0x230 [ 68.760756] ? securitycapable+0x51/0x90 [ 68.760756] genlrcvmsg+0x280/0x500 [ 68.760756] ? genlgetcmd+0x3c0/0x3c0 [ 68.760756] ? lockacquire+0x1ac/0x4f0 [ 68.760756] ? nfcgenldevdown+0xe0/0xe0 [ 68.760756] ? lockdephardirqsonprepare+0x410/0x410 [ 68.760756] netlinkrcvskb+0x11b/0x340 [ 68.760756] ? genlgetcmd+0x3c0/0x3c0 [ 68.760756] ? netlinkack+0x9c0/0x9c0 [ 68.760756] ? netlinkdelivertap+0x136/0xb00 [ 68.760756] genlrcv+0x1f/0x30 [ 68.760756] netlinkunicast+0x430/0x710 [ 68.760756] ? memset+0x20/0x40 [ 68.760756] ? netlinkattachskb+0x740/0x740 [ 68.760756] ? __buildskbaround+0x1f4/0x2a0 [ 68.760756] netlinksendmsg+0x75d/0xc00 [ 68.760756] ? netlinkunicast+0x710/0x710 [ 68.760756] ? netlinkunicast+0x710/0x710 [ 68.760756] socksendmsg+0xdf/0x110 [ 68.760756] __sys_sendto+0x19e/0x270 [ 68.760756] ? __ia32sysgetpeername+0xa0/0xa0 [ 68.760756] ? fdinstall+0x178/0x4c0 [ 68.760756] ? fdinstall+0x195/0x4c0 [ 68.760756] ? kernelfpubegin_mask+0x1c0/0x1c0 [ 68.760756] _x64syssendto+0xd8/0x1b0 [ 68.760756] ? lockdephardirqson+0xbf/0x130 [ 68.760756] ? syscallenterfromusermode+0x1d/0x50 [ 68.760756] dosyscall64+0x3b/0x90 [ 68.760756] entrySYSCALL64afterhwframe+0x44/0xae [ 68.760756] RIP: 0033:0x7f67fb50e6b3 ... [ 68.760756] RSP: 002b:00007f67fa91fe90 EFLAGS: 00000293 ORIGRAX: 000000000000002c [ 68.760756] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f67fb50e6b3 [ 68.760756] RDX: 000000000000001c RSI: 0000559354603090 RDI: 0000000000000003 [ 68.760756] RBP: 00007f67fa91ff00 R08: 00007f67fa91fedc R09: 000000000000000c [ 68.760756] R10: 0000000000000000 R11: 0000000000000293 R12: 00007ffe824d496e [ 68.760756] R13: 00007ffe824d496f R14: 00007f67fa120000 R15: 0000000000000003

[ 68.760756] </TASK> [ 68.760756] [ 68.760756] Allocated by task 279: [ 68.760756] kasansavestack+0x1e/0x40 [ ---truncated---

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49505.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
ff169909eac9e00bf1aa0af739ba6ddfb1b1d135
Fixed
a8e03bcad52dc9afabf650fdbad84f739cec9efa
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
47244ac0b65bd74cc70007d8e1bac68bd2baad19
Fixed
f81270125b50532624400063281e6611ecd61ddf
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
c45cea83e13699bdfd47842e04d09dd43af4c371
Fixed
6abfaca8711803d0d7cc8c0fac1070a88509d463
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
307d2e6cebfca9d92f86c8e2c8e3dd4a8be46ba6
Fixed
fbf9c4c714d3cdeb98b6a18e4d057f931cad1d81
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
73a0d12114b4bc1a9def79a623264754b9df698e
Fixed
2a1b5110c95e4d49c8c3906270dfcde680a5a7be
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
8a9c61c3ef187d8891225f9b932390670a43a0d3
Fixed
1632be63862f183cd5cf1cc094e698e6ec005dfd
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
3e3b5dfcd16a3e254aab61bd1e8c417dd4503102
Fixed
4a68938f43b7c2663e4c90bb9bbe29ac8b9a42a0
Fixed
4f5d71930f41be78557f9714393179025baacd65
Fixed
1b0e81416a24d6e9b8c2341e22e8bf48f8b8bfc9
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Last affected
5ef16d2d172ee56714cff37cd005b98aba08ef5a

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49505.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
4.9.318
Type
ECOSYSTEM
Events
Introduced
4.10.0
Fixed
4.14.283
Type
ECOSYSTEM
Events
Introduced
4.15.0
Fixed
4.19.247
Type
ECOSYSTEM
Events
Introduced
4.20.0
Fixed
5.4.198
Type
ECOSYSTEM
Events
Introduced
5.5.0
Fixed
5.10.121
Type
ECOSYSTEM
Events
Introduced
5.11.0
Fixed
5.15.46
Type
ECOSYSTEM
Events
Introduced
5.16.0
Fixed
5.17.14
Fixed
5.18.3

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-49505.json"