Closed Bug 194446 Opened 23 years ago Closed 3 years ago

Attachments Security Review Action Items

Categories

(MailNews Core :: Attachments, defect)

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: hjtoi-bugzilla, Unassigned)

References

Details

(Keywords: meta, sec-audit, Whiteboard: [sg:audit])

Old C code, new uses (like smileys), need to check for buffer overflows Attachments can "overflow" into message content and spoof the actual message. Can you put scripts in vCard? If so, make sure that it does not run with content privileges, and that it honors the "disable JS for mail" pref. Stress test with long content types to make sure that they don't cause buffer overflows or write over other message headers Print can print stuff you did not see (we re-fetch message before print, scripts can change content, scripts won't run in print, stylesheet can be different for print media). If we detect print media or scripts are on and there are scripts, we should warn the user and recommend they preview before actually printing. What if an attachment name contained path separators, would a user write the file in a place they did not expect? We should replace path separators with underscore. It would be better to list characters that are allowed. Can JS resize, close etc. mailnews windows? Will we render and run XUL attachments as inline? We do not display all From: headers (possibly others) in the message list view (we only display the first). Make sure that we never put content derived from messages or mailserver into chrome in a way that causes the content to be parsed (and then run). document.write and innerHTML are two such methods, there may be others. (This prevents situations like: From: <script>doBadStuff()</script>) Make sure you never put a URL from content into a clickable link in the chrome, because link might be of the form javascript:doBadStuff() etc. How do we deal with <title><script>doBadStuff()</script></title>? Do not trust message content or headers Do not trust the mailserver
Whiteboard: [sg:investigation]
Product: MailNews → Core
Product: Core → MailNews Core
Assignee: mscott → nobody
QA Contact: stephend → attachments
bienvenu: is there anything useful in this bug or should we just close it?
Assignee: nobody → dbienvenu
Keywords: meta
Whiteboard: [sg:investigation] → [sg:audit]
We've turned off the ability to do js in mail messages, so I think this bug can be opened up.
Group: core-security
Keywords: sec-audit
Assignee: dbienvenu → nobody
Severity: normal → S3

This hasn't been touched in 20 years. And with the exception mime, the product is now signficantly different.
Kaie, is there anything of value here to keep this open?

Flags: needinfo?(kaie)

This bug lists ideas for triggering unexpected behavior in Thunderbird, possibly causing crashes.

Only some of the prevented ideas were related to JS, so one could argue comment 2 wasn't a sufficient argument to make this list public.

It would still make sense to investigate the remaining listed scenarios for hardening purposes.

Given this bug has been open for so long, it's possible this has inspired some bad actors to hunt for security issues in Thunderbird.

Flags: needinfo?(kaie)

(In reply to Heikki Toivonen (remove -bugzilla when emailing directly) from comment #0)

Old C code, new uses (like smileys), need to check for buffer overflows

Smilies are replaced by their corresponding emoji now.
Code is here: https://searchfox.org/mozilla-central/rev/3067ba33c2202459aae52b7a0f7218a71fe5f7c3/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp#664

Attachments can "overflow" into message content and spoof the actual message.

This is known but covered in other bugs.

Can you put scripts in vCard? If so, make sure that it does not run with
content
privileges, and that it honors the "disable JS for mail" pref.

JS in mail is completely disabled since a long time ago. The vCard is in the same context so can't run scripts. And it's all in content, not chrome.

Stress test with long content types to make sure that they don't cause buffer
overflows or write over other message headers

Header parsing is in JavaScript now, so can't buffer overflow.
Also, libmime went through fuzzing recently.

Print can print stuff you did not see (we re-fetch message before print,
scripts
can change content, scripts won't run in print, stylesheet can be different
for
print media). If we detect print media or scripts are on and there are
scripts,
we should warn the user and recommend they preview before actually printing.

We always preview before printing now.

What if an attachment name contained path separators, would a user write the
file in a place they did not expect? We should replace path separators with
underscore. It would be better to list characters that are allowed.

Forbidden chars are replaced.

Can JS resize, close etc. mailnews windows?

JS is disabled in mail, and it's in content, so no.

Will we render and run XUL attachments as inline?

The "active" parts of XUL, XBL was removed years ago. Nothing to run.

We do not display all From: headers (possibly others) in the message list
view (we only display the first).

Right, we do, and we must do so per spec.

Make sure that we never put content derived from messages or mailserver into
chrome in a way that causes the content to be parsed (and then run).
document.write and innerHTML are two such methods, there may be others. (This
prevents situations like: From: <script>doBadStuff()</script>)

We do take care. Any exploitable case would have to be filed separately with detail.

Make sure you never put a URL from content into a clickable link in the
chrome,
because link might be of the form javascript:doBadStuff() etc.

Same as above, we do take care.

How do we deal with <title><script>doBadStuff()</script></title>?

Scripts are not active in mail.
For non-mail contexts, it's js in content.

Do not trust message content or headers
Do not trust the mailserver

I don't see any action point for these.

Magnus, thanks a lot for your very helpful analysis, it's great you know the current state of the mentioned code areas.
Your explanations sound reasonable.

Resolving as worksforme.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.