Skip to content

CVE-2022-24859 Manipulated inline images can cause Infinite Loop in PyPDF2

MediumCVSS 5.5 EPSS 1.3%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
Proof of concept public · automatable: no · technical impact: partial
Technology
UbuntuDebian

Description

PyPDF2 is an open source python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files. In versions prior to 1.27.5 an attacker who uses this vulnerability can craft a PDF which leads to an infinite loop if the PyPDF2 if the code attempts to get the content stream. The reason is that the last while-loop in ContentStream._readInlineImage only terminates when it finds the EI token, but never actually checks if the stream has already ended. This issue has been resolved in version 1.27.5. Users unable to upgrade should validate and PDFs prior to iterating over their content stream.

Upgrade path

9 packages: 7 fixed.

PackageAffectedFixed inStatus
debian/pypdf2(Debian 12) < 1.27.9-1 1.27.9-1 Fixed
pypdf2 project pypdf2 < 1.27.5 1.27.5 Fixed
pypi pypdf2(PyPI) < 1.27.5; = 1.15; = 1.16; = 1.17 +15 more 1.27.5 Fixed
ubuntu/pypdf2(Ubuntu 20.04) < 1.26.0-3ubuntu1.20.04.1; = 1.26.0-2; = 1.26.0-3ubuntu1 1.26.0-3ubuntu1.20.04.1 Fixed
ubuntu/pypdf2(Ubuntu 22.04) < 1.26.0-4ubuntu0.22.04.1; = 1.26.0-4 1.26.0-4ubuntu0.22.04.1 Fixed
ubuntu/pypdf2(Ubuntu Pro 16.04) < 1.25.1-1ubuntu0.1~esm1; = 1.23+git20141008-1; = 1.25.1-1 1.25.1-1ubuntu0.1~esm1 Fixed
ubuntu/pypdf2(Ubuntu Pro 18.04) < 1.26.0-2ubuntu0.1~esm1; = 1.26.0-2 1.26.0-2ubuntu0.1~esm1 Fixed
debian linux = 9.0 No fix listed Versions listed
py-pdf PyPDF2 = < 1.27.5 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
pypi pypdf2(PyPI) < 1.27.5 1.27.5
pypi pypdf2(PyPI) = 1.15 No fix listed
pypi pypdf2(PyPI) = 1.16 No fix listed
pypi pypdf2(PyPI) = 1.17 No fix listed
pypi pypdf2(PyPI) = 1.18 No fix listed
pypi pypdf2(PyPI) = 1.19 No fix listed
pypi pypdf2(PyPI) = 1.20 No fix listed
pypi pypdf2(PyPI) = 1.21 No fix listed
pypi pypdf2(PyPI) = 1.22 No fix listed
pypi pypdf2(PyPI) = 1.23 No fix listed
pypi pypdf2(PyPI) = 1.24 No fix listed
pypi pypdf2(PyPI) = 1.25 No fix listed
pypi pypdf2(PyPI) = 1.25.1 No fix listed
pypi pypdf2(PyPI) = 1.26.0 No fix listed
pypi pypdf2(PyPI) = 1.27.0 No fix listed
pypi pypdf2(PyPI) = 1.27.1 No fix listed
pypi pypdf2(PyPI) = 1.27.2 No fix listed
pypi pypdf2(PyPI) = 1.27.3 No fix listed
pypi pypdf2(PyPI) = 1.27.4 No fix listed
py-pdf PyPDF2 = < 1.27.5 No fix listed
ubuntu/pypdf2(Ubuntu:22.04) < 1.26.0-4ubuntu0.22.04.1 1.26.0-4ubuntu0.22.04.1
pypdf2 project pypdf2 < 1.27.5 1.27.5
debian linux = 9.0 No fix listed
debian/pypdf2(Debian:12) < 1.27.9-1 1.27.9-1
ubuntu/pypdf2(Ubuntu:Pro:16.04) < 1.25.1-1ubuntu0.1~esm1 1.25.1-1ubuntu0.1~esm1
Show 8 more
ProductAffected versionsFixed in
ubuntu/pypdf2(Ubuntu:Pro:16.04) = 1.23+git20141008-1 No fix listed
ubuntu/pypdf2(Ubuntu:Pro:16.04) = 1.25.1-1 No fix listed
ubuntu/pypdf2(Ubuntu:Pro:18.04) < 1.26.0-2ubuntu0.1~esm1 1.26.0-2ubuntu0.1~esm1
ubuntu/pypdf2(Ubuntu:Pro:18.04) = 1.26.0-2 No fix listed
ubuntu/pypdf2(Ubuntu:20.04) < 1.26.0-3ubuntu1.20.04.1 1.26.0-3ubuntu1.20.04.1
ubuntu/pypdf2(Ubuntu:20.04) = 1.26.0-2 No fix listed
ubuntu/pypdf2(Ubuntu:20.04) = 1.26.0-3ubuntu1 No fix listed
ubuntu/pypdf2(Ubuntu:22.04) = 1.26.0-4 No fix listed

References