Mailing List Archive

Seeking Assurance on Security and Memory Leaks in SuSE GnuPG
On Aug 27 I submitted a query to this mailing list on the same Subject
as headed here, with further details on the software used.

Specifically, I timed the encryption (primarily the KDF aspect) of
alternative cleartext_files with various legal count_value values (1024,
131072, 2097152, 65011712) as:

time gpg2 -c --s2k-cipher-algo AES256 --s2k-digest-algo SHA256 \
--s2k-count count_value cleartext_file

I was surprised to find that count_value of 1024 gave a timing nearly as
long as that for 65011712.

I was pleased to receive a rapid response from Werner Koch, who
explained that the nominated count_value of 1024 actually used a default
count_value compatible with gpg 1.4, and then went on to explain that
OpenPGP used an SHA1-based Key Distribution Function (KDF).

However, in my Aug 30 response, I noted that I had carefully followed
the gpg man pages in specifying my wish to use an AES256 cipher, and an
SHA256 hash function. The count_value of 1024 clearly ignored my wishes
on hash function (for gpg 1.4 compatibility), and --- I must assume ---
also used AES128 cipher for the same reason. As I noted, both AES-128
and SHA-1 are generally deprecated functions in cryptography.

So I am left wondering whether my specified AES-256 and SHA-256 were
used with my other count_value values. My Aug 27 submission highlighted
a Spectra Secure YouTube which noted that the --s2k parameters were
ignored for key export without warning, and that this "bug" had been the
case since 2017. Do we now discover that the --s2k parameters are
similarly ignored for _all_ symmetric encryption procedures, in
contradiction to the man-page instructions on use?

My earlier submissions noted that KeePass (password safe) gave an
encouraging oversight of how areas of memory were secured from other
applications while KeePass is in use, giving a degree of protection from
malware etc., or having critical data finding its way onto disk storage
--- ready for scrutiny my a later hacker. I sought a similar oversight
on gpg --- perhaps based on the KeePass template. I noted the
possibility that such techniques were so obviously necessary that
(perhaps) there was little point in describing them.

The response that I have seen merely implied that such oversight would
take a lot of effort to write, and may be less helpful than expected.
This suggests to me that these "obviously necessary" techniques were
_not_ being implemented (or even attempted), and that the only solution
was to fully ensure the security of your entire system. I see this as a
"Counsel of Perfection" that may only be practical with an air-gapped
system that has had no data input from the internet. My understanding is
that Security is something typically applied in layers, with the full
knowledge that any single layer is unlikely to be perfect.

The concept that no thought may be given within gpg to the protection of
passwords, and that deprecated cryptographic functions may be in use
(despite commands to the contrary), seems to me to be highly disturbing.

Tony



_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-users
Re: Seeking Assurance on Security and Memory Leaks in SuSE GnuPG [ In reply to ]
Tony Lee wrote in
<cc1fda36-77b5-7456-f20f-f73428d383a0@gmail.com>:
|On Aug 27 I submitted a query to this mailing list on the same Subject
...
|The concept that no thought may be given within gpg to the protection of
|passwords, and that deprecated cryptographic functions may be in use
|(despite commands to the contrary), seems to me to be highly disturbing.

Highly disturbing to me are such poisoning emails like you write
continuously. The software you talk about is classified to be
used by governments to some extend, and i rather have Werner and
his team work on improving this big software suite than answering
mails of stinking piles.
Just my one cent.

--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-users
Re: Seeking Assurance on Security and Memory Leaks in SuSE GnuPG [ In reply to ]
Tony Lee via Gnupg-users wrote:
> [...]
>
> I was pleased to receive a rapid response from Werner Koch, who
> explained that the nominated count_value of 1024 actually used a default
> count_value compatible with gpg 1.4, and then went on to explain that
> OpenPGP used an SHA1-based Key Distribution Function (KDF).

KDF here is "Key Derivation Function", not "Key Distribution Function".

> However, in my Aug 30 response, I noted that I had carefully followed
> the gpg man pages in specifying my wish to use an AES256 cipher, and
> an SHA256 hash function.

If I understand correctly, it probably did: your data was encrypted
using AES256 using a key derived from your passphrase using the OpenPGP
KDF and an integrity check value using SHA256 was included with the
encrypted data.

> [...] As I noted, both AES-128 and SHA-1 are generally deprecated
> functions in cryptography.

