🇰🇷 한글 설명
TensorFlow의 tf.raw_ops.SparseMatrixSparseCholesky 함수에서 잘못된 permutation 값을 입력할 경우 Null 포인터 역참조가 발생할 수 있습니다. 이는 ValidateInputs 함수 내의 유효성 검사 실패 시 OP_REQUIRES 매크로가 호출 함수만 종료시키고 호출자(caller)의 실행을 계속하게 만드는 로직 결함 때문입니다.
💡 쉬운 설명
TensorFlow라는 인공지능 도구에서 잘못된 데이터를 입력하면 프로그램이 예상치 못한 오류를 일으키며 갑자기 멈출 수 있습니다. 이는 데이터가 올바른지 확인하는 과정에서 오류가 발생해도 프로그램이 이를 무시하고 다음 단계를 진행하기 때문에 발생합니다.
🇺🇸 원문 (English)
TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a null pointer dereference by providing an invalid `permutation` to `tf.raw_ops.SparseMatrixSparseCholesky`. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/kernels/sparse/sparse_cholesky_op.cc#L85-L86) fails to properly validate the input arguments. Although `ValidateInputs` is called and there are checks in the body of this function, the code proceeds to the next line in `ValidateInputs` since `OP_REQUIRES`(https://github.com/tensorflow/tensorflow/blob/080f1d9e257589f78b3ffb75debf584168aa6062/tensorflow/core/framework/op_requires.h#L41-L48) is a macro that only exits the current function. Thus, the first validation condition that fails in `ValidateInputs` will cause an early return from that function. However, the caller will continue execution from the next line. The fix is to either explicitly check `context->status()` or to convert `ValidateInputs` to return a `Status`. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
📍 영향받는 시스템
TensorFlow 2.5.0 미만 버전 (2.4.2, 2.3.3, 2.2.3, 2.1.4 포함)
⚔️ 공격 벡터
조작된 permutation 인자를 포함한 잘못된 입력 데이터를 TensorFlow 연산에 전달
🛡️ 대응 방법
TensorFlow를 2.5.0 이상의 버전으로 업데이트하거나, 지원되는 최신 패치 버전(2.4.2, 2.3.3 등)으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 번호가 2.5.0 미만인지 확인하여 취약 여부를 판단합니다.
python3 -c 'import tensorflow as tf; print(tf.__version__)'