Page MenuHome GnuPG
Feed Advanced Search

Dec 2 2016

werner added a comment to T2857: gpg-agent crashes regularly, out of core in secure memory allocations.

Another user reported the same problem on IRC. It seems it is Arch Linux
specific but we don't known for sure. The latest test with re-building
Libgcrypt w/o any special options didn't changed anything.

I need top be able to replicate the problem before I can come up with a solution.

Dec 2 2016, 9:15 AM · gnupg (gpg22), Bug Report, gnupg, gpgagent

Nov 30 2016

Pazuzu added a comment to T2857: gpg-agent crashes regularly, out of core in secure memory allocations.

Thanks for your fast reply.
Sadly I have not much time these days... but I have done what you suggested.
Honestly the log files dont tell me much. One thing I recognised is sometimes the logfiles end with "Fatal: libgcrypt
problem: out of core in secure memory" and sometimes they dont (I have not copied every log file here, this might
be to much).

This is what I got with debug memstat and the recent version of gnupg in Arch.

2016-11-30 21:18:35 gpg-agent[5516] listening on socket '/run/user/1000/gnupg/S.gpg-agent'
2016-11-30 21:18:35 gpg-agent[5517] gpg-agent (GnuPG) 2.1.15 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe1d0e5700 for fd 5 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe1c8e4700 for fd 6 started
2016-11-30 21:18:45 gpg-agent[5517] starting a new PIN Entry
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe17fff700 for fd 8 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe177fe700 for fd 9 started
2016-11-30 21:18:51 gpg-agent[5517] handler 0x7efe1d0e5700 for fd 5 terminated
2016-11-30 21:18:52 gpg-agent[5517] Fatal: out of core in secure memory while allocating 512 bytes

2016-11-30 21:18:52 gpg-agent[5517] Fatal: libgcrypt problem: out of core in secure memory
2016-11-30 21:18:35 gpg-agent[5516] listening on socket '/run/user/1000/gnupg/S.gpg-agent'
2016-11-30 21:18:35 gpg-agent[5517] gpg-agent (GnuPG) 2.1.15 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe1d0e5700 for fd 5 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe1c8e4700 for fd 6 started
2016-11-30 21:18:45 gpg-agent[5517] starting a new PIN Entry
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe17fff700 for fd 8 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe177fe700 for fd 9 started
2016-11-30 21:18:51 gpg-agent[5517] handler 0x7efe1d0e5700 for fd 5 terminated
2016-11-30 21:18:52 gpg-agent[5517] Fatal: out of core in secure memory while allocating 512 bytes

2016-11-30 21:18:52 gpg-agent[5517] Fatal: libgcrypt problem: out of core in secure memory
v2016-11-30 21:18:35 gpg-agent[5516] listening on socket '/run/user/1000/gnupg/S.gpg-agent'
2016-11-30 21:18:35 gpg-agent[5517] gpg-agent (GnuPG) 2.1.15 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe1d0e5700 for fd 5 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe1c8e4700 for fd 6 started
2016-11-30 21:18:45 gpg-agent[5517] starting a new PIN Entry
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe17fff700 for fd 8 started
2016-11-30 21:18:45 gpg-agent[5517] handler 0x7efe177fe700 for fd 9 started
2016-11-30 21:18:51 gpg-agent[5517] handler 0x7efe1d0e5700 for fd 5 terminated
2016-11-30 21:18:52 gpg-agent[5517] Fatal: out of core in secure memory while allocating 512 bytes

2016-11-30 21:18:52 gpg-agent[5517] Fatal: libgcrypt problem: out of core in secure memory

This is what I got with debuging memstat and downgraded gnupg to gnupg-2.1.15-2-x86_64.pkg.tar.xz

2016-11-30 21:28:30 gpg-agent[5953] listening on socket '/run/user/1000/gnupg/S.gpg-agent'
2016-11-30 21:28:30 gpg-agent[5954] gpg-agent (GnuPG) 2.1.15 started
2016-11-30 21:28:37 gpg-agent[5954] handler 0x7fd6fedca700 for fd 5 started
2016-11-30 21:28:37 gpg-agent[5954] starting a new PIN Entry
2016-11-30 21:28:42 gpg-agent[5954] handler 0x7fd6fedca700 for fd 5 terminated
2016-11-30 21:28:47 gpg-agent[5954] handler 0x7fd6fedca700 for fd 5 started
2016-11-30 21:28:47 gpg-agent[5954] handler 0x7fd6fe5c9700 for fd 7 started
2016-11-30 21:28:47 gpg-agent[5954] handler 0x7fd6fddc8700 for fd 8 started
2016-11-30 21:28:47 gpg-agent[5954] handler 0x7fd6fd5c7700 for fd 9 started
2016-11-30 21:28:47 gpg-agent[5954] handler 0x7fd6fedca700 for fd 5 terminated
2016-11-30 21:28:47 gpg-agent[5954] handler 0x7fd6fddc8700 for fd 8 terminated
2016-11-30 21:28:47 gpg-agent[5954] handler 0x7fd6fe5c9700 for fd 7 terminated
2016-11-30 21:28:47 gpg-agent[5954] handler 0x7fd6fd5c7700 for fd 9 terminated
2016-11-30 21:29:32 gpg-agent[5954] handler 0x7fd6fe5c9700 for fd 7 started
2016-11-30 21:29:32 gpg-agent[5954] handler 0x7fd6fe5c9700 for fd 7 terminated
2016-11-30 21:30:10 gpg-agent[5954] handler 0x7fd6fe5c9700 for fd 5 started
2016-11-30 21:30:10 gpg-agent[5954] handler 0x7fd6fd5c7700 for fd 7 started
2016-11-30 21:30:10 gpg-agent[5954] handler 0x7fd6fddc8700 for fd 8 started
2016-11-30 21:30:10 gpg-agent[5954] handler 0x7fd6fedca700 for fd 9 started
2016-11-30 21:30:10 gpg-agent[5954] Fatal: out of core in secure memory while allocating 512 bytes

