🇰🇷 한글 설명
Linux 커널의 comedi 드라이버에서 insn_rw_emulate_bits() 함수가 여러 샘플(insn->n)을 처리하지 못해 발생하는 취약점입니다. INSN_READ/INSN_WRITE 명령어가 복수 샘플을 처리해야 하지만 단일 샘플만 처리하여 커널 정보 유출이 발생합니다.
💡 쉬운 설명
Linux 커널의 디바이스 드라이버에서 여러 개의 데이터를 읽어야 할 때 하나만 읽고 있어 의도하지 않은 메모리 정보가 노출됩니다. 이를 통해 공격자가 중요한 커널 정보를 탈취할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
comedi: Make insn_rw_emulate_bits() do insn->n samples
The `insn_rw_emulate_bits()` function is used as a default handler for
`INSN_READ` instructions for subdevices that have a handler for
`INSN_BITS` but not for `INSN_READ`. Similarly, it is used as a default
handler for `INSN_WRITE` instructions for subdevices that have a handler
for `INSN_BITS` but not for `INSN_WRITE`. It works by emulating the
`INSN_READ` or `INSN_WRITE` instruction handling with a constructed
`INSN_BITS` instruction. However, `INSN_READ` and `INSN_WRITE`
instructions are supposed to be able read or write multiple samples,
indicated by the `insn->n` value, but `insn_rw_emulate_bits()` currently
only handles a single sample. For `INSN_READ`, the comedi core will
copy `insn->n` samples back to user-space. (That triggered KASAN
kernel-infoleak errors when `insn->n` was greater than 1, but that is
being fixed more generally elsewhere in the comedi core.)
Make `insn_rw_emulate_bits()` either handle `insn->n` samples, or return
an error, to conform to the general expectation for `INSN_READ` and
`INSN_WRITE` handlers.
📍 영향받는 시스템
Linux kernel comedi 드라이버 (DAQ 카드 지원) - 정확한 영향 버전은 배포판별 백포트 패치 적용 시점 확인 필요
⚔️ 공격 벡터
comedi 디바이스 파일에 INSN_READ/INSN_WRITE 명령어를 insn->n > 1로 설정하여 실행 시 커널 메모리 정보 유출 가능
🛡️ 대응 방법
Linux 커널을 최신 버전으로 업데이트하여 insn_rw_emulate_bits() 함수의 insn->n 처리 패치 적용
🔧 검증 코드
comedi 모듈이 로드되어 있으면 참조 횟수가 표시됩니다. 로드되지 않았으면 영향 없고, 로드된 경우 커널 버전 확인 후 패치 적용 필요
lsmod | grep comedi && cat /sys/module/comedi/refcnt