인젝션 · 역직렬화Injection & deserialization
CWE-502 신뢰할 수 없는 데이터 역직렬화Deserialization of Untrusted Data
신뢰할 수 없는 바이트열을 객체로 복원하면서 의도치 않은 코드 경로가 실행되는 결함.Restoring objects from untrusted bytes triggers unintended code paths.
근본 원인 패턴Root-cause pattern
역직렬화 포맷이 타입/생성자 호출을 표현할 수 있어, 복원 과정 자체가 "가젯" 실행이 된다. ML 모델 파일(pickle 기반)도 같은 원리.The format can express types/constructor calls, so restoring runs "gadgets". Pickle-based ML model files share this.
전형적인 패치Typical fix
데이터 전용 포맷(JSON, safetensors), 타입 허용목록, 서명 검증.Data-only formats (JSON, safetensors), type allowlists, signature checks.