🇰🇷 한글 설명
Linux 커널의 bpf_crypto_crypt 함수에서 목적지 dynptr의 크기가 소스 dynptr의 크기보다 큰지 검증하지 않아 발생하는 경계 외(OOB) 쓰기 취약점입니다. 이로 인해 암호화 작업 시 목적지 버퍼의 크기가 소스보다 작을 경우 메모리 오염이 발생할 수 있습니다.
💡 쉬운 설명
데이터를 암호화하거나 복호화할 때, 결과물을 담을 그릇이 원래 데이터보다 작아도 그대로 데이터를 부어버리는 문제입니다. 이 과정에서 그릇 밖으로 데이터가 넘쳐흘러 시스템의 중요한 메모리 영역을 망가뜨릴 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix out-of-bounds dynptr write in bpf_crypto_crypt
Stanislav reported that in bpf_crypto_crypt() the destination dynptr's
size is not validated to be at least as large as the source dynptr's
size before calling into the crypto backend with 'len = src_len'. This
can result in an OOB write when the destination is smaller than the
source.
Concretely, in mentioned function, psrc and pdst are both linear
buffers fetched from each dynptr:
psrc = __bpf_dynptr_data(src, src_len);
[...]
pdst = __bpf_dynptr_data_rw(dst, dst_len);
[...]
err = decrypt ?
ctx->type->decrypt(ctx->tfm, psrc, pdst, src_len, piv) :
ctx->type->encrypt(ctx->tfm, psrc, pdst, src_len, piv);
The crypto backend expects pdst to be large enough with a src_len length
that can be written. Add an additional src_len > dst_len check and bail
out if it's the case. Note that these kfuncs are accessible under root
privileges only.
📍 영향받는 시스템
Linux kernel (bpf_crypto_crypt 함수를 사용하는 버전)
⚔️ 공격 벡터
루트 권한을 가진 사용자가 조작된 크기의 dynptr를 사용하여 bpf_crypto_crypt 함수를 호출
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 src_len과 dst_len 간의 검증 로직을 적용
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인