2016-11-30 21:30:10 gpg-agent[5954] Fatal: libgcrypt problem: out of core in secure memory

And this is what I got from gdb (I am quite unfamiliar with gdb, so maybe i done something wrong)

Reading symbols from gpg-agent...(no debugging symbols found)...done.
Attaching to program: /usr/bin/gpg-agent, process 3492
Reading symbols from /usr/lib/libgcrypt.so.20...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libgpg-error.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libassuan.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libnpth.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Reading symbols from /usr/lib/libc.so.6...(no debugging symbols found)...done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
0x00007f05452cd18c in pselect () from /usr/lib/libc.so.6
(gdb) break log_fatal
Function "log_fatal" not defined.
Make breakpoint pending on future shared library load? (y or [n])
(gdb) c
Continuing.
[New Thread 0x7f053ffff700 (LWP 4687)]
[New Thread 0x7f05449ea700 (LWP 4698)]
[New Thread 0x7f053f7fe700 (LWP 4699)]
[New Thread 0x7f05451eb700 (LWP 4700)]
[Thread 0x7f053ffff700 (LWP 4687) exited]
[Thread 0x7f053f7fe700 (LWP 4699) exited]
[Thread 0x7f05451eb700 (LWP 4700) exited]
[Thread 0x7f05449ea700 (LWP 4698) exited]
[New Thread 0x7f05449ea700 (LWP 4733)]
[New Thread 0x7f05451eb700 (LWP 4745)]
[New Thread 0x7f053f7fe700 (LWP 4746)]
[New Thread 0x7f053ffff700 (LWP 4747)]
[Thread 0x7f053f7fe700 (LWP 4746) exited]
[Thread 0x7f05449ea700 (LWP 4733) exited]
[Thread 0x7f05451eb700 (LWP 4745) exited]
[Thread 0x7f053ffff700 (LWP 4747) exited]
[New Thread 0x7f053ffff700 (LWP 4775)]
[New Thread 0x7f05451eb700 (LWP 4776)]
[Thread 0x7f053ffff700 (LWP 4775) exited]

Thread 11 "gpg-agent" received signal SIGPIPE, Broken pipe.
[Switching to Thread 0x7f05451eb700 (LWP 4776)]

0x00007f054559a16d in write () from /usr/lib/libpthread.so.0

Nov 30 2016, 9:39 PM · gnupg (gpg22), Bug Report, gnupg, gpgagent
Pazuzu added a comment to T2857: gpg-agent crashes regularly, out of core in secure memory allocations.

Nov 30 2016, 9:39 PM · gnupg (gpg22), Bug Report, gnupg, gpgagent

Nov 29 2016

werner claimed T2857: gpg-agent crashes regularly, out of core in secure memory allocations.
Nov 29 2016, 2:26 PM · gnupg (gpg22), Bug Report, gnupg, gpgagent
werner added a comment to T2857: gpg-agent crashes regularly, out of core in secure memory allocations.

gpg-agent sets 32k aside for so called secure memory. It seems Libgcrypt runs
out of memory during computations with private key parameters.

Please put "debug memstat" into gpg-agent.conf which should print two lines of
info at process termination. If possible do the same with the old version and
compare.

Another thing you can do is to start gpg-agent ("gpgconf --launch gpg-agent"),
then look for its PID and attach gdb:

  $ gpg gpg-agent PID
  gdb> break log_fatal
  gdb> c

after you hit the breakpoint enter "bt".

Nov 29 2016, 2:26 PM · gnupg (gpg22), Bug Report, gnupg, gpgagent
justus renamed T2857: gpg-agent crashes regularly, out of core in secure memory allocations from gpg-agent crashes regularly to gpg-agent crashes regularly, out of core in secure memory allocations.
Nov 29 2016, 1:35 PM · gnupg (gpg22), Bug Report, gnupg, gpgagent
Pazuzu set Version to 2.1.16 on T2857: gpg-agent crashes regularly, out of core in secure memory allocations.
Nov 29 2016, 12:04 PM · gnupg (gpg22), Bug Report, gnupg, gpgagent
Pazuzu added projects to T2857: gpg-agent crashes regularly, out of core in secure memory allocations: gpgagent, gnupg, Bug Report.
Nov 29 2016, 12:04 PM · gnupg (gpg22), Bug Report, gnupg, gpgagent

Oct 13 2016

justus added a comment to T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol.

John is using 2.1.14, but this bug was fixed in 2.1.15.

Oct 13 2016, 1:26 PM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)
justus closed T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol as Resolved.
Oct 13 2016, 1:26 PM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)

Oct 12 2016

dkg reopened T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol as "Open".
Oct 12 2016, 11:51 PM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)
dkg added a comment to T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol.

This is apparently just re-reported on gnupg-users:

