Sender Email Address Spoofing by encoded extraneous white space in display name
Categories
(Thunderbird :: Message Reader UI, defect)
Tracking
(thunderbird_esr68+ fixed, thunderbird76+ affected, thunderbird77 fixed)
People
(Reporter: mkmelin, Assigned: mkmelin)
References
Details
(Keywords: csectype-spoof, sec-low)
Attachments
(1 file, 1 obsolete file)
11.78 KB,
patch
|
pmorris
:
review+
wsmwk
:
approval-comm-esr68+
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #1506587 +++
By abusing Unicode whitespaces (e.g., U+3000) within the 'From:' email header, an attacker can spoof the sender email address when displayed by the Thunderbird mail client.
Turns out bug 1506587 didn't fix the case where the special characters are encoded.
Testcase in attachment 9128245 [details].
Assignee | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Yes, I was wondering which code path RFC 2047 encoded tokens would take.
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 3•5 years ago
|
||
Comment 4•5 years ago
|
||
Actually,
YmzDtiA8aW52aXNpYmxlc3BhY2VAZnJpZW5kLmV4YW1wbGUuY29tPiAu decodes to blö <invisiblespace@friend.example.com> .
and encoding that again I get
YmzDtiA8aW52aXNpYmxlc3BhY2VAZnJpZW5kLmV4YW1wbGUuY29tPiAu
So it seems to me that the comment is in fact incorrect and the RFC 2047 token doesn't contain invisible (zero width) spaces like \u200B. It's also not used outside the token so it appears that the test doesn't actually prove anything :-(
Updated•5 years ago
|
Comment 5•5 years ago
|
||
jfkthame, is there a CSS property that can collapse sequences of space-like and default-ignorable characters to a single rendered space without modifying the DOM text node value?
Comment 6•5 years ago
|
||
I can't think of something in CSS that would do this... we have the CSS white space processing rules, but collapsing only applies to normal <space> (and <tab>) characters, not to what the spec calls "other space separators".
As a minor optimization to the patch, I think that cleanToken()
shouldn't be invoked at all if the token only contains characters in the ASCII range \x20-\x7E
. So only call cleanToken(t.token)
if the following regex test /[^\x20-\x7E]/.test(t.token)
returns true. There is no point cleaning the token if it doesn't contain any zero-width characters, especially that consecutive spaces are collapsed outside of the cleanToken
function.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 8•5 years ago
|
||
I think for consistency it's just easier to to find-replace at once.
Assignee | ||
Comment 9•5 years ago
|
||
Adds some tests but other than that it's mostly moving the call to a better place.
There is one slight imperfection in the patch. For case D I replace with space, not remove. For some reason if i replace with "" throughout the process, somewhere, e.g. for zero width space the spaces surrounding it will also get completely removed. I haven't figured out exactly why, but it shouldn't matter in practice.
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
Assignee | ||
Comment 12•5 years ago
|
||
Assignee | ||
Comment 13•5 years ago
|
||
Comment 14•5 years ago
•
|
||
The comment is incorrect :-( - Just proving the confusion.
+ // btoa takes a binary string to encode. unescape(encodeURIComponent(source))
+ // does UTF-8 to binary conversion. See bug 1551746 for other ways.
Correct is this:
unescape(encodeURIComponent(source)) encodes the JavaScript UTF-16 representation of the string into UTF-8.
And please lose the comment about btoa. It just takes some bytes, and bytes are always binary, in fact, everything is binary ;-)
Assignee | ||
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
Well, yes, btoa() takes some arbitrary binary data. I don't think the hint is useful since we all know that. But more importantly, the comment is totally wrong, since the aim is not UTF-8 to binary, whatever that might mean, but UTF-16 to UTF-8.
Comment 17•5 years ago
|
||
https://hg.mozilla.org/comm-central/rev/5a60280601f4f761896dc12d87c7e35c921c8fd2
Follow-up: Correct comment. rs=comment-only DONTBUILD
Comment 18•5 years ago
|
||
Comment 19•5 years ago
|
||
Comment 20•5 years ago
|
||
Should this bug get marked as resolved?
Assignee | ||
Comment 21•5 years ago
|
||
Yes.
Comment 22•5 years ago
|
||
Comment 23•5 years ago
|
||
Magnus, who should get attributed as the reporter of this issue?
Assignee | ||
Comment 24•5 years ago
|
||
I think the reporter of bug 1506587. See bug 1506587 comment 67.
Updated•5 years ago
|
Comment 25•5 years ago
|
||
(In reply to Kai Engert (:KaiE:) from comment #23)
Magnus, who should get attributed as the reporter of this issue?
If you need a name for the security advisory, please use "Ahmed Elsobky (@0xSobky)". Thanks!
Updated•5 years ago
|
Comment 26•5 years ago
|
||
Updated•5 years ago
|
Description
•