After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 548136 - Passwords containing "%" followed by any two characters are improperly handled
Passwords containing "%" followed by any two characters are improperly handled
Status: RESOLVED OBSOLETE
Product: seahorse
Classification: Applications
Component: general
2.22.x
Other All
: Normal normal
: 2.22.0
Assigned To: Seahorse Maintainer
Seahorse Maintainer
: 548496 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-08-17 15:19 UTC by Jeremy Bopp
Modified: 2012-02-02 14:05 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22



Description Jeremy Bopp 2008-08-17 15:19:38 UTC
Please describe the problem:
If the password contains "%" followed by any *two* characters, i.e. "%sf" or "%vd", you will not be able to use seahorse to decrypt a private PGP key that was originally encrypted with gpg.  This means that you cannot change the key's password using seahorse nor can you use seahorse-agent to fetch your private key for signing text, etc.  If the private key is created or otherwise encrypted with seahorse using one of these passwords, gpg will not be able to decrypt the private key.

Steps to reproduce:
1. Create a new public/private key pair using gpg as follows:
   GPG_AGENT_INFO="" gpg --gen-key
2. Accept defaults for key type and key size, enter some user name, etc.
3. For the password enter "%ss".
4. Start seahorse and attempt to change the password for the new key.


Actual results:
No matter what password you enter, you will always receive an invalid password response.

Expected results:
Entering "%ss" as the password should allow you to go about changing the password on the new key.

Does this happen every time?
Yes.

Other information:
It's possible to turn around the presented scenario and create a public/private keypair using seahorse and a password as specified.  gpg will be unable to decrypt the key using that password even though seahorse will be able to do so.   It's also possible to use seahorse to change the password on an existing key (as long as the password does not have the bad form) to a password which gpg will not be able to use to decrypt the key.

Basically, it looks like the password dialogs for seahorse are malfunctioning.
Comment 1 Adam Schreiber 2008-08-19 18:56:29 UTC
*** Bug 548496 has been marked as a duplicate of this bug. ***
Comment 2 Stef Walter 2008-08-31 18:32:37 UTC
Hmmm, this smacks of us using the string directly in a printf style format function. I'll look around. 
Comment 3 Adam Schreiber 2008-08-31 18:34:34 UTC
Probably a g_strdup_printf function then.
Comment 4 Stef Walter 2008-08-31 19:34:07 UTC
Odd, I can't duplicate this. Would you happen to know if it's seahorse-agent or seahorse itself doing the password prompting? Does this occur if you don't use the agent?
Comment 5 Jeremy Bopp 2008-08-31 20:45:32 UTC
I believe it to be seahorse-agent prompting for the password.  That's why the password set using gpg and pinentry (step 1 of the reproduction instructions) will generate a key which also cannot be decrypted when I try to use Thunderbird to sign a message, which is using gpg and the default gpg agent settings under Gnome.  As far as I can tell, the same password entry dialog is displayed for Thunderbird when signing a message as is displayed when using seahorse to try decrypting the key prior to changing the password, so if seahorse-agent displays one, it's probably displaying the other.

If there are some steps you would like me to follow in order to verify the state of things, please send them along.  Would killing seahorse-agent be sufficient to cause seahorse to fall back to another mechanism for password retrieval?
Comment 6 Stef Walter 2008-08-31 20:59:58 UTC
Yes, I believe that killing seahorse-agent would cause gpg and gpgme to use the internal seahorse callbacks to prompt for a password. The two share the same dialog, so the result may look similar. 
Comment 7 Jeremy Bopp 2008-08-31 21:23:23 UTC
After killing the seahorse-agent program, the fallback which is used is to call the pinentry program to retrieve the password.  This method works fine since that method is used by step 1 of the reproduction steps to initially set the password.

I ran another test this time using seahorse itself to create the key rather than gpg.  Instead of step 1 as specified for reproducing this defect, use seahorse to create the key.  Follow the remainder of the steps as specified.  This will yield a key which seahorse and gpg can decrypt when using the pinentry program (instead of seahorse-agent) to retrieve the password.  If seahorse-agent is used to retrieve the password, the key cannot be decrypted by either program.

