Keepassxc: Keyboard clipboard is *not* cleared after timeout

Created on 7 Jan 2020  Â·  11Comments  Â·  Source: keepassxreboot/keepassxc

The clipboard is not cleared according to the relevant security setting.

Steps to Reproduce

  1. In KeePassXC go to Tools → Settings → Security
  2. Tick "Clear clipboard after" and set the timeout to "10 sec"
  3. Open a password database
  4. Highlight an entry with a password and press Ctrl-c
  5. Wait for more than 10 seconds
  6. Focus another window and paste using the keyboard (Ctrl-v or Ctrl-Shift-v, depending on the application)

Expected Behavior

Nothing should be pasted.

Current Behavior

The password is pasted!

Context

The mouse clipboard is cleared.

I'm running vanilla Ubuntu 19.10 (with GNOME) with the latest updates. I'm not running any custom clipboard managers as far as I know.

This did work on every other KeePassXC version + OS + WM combination I've ever tried before.

Debug Info

KeePassXC - Version 2.4.3
Revision: 5d6ef0c

Qt 5.12.4
Debugging mode is disabled.

Operating system: Ubuntu 19.10
CPU architecture: x86_64
Kernel: linux 5.3.0-24-generic

Enabled extensions:

  • Auto-Type
  • Browser Integration
  • SSH Agent
  • KeeShare (only unsigned sharing)
  • YubiKey

Cryptographic libraries:
libgcrypt 1.8.4

bug high priority Linux security

All 11 comments

Holy cow confirmed. This affects Linux only.

  • Ubuntu 19.04 - no clearing
  • Windows 10 - cleared
  • macOS 10.15 - cleared

I bet you are using a clipboard manager. In Klipper you have to turn off "Prevent empty clipboard".
I cannot reproduce this with that setting turned off.

@phoerious I'm not using Klipper, at least. And none of these show any results:

  1. apt list --installed | grep --ignore-case clipboard
  2. pgrep --ignore-case clipboard

apropos clipboard only shows xclipboard, which AFAIK is not a clipboard manager.

Do you know any other ways to check whether I am using a clipboard manager?

We discussed this on IRC, it may be that Gnome has some built-in clipboard management features or there is a weird Qt interaction preventing us from clearing the clipboard. On KDE I cannot reproduce this behaviour.

Can you test if

xclip -selection clipboard <(echo -n) && xsel -c

reliably clears both (!) the Ctrl+V and the middle-mouse-button clipboard buffers?

@phoerious Verified:

  1. Installed xclip and xsel
  2. Selected the command in your comment to populate the mouse clipboard
  3. Pressed Ctrl-c to populate the keyboard clipboard
  4. Opened a GNOME Terminal
  5. Pressed Ctrl-Shift-v to paste from the keyboard buffer
  6. Ran the command
  7. Pressed Ctrl-Shift-v (nothing was pasted)
  8. Middle clicked (nothing was pasted)

Hello, I am encoutering the same issue on Debian unstable but kernel 4.19.0-5-amd64. This issue has been present since I switched from KeepassX to KeepassXC about 1 or 2 months ago. I had not this issue from using KeePassx. Funny thing is, I tried , the keepassxc-cli clip and the timeout successfully cleared the clipboard. I am using gnome 1:3.30+2. I am using the packaged keepassxc version (2.4.3).

EDIT: I do not have a clipboard manager. A colleague also using gnome on debian unstable is having the same problem. Other colleagues on other window-manager on debian unstable do not encounter the same issue.

The CLI uses xclip for managing the clipboard.

Instead of clearing the clipboard, wouldn't it be more reliable to change it to some whitespace?

That may be the issue, Gtk could be ignoring a blank clipboard entry and retaining the existing clipboard.

To add some context: GS/Mutter 3.34 (the version shipped with Ubuntu 19.10) introduced a clipboard manager by default. Whenever the clipboard is cleared, the c-m takes over and provides a copy previously taken for further use. So what we see here is likely a conflict of features (as rightly pointed out before).

The solution taken here, explicitly setting a new empty content, therefore appears to be the safest solution, also taken other clipboard managers into account.

FTR, actually Carlos found a way to allow clearing the clipboard without the c-m taking over - backported to gnome 3.34 / 3.36 (https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1206?commit_id=5671f0a284a5875f7d964a4d368470c33581ba80)

Was this page helpful?
0 / 5 - 0 ratings