Homoglyphs in URL tooltips #19958

Closed
opened 2026-01-31 06:58:36 +00:00 by claunia · 7 comments
Owner

Originally created by @j4james on GitHub (May 25, 2023).

Windows Terminal version

1.18.1421.0

Windows build number

10.0.19045.2913

Other Software

No response

Steps to reproduce

  1. Open a bash shell in Windows Terminal
  2. Execute the following command:
printf "\n\e]8;;https://www.xn--fcbook-3nf5b.com/\e\\TOTALLY REAL FACEBOOK LINK. YOU CAN TRUST ME.\e]8;;\e\\ \n\n"
  1. Hover over the resulting link text to see where the URL is going to take you.

Expected Behavior

There was a new feature advertised in the v1.18.1421.0 release notes that said "when you're hovering over a URL, we now display it in a partially-encoded form to help you avoid homoglyph attacks". So I expected there would be something in the tooltip indicating that this link was not exactly what it seemed.

Actual Behavior

The URL displayed in the tooltip gives the impression that it's linking to https://www.facebook.com/, which is very misleading.

image

Does PR #15095 perhaps rely on functionality that's only available in Windows 11?

Originally created by @j4james on GitHub (May 25, 2023). ### Windows Terminal version 1.18.1421.0 ### Windows build number 10.0.19045.2913 ### Other Software _No response_ ### Steps to reproduce 1. Open a bash shell in Windows Terminal 2. Execute the following command: ``` printf "\n\e]8;;https://www.xn--fcbook-3nf5b.com/\e\\TOTALLY REAL FACEBOOK LINK. YOU CAN TRUST ME.\e]8;;\e\\ \n\n" ``` 3. Hover over the resulting link text to see where the URL is going to take you. ### Expected Behavior There was a new feature advertised in the v1.18.1421.0 release notes that said "when you're hovering over a URL, we now display it in a partially-encoded form to help you avoid homoglyph attacks". So I expected there would be something in the tooltip indicating that this link was not exactly what it seemed. ### Actual Behavior The URL displayed in the tooltip gives the impression that it's linking to `https://www.facebook.com/`, which is very misleading. ![image](https://github.com/microsoft/terminal/assets/4181424/f13b2101-dff4-4817-ba1a-59503e873edb) Does PR #15095 perhaps rely on functionality that's only available in Windows 11?
claunia added the Issue-BugIn-PRProduct-TerminalArea-UserInterfacePriority-1 labels 2026-01-31 06:58:36 +00:00
Author
Owner

@j4james commented on GitHub (May 25, 2023):

I should add, I'm quite impressed that it decoded the punycode URL in the first place, and I think it's a good thing that we don't discriminate against non-Latin languages. However, there should at least be some indication when a URL contains characters that aren't ASCII.

@j4james commented on GitHub (May 25, 2023): I should add, I'm quite impressed that it decoded the punycode URL in the first place, and I think it's a good thing that we don't discriminate against non-Latin languages. However, there should at least be some indication when a URL contains characters that aren't ASCII.
Author
Owner

@ianjoneill commented on GitHub (May 25, 2023):

I can reproduce this in Windows 11 (10.0.22621.1702), so it doesn't seem to be Windows 10 specific.

(Edited to include version number)

@ianjoneill commented on GitHub (May 25, 2023): I can reproduce this in Windows 11 (10.0.22621.1702), so it doesn't seem to be Windows 10 specific. (Edited to include version number)
Author
Owner

@DHowett commented on GitHub (May 25, 2023):

Ah, you know what? I was totally wrong about what we prevented. Great catch.

(The change actually prevents the display of URLs with an RTL/LTR override in them, which can be used to mask the destination.)

@DHowett commented on GitHub (May 25, 2023): Ah, you know what? I was totally wrong about what we prevented. Great catch. (The change actually prevents the display of URLs with an RTL/LTR override in them, which can be used to mask the destination.)
Author
Owner

@lhecker commented on GitHub (May 25, 2023):

For reference: https://chromium.googlesource.com/chromium/src/+/main/docs/idn.md
The relevant code is fairly complex and it doesn't seem like WinRT or Win32 implement a similar API already. As such the best move for us might be to disable IDNs for the tooltip in general.

@lhecker commented on GitHub (May 25, 2023): For reference: https://chromium.googlesource.com/chromium/src/+/main/docs/idn.md The relevant code is fairly complex and it doesn't seem like WinRT or Win32 implement a similar API already. As such the best move for us might be to disable IDNs for the tooltip in general.
Author
Owner

@j4james commented on GitHub (May 26, 2023):

As such the best move for us might be to disable IDNs for the tooltip in general.

If you mean we shouldn't convert the punycode version to Unicode, that wouldn't help, because it could just as easily have been Unicode to start with. I only used the punycode encoding in my example to make it obvious it was doing something dodgy.

A simple solution could be to check if the URL has anything other than ASCII, and if so, add a little warning in the tooltip saying exactly that (e.g. "Warning: this URL contains characters that aren't ASCII").

@j4james commented on GitHub (May 26, 2023): > As such the best move for us might be to disable IDNs for the tooltip in general. If you mean we shouldn't convert the punycode version to Unicode, that wouldn't help, because it could just as easily have been Unicode to start with. I only used the punycode encoding in my example to make it obvious it was doing something dodgy. A simple solution could be to check if the URL has anything other than ASCII, and if so, add a little warning in the tooltip saying exactly that (e.g. "Warning: this URL contains characters that aren't ASCII").
Author
Owner

@lhecker commented on GitHub (May 26, 2023):

Oh, I meant that we could actively encode any non-ASCII URL as punycode ourselves. It's what a hypothetical domain would actually be named anyways after all. IdnToAscii will return the input string if it's ASCII already.

Edit: Actually, we should probably show both: https://www.unicode.org/reports/tr36/#Punycode_Spoofs

@lhecker commented on GitHub (May 26, 2023): Oh, I meant that we could actively encode any non-ASCII URL as punycode ourselves. It's what a hypothetical domain would actually be named anyways after all. [`IdnToAscii`](https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-idntoascii) will return the input string if it's ASCII already. Edit: Actually, we should probably show both: https://www.unicode.org/reports/tr36/#Punycode_Spoofs
Author
Owner

@j4james commented on GitHub (May 26, 2023):

OK, that makes sense. I thought you were saying there wasn't an API for that. I realise now you were talking about Chrome's IDN policy algorithm.

Actually, we should probably show both: https://www.unicode.org/reports/tr36/#Punycode_Spoofs

Yep. I was just going to recommend that.

@j4james commented on GitHub (May 26, 2023): OK, that makes sense. I thought you were saying there wasn't an API for that. I realise now you were talking about Chrome's IDN policy algorithm. > Actually, we should probably show both: https://www.unicode.org/reports/tr36/#Punycode_Spoofs Yep. I was just going to recommend that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19958