Skip to content

Arbitrary Code Execution via Tensorflow's Load Function

Description

Tensorflow's low-level load function may result in arbitrary code execution. The load function can deserialize untrusted data, potentially leading to code injection attacks.

Examples

Insecure Code

python
tensorflow.saved_model.load('untrusted_model.pkl')

Secure Code

python
tensorflow.saved_model.load('trusted_model.pkl')

Remediation

Use the `tensorflow.saved_model.load()` function with a trusted model path and ensure that the model file is not tampered with or comes from an untrusted source.

Rule Details

FieldValue
IDCODE-0247
CategoryDeserialization
SeverityCRITICAL
CWECWE-502
ConfidenceMEDIUM
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsdeserialization, code-injection
OWASPN/A

References