https://lists.gnupg.org/pipermail/gnupg-users/2016-October/056892.html

So i don't think it's fixed.

And fwiw, it seems like a clear bug to me if i use "ssh-add" and then it is not
added to the agent.

From the ssh-add's client's perspective, some keys are magically never added,
but others are. This kind of mystery behavior is confusing and frustrating. If
gpg-agent is going to handle the ssh-agent protocol, it should aim toward behave
as the user of the ssh-agent protocol expects, regardless of whether the user
knows that they're using gpg-agent or some other implementation.

Oct 12 2016, 11:51 PM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)

Jul 25 2016

justus added a comment to T2355: --import of a keypair together with --batch results in no pinentry and i/o errors.

Ah, I misunderstood your problem. In the future, please paste all program interactions in one chunk
in the right order. We did merge some changes related to exporting of secret keys, so it may very
well be solved by that.

Thanks for caring :)

Jul 25 2016, 11:02 AM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry
justus closed T2355: --import of a keypair together with --batch results in no pinentry and i/o errors as Resolved.
Jul 25 2016, 11:02 AM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry

Jul 22 2016

dranft added a comment to T2355: --import of a keypair together with --batch results in no pinentry and i/o errors.

I think the problem is that your key export fails, because you pointed
--homedir at the (presumably) empty directory "%tmp%\_tempKeyring".

The export did not use any filter and tried to export a key as can be seen in
Msg8313 "error receiving key from agent"
The import itself also stated no errors as it can be seen in T2355 (dranft on May 12 2016, 03:00 PM / Roundup), but this
imported secret key cannot be used (or exported) anymore.
Also important: This is no longer reproducible in 2.1.14 (which might be enough
to set the bug to fixed)

Jul 22 2016, 3:11 PM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry
justus claimed T2355: --import of a keypair together with --batch results in no pinentry and i/o errors.
Jul 22 2016, 2:48 PM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry
justus added a comment to T2355: --import of a keypair together with --batch results in no pinentry and i/o errors.

I don't believe this demonstrates a bug.

I think the problem is that your key export fails, because you pointed --homedir at the (presumably)
empty directory "%tmp%\_tempKeyring". This leads to the not very helpful error message about the
eof. If the export were successful, gpg would have written the key to stdout.

For reference, here is what I tried. First GNUPGHOME points to a home with the key I want to export:

    $ echo $GNUPGHOME
    /tmp/tmp.T7I4M9RIc3
    $ g10/gpg --list-keys alpha
    gpg: please do a --check-trustdb
    pub   dsa1024 1999-03-08 [SCA]
          A0FF4590BB6122EDEF6E3C542D727CC768697734
    uid           [ unknown] Alfa Test (demo key) <alfa@example.net>
    uid           [ unknown] Alpha Test (demo key) <alpha@example.net>
    uid           [ unknown] Alice (demo key)
    sub   elg1024 1999-03-08 [E]

You need some kind of pinentry program, because you may be asked for the current passphrase or an
export passphrase:

    $ cat $GNUPGHOME/gpg-agent.conf
    pinentry-program /usr/bin/pinentry-x11

Now export the key:

    $ g10/gpg --export-secret-keys alpha >/tmp/alpha.gpg

Now I create an empty home, and import the key in batch mode:

    $ export GNUPGHOME=$(mktemp -d)
    $ g10/gpg --batch --import /tmp/alpha.gpg
    gpg: keybox '/tmp/tmp.bL2caQmZri/pubring.kbx' created
    gpg: /tmp/tmp.bL2caQmZri/trustdb.gpg: trustdb created
    gpg: key 2D727CC768697734: public key "Alfa Test (demo key) <alfa@example.net>" imported
    gpg: key 2D727CC768697734: secret key imported
    gpg: Total number processed: 3
    gpg:               imported: 1
    gpg:       secret keys read: 3
    gpg:   secret keys imported: 2

Could you please check if that works for you?

Jul 22 2016, 2:48 PM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry

Jul 19 2016

justus added a comment to T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol.

I do consider it a bug, at least because we did not signal an error to ssh-add.
Fortunately, this was easy to fix.

Fixed in 270f7f7b.

Jul 19 2016, 4:54 PM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)
justus closed T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol as Resolved.
Jul 19 2016, 4:54 PM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)
justus added a project to T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew): gpgrt.
Jul 19 2016, 12:01 PM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report
justus added a comment to T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew).

Yes, that is very likely the same bug. Feel free to reopen this report if yuo
can still reproduce it, in which case a backtrace would be very handy.

Fixed in 28fd0ab.

Jul 19 2016, 12:01 PM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report
justus removed a project from T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew): gnupg.
Jul 19 2016, 12:01 PM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report
justus closed T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew) as Resolved.
Jul 19 2016, 12:01 PM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report

Jul 18 2016

justus added a comment to T2015: GET_PASSPHRASE with --no-ask always return error in gnupg 2.1.5.

Fixed in f4742493.

Jul 18 2016, 12:59 PM · gpgagent, Bug Report, gnupg
justus closed T2015: GET_PASSPHRASE with --no-ask always return error in gnupg 2.1.5 as Resolved.
Jul 18 2016, 12:59 PM · gpgagent, Bug Report, gnupg

Jun 9 2016

gfontenot added a comment to T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew).

Sorry for going AWOL on this, Werner. Do you still need a backtrace from me, or is the
one from 2371 enough?