All of this means that seahorse can do the right thing to set a password for a key it creates, but that seahorse-agent is corrupting the passwords it retrieves somewhere before the passwords are actually used.
Comment 8 Stef Walter 2008-09-01 01:53:02 UTC
Thanks for the research. I'll look into it further as soon as I get a chance.
Comment 9 Stef Walter 2008-09-11 01:40:19 UTC
Passwords with %s and %f get sent properly back to gpg. I cannot duplicate this with 2.23.92. When you get a chance can you see if this is still the case?
Comment 10 Jeremy Bopp 2008-09-11 02:50:28 UTC
I have only found this problem on seahorse 2.22.3 under Gentoo running on AMD64.  I don't have any newer version available to this system unless I grab the source and compile it directly outside the package manager.  That won't be a problem unless compiling and running that new version requires replacing other packages on my system.  Let me know what to expect, and I'll give this a try if possible.

One other person on the Gentoo forums has the same problem (http://forums.gentoo.org/viewtopic-t-702652-highlight-.html), and removing the %s from his password also corrected the issue.  Perhaps this is a Gentoo-specific defect.
Comment 11 Tobias Mueller 2009-04-05 22:31:58 UTC
I'm closing as we have no duplicates so far. Also I can't reproduce with r2968.
Jeremy, please reopen this issue, if you still have problems!
Comment 12 Dirk Salewski 2011-03-16 06:00:00 UTC
Hello Tobias, 

unfortunately we have a duplicate now. The above mentioned workaround "solved" the problem for me. Is there any information I can provide that might help you solve the issue? 

Dirk
Comment 13 Tobias Mueller 2011-03-16 08:47:24 UTC
Hey Dirk. Are you saying that you encounter this issue? If so, then we need to reopen this bug. And with which version are you experiencing this bug?
Comment 14 Pacho Ramos 2011-03-16 09:13:35 UTC
http://bugs.gentoo.org/show_bug.cgi?id=234986#c6

app-crypt/gnupg-2.0.17
app-crypt/gpgme-1.3.0
app-crypt/seahorse-2.32.0
Comment 15 Tobias Mueller 2011-03-16 09:34:33 UTC
Oups. Jesus, that's embarrassing. Reopening.
Stef, could you have another look into this? It's not about "Passwords with %s and %f get sent properly back to gpg." but about a percent and *two* characters. The downstream report has a good analysis.
Comment 16 Stef Walter 2011-03-16 13:32:56 UTC
I can't duplicate this with seahorse 2.91.91 (when run in both the following ways):

$ seahorse
$ GPG_AGENT_INFO="" seahorse

I'll try on 2.32.0
Comment 17 Stef Walter 2011-03-16 13:36:51 UTC
Tobias, did you manage to duplicate this problem?

Can't duplicate on seahorse 2.32.0 either. I generated a key generated in gpg (without using a GPG agent) with the password '%ss'. And I can change the password through seahorse.

Pacho, could you include a screenshot of the prompt that's failing? That may help us identify where this bug actually is.
Comment 18 Dirk Salewski 2011-03-19 06:27:22 UTC
Strange - I cannot reproduce the problem myself after 

a) disabling gpg-agent and
b) switching forth and back from/to a "%.."-Password. The switch to a non-"%.."-Password needed to be done from the command line, the switch back worked from within seahorse.

History is as follows: after installing gnome seahorse wouldn't accept my gpg keys for mail signing in gnome evolution. Googling around made me try "eval 'gpg-agent --daemon'" within my session. The password prompt changed at that time from the seahorse one to the pinentry-gtk one. After recompiling most of my software that suddenly stopped working. pinentry-gtk didn't come up anymore, seahorse complained about some smartcard-related problem (regardless gnupg being compiled with or without smartcard support). 

I'll watch this and report back if I manage to reproduce that again.
Comment 19 Stef Walter 2011-03-20 18:09:27 UTC
Alright. Thanks.
Comment 20 Fabio Durán Verdugo 2011-06-08 04:17:54 UTC
any news for this report?
Comment 21 Tobias Mueller 2012-02-02 14:05:19 UTC
I guess this issue is OBSOLETE by now. Please reopen if this is not the case.