🔍 CVE-2022-49075

8.1
CVSS Score
HIGH
2025-02-26
2026-08-04 10:17
✅ 완료

🇰🇷 한글 설명

Linux 커널의 Btrfs 파일 시스템에서 qgroup 예약 시 발생하는 정수 오버플로 취약점입니다. fallocate를 통해 4GiB 이상의 범위를 할당할 때 bytes_changed 변수가 unsigned int 범위를 초과하여 qgroup 제한을 우회하고 할당량을 초과할 수 있습니다.

💡 쉬운 설명

파일 시스템의 용량 제한 기능을 설정해 두어도, 아주 큰 파일을 한 번에 만들려고 하면 제한 수치를 계산하는 과정에서 오류가 발생합니다. 이로 인해 설정된 용량 제한을 무시하고 시스템 용량을 초과하여 파일을 저장할 수 있게 됩니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: btrfs: fix qgroup reserve overflow the qgroup limit We use extent_changeset->bytes_changed in qgroup_reserve_data() to record how many bytes we set for EXTENT_QGROUP_RESERVED state. Currently the bytes_changed is set as "unsigned int", and it will overflow if we try to fallocate a range larger than 4GiB. The result is we reserve less bytes and eventually break the qgroup limit. Unlike regular buffered/direct write, which we use one changeset for each ordered extent, which can never be larger than 256M. For fallocate, we use one changeset for the whole range, thus it no longer respects the 256M per extent limit, and caused the problem. The following example test script reproduces the problem: $ cat qgroup-overflow.sh #!/bin/bash DEV=/dev/sdj MNT=/mnt/sdj mkfs.btrfs -f $DEV mount $DEV $MNT # Set qgroup limit to 2GiB. btrfs quota enable $MNT btrfs qgroup limit 2G $MNT # Try to fallocate a 3GiB file. This should fail. echo echo "Try to fallocate a 3GiB file..." fallocate -l 3G $MNT/3G.file # Try to fallocate a 5GiB file. echo echo "Try to fallocate a 5GiB file..." fallocate -l 5G $MNT/5G.file # See we break the qgroup limit. echo sync btrfs qgroup show -r $MNT umount $MNT When running the test: $ ./qgroup-overflow.sh (...) Try to fallocate a 3GiB file... fallocate: fallocate failed: Disk quota exceeded Try to fallocate a 5GiB file... qgroupid         rfer         excl     max_rfer --------         ----         ----     -------- 0/5           5.00GiB      5.00GiB      2.00GiB Since we have no control of how bytes_changed is used, it's better to set it to u64.

📍 영향받는 시스템

Linux kernel (Btrfs 파일 시스템을 사용하는 시스템)

⚔️ 공격 벡터

로컬 사용자가 fallocate 명령어를 사용하여 4GiB 이상의 대용량 파일을 생성함으로써 발생

🛡️ 대응 방법

Btrfs qgroup 오버플로 문제가 수정된 최신 버전의 Linux 커널로 업데이트

🔧 검증 코드

출력된 커널 버전이 해당 취약점이 패치된 이후의 버전인지 확인

Shell / Script
uname -r

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H

💻 영향받는 소프트웨어

Linux Kernel