CVE-2022-50747 in Linuxinfo

Summary

by MITRE • 12/24/2025

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

hfs: Fix OOB Write in hfs_asc2mac

Syzbot reported a OOB Write bug:

loop0: detected capacity change from 0 to 64 ================================================================== BUG: KASAN: slab-out-of-bounds in hfs_asc2mac+0x467/0x9a0 fs/hfs/trans.c:133 Write of size 1 at addr ffff88801848314e by task syz-executor391/3632

Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:284 print_report+0x107/0x1f0 mm/kasan/report.c:395 kasan_report+0xcd/0x100 mm/kasan/report.c:495 hfs_asc2mac+0x467/0x9a0 fs/hfs/trans.c:133 hfs_cat_build_key+0x92/0x170 fs/hfs/catalog.c:28 hfs_lookup+0x1ab/0x2c0 fs/hfs/dir.c:31 lookup_open fs/namei.c:3391 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0x10e6/0x2df0 fs/namei.c:3710 do_filp_open+0x264/0x4f0 fs/namei.c:3740

If in->len is much larger than HFS_NAMELEN(31) which is the maximum length of an HFS filename, a OOB write could occur in hfs_asc2mac(). In that case, when the dst reaches the boundary, the srclen is still greater than 0, which causes a OOB write. Fix this by adding a check on dstlen in while() before writing to dst address.

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 04/21/2026

The vulnerability CVE-2022-50747 represents a critical out-of-bounds write flaw within the Linux kernel's HFS filesystem implementation, specifically in the hfs_asc2mac function located in fs/hfs/trans.c. This issue was identified through automated fuzzing by syzbot, which detected a kernel address sanitizer (KASAN) violation during normal filesystem operations. The flaw manifests when processing filenames that exceed the maximum HFS filename length of 31 characters, creating a scenario where memory writes extend beyond the allocated buffer boundaries. The technical analysis reveals that the vulnerability stems from insufficient bounds checking in the string conversion routine that translates ASCII filenames to Macintosh encoding, a fundamental operation required for HFS filesystem compatibility and file access.

The operational impact of this vulnerability extends beyond simple data corruption, as it represents a potential vector for privilege escalation and system compromise. When an attacker crafts a filename exceeding HFS_NAMELEN limits, the flawed hfs_asc2mac function fails to properly validate buffer boundaries during the conversion process, leading to memory corruption that could be exploited to execute arbitrary code within kernel space. This particular flaw operates at the filesystem level and affects systems running Linux kernels with HFS support, making it relevant to various computing environments including Apple Macintosh systems running Linux or hybrid configurations. The vulnerability's exploitation potential aligns with ATT&CK technique T1068 (Local Privilege Escalation) and CWE-787 (Out-of-bounds Write), where improper input validation leads to memory corruption. The call trace demonstrates the vulnerability chain starting from filesystem lookup operations through to the core conversion function, indicating that any application or user interaction with HFS filesystems containing oversized filenames could trigger the exploit.

Mitigation strategies for CVE-2022-50747 require immediate kernel updates from vendors, as the fix involves implementing proper bounds checking within the hfs_asc2mac function before any memory writes occur. The recommended patch adds a validation check on dstlen within the while loop condition to ensure that the destination buffer boundaries are never exceeded during the character conversion process. System administrators should prioritize applying the patched kernel versions from their respective distributions, particularly for systems that mount or interact with HFS filesystems. Additional protective measures include implementing strict file naming policies to prevent oversized filenames from being created, monitoring for unusual filesystem access patterns, and ensuring that HFS filesystem support is disabled on systems where it is not required. Organizations should also consider implementing kernel hardening techniques such as stack canaries, address space layout randomization, and control flow integrity checks to reduce the exploitability of similar vulnerabilities. The fix directly addresses the root cause by ensuring that the destination buffer length is always validated against the source data length before any write operations, thereby preventing the out-of-bounds memory corruption that could lead to system instability or unauthorized privilege escalation.

Responsible

Linux

Reservation

12/24/2025

Disclosure

12/24/2025

Moderation

accepted

CPE

ready

EPSS

0.00239

KEV

no

Activities

low

Sources

Interested in the pricing of exploits?

See the underground prices here!