6120595 2001-02-20 16:15 -0500 /147 rader/ V. Alex Brennen <vab@CRYPTNET.NET> Sänt av: joel@lysator.liu.se Importerad: 2001-02-21 01:51 av Brevbäraren (som är implementerad i) Python Extern mottagare: BUGTRAQ@SECURITYFOCUS.COM Externa svar till: vab@CRYPTNET.NET Mottagare: Bugtraq (import) <15543> Ärende: [CryptNET Advisory] pgp4pine-1.75-6 - expired public keys ------------------------------------------------------------ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 - ------------------------------------------------------------------------------ CryptNET Security Advisory http://www.cryptnet.net/ Advisory Type: Privacy - Programmatic Error Synopsis: pgp4pine may fail to identify expired public keys Issue Date: 2001.02.20 Program: pgp4pine-1.75-6 - http://pgp4pine.flatline.de/ Related Programs: Gnu Privacy Guard (GnuPG) Version 1.0.4 Pine Version 4.2.1 Maintainer Response: Attempts to contact the maintainer of the pgp4pine package where unsuccessful. - ------------------------------------------------------------------------------ 1. Executive Summary pgp4pine is a program which is used to interface various PGP implementations with the popular Pine mail reading package. Version 1.75-6 of pgp4pine fails to properly identify expired keys when working with the Gnu Privacy Guard program (GnuPG). This failure may result in the transmission of sensitive information in clear text across the network. 2. Problem Description Version 1.75-6 of pgp4pine does not include code to check if public keys are expired when loading keys from the GnuPG openPGP implementation. If a user has an expired public key in their keyring and attempts to encrypt a message to a recipient with that expired public key, pgp4pine will fail to recognize that the key is expired. pgp4pine will then issue a command to GnuPG to encrypt the email message with the expired key. The encryption will not be successful, GnuPG will return an error message due to the invalid key. pgp4pine will not detect the error which occurred when encrypting the text and will return program flow control to Pine. Pine will then transmit the message in the clear. No notice that an error occurred will be provided to the user by pgp4pine. To duplicate the error on the command line: bash$ pgp4pine -e -i /tmp/in.tmp -o /tmp/out.tmp -r (*R) * Where R is a recipient with an expired public key in your keyring. 3. Solution A patch, written by V. Alex Brennen, has been provided with this advisory. The patch consists of code modifications which allow pgp4pine to recognize and ignore expired keys when working with GnuPG. 4. About This Advisory This advisory was produced as part of the CryptNET Free Cryptography Auditing Project. CryptNET is a group working on the development of Free Software cryptographic solutions. As part of its mission, CryptNET has undertaken The Free Cryptography Auditing Project. The project is an effort to audit some of the more popular free software cryptographic programs licensed under the GNU General Public License. If you would like to become involved in this project, please see the CryptNET web site. John Sheehy, an IBM certified specialist with e-techservices.com (http://www.e-techservices.com/), assisted with the discovery and identification of this bug. - ------------------------------------------------------------------------------ [ENC: Patch] - ------------------------------------------------------------------------------ diff -urN pgp4pine-1.75/pgp4pine/keyrings.c vab.pgp4pine-1.75/pgp4pine/keyrings.c - --- pgp4pine-1.75/pgp4pine/keyrings.c Fri Aug 18 09:24:45 2000 +++ vab.pgp4pine-1.75/pgp4pine/keyrings.c Mon Feb 12 21:03:09 2001 @@ -449,22 +449,36 @@ if (strchr(buf,':') != NULL) { strncpy(keyType,getItem(buf,':',1),3); lineType = 0; - - if (strcmp(keyType,"sec") == 0) lineType = 1; /* secret line... */ - - if (strcmp(keyType,"pub") == 0) lineType = 2; /* public key */ - - if (strcmp(keyType,"uid") == 0) lineType = 4; /* user id */ - - + /* + The letter e in the second field of the colon delimited GnuPG + output denotes that gpg asserts that the trust on this item + has expired (perhaps as the result of an expired openPGP type + 0x13 or 0x18 signature packet). If this line denotes a public + key, GnuPG will not function with this key. So, we should + return with out adding it to the list. We shouldn't check + expiration ourselves because GnuPG is the final authority. + - V. Alex Brennen, CryptNET FCAP [http://www.cryptnet.net/] + 2001.02.13.01.13.47 + */ + strncpy(tmpString,getItem(buf,':',2),1); + if (strcmp(tmpString,"e") == 0) lineType = -1; /* Line w/ expired trust */ + else if (strcmp(keyType,"sec") == 0) lineType = 1; /* secret line... */ + else if (strcmp(keyType,"pub") == 0) lineType = 2; /* public key */ + else if (strcmp(keyType,"uid") == 0) lineType = 4; /* user id */ + if (lineType == 1) inSec = 1; - - if (lineType == 2) inSec = 0; + else if (lineType == 2) inSec = 0; switch (lineType) { case 1: case 2: if (lineType == 2 && getSecretOnly) break; + myNewKey = (struct pkiKey *) myMalloc(sizeof(pkiKeyStruct)); if (firstKey == NULL) firstKey = myNewKey; if (oldKey != NULL) oldKey->nextKey = myNewKey; oldKey = myNewKey; - - + /* next, key size... */ strncpy(tmpString,getItem(buf,':',3),KEY_SIZE_LENGTH); strncpy(myNewKey->keySize,tmpString,KEY_SIZE_LENGTH); @@ -523,6 +537,8 @@ strncpy(myNewKey->emailAddress,extractEmailAddress(tmpString),EMAIL_ADDRESS_MAX_LENGTH); } break; + default: + break; } } } - ------------------------------------------------------------------------------ End CryptNET Advisory - ------------------------------------------------------------------------------ - --- V. Alex Brennen [vab@cryptnet.net] F A R B E Y O N D D R I V E N ! [ http://www.cryptnet.net/ ] 0EC8 B0E3 052D FC4C 208F 76EB FA92 0973 992A 4B3F -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: Made with pgp4pine 1.75-6 iD8DBQE6kt6h+pIJc5kqSz8RAnKgAJ0T9mpnZgSM3Fh3EszThayvags90ACfQs9G hgWgYK1IrWbrkFdBYYgpQfg= =wCgO -----END PGP SIGNATURE----- (6120595) --------------------------------(Ombruten) Bilaga (text/plain) i text 6120596 6120596 2001-02-20 16:15 -0500 /56 rader/ V. Alex Brennen <vab@CRYPTNET.NET> Bilagans filnamn: "vab.pgp4pine.patch" Importerad: 2001-02-21 01:51 av Brevbäraren (som är implementerad i) Python Extern mottagare: BUGTRAQ@SECURITYFOCUS.COM Externa svar till: vab@CRYPTNET.NET Mottagare: Bugtraq (import) <15544> Bilaga (text/plain) till text 6120595 Ärende: Bilaga (vab.pgp4pine.patch) till: [CryptNET Advisory] pgp4pine-1.75-6 - expired public keys ------------------------------------------------------------ diff -urN pgp4pine-1.75/pgp4pine/keyrings.c vab.pgp4pine-1.75/pgp4pine/keyrings.c --- pgp4pine-1.75/pgp4pine/keyrings.c Fri Aug 18 09:24:45 2000 +++ vab.pgp4pine-1.75/pgp4pine/keyrings.c Mon Feb 12 21:03:09 2001 @@ -449,22 +449,36 @@ if (strchr(buf,':') != NULL) { strncpy(keyType,getItem(buf,':',1),3); lineType = 0; - if (strcmp(keyType,"sec") == 0) lineType = 1; /* secret line... */ - if (strcmp(keyType,"pub") == 0) lineType = 2; /* public key */ - if (strcmp(keyType,"uid") == 0) lineType = 4; /* user id */ - + /* + The letter e in the second field of the colon delimited GnuPG + output denotes that gpg asserts that the trust on this item + has expired (perhaps as the result of an expired openPGP type + 0x13 or 0x18 signature packet). If this line denotes a public + key, GnuPG will not function with this key. So, we should + return with out adding it to the list. We shouldn't check + expiration ourselves because GnuPG is the final authority. + - V. Alex Brennen, CryptNET FCAP [http://www.cryptnet.net/] + 2001.02.13.01.13.47 + */ + strncpy(tmpString,getItem(buf,':',2),1); + if (strcmp(tmpString,"e") == 0) lineType = -1; /* Line w/ expired trust */ + else if (strcmp(keyType,"sec") == 0) lineType = 1; /* secret line... */ + else if (strcmp(keyType,"pub") == 0) lineType = 2; /* public key */ + else if (strcmp(keyType,"uid") == 0) lineType = 4; /* user id */ + if (lineType == 1) inSec = 1; - if (lineType == 2) inSec = 0; + else if (lineType == 2) inSec = 0; switch (lineType) { case 1: case 2: if (lineType == 2 && getSecretOnly) break; + myNewKey = (struct pkiKey *) myMalloc(sizeof(pkiKeyStruct)); if (firstKey == NULL) firstKey = myNewKey; if (oldKey != NULL) oldKey->nextKey = myNewKey; oldKey = myNewKey; - + /* next, key size... */ strncpy(tmpString,getItem(buf,':',3),KEY_SIZE_LENGTH); strncpy(myNewKey->keySize,tmpString,KEY_SIZE_LENGTH); @@ -523,6 +537,8 @@ strncpy(myNewKey->emailAddress,extractEmailAddress(tmpString),EMAIL_ADDRESS_MAX_LENGTH); } break; + default: + break; } } } (6120596) --------------------------------(Ombruten)