Skip to content

Rework pubkey_options struct#416

Merged
mkj merged 1 commit into
masterfrom
pr/options-cleanup
Apr 16, 2026
Merged

Rework pubkey_options struct#416
mkj merged 1 commit into
masterfrom
pr/options-cleanup

Conversation

@mkj
Copy link
Copy Markdown
Owner

@mkj mkj commented Apr 16, 2026

Pubkey info is now included in the restriction struct. A temporary pubkey_options is filled then set in the global session after auth.

@mkj mkj force-pushed the pr/options-cleanup branch from a5160dd to a8958d5 Compare April 16, 2026 12:50
Pubkey info is now included in the restriction struct. A temporary
pubkey_options is filled then set in the global session after auth.
@mkj mkj force-pushed the pr/options-cleanup branch from a8958d5 to c60db64 Compare April 16, 2026 13:53
@mkj mkj merged commit c60db64 into master Apr 16, 2026
17 of 18 checks passed
@mkj mkj deleted the pr/options-cleanup branch April 16, 2026 16:14
@mkj
Copy link
Copy Markdown
Owner Author

mkj commented May 3, 2026

This PR fixed a security issue

  • Security: server: Fix ability to bypass an authorized_keys "forced_command"
    option by an authenticated user, if Dropbear is running with "-t" option.
    ("-t" is require both password and public key).

After the initial pubkey auth succeeds (with forced_command key), a subsequent failed pubkey attempt could clear the forced command option. That's only applicable with "-t" where it accepts the subsequent attempts.

The commit here is a large rework (and IMO improves the code), but a simpler mitigation for the fix would be to not clear the options.

/* Retain pubkey options only if auth succeeded */
if (!ses.authstate.authdone) {
svr_pubkey_options_cleanup();
}

becomes

    /* Retain pubkey options if auth succeeded or pubkey partial success (multi-auth).
    * In multi-auth mode, pubkey success clears AUTH_TYPE_PUBKEY from authtypes.
    * If that flag is cleared, pubkey auth succeeded and options should persist. */
    if (!ses.authstate.authdone
       && (ses.authstate.authtypes & AUTH_TYPE_PUBKEY)) {
       svr_pubkey_options_cleanup();
    }

Note that I haven't tested that thoroughly.

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.

1 participant