[upstream] Thunderbird 91.5.0 regression: writes attachments to /tmp readable to everyone

Bug #1959604 reported by Pierre Sauter
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mozilla Thunderbird
Fix Released
Unknown
thunderbird (Ubuntu)
Fix Released
High
Unassigned

Bug Description

thunderbird saves opened attachments to /tmp with permissions according to umask setting. This was fixed a long time ago with a protected folder /tmp/mozilla_${USER}0 and was still working correctly as of version 78.14.0+build1-0ubuntu0.20.04.2. The recent update to 1:91.5.0+build1-0ubuntu0.20.04.1 reintroduced the bug.

Ubuntu 20.04.3 LTS
Kernel release: 5.13.0-25-generic
Architecture: x86_64

Tags: upstream
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug, that sounds like an upstream issue, maybe you could report it to https://bugzilla.mozilla.org/ ?

Revision history for this message
In , Pierre Sauter (pierre-sauter-z) wrote :

Steps to reproduce:

open an attachment (png) with the associated app

Actual results:

the file is saved to /tmp readable to everyone

Expected results:

a protected subdirectory /tmp/mozilla_${user}0 should be created and the file saved there

Revision history for this message
In , Pierre Sauter (pierre-sauter-z) wrote :

References:

old bug that led to the mozilla_$user subdirectory:
https://bugzilla.mozilla.org/show_bug.cgi?id=377630

Ubuntu bug report:
https://bugs.launchpad.net/ubuntu/+source/thunderbird/+bug/1959604

Revision history for this message
Pierre Sauter (pierre-sauter-z) wrote :

Done

Changed in thunderbird:
status: Unknown → New
Olivier Tilloy (osomon)
summary: - Thunderbird 91.5.0 regression: writes attachments to /tmp readable to
- everyone
+ [upstream] Thunderbird 91.5.0 regression: writes attachments to /tmp
+ readable to everyone
tags: added: upstream
Revision history for this message
In , Mkmelin+mozilla (mkmelin+mozilla) wrote :
Changed in thunderbird:
status: New → Confirmed
Revision history for this message
In , Mkmelin+mozilla (mkmelin+mozilla) wrote :

Created attachment 9262175
Bug 1753242 - use a tmp subdir for opening temp files. r=darktrojan

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, upstream confirmed the regression and proposed a suggested fix for review now

Changed in thunderbird (Ubuntu):
importance: Undecided → High
status: New → Triaged
Changed in thunderbird:
status: Confirmed → In Progress
Revision history for this message
In , Pulsebot (pulsebot) wrote :

Pushed by <email address hidden>:
https://hg.mozilla.org/comm-central/rev/2f7ca550aed8
use a tmp subdir for opening temp files. r=darktrojan

Revision history for this message
In , Mkmelin+mozilla (mkmelin+mozilla) wrote :

Comment on attachment 9262175
Bug 1753242 - use a tmp subdir for opening temp files. r=darktrojan

[Approval Request Comment]
Regression caused by (bug #): bug 1737711
User impact if declined: information leak possible for multi-user systems
Testing completed (on c-c, etc.): c-c
Risk to taking this patch (and alternatives if risky): some risk of unexpected behavior

Changed in thunderbird:
status: In Progress → Fix Released
Revision history for this message
In , Vseerror (vseerror) wrote :

Comment on attachment 9262175
Bug 1753242 - use a tmp subdir for opening temp files. r=darktrojan

[Triage Comment]
Approved for beta

Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :
Revision history for this message
In , Wls220spring (wls220spring) wrote :

Verified testing the 98.0b2 release candidate on Fedora 35 Workstation.

Revision history for this message
In , Vseerror (vseerror) wrote :

Comment on attachment 9262175
Bug 1753242 - use a tmp subdir for opening temp files. r=darktrojan

[Triage Comment]
Approved for esr91

Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :

The test changes won't merge. The changes to msgHdrView.js apply fine. Uplifting without the tests seems like a bad idea, how do you want to proceed?

Revision history for this message
In , Mkmelin+mozilla (mkmelin+mozilla) wrote :
Revision history for this message
In , Mkmelin+mozilla (mkmelin+mozilla) wrote :

Sorry, still something to sort out with that.

Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :

Created attachment 9266065
1753242_esr91.patch

fixed version for esr91 based on comment 11.

Diff to comment 11:
```
➜ hg diff
diff --git a/mail/test/browser/attachment/browser_openAttachment.js b/mail/test/browser/attachment/browser_openAttachment.js
--- a/mail/test/browser/attachment/browser_openAttachment.js
+++ b/mail/test/browser/attachment/browser_openAttachment.js
@@ -39,17 +39,17 @@ add_task(async function setupModule(modu
   be_in_folder(folder);

   // @see logic for tmpD in msgHdrView.js
   tmpD = PathUtils.join(
     Services.dirsvc.get("TmpD", Ci.nsIFile).path,
     "pid-" + Services.appinfo.processID
   );

- let savePath = PathUtils.join(tmpD, "saveDestination");
+ savePath = PathUtils.join(tmpD, "saveDestination");
   await IOUtils.makeDirectory(savePath);
   Services.prefs.setStringPref("browser.download.dir", savePath);

   Services.prefs.setIntPref("browser.download.folderList", 2);
   Services.prefs.setBoolPref("browser.download.useDownloadDir", true);
   Services.prefs.setIntPref("security.dialog_enable_delay", 0);

   let mockedExecutable = FileUtils.getFile("TmpD", ["mockedExecutable"]);
@@ -406,12 +406,8 @@ add_task(async function saveToDiskPrompt
   let file = await checkFileSaved(tmpD);
   file.remove(false);
   Assert.ok(MockFilePicker.shown, "file picker was shown");

   MockFilePicker.reset();
   Services.prefs.setBoolPref("browser.download.useDownloadDir", true);
 });

-registerCleanupFunction(() => {
- // Remove created folders.
- folder.deleteSelf(null);
-});
```

Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :
Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :

Comment on attachment 9266065
1753242_esr91.patch

[Triage Comment]
Previously approved by wsmwk; moving flag to esr91 version of patch.

Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :

Verified the fix works on 91.7.0-build1, Linux64.

Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :

```
CVE-??:
     title: Opened attachments are saved world-readable
     impact: moderate
     reporter: Pierre Sauter
     description: |
       Thunderbird 91.4.1-91.6.1 saves opened attachment files in the temporary directory with world-readable permissions.
     bugs:
       - url: 1753242
```

Kai - We'd like advisory for this bug.

Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :
Revision history for this message
In , Rob Lemley (rjl-tbird) wrote :

(In reply to Rob Lemley [:rjl] from comment #17)
> Kai - We'd like advisory for this bug.

No advisory. This bug is mentioned in the release notes.

Revision history for this message
Simon Déziel (sdeziel) wrote :

Marking as fix released because the upstream bug was closed and the fix was verified to work in comment 20 (version 91.7.0). Ubuntu currently ships version 91.11.0.

Changed in thunderbird (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.