🇰🇷 한글 설명
Linux 커널의 AMD IOMMU debugfs 구현에서 잠재적인 경계 외 메모리 접근(Out-of-bounds access) 취약점이 발견되었습니다. iommu_mmio_write() 및 iommu_capability_write() 함수에서 사용자 입력값을 처리할 때 정수 오버플로우로 인해 음수 값이 발생할 수 있는 문제가 있었습니다. 이를 해결하기 위해 입력값 파싱 방식을 변경하고 음수 값에 대한 명시적인 검증 로직이 추가되었습니다.
💡 쉬운 설명
컴퓨터의 메모리 관리 장치(IOMMU)를 테스트하는 기능에서 숫자를 잘못 입력하면 시스템이 허용되지 않은 메모리 영역을 건드릴 수 있는 오류입니다. 공격자가 특수한 숫자를 입력하여 시스템의 보안 경계를 넘으려고 시도할 수 있는 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
iommu/amd: Remove latent out-of-bounds access in IOMMU debugfs
In iommu_mmio_write() and iommu_capability_write(), the variables
dbg_mmio_offset and dbg_cap_offset are declared as int. However, they
are populated using kstrtou32_from_user(). If a user provides a
sufficiently large value, it can become a negative integer.
Prior to this patch, the AMD IOMMU debugfs implementation was already
protected by different mechanisms.
1. #define OFS_IN_SZ 8 ensures the user string <= 8 bytes, so
e.g. 0xffffffff isn't a valid input.
if (cnt > OFS_IN_SZ)
return -EINVAL;
2. Implicit type promotion in iommu_mmio_write(), dbg_mmio_offset is int
and iommu->mmio_phys_end is u64
if (dbg_mmio_offset > iommu->mmio_phys_end - sizeof(u64))
return -EINVAL;
3. The show handlers would currently catch the negative number and
refuse to perform the read.
Replace kstrtou32_from_user() with kstrtos32_from_user() to parse the
input, and check for negative values to explicitly prevent out-of-bounds
memory accesses directly in iommu_mmio_write() and
iommu_capability_write().
📍 영향받는 시스템
AMD IOMMU debugfs를 사용하는 Linux 커널 버전
⚔️ 공격 벡터
사용자가 debugfs를 통해 매우 큰 정수 값을 입력하여 음수 값으로 변환되도록 유도하는 방식
🛡️ 대응 방법
커널 패치를 적용하여 kstrtou32_from_user()를 kstrtos32_from_user()로 교체하고 음수 값 검증 로직을 적용해야 합니다.
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 패치 버전인지 확인합니다.