Jun 9 2016, 4:58 PM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report

May 30 2016

werner added a comment to T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew).

See bug 2371, which has a backtrace attached.

May 30 2016, 8:08 AM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report
werner added a project to T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew): Duplicate.
May 30 2016, 8:08 AM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report
werner added a comment to T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew).

Duplicate of T2371

May 30 2016, 8:08 AM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report

May 19 2016

werner added projects to T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew): gnupg (gpg21), gpgagent, gnupg.
May 19 2016, 10:07 AM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report
werner added a comment to T2358: gnupg 2.1, gpg-agent crashing on 'assertion failed' (OS X, Homebrew).

Thanks. I need a stack backtrace to find the location of the cause.
Please start gpg-agent using:

  gpg-connect-agent /bye

The figure out the PID of the gpg-agent process and run

  gdb /usr/local/bin/gpg-agent PID

At the gdb prompt enter

  handle SIGPIPE nostop noprint pass
  c

The "c" continues operation of gpg-agent. In another terminal run

  gpg2 --sign

as done in your example. GDB in the first terminal will eventually
stop due to the assert. Enter at the gdb prompt:

  bt

and post the output. I would also like to know which version of
libgpg-error you are using:

  gpg-error --version

should show this (or use gpg-error-config --version).

May 19 2016, 10:07 AM · gpgrt, Duplicate, gpgagent, gnupg (gpg21), Bug Report

May 12 2016

dranft renamed T2355: --import of a keypair together with --batch results in no pinentry and i/o errors from --import of a keypair together with --batch and --homedir results in no pinentry and i/o errors to --import of a keypair together with --batch results in no pinentry and i/o errors.
May 12 2016, 3:07 PM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry
dranft added a comment to T2355: --import of a keypair together with --batch results in no pinentry and i/o errors.

PS: forget the --homedir thing, it is even reprodicable in the default folder in
%appdata%.

May 12 2016, 3:07 PM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry
dranft added a comment to T2355: --import of a keypair together with --batch results in no pinentry and i/o errors.

Sorry, forgot my import cmdline:

