Skip to content

Pageant WM_COPYDATA protocol fix & token tightening - #624

Merged
Eugeny merged 3 commits into
Eugeny:mainfrom
vzex:pageant_and_cert
Aug 17, 2026
Merged

Pageant WM_COPYDATA protocol fix & token tightening#624
Eugeny merged 3 commits into
Eugeny:mainfrom
vzex:pageant_and_cert

Conversation

@vzex

@vzex vzex commented Jan 15, 2026

Copy link
Copy Markdown
Contributor
  1. pageant MemoryMap always fail in cargo build --release mode if pass the security_attributes argument in MemoryMap::new, I don't know why, but pass None can fix it.
  2. Support ssh certificate based authentication, when use sshagent, it will scan for both cert and publickey, if is cert, it should trigger the new auth method. example is here https://github.com/vzex/russh/blob/main/russh/examples/client_exec_sshagent.rs

Comment thread pageant/src/wmmessage.rs Outdated
Comment thread pageant/src/wmmessage.rs Outdated
@vzex
vzex force-pushed the pageant_and_cert branch from 07b9a0a to 271edc6 Compare June 18, 2026 09:14
@rebelliongeeks

rebelliongeeks commented Aug 15, 2026

Copy link
Copy Markdown

On a non-domain Windows 11 account, the WM_COPYDATA transport fails with 0x80070519 (ERROR_UNKNOWN_REVISION) out of the security descriptor setup in query_pageant_direct (debug build, pageant 0.2.1). The cause looks like a lifetime bug in get_current_process_user: it returns TOKEN_USER by value, but the Sid field inside it is a pointer into the local buffer Vec, which is dropped when the function returns. SetSecurityDescriptorOwner then receives a dangling pointer, which is undefined behavior, hence the build-mode-dependent failures. So removing the security attributes, as this PR does, is the correct fix and not just a workaround: the code being removed was handing Windows a pointer to freed memory.

For reference, connecting to Pageant's own named pipe (\\.\pipe\pageant.<user>.<hash>) with connect_named_pipe works cleanly as an alternative transport, standard agent protocol.

@Eugeny Eugeny changed the title pageant bug and support ssh certificate auth Pageant WM_COPYDATA protocol fix & token tightening Aug 17, 2026
@Eugeny
Eugeny merged commit c9da80c into Eugeny:main Aug 17, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants