SSH client doesn't handle properly non-ASCII chars
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openssh (Ubuntu) |
Fix Released
|
Medium
|
Marco Trevisan (Treviño) | ||
Focal |
Incomplete
|
Medium
|
Marco Trevisan (Treviño) | ||
Jammy |
Incomplete
|
Medium
|
Marco Trevisan (Treviño) | ||
Noble |
Fix Released
|
Medium
|
Marco Trevisan (Treviño) |
Bug Description
[ Impact ]
Non-ascii visible chars (including back-slashes, new lines and so) are not properly rendered by clients, showing their octal visualization.
Such as:
Hello SSHD \\ We love \360\237\215\225!
Instead of:
Hello SSHD \ We love 🍕!
This is particularly an issue when a server has configured keyboard interactive authentication and a PAM module wants to show non-ASCII characters such as a QR code for web authentication:
When using an ubuntu server running authd for web authentication we may end up having the login qrcode rendered such as
\210\342\
Which is clearly unreadable.
[ Test case ]
## Server preparation
Enable PAM and keyboard interactive authentication in a ssh server:
Add a configuration file such as:
/etc/ssh/
Containing:
UsePAM yes
KbdInteractive
ForceCommand bash -c "echo Hello from SSHD \ We also love 🍕!; $SHELL"
It's also suggested to check for regressions using a `Banner` option in sshd, pointing to a file with utf-8 contents:
echo "Hello" | qrencode -t ansiutf8 > /tmp/ssh-banner
Banner /tmp/ssh-banner
Restart the server:
sudo systemctl restart ssh.service
Edit the sshd PAM configuration file, adding as first line:
auth requisite pam_echo.so Hello SSHD \ We love 🍕!
Can be done with the command:
sudo sed '1 iauth requisite pam_echo.so Hello SSHD! \\ We love 🍕!' \
-i /etc/pam.d/sshd
## Client test
In the same host:
ssh -o PubkeyAuthentic
-o PasswordAuthent
-o PreferredAuthen
$USER@
The client should show:
Hello SSHD \ We love 🍕!
($USER@localhost) Password:
...
Hello from SSHD \ We also love 🍕!
███████
███████
████ ▄▄▄▄▄ █▀█ █ █ ▄▄▄▄▄ ████
████ █ █ █▄█▄▄▀█ █ █ ████
████ █▄▄▄█ █ ▄▄█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ █▄█▄█▄▄▄▄▄▄▄████
████ █▄▀▀▄ █▀▄ ▄▀▄ ▄█▄ ▀████
████ ██▀▀ ▄▀▀▄▀▄▀▀ ▄▀ ████
████▄▄▄▄██▄▄ █▄█ ▀█▀██████
████ ▄▄▄▄▄ █▄▀▀▄▄█ ▀ ▄▄ ▀████
████ █ █ █▀█▀█▄ ▀▄▀▀▀ ████
████ █▄▄▄█ █▀ ▄ ▀▄▄█▄█▄█▄████
████▄▄▄
███████
███████
Retry the same with another host and without keyboard authentication enabled in the server side.
To verify the fix in more complex scenario it's possible to follow the instructions of configuring authd:
- https:/
Once authd is configured, the user should be able to scan a QrCode from a ssh session.
## Cleanup
Revert the changes done in the cleanup phase, after test is done
sudo sed '/pam_echo\.so/d' -i /etc/pam.d/sshd
sudo rm /etc/ssh/
# Further testing
It's also required to check if other configurations using keyboard interactive such as TOTP/HOTP access still work:
https:/
# Authd testing
- Configurand install authd and MsEntraID broker as described at:
https:/
- Configure SSHd and try to login using the Qrcode as documented at
https:/
- Accessing via SSH to a machine via QrCode should show a properly rendered
qrcode
[ Regression potential ]
SSH info messages are not shown by the client. Even though those aren't covered by this change, it's important to check for regressions in any output that SSH exposes to the user. So banners and other messages should be checked for regressions.
These kind of messages are normally shown only when PAM *and* keyboard interaction are enabled in the server side, so it should not affect the default ubuntu servers behavior.
Related branches
- Vladimir Petko (community): Abstain
- git-ubuntu import: Pending requested
-
Diff: 140 lines (+118/-0)3 files modifieddebian/changelog (+9/-0)
debian/patches/series (+1/-0)
debian/patches/sshconnect2-Write-kbd-interactive-service-info-and-instru.patch (+108/-0)
- Vladimir Petko (community): Abstain
- git-ubuntu import: Pending requested
-
Diff: 140 lines (+118/-0)3 files modifieddebian/changelog (+9/-0)
debian/patches/series (+1/-0)
debian/patches/sshconnect2-Write-kbd-interactive-service-info-and-instru.patch (+108/-0)
- Julian Andres Klode (community): Approve
- Tobias Heider (community): Approve
- Canonical Server Reporter: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 426 lines (+388/-0)6 files modifieddebian/patches/auth-Add-KbdintResult-definition-to-define-result-values-.patch (+106/-0)
debian/patches/auth-pam-Add-an-enum-to-define-the-PAM-done-status.patch (+73/-0)
debian/patches/auth-pam-Add-debugging-information-when-we-receive-PAM-me.patch (+23/-0)
debian/patches/auth-pam-Immediately-report-interactive-instructions-to-c.patch (+73/-0)
debian/patches/series (+5/-0)
debian/patches/sshconnect2-Write-kbd-interactive-service-info-and-instru.patch (+108/-0)
Changed in openssh (Ubuntu Jammy): | |
assignee: | nobody → Marco Trevisan (Treviño) (3v1n0) |
importance: | Undecided → Medium |
status: | New → In Progress |
Changed in openssh (Ubuntu Focal): | |
assignee: | nobody → Marco Trevisan (Treviño) (3v1n0) |
importance: | Undecided → Medium |
status: | New → In Progress |
Changed in openssh (Ubuntu Noble): | |
assignee: | nobody → Marco Trevisan (Treviño) (3v1n0) |
importance: | Undecided → Medium |
status: | New → In Progress |
status: | In Progress → Fix Released |
Changed in openssh (Ubuntu): | |
status: | In Progress → Fix Released |
description: | updated |
Changed in openssh (Ubuntu Focal): | |
status: | In Progress → Fix Committed |
Changed in openssh (Ubuntu Jammy): | |
status: | In Progress → Fix Committed |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
This seems like quite an invasive change. It has not yet been accepted upstream. It touches PAM, and it looks to me like it might affect behaviour before authentication is complete. It affects escaping. Injection of malicious data into a stream to be parsed by the terminal has security implications. There is no security analysis or opinion of the security team presented.
If we're going to make changes in stable releases, or even a distribution patch, I think we need particularly strong justification given the above factors.
To consider that, we need to consider the actual impact to users. But that doesn't seem to have been presented here.
> Non-ascii visible chars are not properly rendered by clients, showing their octal visualization.
That's not really an explanation of impact to user.
What are we looking at here? Just the ability to include emoji in messages that, according to the SRU documentation provided, won't even be seen by the user? That sounds like a feature to me, and therefore doesn't seem appropriate to change a stable release for given that no justification has been provided.
> SSH info messages are not shown by the client.
This seems to be contradicted by the provided Test Plan, which runs the client and checks for the message. Please explain.
> These kind of messages are normally shown only when PAM is enabled in the server side, so it should not affect the normal behavior.
PAM is enabled by default on openssh on Ubuntu, no?
For SRU purposes, -1 based on the lack of an acceptable justification to SRU. If there is one, please present it, otherwise these uploads should be rejected from the queue.