Use after free in PDFium (CVE-2026-17875)
A use-after-free exists in PDFium when a page's /Annots array is aliased with a Name Tree node's /Limits array. During link enumeration, a name lookup mutates the aliased array, destroying an inline annotation dictionary while a raw pointer to it is still held, leading to a use-after-free that could allow arbitrary code execution in the renderer process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 50 days
Flapjack, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential Use-After-Free exists in PDFium when rendering pages with a shared array acting as both an /Annots array and a Name Tree /Limits array. During link enumeration, a name lookup can trigger an in-place mutation of the aliased array, destroying inline dictionaries while a raw pointer is still held. Subsequent access to this dangling pointer results in a Use-After-Free.
Affected files:
third_party/pdfium/core/fpdfdoc/cpdf_nametree.cpp
Estimated timestamp from git blame: 2017-07-24
Summary
A potential Use-After-Free (UAF) vulnerability exists in Chromium's PDFium component. The issue occurs due to an unsafe in-place mutation of a Name Tree node's /Limits array during name lookups. If this array is aliased with a page's /Annots array, the mutation can destroy an inline annotation dictionary while a raw pointer to it (FPDF_LINK) is actively being held by PDFiumPage::PopulateAnnotationLinks(). Dereferencing this pointer leads to a UAF.
Vulnerability Details
In third_party/pdfium/core/fpdfdoc/cpdf_nametree.cpp, the SearchNameNodeByNameInternal function traverses Name Tree nodes during lookups. As part of this traversal, it calls GetNodeLimits to evaluate the node's bounds. If GetNodeLimits determines that the lower limit is greater than the upper limit (via string comparison), it swaps the elements and replaces them with new CPDF_String objects using SetNewAt:
std::pair<WideString, WideString> GetNodeLimits(CPDF_Array* limits) {
WideString left = limits->GetUnicodeTextAt(0);
WideString right = limits->GetUnicodeTextAt(1);
// If the lower limit is greater than the upper limit, swap them.
if (left.Compare(right) > 0) {
std::swap(left, right);
limits->SetNewAt<CPDF_String>(0, left.AsStringView());
limits->SetNewAt<CPDF_String>(1, right.AsStringView());
}
return {std::move(left), std::move(right)};
}
If the replaced elements are inline objects, the SetNewAt assignment drops their only RetainPtr reference count to zero, causing immediate destruction of the objects.
Concurrently, PDFiumPage::PopulateAnnotationLinks() iterates over the /Annots array using FPDFLink_Enumerate(). FPDFLink_Enumerate yields raw pointers to the annotation dictionaries via the FPDF_LINK type, which is effectively a void* and is not protected by MiraclePtr/raw_ptr. Inside this enumeration loop, PopulateAnnotationLinks calls GetLinkTarget(), which may trigger a Name Tree lookup if the link destination is a named string.
Potential Exploitation Steps
While we do not have a working Proof of Concept, an attacker could potentially trigger this vulnerability via the following steps:
- Construct a malicious PDF with an indirect Array object (e.g.,
1 0 R). - Populate the array with two inline elements: a string and a dictionary (e.g.,
[ (Z_String) << /Subtype /Link /Dest (SomeDest) /Rect [0 0 100 100] >> ]). - Alias the array by setting it as both the page's
/Annotsarray and a/DestsName Tree node's/Limitsarray. - When Chromium processes the page,
PopulateAnnotationLinksenumerates the array. It skips the string and yields a rawFPDF_LINKto the inline dictionary. PopulateAnnotationLinkscallsGetLinkTarget, which extracts(SomeDest)and triggers a Name Tree lookup.- The lookup traverses the aliased node.
GetNodeLimitsfetches the elements.GetUnicodeTextAt(0)returns"Z_String", whileGetUnicodeTextAt(1)evaluates the dictionary and returns""(as dictionaries are not strings). GetNodeLimitsevaluates"Z_String" > ""as true. It callsSetNewAt, replacing the dictionary with a newCPDF_String.- The inline dictionary is immediately destroyed as its refcount hits 0.
- Execution returns to
PopulateAnnotationLinks, which callsFPDFLink_GetAnnotRect(link_annot, ...)using the now-danglingFPDF_LINKpointer. FPDFLink_GetAnnotRectdereferences the freed memory, leading to a UAF and potentially Arbitrary Code Execution within the Renderer process.
Suggested Fix
To fix this vulnerability, GetNodeLimits should not perform in-place mutation of the /Limits array during read-only lookup operations. Alternatively, the enumeration APIs (FPDFLink_Enumerate and the consumers like PopulateAnnotationLinks) should hold strong references (RetainPtr<CPDF_Dictionary>) to the objects they are processing across calls that might mutate the PDF structure.
Evaluated with Chrome root at commit: 2155cb00003ec35716a76ed3246eae995f87b7ff
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the GetNodeLimits function mutates the /Limits array in place during a read-only lookup, and if that array is aliased with /Annots, it destroys an inline dictionary while a raw pointer to it is still held.
Impact
This could lead to a use-after-free and potentially arbitrary code execution within the renderer process.
What the attacker needed
Victim opens a malicious PDF; PDF contains aliased arrays
The fix
The GetNodeLimits function should not perform in-place mutation of the /Limits array during read-only lookups, or enumeration APIs should hold strong references to the objects they process.
How it was found
- Construct a malicious PDF with an indirect Array object.
- Populate the array with two inline elements: a string and a dictionary.
- Alias the array by setting it as both the page's /Annots array and a /Dests Name Tree node's /Limits array.
- When Chromium processes the page, PopulateAnnotationLinks enumerates the array, skips the string, and yields a raw FPDF_LINK to the inline dictionary.
- PopulateAnnotationLinks calls GetLinkTarget, which triggers a Name Tree lookup that traverses the aliased node.
- GetNodeLimits compares the string and dictionary, swaps them, and replaces the dictionary with a new string, destroying the inline dictionary.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A use-after-free is a bug where a program keeps using memory after it has been freed. Here, a PDF can be crafted so that looking up a link name accidentally deletes an annotation object, but the program still tries to read it, which can crash or be exploited to run attacker code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.