CVE-2022-38222
High · 7.8CVSS
7.8
EPSS
0.5%
Published
Sep 29, 2022
CISA due date
—
Cloudanix analysis
A problem in older PDF software can let attackers crash a computer or run malicious code simply by getting someone to open a specially made PDF file.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Application
- Class
- Use After Free
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Use-after-free in JBIG2Stream::close() within JBIG2Stream.cc allows memory corruption when a crafted PDF is processed by Xpdf tools such as pdfimages.
Why it matters to the business
Attackers can crash PDF processing applications or potentially execute arbitrary code on systems handling untrusted PDF files, disrupting workflows that rely on Xpdf for document conversion or extraction.
How an attack unfolds
An attacker creates a specially crafted PDF that triggers the use-after-free condition in JBIG2 handling; the victim then opens or processes the file locally using an affected Xpdf binary, resulting in denial of service or further memory manipulation.
How to fix it
Upgrade Xpdf to the latest available version that resolves the JBIG2Stream issue; if no update exists, replace Xpdf with an alternative PDF tool or isolate its use to trusted files only.
How to confirm the fix worked
Verify the installed Xpdf version against known patched releases, test processing of sample PDFs that previously triggered the flaw, and confirm absence of crashes or memory errors under controlled conditions.
Typical attack path
- Create a malicious PDF exploiting the JBIG2 use-after-free in JBIG2Stream::close()
- Deliver the PDF to the target via email, web download, or shared storage
- Victim invokes an affected Xpdf binary such as pdfimages on the file
- Trigger the use-after-free to cause crash or attempt code execution
How to detect it
Review system and application logs for segmentation faults or abnormal terminations of pdfimages and xpdf processes when handling PDF files; correlate with file creation or access events involving external PDFs.
What your security team should do
- Block or sandbox Xpdf execution against untrusted PDFs
- Replace Xpdf with maintained alternatives in enterprise workflows
- Add PDF file-type restrictions to email and download gateways
- Monitor process crashes involving pdfimages or xpdf binaries
The record
There is a use-after-free issue in JBIG2Stream::close() located in JBIG2Stream.cc in Xpdf 4.04. It can be triggered by sending a crafted PDF file to (for example) the pdfimages binary. It allows an attacker to cause Denial of Service or possibly have unspecified other impact.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Mageia:9 | xpdf | 0 | 4.05-1.mga9 |
| Ubuntu:16.04:LTS | ipe | 0 | No fix |
| Ubuntu:18.04:LTS | ipe | 0 | No fix |
| Ubuntu:20.04:LTS | ipe | 0 | No fix |
| Ubuntu:22.04:LTS | ipe | 0 | No fix |
| Ubuntu:24.04:LTS | ipe | 0 | No fix |
| Ubuntu:24.10 | ipe | 0 | No fix |
| Ubuntu:25.04 | ipe | 0 | No fix |
| Ubuntu:25.10 | ipe | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | ipe | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | ipe | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | ipe | 0 | No fix |
Related vulnerabilities
- CVE-2023-3436 Xpdf 4.04 will deadlock on a PDF object stream whose "Length" field is itself in another… Also affects xpdf
- CVE-2023-3044 An excessively large PDF page size (found in fuzz testing, unlikely in normal PDF files)… Also affects xpdf
- CVE-2023-2664 In Xpdf 4.04 (and earlier), a PDF object loop in the embedded file tree leads to infinite… Also affects xpdf
- CVE-2023-2663 In Xpdf 4.04 (and earlier), a PDF object loop in the page label tree leads to infinite… Also affects xpdf
- CVE-2023-2662 In Xpdf 4.04 (and earlier), a bad color space object in the input PDF file can cause a… Also affects xpdf
- CVE-2022-45587 Stack overflow vulnerability in function gmalloc in goo/gmem.cc in xpdf 4.04, allows… Also affects xpdf
- CVE-2022-45586 Stack overflow vulnerability in function Dict::find in xpdf/Dict.cc in xpdf 4.04, allows… Also affects xpdf
- CVE-2022-43071 A stack overflow in the Catalog::readPageLabelTree2(Object*) function of XPDF v4.04… Also affects xpdf