🇰🇷 한글 설명
Linux 커널의 media mtk-jpeg 드라이버에서 에러 처리 과정 중 Use-After-Free 취약점이 발견되었습니다. mtk_jpeg_dec_device_run 함수에서 에러 발생 시 작업이 완료된 것으로 잘못 표시되어, 모듈 제거 또는 파일 디스크립터 종료 시 이미 해제된 메모리에 접근할 수 있습니다.
💡 쉬운 설명
프로그램이 작업을 마친 후 메모리를 정리했는데, 시스템이 실수로 이미 사라진 메모리 공간을 다시 사용하려고 시도할 때 발생하는 오류입니다. 이로 인해 시스템이 충돌하거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run
In mtk_jpeg_probe, &jpeg->job_timeout_work is bound with
mtk_jpeg_job_timeout_work.
In mtk_jpeg_dec_device_run, if error happens in
mtk_jpeg_set_dec_dst, it will finally start the worker while
mark the job as finished by invoking v4l2_m2m_job_finish.
There are two methods to trigger the bug. If we remove the
module, it which will call mtk_jpeg_remove to make cleanup.
The possible sequence is as follows, which will cause a
use-after-free bug.
CPU0 CPU1
mtk_jpeg_dec_... |
start worker |
|mtk_jpeg_job_timeout_work
mtk_jpeg_remove |
v4l2_m2m_release |
kfree(m2m_dev); |
|
| v4l2_m2m_get_curr_priv
| m2m_dev->curr_ctx //use
If we close the file descriptor, which will call mtk_jpeg_release,
it will have a similar sequence.
Fix this bug by starting timeout worker only if started jpegdec worker
successfully. Then v4l2_m2m_job_finish will only be called in
either mtk_jpeg_job_timeout_work or mtk_jpeg_dec_device_run.
📍 영향받는 시스템
Linux kernel (mtk-jpeg driver module 포함 버전)
⚔️ 공격 벡터
특정 에러 경로를 유도하는 작업 수행 후 모듈을 제거하거나 파일 디스크립터를 닫는 방식
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 mtk-jpeg 드라이버의 에러 처리 로직을 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인합니다.