Skip to content

PAM: fix use-after-free during p11_child processing - #8861

Merged
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
alexey-tikhonov:use-after-free-pam-pkcs
Jun 30, 2026
Merged

PAM: fix use-after-free during p11_child processing#8861
alexey-tikhonov merged 1 commit into
SSSD:masterfrom
alexey-tikhonov:use-after-free-pam-pkcs

Conversation

@alexey-tikhonov

Copy link
Copy Markdown
Member

pam_check_cert_send() stored pctx->sss_certmap_ctx in the request state. If p11_refresh_certmap_ctx() ran while p11_child was still executing (e.g. triggered by a domain refresh), it freed and replaced the certmap context, leaving the request state holding a dangling pointer. p11_child_done() could later use that pointer.

Fix this by passing the pam_ctx into pam_check_cert_send() and dereferencing pctx->sss_certmap_ctx at the time it is actually needed in p11_child_done(), so the current context is always used.

Resolves: #8796

Assisted-By: Claude Code (Opus 4.6)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the pam_check_cert_send function and the pam_check_cert_state structure to accept and store the full pam_ctx context instead of only the sss_certmap_ctx member. This allows for cleaner context management and potential future extensions. I have no feedback to provide as the changes are straightforward and correct.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@alexey-tikhonov
alexey-tikhonov marked this pull request as ready for review June 29, 2026 20:57

@sumit-bose sumit-bose left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

thank you for the fix, ACK.

bye,
Sumit

@alexey-tikhonov
alexey-tikhonov force-pushed the use-after-free-pam-pkcs branch from e3e0059 to 8a18f27 Compare June 30, 2026 09:07
@alexey-tikhonov

Copy link
Copy Markdown
Member Author

Added Fixes: CVE-2026-12610 to the commit message + cosmetic edit.

@ikerexxe ikerexxe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

`pam_check_cert_send()` stored `pctx->sss_certmap_ctx` in the
request state. If `p11_refresh_certmap_ctx()` ran while `p11_child`
was still executing (e.g. triggered by a domain refresh), it freed
and replaced the certmap context, leaving the request state holding
a dangling pointer. `p11_child_done()` could later use that pointer.

Fix this by passing the `pam_ctx` into `pam_check_cert_send()` and
dereferencing `pctx->sss_certmap_ctx` at the time it is actually needed
in `p11_child_done()`, so the current context is always used.

Resolves: SSSD#8796
Fixes: CVE-2026-12610

Assisted-By: Claude Code (Opus 4.6)
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Sumit Bose <sbose@redhat.com>
@sssd-bot

Copy link
Copy Markdown
Contributor

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 CodeQL (success)
🟢 osh-diff-scan:fedora-rawhide-x86_64:upstream (success)
🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-44-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 testing-farm:centos-stream-10-x86_64:upstream (success)
🟢 testing-farm:fedora-43-x86_64:upstream (success)
🟢 testing-farm:fedora-44-x86_64:upstream (success)
🔴 testing-farm:fedora-rawhide-x86_64:upstream (failure)
🟢 Analyze (target) / cppcheck (success)
🟢 Build / freebsd (success)
🟢 Build / make-distcheck (success)
🟢 ci / intgcheck (centos-10) (success)
🟢 ci / intgcheck (fedora-43) (success)
🟢 ci / intgcheck (fedora-44) (success)
🔴 ci / intgcheck (fedora-45) (failure)
🟢 ci / prepare (success)
🟢 ci / system (centos-10) (success)
🟢 ci / system (fedora-43) (success)
🔴 ci / system (fedora-44) (failure)
🔴 ci / system (fedora-45) (failure)
➖ Coverity scan / coverity (skipped)
🟢 Static code analysis / codeql (success)
🟢 Static code analysis / pre-commit (success)
🟢 Static code analysis / python-system-tests (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@sssd-bot
sssd-bot force-pushed the use-after-free-pam-pkcs branch from 8a18f27 to 094aa5f Compare June 30, 2026 18:27
@alexey-tikhonov
alexey-tikhonov merged commit fa7a559 into SSSD:master Jun 30, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use-after-free crash in PAM responder during YubiKey / PKCS#11 authentication

4 participants