This is completely irrelevant to a KDF. The only purpose of a KDF is to
expend considerable computational power to derive a key from a
passphrase, to partially compensate for the expected low entropy of a
passphrase by making a search dramatically more expensive.

> So I am left wondering whether my specified AES-256 and SHA-256 were
> used with my other count_value values.

Most probably yes, although you would need to examine the source code to
be certain. GPG 1.4 *did* support AES256 and SHA256, so compatibility
would not be an excuse to fail to use them.

> My Aug 27 submission highlighted a Spectra Secure YouTube which noted
> that the --s2k parameters were ignored for key export without warning,
> and that this "bug" had been the case since 2017. Do we now discover
> that the --s2k parameters are similarly ignored for _all_ symmetric
> encryption procedures, in contradiction to the man-page instructions
> on use?

If so, that would be a very serious bug, but you would need to examine
the sources to make sure.


-- Jacob

_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-users
Seeking Assurance on Security and Memory Leaks in SuSE GnuPG [ In reply to ]
TL > I was pleased to receive a rapid response from Werner Koch, who
explained that the nominated count_value of 1024 actually used a default
count_value compatible with gpg 1.4, and then went on to explain that
OpenPGP used an SHA1-based Key Distribution Function (KDF).

Jacob B > KDF here is "Key Derivation Function", not "Key Distribution
Function".

You are correct: not sure how this happened. My original submission
reflected a "Notes" paper I had been writing (for my own clarification)
which included an acronyn list with the correct expansion. I guess this
confirms my status as a non-expert, which is why I "Seek Assurance"!


Jacob B > If I understand correctly, it probably did: your data was
encrypted using AES256 using a key derived from your passphrase using
the OpenPGP KDF and an integrity check value using SHA256 was included
with the encrypted data.

That was certainly my intention, using:

time gpg2 -c --s2k-cipher-algo AES256 --s2k-digest-algo SHA256 \
--s2k-count count_value cleartext_file

where the man gpg states:

--s2k-cipher-algo name
Use name as the cipher algorithm for symmetric encryption
with a passphrase

--s2k-digest-algo name
Use name as the digest algorithm used to mangle the
passphrases for symmetric encryption.
The default is SHA-1.
--s2k-count n
Specify how many times the passphrases mangling for
symmetric encryption is repeated. This
value may range between 1024 and 65011712 inclusive.

Werner noted [for Count 1024] For backward compatibility reasons with
1.4 the default count value is used in this case [and] You can't compare
some AES-KDF to the SHAl based KDF of OpenPGP. The --s2k options mention
"mangling passphrases" which sounds exactly like a KDF, but a default
SHA-1 was used in one case, at least.

TL > My Aug 27 submission highlighted a Spectra Secure YouTube (dated 29
Nov 2021) which noted that the --s2k parameters were ignored for key
export without warning, and that this "bug" had been the case since 2017.

Jacob B > ... that would be a very serious bug ...

The Spectra Secure YouTube was:
https://www.youtube.com/watch?v=j-qBChKG15Y "Password Managers: The Case
Against GNU pass (feat gpg)". Around minute 4:31 it explains very
clearly that the --s2k settings do not work (when exporting a key),
showing screen evidence. In a later comment, Spectra Secure quotes
"additional context on reddit" from skeeto at:
https://www.reddit.com/r/commandline/comments/r4ndi9/comment/hmjbkmc/ ,
which states: "The exported S2K protection is different than than the
protection used on the keyring, so you can't infer anything about GnuPG
keys at rest unless you're storing them in exported format rather than
on your keyring. This changed in GnuPG 2.1, and that's why the S2K
options are silently ignored as of GnuPG 2.1. I'm the person who filed
the bug report discussed in the video, and the responses to that report
are how I learned what's going on.". This implies the "silent ignoring"
is correct for exported keys, but may not be relevant to other
functions. We now seem to find it can be relevant to other activities as
well.

In fact, all I can really infer is that practice does not match the man
gpg, so it is difficult to decide what is (or should be) going on.

I am not really in a position to examine the sources with any
confidence, but would welcome suggestions for software which would
permit me to check what was set up. Does John the Ripper (gpg-opencl),
plus hashcat, detail the algorithms used, having broken a password?

Tony


_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
https://lists.gnupg.org/mailman/listinfo/gnupg-users