Skip to content

Arbitrary Code Execution via TensorFlow Library Loading

Description

Loading custom operator libraries in TensorFlow can result in arbitrary code execution. This can occur when using the `load_library` or `load_op_library` functions with untrusted input.

Examples

Insecure Code

python
tensorflow.load_library(user_input)

Secure Code

python
tensorflow.load_library('approved_library.so')

Remediation

Validate and sanitize any user-provided input before passing it to `load_library` or `load_op_library`. Consider using a whitelist of approved libraries.

Rule Details

FieldValue
IDCODE-0515
CategoryInjection
SeverityCRITICAL
CWECWE-676
ConfidenceMEDIUM
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsarbitrary code execution, library loading
OWASPN/A

References