Fix Heap UAF in cupsdContinueJob via Concurrent Filter Deletion - #1683
Open
Ashwinjali wants to merge 1 commit into
Open
Fix Heap UAF in cupsdContinueJob via Concurrent Filter Deletion#1683Ashwinjali wants to merge 1 commit into
Ashwinjali wants to merge 1 commit into
Conversation
…etion A heap use-after-free vulnerability exists in the CUPS scheduler where `cupsdContinueJob` drops `MimeDatabase->lock` while retaining references to borrowed `mime_filter_t` pointers in a local `filters` array. While the lock is temporarily dropped, a concurrent background thread (e.g., `create_local_bg_thread` processing an unauthenticated `CUPS-Create-Local-Printer` request) can trigger `cupsdSetPrinterAttrs` which calls `delete_printer_filters`. This unconditionally frees the `mime_filter_t` objects. When the main thread resumes and dereferences these pointers later in the job processing loop, it results in a UAF. This patch resolves the issue by creating a deep copy of the borrowed `mime_filter_t` pointers into a privately owned array before dropping the lock. This ensures the main thread iterates over a safe snapshot of the filter data, preventing the UAF if the original filters are freed in the background.
michaelrsweet
requested changes
Aug 27, 2026
michaelrsweet
left a comment
Member
There was a problem hiding this comment.
Deep copying is the wrong fix.
If a job is in progress then the MIME database entries should not be updated at all. We need to fix that erroneous behavior.
But honestly until the printer is actually setup you can't actually print - did you actually run into this issue or is this a theoretical AI-detected flaw that can't actually happen?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A heap use-after-free vulnerability exists in the CUPS scheduler where
cupsdContinueJobdropsMimeDatabase->lockwhile retaining references to borrowedmime_filter_tpointers in a localfiltersarray.While the lock is temporarily dropped, a concurrent background thread (e.g.,
create_local_bg_threadprocessing an unauthenticatedCUPS-Create-Local-Printerrequest) can triggercupsdSetPrinterAttrswhich callsdelete_printer_filters. This unconditionally frees themime_filter_tobjects. When the main thread resumes and dereferences these pointers later in the job processing loop, it results in a UAF.This patch resolves the issue by creating a deep copy of the borrowed
mime_filter_tpointers into a privately owned array before dropping the lock. This ensures the main thread iterates over a safe snapshot of the filter data, preventing the UAF if the original filters are freed in the background.