C:\Program Files (x86)\GNU\GnuPG\2.1.12\bin>gpg --batch --homedir
%tmp%\_tempKeyring --import "P:\2EEC2B65A2B4B3EF.sec.asc"
gpg: Die "Keybox" `C:/Users/ranftd/AppData/Local/Temp/_tempKeyring/pubring.kbx'
wurde erstellt
gpg: C:/Users/ranftd/AppData/Local/Temp/_tempKeyring/trustdb.gpg: trust-db erzeugt
gpg: Schlüssel A2B4B3EF: Öffentlicher Schlüssel "Daniel Ranft (Giegerich &
Partner GmbH)" importiert
gpg: Schlüssel A2B4B3EF: "Daniel Ranft (Giegerich & Partner GmbH)" nicht geändert
gpg: Schlüssel A2B4B3EF: geheimer Schlüssel importiert
gpg: Anzahl insgesamt bearbeiteter Schlüssel: 4
gpg: importiert: 1
gpg: unverändert: 1
gpg: gelesene geheime Schlüssel: 3
gpg: unveränderte geh. Schl.: 2
gpg: keine ultimativ vertrauenswürdigen Schlüssel gefunden

May 12 2016, 3:00 PM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry
dranft set Version to 2.1.12 on T2355: --import of a keypair together with --batch results in no pinentry and i/o errors.
May 12 2016, 2:58 PM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry
dranft added projects to T2355: --import of a keypair together with --batch results in no pinentry and i/o errors: pinentry, Windows 32, gnupg, Windows, gnupg (gpg21), gpgagent, Bug Report.
May 12 2016, 2:58 PM · Bug Report, gpgagent, gnupg (gpg21), Windows, gnupg, Windows 32, pinentry

Apr 19 2016

werner closed T2310: Set 'confirm' flag with smartcard as Resolved.
Apr 19 2016, 2:22 PM · gnupg, gpgagent, Feature Request
gregoire renamed T2310: Set 'confirm' flag with smartcard from Set 'config' flag with smartcard to Set 'confirm' flag with smartcard.
Apr 19 2016, 11:39 AM · gnupg, gpgagent, Feature Request
gregoire added a comment to T2310: Set 'confirm' flag with smartcard.

I think I was confused by the fact that I didn't use ssh-add to add the key and
I didn't realize that I could add it manually to sshcontrol. I did that and it
now works as expected. Sorry about the noise.

Although maybe it would be nice to be able to make 'confirm' the default for
keys which are not listed in sshcontrol. But that's a very minor thing.

Apr 19 2016, 11:39 AM · gnupg, gpgagent, Feature Request

Apr 15 2016

werner added a project to T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol: gnupg.
Apr 15 2016, 8:31 AM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)

Apr 14 2016

werner added a project to T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol: Not A Bug.
Apr 14 2016, 3:48 PM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)
werner added a comment to T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol.

I would not consider this a bug. sshcontrol is used to enable certain keys for
use with ssh. Updating keys is useless if they are already available.

If you remove the keys from sshcontrol you disable them. I would suggest to put
a '!' in front of the keygrip instead of deleting the line in sshcontrol. This
allows to re-enable a key w/o problems.

Apr 14 2016, 3:48 PM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)

Apr 13 2016

DamienCassou added a comment to T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol.

The solution is to remove the key in private-keys-v1.d before running ssh-add.

http://superuser.com/a/1064269/216912

Apr 13 2016, 10:49 AM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)
DamienCassou set Version to 2.1.11 on T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol.
Apr 13 2016, 10:48 AM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)
DamienCassou added projects to T2316: ssh-add ignores keys already in private-keys-v1.d but not in sshcontrol: gnupg (gpg21), gpgagent, ssh, Bug Report.
Apr 13 2016, 10:48 AM · gnupg, Not A Bug, Bug Report, ssh, gpgagent, gnupg (gpg21)

Apr 8 2016

werner added projects to T2310: Set 'confirm' flag with smartcard: gpgagent, gnupg.
Apr 8 2016, 8:34 AM · gnupg, gpgagent, Feature Request

Apr 5 2016

justus closed T1211: gpg-agent should disable ptrace as Resolved.
Apr 5 2016, 3:34 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
justus added a comment to T1509: gnupg2 (gpg-agent): Disable producing of core dumps for gpg-agent via prctl(PR_SET_DUMPABLE, 0) as ssh-agent does.

gpg-agent does disable core dumps both in the stable and modern version.
Furthermore I have to agree with Werner here, if there is a process that can
ptrace your gpg-agent, then you have already lost anyway.

Apr 5 2016, 2:59 PM · gnupg, Debian, gnupg (gpg20), Feature Request, gpgagent
justus closed T1509: gnupg2 (gpg-agent): Disable producing of core dumps for gpg-agent via prctl(PR_SET_DUMPABLE, 0) as ssh-agent does as Resolved.
Apr 5 2016, 2:59 PM · gnupg, Debian, gnupg (gpg20), Feature Request, gpgagent

Mar 1 2016

aheinecke added projects to T2267: Fix "Invalid Parameter passed to C runtime function" warnings on Windows: Feature Request, gpgagent, gnupg.
Mar 1 2016, 9:49 AM · Windows 32, Windows, gnupg, gpgagent, Feature Request

Jan 15 2016

werner added a project to T2015: GET_PASSPHRASE with --no-ask always return error in gnupg 2.1.5: gpgagent.
Jan 15 2016, 4:40 PM · gpgagent, Bug Report, gnupg

Jan 5 2016

aheinecke removed a project from T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected: Restricted Project.
Jan 5 2016, 10:55 AM · Bug Report, gnupg, gpgagent, gnupg (gpg21)
aheinecke added a comment to T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected.

I've tested to generate an rsa2048 key with backup on a v2.0 card and it works
now. I have not tested restoring from backup etc. But as this report was about
the failed generation, this issue is resolved imo.

Thanks!

Jan 5 2016, 10:55 AM · Bug Report, gnupg, gpgagent, gnupg (gpg21)
aheinecke closed T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected as Resolved.
Jan 5 2016, 10:55 AM · Bug Report, gnupg, gpgagent, gnupg (gpg21)

Dec 24 2015

gniibe added a comment to T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected.

I removed the not-working checkbkupkey subcommand in
44aee35e69540510617aea4b886ef845590960fe

Dec 24 2015, 3:58 AM · Bug Report, gnupg, gpgagent, gnupg (gpg21)
gniibe added a comment to T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected.

Also fixed the bkuptocard subcommand in: 40959add1ba0efc1f4aa87fa075fa42423eff73c

Dec 24 2015, 3:55 AM · Bug Report, gnupg, gpgagent, gnupg (gpg21)

Dec 18 2015

gniibe added a comment to T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected.

Fixed in
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=b30c15bf7c5336c4abb1f9dcd974cd77ba6c61a7

Dec 18 2015, 2:52 AM · Bug Report, gnupg, gpgagent, gnupg (gpg21)
gniibe added a project to T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected: Restricted Project.
Dec 18 2015, 2:52 AM · Bug Report, gnupg, gpgagent, gnupg (gpg21)

Dec 17 2015

gniibe added a comment to T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected.

I'm considering fixing this.

Dec 17 2015, 1:13 PM · Bug Report, gnupg, gpgagent, gnupg (gpg21)
gniibe claimed T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected.
Dec 17 2015, 1:13 PM · Bug Report, gnupg, gpgagent, gnupg (gpg21)

Dec 7 2015

aheinecke added projects to T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected: gnupg (gpg21), gpgagent, gnupg, Bug Report.
Dec 7 2015, 6:02 PM · Bug Report, gnupg, gpgagent, gnupg (gpg21)
aheinecke updated subscribers of T2169: Smartcard card-edit generate fails when off-card backup of encryption key is selected.
Dec 7 2015, 6:02 PM · Bug Report, gnupg, gpgagent, gnupg (gpg21)

Nov 20 2015

werner added a comment to T2011: gnupg should notify cancellation of its operation to gpg-agent to kill pinentry.

Keep the bug open. We won't fix it for the next release.

Nov 20 2015, 2:06 PM · Bug Report, gpgagent
neal added a comment to T2011: gnupg should notify cancellation of its operation to gpg-agent to kill pinentry.

werner: What is your call to action? Should pinentry always be shutdown or is
the status quo acceptable? Thanks.

Nov 20 2015, 1:32 PM · Bug Report, gpgagent

Nov 5 2015

werner added a comment to T1109: Pinentry and cache update race.

I am pretty sure that there is a race. The two sessions are not mutally locked
and thus the second client may ask for the passprase again.

  Pinentry-1 returns to Client-1
  task switch
  Client-2 now checks the cache again, does not see an update, starts Pinentry-2
  task switch
  Client-1 updates the cache

How ever it will be a rare problem and it would at best be annoying.

Nov 5 2015, 4:24 PM · Info Needed, Bug Report, gnupg, gpgagent

Nov 4 2015

neal added a comment to T1109: Pinentry and cache update race.

I tried running:

  echo | gpg -s -a

in two terminal. In the first terminal, I got a pinentry prompt (I'm using
pinentry-tty) and in the second, gpg2 appeared to freeze. Once I entered my
passphrase correctly in the first terminal, the first gpg2 process split out the
signed message and less than a second later, the second did as well.

The code also suggests that this is fixed (agent/findkey.c)

      /* If the pinentry is currently in use, we wait up to 60 seconds
         for it to close and check the cache again.  This solves a common
         situation where several requests for unprotecting a key have
         been made but the user is still entering the passphrase for
         the first request.  Because all requests to agent_askpin are
         serialized they would then pop up one after the other to
         request the passphrase - despite that the user has already
         entered it and is then available in the cache.  This
         implementation is not race free but in the worst case the
         user has to enter the passphrase only once more. */

Interestingly, this comment is from 2006 (commit: df52700f), which predates this
bug report.

As such, I'm changing this bug's status to needs-eg. Perhaps Werner can shed
some more light on this issue.

Nov 4 2015, 12:17 PM · Info Needed, Bug Report, gnupg, gpgagent
neal added a project to T1109: Pinentry and cache update race: Info Needed.
Nov 4 2015, 12:17 PM · Info Needed, Bug Report, gnupg, gpgagent

Oct 12 2015

werner lowered the priority of T1254: pinentry: show only one password dialog - queue others from Normal to Low.
Oct 12 2015, 3:37 PM · gnupg, Bug Report, gpgagent

Oct 3 2015

werner added a comment to T2114: gpa --disable-x509.

Please describe which certifciates you see, which version of GnuPG you are
using, and what error you get when trying to delete a cert.

Oct 3 2015, 10:11 AM · Bug Report, gpa, gpgagent

Sep 28 2015

RMSheritage set Version to GPA 0.9.5 on T2114: gpa --disable-x509.
Sep 28 2015, 4:35 PM · Bug Report, gpa, gpgagent
RMSheritage added projects to T2114: gpa --disable-x509: gpgagent, gpa, Bug Report.
Sep 28 2015, 4:35 PM · Bug Report, gpa, gpgagent

Sep 24 2015

werner added a comment to T2111: ssh-agent support broken.

Are you using an Ed25519 key? There was a regression in 2.1.8 which has
meanwhile be fixed in the repo. See also T2096.

Sep 24 2015, 10:42 AM · Debian, Bug Report, gnupg, ssh, Duplicate, gnupg (gpg21)

Sep 23 2015

iprok added projects to T2111: ssh-agent support broken: gnupg (gpg21), gpgagent, gnupg, Bug Report, Debian.
Sep 23 2015, 6:51 PM · Debian, Bug Report, gnupg, ssh, Duplicate, gnupg (gpg21)

Sep 21 2015

werner removed a project from T1951: gpg-agent needs an API to verify a passphrase: Restricted Project.
Sep 21 2015, 8:51 AM · gnupg, Feature Request, gpgagent
werner closed T1951: gpg-agent needs an API to verify a passphrase as Resolved.
Sep 21 2015, 8:51 AM · gnupg, Feature Request, gpgagent

Sep 9 2015

werner removed Due Date on T1109: Pinentry and cache update race.
Sep 9 2015, 4:10 PM · Info Needed, Bug Report, gnupg, gpgagent
werner lowered the priority of T1109: Pinentry and cache update race from Normal to Low.
Sep 9 2015, 4:09 PM · Info Needed, Bug Report, gnupg, gpgagent

Sep 8 2015

werner closed T1969: gpg-agent stops working after OSX Upgrade to Yosemite as Resolved.
Sep 8 2015, 3:00 PM · patch, Bug Report, gpgagent, gnupg, gnupg (gpg20), Won't Fix, MacOS

Aug 21 2015

aheinecke added a project to T2066: Wrong BLOB Type/keytable.c:150: gnupg.
Aug 21 2015, 11:41 AM · Not A Bug, gnupg, Bug Report, gpg4win

Aug 13 2015

werner removed Due Date on T2066: Wrong BLOB Type/keytable.c:150.
Aug 13 2015, 6:37 PM · Not A Bug, gnupg, Bug Report, gpg4win
werner added a comment to T1211: gpg-agent should disable ptrace.

c) Run gpg-agent under gdb
d) Run a modified gpg-agent (rm ~/S.gpg-agent; my-gpg-agent --daemon)
e) Hook into the tty and use pinentry-curses
f) scp ~/.gnupg/private-keys-v1.d/* mybox: and sniff the passphrase.

Aug 13 2015, 6:36 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent

Aug 12 2015

dkg reopened T1211: gpg-agent should disable ptrace as "Open".
Aug 12 2015, 3:53 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
dkg added a comment to T1211: gpg-agent should disable ptrace.

so far, the proposed mechanisms for getting at gpg-agent's memory from a peer
process running as the same user are:

a) ptrace (e.g. via /usr/bin/gcore or /usr/bin/strace)
b) /proc/$PID/mem, which is owned by the user and mode 0600

DarkStarSword's patch effectively closes (a) (by rejecting ptrace connections)
and appears on my GNU/Linux system to close (b) as well: /proc/$PID/mem is
root-owned when the patch is applied instead of being user-owned.

Are there other channels for per-process memory access that we should be
thinking about?

I agree with Werner and Neal that the UNIX model is probably insufficient to
close all the holes easily, but i also don't think that's a good reason to avoid
closing those holes we can close.

If there are other ways that another process by the same user can get at the
RAM, please point them out and i'll look into ways to address them too.

In the meantime, i'll also look into ways to facilitate running the process as a
separate user account entirely.

Aug 12 2015, 3:53 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
werner closed T1211: gpg-agent should disable ptrace as Resolved.
Aug 12 2015, 10:09 AM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
werner added a project to T1211: gpg-agent should disable ptrace: Won't Fix.
Aug 12 2015, 10:09 AM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
werner added a comment to T1211: gpg-agent should disable ptrace.

I am closing this.

BTW: I can't share DarkStarSword's fear about prioritizing ease of debugging
over security - I would never do that for a real security problem; Neal and me
both explained why this proposed fix does can't help against an attack.

Aug 12 2015, 10:09 AM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
dkg added a comment to T1211: gpg-agent should disable ptrace.

D128: 666_0003-Avoid-simple-memory-dumps-via-ptrace.patch

Aug 12 2015, 2:55 AM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
dkg added a comment to T1211: gpg-agent should disable ptrace.

I'm going to introduce the prctl(SET_DUMPABLE, 0) change to main in
agent/gpg-agent.c in the debian 2.1.x series as of 2.1.7-1, using the patch i'm
attaching here.

I make no representations that this solves all possible memory leakages, but it
does address one specific and relatively straightforward attack.

As to Werner's legitimate concerns about making debugging harder, there remain
at least two options: ptrace as the superuser, and launching gpg-agent itself
under gdb directly.

If this experiment proves disastrous somehow (i'm not seeing how), we can always
revert the patch.

Aug 12 2015, 2:55 AM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent

Aug 11 2015

noname added projects to T2066: Wrong BLOB Type/keytable.c:150: gpg4win, gpgagent, Bug Report.
Aug 11 2015, 3:08 PM · Not A Bug, gnupg, Bug Report, gpg4win
noname set Due Date to Aug 11 2015, 2:00 AM on T2066: Wrong BLOB Type/keytable.c:150.
Aug 11 2015, 3:08 PM · Not A Bug, gnupg, Bug Report, gpg4win

Aug 9 2015

DarkStarSword added a comment to T1211: gpg-agent should disable ptrace.

Glad I was able to help get one bug fixed at least :)

The in-memory encryption will definitely help in this scenario (that is, a
casual attack by e.g. a colleague or another student having a laugh as their
friend left their screen unlocked... real attack - I should know, I've done it,
and had it done to me, as had several of my friends back in uni (to be fair -
that was on Firefox password manager, but it could just as easily have been
gpg-agent)... This is not about stopping a motivated attacker with physical
access to the system as they could always subvert the system in other ways e.g.
adding a shell alias to run a trojaned gpg-agent instead of the real thing,
install a key logger, etc).

I'm still not super happy that a casual attacker could walk away with a core
file containing the encrypted passphrase and the key to decrypt it. What started
as a casual attack for a laugh could later transform into a more serious attack
given that they can hold onto this information indefinitely. I'm not a motivated
attacker, but that would tempt the hell out of me if I was even slightly so
inclined. I should know, because I've been in a similar situation in the past
where I obtained an unshadowed passwd file (through a purely casual attack when
I was looking up a friend's uid and discovered the passwd file was not
shadowed... so of course I made a copy). I could have left it alone, but it
tempted the hell out of me and I ended up running john over it for two straight
weeks (never did much with the result, but that's not the point)!

I would hope that the developers of any security product learns to think like an
attacker.

I must say I am deeply troubled by the priority seeming to be on the ease of
debugging a security product which has the sole purpose of keeping a passphrase
safe. As the saying goes security is always a trade-off, but given that
gpg-agent is a security product and not a word processor, this particular trade
off does not sit right with me. I would expect the development team to have root
access on their own systems, which avoids the issue as the root user can always
attach a debugger with or without this change - is there truly a reason that
they need to attach to a running gpg-agent on a system they don't have root on?
And what about the thousands of gpg-agents running on other systems in the wild
that should never need to attach a debugger (and if they do... sudo)?

The information about FIPS mode and SELinux is good to know, at least for people
running distributions that support and enable them by default. But from what I
can gather FIPS mode is a RHEL only feature (I may be wrong - I'm not all that
familiar with it), and SELinux is still either not enabled, or in permissive
mode in many distributions by default (including Debian and Ubuntu).

As I mentioned in the original report, an alternative way to protect the memory
of gpg-agent is to install it with the setgid bit set (ssh-agent does both the
prctl() and setgid for example - now there's some developers I applaud). Unlike
SELinux and FIPS mode this works in every distribution and has been supported
for donkeys years.

Aug 9 2015, 3:17 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent

Aug 7 2015

werner added a comment to T1211: gpg-agent should disable ptrace.

This identified another bug: To be prepared for FIPS evaluation,
gpg-agent does not store the cached passphrases in the clear but
encrypts them in memory. Right this is security by obscurity but if
we ever have a way to store that key in a secured RAM (e.g. TPM, ARM
TrustZone) we can indeed limit the time a passphrase is available in
the clear to the period it is really needed. This all seems to work
but your tests shows that libassuan does not clear its internal line
buffers so that you can actually find the passphrase in the core
file. I just pushed a fix for this.

IIRC, FIPS mode in Linux inhibits all access to process memory system
wide. Changing this just a for a single user process does not make
much sense.

Further, being able to attach to a running processing is one of the
best debug methods we have. Giving up on this without for a perceived
extra protection is not going to work. There are too many ways to get
the passphrase using other ways. Linux can't protect a user to get
data belonging to him. Iff gpg-agent were a system daemon things
would be different and extra protection would make sense as a
fallback.

Aug 7 2015, 12:47 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
DarkStarSword added a comment to T1211: gpg-agent should disable ptrace.

Without this I can do gcore pidof gpg-agent and QUITE CLEARLY see my
passphrase in the produced dump:

ian@draal~ [i]> gcore (pidof gpg-agent)
0x00007fb8f8849293 in __select_nocancel () at

../sysdeps/unix/syscall-template.S:81

81      ../sysdeps/unix/syscall-template.S: No such file or directory.
warning: target file /proc/1560/cmdline contained unexpected null characters
warning: Memory read failed for corefile section, 8192 bytes at 0x7ffce0a12000.
Saved corefile core.1560
0x00007f2dd583c293 in __select_nocancel () at

../sysdeps/unix/syscall-template.S:81

81      ../sysdeps/unix/syscall-template.S: No such file or directory.
warning: target file /proc/1540/cmdline contained unexpected null characters
warning: Memory read failed for corefile section, 8192 bytes at 0x7ffccfbe3000.
Saved corefile core.1540
ian@draal~ [i]> strings core.1560 | grep pass
passwd
This is my ultra secure passphrase - I definitely expect any program that

manages this to take reasonable steps to keep it safe even if I accidentally
leave my screen unlocked one day!

Invalid passphrase; please try again
You need a passphrase to unlock the secret key for user:%0A"test123

<test@test.com>"%0A2048-bit RSA key, ID DE3A7EAB, created 2015-08-06 (main key
ID F459B571)%0A

    SETERROR Invalid passphrase; please try again
    his is my ultra secure passphrase - IQ
    ian@draal~ [i]>

With this one line change I cannot do the above - that's the definition of
reducing the attack surface last time I checked.

You absolutely can still use gdb to debug it - you just have to start it under
gdb as opposed to attaching to an existing process, or attach the debugger as
root. You could also just disable the syscall in a debug build.

Aug 7 2015, 12:02 AM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent

Aug 6 2015

werner added a comment to T1211: gpg-agent should disable ptrace.

It does not reduce the attack surface. And yes, it complicates things
because you can't anymore debug the process without changing the code
or using other tricks (aka attack). I have not tested the SELinux
feature for quite some time but gnupg supports SELinux if configured
with --enable-selinux-support. If you want some protection better use
that.

dkg: We disable core dumps for the simple reason that we do not want
to see core files on disk. Disk sectors have a longer lifetime than a
process and a user session - thus avoiding core files is a real world
threat mitigation.

Aug 6 2015, 9:08 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent

Aug 5 2015

DarkStarSword added a comment to T1211: gpg-agent should disable ptrace.

So a single syscall to demonstrably reduce the attack surface really complicates
things does it?

News to me.

Aug 5 2015, 4:31 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
dkg added a comment to T1211: gpg-agent should disable ptrace.

I agree with you that the standard UNIX model is generally insufficient here.

Perhaps the distros could weigh in with mechanisms to facilitate
secondary-account creation for agents and the like. I've opened
https://bugs.debian.org/794667 about this.

However, i don't think the weak UNIX permissions model is a reason to avoid a
small piece of code like that offered by DarkStarSword below. Closing off one
avenue of attack is still worthwhile, even if other avenues remain. As werner
said, gpg-agent won't create a coredump (even though other avenues of attack are
possible).

Is there something about the complexity of prctl(PR_SET_DUMPABLE, 0); that makes
it undesirable?

Aug 5 2015, 4:28 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
neal added a comment to T1211: gpg-agent should disable ptrace.

dkg: The problem is that the underlying architecture is broken. Unix's stock
permission model is about protecting users from other users, not protecting
processes from other processes. Thus, I don't think it makes any sense to
complicate the code by implementing these effectively useless protections.

FWIW, a widely used practical system that does a much better job at this is
Android. Android runs every program under its own uid. We could do the same
thing with gpg-agent. In fact, this is currently possible with a little help
from ssh. Unfortunately, this requires a fair amount of work by the user to set
up. In particular, the user needs to create a secondary account. It would be
nice if distributions provided a simply way for an unprivileged user to allocate
additional uids, but this is probably a lot of work.

Aug 5 2015, 3:31 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent

Aug 4 2015

werner renamed T1211: gpg-agent should disable ptrace from gpg-agent allows ptrace to gpg-agent should disable ptrace.
Aug 4 2015, 12:43 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
werner added a project to T1211: gpg-agent should disable ptrace: Feature Request.
Aug 4 2015, 12:42 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent
werner removed a project from T1211: gpg-agent should disable ptrace: Bug Report.
Aug 4 2015, 12:42 PM · Won't Fix, Feature Request, gnupg, Not A Bug, gpgagent