🇰🇷 한글 설명
TensorFlow의 `tf.raw_ops.SparseReshape` 구현에서 입력 또는 대상 형상의 요소 수가 0인지 확인하지 않아 정수 0으로 나누기 예외가 발생할 수 있습니다. 이로 인해 프로그램이 비정상적으로 종료될 수 있는 취약점이 존재합니다.
💡 쉬운 설명
데이터의 모양을 바꾸는 과정에서 숫자를 0으로 나누는 계산 실수가 발생할 수 있는 문제입니다. 이로 인해 인공지능 모델을 실행하는 프로그램이 갑자기 멈출 수 있습니다.
🇺🇸 원문 (English)
TensorFlow is an end-to-end open source platform for machine learning. In affected versions the implementation of `tf.raw_ops.SparseReshape` can be made to trigger an integral division by 0 exception. The [implementation](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/reshape_util.cc#L176-L181) calls the reshaping functor whenever there is at least an index in the input but does not check that shape of the input or the target shape have both a non-zero number of elements. The [reshape functor](https://github.com/tensorflow/tensorflow/blob/8d72537c6abf5a44103b57b9c2e22c14f5f49698/tensorflow/core/kernels/reshape_util.cc#L40-L78) blindly divides by the dimensions of the target shape. Hence, if this is not checked, code will result in a division by 0. We have patched the issue in GitHub commit 4923de56ec94fff7770df259ab7f2288a74feb41. The fix will be included in TensorFlow 2.6.0. We will also cherrypick this commit on TensorFlow 2.5.1 as this is the other affected version.
📍 영향받는 시스템
TensorFlow 2.5.1 및 그 이전 버전
⚔️ 공격 벡터
조작된 형태(shape)를 가진 입력 데이터를 TensorFlow의 SparseReshape 연산에 전달하여 발생
🛡️ 대응 방법
TensorFlow를 2.6.0 이상 버전으로 업데이트하거나 2.5.1 보안 패치 버전으로 업데이트
🔧 검증 코드
출력된 버전이 2.6.0 미만인지 확인하여 취약 여부를 판단합니다.
python3 -c 'import tensorflow as tf; print(tf.__version__)'