Closed Bug 1701974 Opened 4 years ago Closed 7 hours ago

Use x-kde-passwordManagerHint when copying passwords to the clipboard to keep KDE's Klipper from writing it to plaintext history

Categories

(Core :: Widget: Gtk, enhancement)

Unspecified
Linux
enhancement

Tracking

()

RESOLVED FIXED
142 Branch
Tracking Status
firefox142 --- fixed

People

(Reporter: chris, Assigned: tschuster)

References

Details

(Keywords: reporter-external, sec-want, Whiteboard: [reporter-external] [client-bounty-form] [verif?])

Attachments

(1 file)

On Fedora 33 systems running KDE, there exists a process by which a password stored in the Firefox password manager (and third party password managers) may be written to disk in plaintext.

1.) Install Fedora 33 KDE (I used Fedora-KDE-Live-x86_64-33-1.2.iso, installed via UEFI on a Dell Latitude 7490) and go through typical new user setup steps.
2.) Launch Firefox, and save a password to any website into Firefox's built-in password manager
3.) Using Firefox's password manager, copy the password saved in step 2 to the clipboard, and immediately close Firefox
4.) Restart (or optionally shut down and turn back on) the computer using the Plasma restart menu option.
5.) Log back in and reopen any text editor, such as KWrite, and paste the contents of the clipboard using any means (C-v, Edit->Paste, etc). The password that was previously placed onto the clipboard in step 2 is pasted into the text editor.

The fact that the contents of the clipboard from step 2 (prior to the reboot) can be pasted into a text editor after a reboot is evidence that the contents of the clipboard were written to disk. On systems lacking full-disk encryption, this means that the clipboard content (ie: the password from step 2) is written to disk in plaintext.

I have reported this issue to KDE's security team directly, and their response was that this behavior was intentional. I was told that there is a metadata flag that can be applied when copying to the clipboard (https://github.com/keepassxreboot/keepassxc/blob/86278311d23b89322afddd98890385e2267c84cd/src/gui/Clipboard.cpp#L63) but to my knowledge KeePassXC is the only application on the planet that utilizes this.

Additionally, this bug was reported to Red Hat Product Security, originally on February 9, 2021, under incident INC1626643. Red Hat Product Security opted not to file a CVE on this issue, as they claim that the information cannot leak across a security boundary because the contents of the clipboard are stored in a user’s home directory, which is protected with file permissions of 0700.

While this does appear to be a bug with KDE and Klipper specifically, I am reporting this issue so that Firefox can mitigate this issue by implementing the “x-kde-passwordManagerHint” patch shown above. I have also reported the same bug to the Google Chrome team for mitigation using the same technique, as both KDE and Red Hat do not seem interested in fixing the issue upstream.

Flags: sec-bounty?

Summarizing a bit:
KDE's Klipper writes clipboard content to a history file on disk. Sounds handy, but is problematic for sensitive content like passwords. A few years back they implemented a hint password managers could use, because otherwise they have no context for what the user might consider sensitive or not. Firefox should use this hint in the about:logins copy-to-clipboard feature.

Here's where they implemented the feature
https://phabricator.kde.org/D12539

This is not a Firefox security vulnerability. This is a problem Klipper caused while implementing a feature for power users, and a hook they added that cooperating password managers could use to help Klipper protect users from the problem it caused. It could be a nasty surprise to users, though, and it should be a simple enough fix that it's worth looking into.

I can find enough written about this in public searches that keeping this bug hidden would be counter-productive -- if users know this problem exists they can take steps to protect themselves (e.g. turning off the Klipper history feature, using a different OS).

Group: firefox-core-security
Status: UNCONFIRMED → NEW
Type: task → enhancement
Component: Security → Password Manager
Ever confirmed: true
Keywords: sec-want
OS: Unspecified → Linux
Product: Firefox → Toolkit
Summary: Passwords written to disk in plaintext on Fedora KDE systems → Use x-kde-passwordManagerHint when copying passwords to the clipboard to keep KDE's Klipper from writing it to plaintext history

Password manager sounds like a really good use case for x-kde-passwordManagerHint. We use the nsIClipboardHelper's copyString method: https://searchfox.org/mozilla-central/source/browser/components/aboutlogins/AboutLoginsChild.jsm#124 - which AFAICT has no support for this kind of hint. Is there another service we should use or does this need to get implemented in Widget first?

Component: Password Manager → Widget
Product: Toolkit → Core

Unfortunately this does not qualify for our bug bounty program.

Flags: sec-bounty? → sec-bounty-
Component: Widget → Widget: Gtk

Is this bug still valid now?

Flags: needinfo?(chris)

Confirming that this bug still occurs on Fedora 42 KDE.

Flags: needinfo?(chris)
Assignee: nobody → tschuster
Status: NEW → ASSIGNED

I tested this and it successfully prevents the CopyQ clipboard manager from adding the password in about:logins to the history. Of course this only works with clipboard managers that respect the x-kde-passwordManagerHint.

Pushed by tschuster@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/9232f0c02759 https://hg.mozilla.org/integration/autoland/rev/653b9da38172 Use x-kde-passwordManagerHint when copying private data to the clipboard. r=stransky
Pushed by abutkovits@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/ba31d92de0b9 https://hg.mozilla.org/integration/autoland/rev/662c31416c93 Revert "Bug 1701974 - Use x-kde-passwordManagerHint when copying private data to the clipboard. r=stransky" for causing failures at SelectionActionDelegateTest.
Flags: needinfo?(tschuster) → needinfo?(abutkovits)

This code change is Linux/GTK only, so there really shouldn't be a way for it to cause Android tests to fail.

Pushed by abutkovits@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/35b8cf3f5784 https://hg.mozilla.org/integration/autoland/rev/fb0fb62e1664 Use x-kde-passwordManagerHint when copying private data to the clipboard. r=stransky

Relanded the push and backed out the real culprit.
Sorry for the trouble.

Flags: needinfo?(abutkovits)
Status: ASSIGNED → RESOLVED
Closed: 7 hours ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: