Upstream already committed this fix to OpenBSD CVS 
(auth-options.c,v 1.104, OpenBSD-Commit-ID: 
ea9c2afc636e120f68a0b70087afb1d5ecc1f9e0) 

and synced it to openssh-portable master:
https://github.com/openssh/openssh-portable/commit/9ca942330f1829e0c0e2fd4d96ed5a06449af156

** Description changed:

  [Impact]
  
  After upgrading openssh-server from 1:9.6p1-3ubuntu13.16 to 
1:9.6p1-3ubuntu13.18
  on Ubuntu 24.04 LTS, root public-key logins fail on hosts configured with
  "PermitRootLogin forced-commands-only".
  
  The client authenticates successfully and is then immediately disconnected.
  sshd's privilege-separation monitor terminates the connection with a fatal 
error.
  
  [Test Plan]
  
  On a resolute system:
  
  1. Generate key pair:
  $ ssh-keygen -t ed25519 -C "<your-mail>"
  
  2. Add pub key to: ~/.ssh/authorized_keys
  
  $ cat ~/.ssh/authorized_keys
  command="/bin/echo FORCED_COMMAND_SUCCESS" ssh-ed25519 .....
  
  3. Login with root
  
  $ ssh -i ~/.ssh/<private-key> root@localhost
  
  This should fail with the log:
  
  $ journalctl -u ssh
  ..
  ***: fatal: monitor_child_preauth: unexpected authentication from 102
  ...
  
  With the proposed fix, the command should succeed with output:
  
  FORCED_COMMAND_SUCCESS
  Connection to localhost closed.
  
  [ Where problems could occur ]
  
  The fix only changes sshauthopt_serialise() so that "true"/"yes" are 
serialised
  for force_command / cert_principals only when those fields are actually
  non-NULL (matching the deserialisation side). It affects the
  privilege-separation serialisation of authentication options exchanged between
  the unprivileged child and the monitor.
  
  If the change were wrong, the possible impact would be limited to the
  authentication path:
    - forced-command keys could be misinterpreted (a forced command dropped, or
      spuriously applied), or
    - authorized_keys with restriction/certificate options could be evaluated
      incorrectly.
  
  [ Other Info ]
  
  
-   - Upstream fix / PR: https://github.com/openssh/openssh-portable/pull/712
+   - Upstream commit: 
https://github.com/openssh/openssh-portable/commit/9ca942330f1829e0c0e2fd4d96ed5a06449af156
 (OpenBSD-Commit-ID: ea9c2afc636e120f68a0b70087afb1d5ecc1f9e0)
+   - Upstream PR: https://github.com/openssh/openssh-portable/pull/712
    - Verified by the reporter on NOBLE against a PPA build
      (1:9.6p1-3ubuntu13.20~ppa...) on a clean Ubuntu 24.04 container: forced
      commands run, unforced keys are cleanly refused, no fatal crash.
      PPA: https://launchpad.net/~hectorcao/+archive/ubuntu/lp2166842

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2166842

Title:
  sshd: fatal "monitor_child_preauth: unexpected authentication from
  102" breaks root public-key login with PermitRootLogin=forced-
  commands-only + UsePAM=yes (regression in 1:9.6p1-3ubuntu13.18)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/2166842/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to