Bug 3427 - display prompt error when displaying escape charaters
Summary: display prompt error when displaying escape charaters
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 8.6p1
Hardware: All All
: P5 trivial
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-29 18:38 AEST by shizhenzhen
Modified: 2022-05-02 13:03 AEST (History)
2 users (show)

See Also:


Attachments
display prompt for different versions (960.50 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-04-29 18:38 AEST, shizhenzhen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description shizhenzhen 2022-04-29 18:38:39 AEST
Created attachment 3588 [details]
display prompt  for different versions

The the function conv() is called by a service module to set pam_message which msg_style is PAM_TEXT_INFO and msg contains escape characters,such as QR code. In version 8.1p1, display prompt can display correctly when using the ssh command to login,but,In version 8.6p1, prompt msg show no escape. Display results will be provided in the attachment.

    According to source code analysis, it is caused by function asmprintf() which is called in line 1942 of file sshconnect2.c
Comment 1 Darren Tucker 2022-04-29 19:05:09 AEST
This was added to prevent a malicious server from conducting preauth terminal control sequence attacks via this mechanism (while still allowing valid utf-8).
Comment 2 Damien Miller 2022-05-02 09:54:28 AEST
Note that this still allows through valid UTF-8 encoded unicode characters, so you could still display QR codes via characters like https://www.fileformat.info/info/unicode/char/2588/index.htm

Tools like qrencode support this, e.g. "qrencode -t utf8 https://bugzilla.mindrot.org"
Comment 3 Damien Miller 2022-05-02 13:03:29 AEST
I forgot to paste the actual QR code generated:

█████████████████████████████████████
█████████████████████████████████████
████ ▄▄▄▄▄ █▀▀ ██▀  █▄ ▄██ ▄▄▄▄▄ ████
████ █   █ █▄▀████▄▀▀▄▀ ▀█ █   █ ████
████ █▄▄▄█ █ ▄ █▄█▄ ▄█▀▀▀█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ █ ▀▄█▄█ ▀▄█ █▄▄▄▄▄▄▄████
████▄ ▀▄█▀▄ █▀█▄▀ ▄█ █▄█▀▀ ▄▄▀▄▄▀████
███████▀▀▄▄█▀▀▀▀ ▀▄█ ▄█▄▄█▄█▀▄  █████
███████▄▀ ▄█▀█▄▀▀▄█ █▄█   ▄▄█▄█▄▄████
████ ▀ █▀█▄█▀█▄ █  █▀▀▀▀▄ ███ ▄ ▄████
██████▀▄▄▀▄▄▄▄████▀█ ▄▀█▄ ▀▀█▀█▄▀████
████▄█▄█▄▄▄▀█▄▄▀▄█ ██ ▄█▀ ▀▄▄██  ████
████▄█▄█▄█▄▄▀▄▄ █▄▀▄ ▀█  ▄▄▄ █ ▀▀████
████ ▄▄▄▄▄ █▄▀ █▀▀█▀█▄▀█ █▄█ ▀▀▄█████
████ █   █ █▀▀█▄█ █▄▄▄▄█ ▄ ▄ ▀▀ █████
████ █▄▄▄█ █▀▄█  ▀▀██▀▀  ▀█▀ ▄▄▀▄████
████▄▄▄▄▄▄▄█▄█▄█▄███▄▄█▄▄▄██▄▄█▄█████
█████████████████████████████████████
█████████████████████████████████████


(it might not render perfectly in the browser, some fonts seem to have broken metrics that cause the block character to be wider than whitespace, even for monospace fonts - try changing fonts if it looks broken)