🔍 CVE-2025-38349

7.8
CVSS Score
HIGH
2025-07-18
2026-10-03 11:17
✅ 완료

🇰🇷 한글 설명

Linux 커널의 epoll 메커니즘에서 ep refcount를 뮤텍스(mutex)를 해제하기 전에 감소시켜 발생하는 Use-After-Free 취약점입니다. 뮤텍스 해제 과정 중에 다른 프로세스가 해당 객체를 해제할 수 있어 메모리 손상 및 시스템 불안정을 초래할 수 있습니다.

💡 쉬운 설명

데이터를 잠그고 사용하는 도중에 데이터의 수명을 관리하는 숫자를 먼저 줄여버려서 발생하는 문제입니다. 이로 인해 데이터가 사용 중임에도 불구하고 시스템이 데이터를 삭제해버려 오류가 발생할 수 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: eventpoll: don't decrement ep refcount while still holding the ep mutex Jann Horn points out that epoll is decrementing the ep refcount and then doing a mutex_unlock(&ep->mtx); afterwards. That's very wrong, because it can lead to a use-after-free. That pattern is actually fine for the very last reference, because the code in question will delay the actual call to "ep_free(ep)" until after it has unlocked the mutex. But it's wrong for the much subtler "next to last" case when somebody *else* may also be dropping their reference and free the ep while we're still using the mutex. Note that this is true even if that other user is also using the same ep mutex: mutexes, unlike spinlocks, can not be used for object ownership, even if they guarantee mutual exclusion. A mutex "unlock" operation is not atomic, and as one user is still accessing the mutex as part of unlocking it, another user can come in and get the now released mutex and free the data structure while the first user is still cleaning up. See our mutex documentation in Documentation/locking/mutex-design.rst, in particular the section [1] about semantics: "mutex_unlock() may access the mutex structure even after it has internally released the lock already - so it's not safe for another context to acquire the mutex and assume that the mutex_unlock() context is not using the structure anymore" So if we drop our ep ref before the mutex unlock, but we weren't the last one, we may then unlock the mutex, another user comes in, drops _their_ reference and releases the 'ep' as it now has no users - all while the mutex_unlock() is still accessing it. Fix this by simply moving the ep refcount dropping to outside the mutex: the refcount itself is atomic, and doesn't need mutex protection (that's the whole _point_ of refcounts: unlike mutexes, they are inherently about object lifetimes).

📍 영향받는 시스템

Linux Kernel (epoll 관련 모듈 사용 시스템)

⚔️ 공격 벡터

특정 타이밍에 epoll 참조 횟수를 조작하여 메모리 해제 후 접근(Use-After-Free) 유도

🛡️ 대응 방법

Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 refcount 감소 로직 수정 적용

🔧 검증 코드

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

Shell / Script
uname -r

📊 CVSS Vector String

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

💻 영향받는 소프트웨어

Linux Kernel