Mailing List Archive

gpg --verify hangs on malformed signature
subject says it.
If the issue came up already I'm sorry, but I just downloaded 0.3.2, found the problem, looked into
the last 2 month archived mail and found nothing. The problem in detail:

I try to verify a signed text (mail, signed with PGP5.0i using SHA).
If the signature is fine it reports it, however if I corrupt the signature a bit by adding a key to
it I get:

gpg: CRC error; d8b879 - 826da9
gpg: onepass_sig with unknown version 20

and then it hangs. GDB shows where it hangs:

#0 underflow (a=0x80a5314) at iobuf.c:745
#1 0x808f3a5 in iobuf_readbyte (a=0x80a5314) at iobuf.c:843
#2 0x806414d in skip_rest (inp=0x80a5314, pktlen=60224425) at parse-packet.c:437
#3 0x8065632 in parse_onepass_sig (inp=0x80a5314, pkttype=4, pktlen=604044299, ops=0x80a86fc) at parse-packet.c:864
#4 0x8063c46 in parse (inp=0x80a5314, pkt=0x80a4c8c, reqtype=0, retpos=0x0, skip=0xbffffa28, out=0x0, do_skip=0)
at parse-packet.c:324
#5 0x8063294 in parse_packet (inp=0x80a5314, pkt=0x80a4c8c) at parse-packet.c:127
#6 0x8059ba1 in do_proc_packets (c=0x80a4bf4, a=0x80a5314) at mainproc.c:700
#7 0x8059af3 in proc_signature_packets (a=0x80a5314, signedfiles=0x0) at mainproc.c:674
#8 0x8071a0c in verify_signatures (nfiles=1, files=0xbffffc8c) at verify.c:80
#9 0x804fdcd in main (argc=1, argv=0xbffffc8c) at g10.c:788

and the whole stuff run with --debug-all shows at the critical point:

gpg: DBG: free_packet() type=2
gpg: DBG: iobuf-3.0: close 'file_filter'
gpg: DBG: iobuf-6.0: open '/homes/steffen/tmp/bla'
gpg: DBG: armor-filter: control: 5
gpg: DBG: iobuf-6.1: push 'armor_filter'
gpg: DBG: chain: 6.1 'armor_filter'
gpg: DBG: chain: 6.0 'file_filter'
gpg: DBG: armor-filter: control: 1
gpg: DBG: armor-filter: control: 3
gpg: DBG: parse_packet(iob=6): type=4 length=13
gpg: DBG: iobuf-6.2: push 'block_filter'
gpg: DBG: chain: 6.2 'block_filter'
gpg: DBG: chain: 6.1 'armor_filter'
gpg: DBG: chain: 6.0 'file_filter'
gpg: DBG: init block_filter 0x80a761c
gpg: DBG: parse_packet(iob=6): type=11 length=0
gpg: DBG: armor-filter: control: 3
gpg: DBG: free block_filter 0x80a761c
gpg: DBG: iobuf-6.2: pop '(null)'
gpg: DBG: free_packet() type=11
gpg: DBG: armor-filter: control: 3
gpg: CRC error; d8b879 - 826da9
gpg: DBG: parse_packet(iob=6): type=4 length=604044300
gpg: onepass_sig with unknown version 20
gpg: DBG: iobuf-6.1: error
gpg: DBG: iobuf-6.1: error
gpg: DBG: iobuf-6.1: error
(last line repeated again and again)

any clues/workarounds?
Re: gpg --verify hangs on malformed signature [ In reply to ]
Steffen Ullrich <ccrlphr@xensei.com> writes:

> gpg: CRC error; d8b879 - 826da9
> gpg: onepass_sig with unknown version 20

Here is a patch for this; apply this to g10/parse-packet.c:

diff -u -r1.40 parse-packet.c
--- parse-packet.c 1998/07/09 13:37:10 1.40
+++ parse-packet.c 1998/07/21 13:08:59
@@ -434,7 +434,8 @@
}
else {
for( ; pktlen; pktlen-- )
- iobuf_get(inp);
+ if( iobuf_get(inp) == -1 )
+ break;
}
}


Thanks,

Werner
Re: gpg --verify hangs on malformed signature [ In reply to ]
Sorry, but the patch doesn't help. Looking at the debug messages I think here is the one
who shows the problem first:

gpg: DBG: armor-filter: control: 3
gpg: CRC error; d8b879 - 826da9
gpg: DBG: parse_packet(iob=6): type=4 length=604044300
^^^^^^^^^^^^
gpg: onepass_sig with unknown version 20
gpg: DBG: iobuf-6.1: error
gpg: DBG: iobuf-6.1: error

I know for sure that the text isn't that big at all.


BTW, why it reports

gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.

when I vaildate the valid signature of a mail. I imported the foreign key, signed it and now I would think
if I signed the key it should be trusted - or whom should I trust if not me?

BTW, did you know that the german division of Network Associates (which know owns PGP) charges 3049,-
DM for a 10 user License? They still give you only the NT and Mac version, but starting with 10
users you are allowed to use the code which is available commercially under UNIX.



On Tue, Jul 21, 1998 at 03:15:26PM +0200, Werner Koch wrote:
> Steffen Ullrich <ccrlphr@xensei.com> writes:

> > gpg: CRC error; d8b879 - 826da9
> > gpg: onepass_sig with unknown version 20

> Here is a patch for this; apply this to g10/parse-packet.c:

> diff -u -r1.40 parse-packet.c
> --- parse-packet.c 1998/07/09 13:37:10 1.40
> +++ parse-packet.c 1998/07/21 13:08:59
> @@ -434,7 +434,8 @@
> }
> else {
> for( ; pktlen; pktlen-- )
> - iobuf_get(inp);
> + if( iobuf_get(inp) == -1 )
> + break;
> }
> }


> Thanks,

> Werner
Re: gpg --verify hangs on malformed signature [ In reply to ]
Steffen Ullrich <ccrlphr@xensei.com> writes:

> Sorry, but the patch doesn't help. Looking at the debug messages I think here is the one
> who shows the problem first:
>
> gpg: DBG: armor-filter: control: 3
> gpg: CRC error; d8b879 - 826da9
> gpg: DBG: parse_packet(iob=6): type=4 length=604044300
> ^^^^^^^^^^^^

I noticed that. The reason is that the (armored) data is scrambled
and the parsing codes sees a packet of this length. Yes, my patch is
not good: skip_rest does not return an error code and the error
checking
at the end of parse is only done if the parsingfunction returns with
-1; which it does not. We should change the line after the leave
label in parse() to:

if( !rc && iobuf_error(inp) )
rc = ...


I think I should add some test cases for invalid data.

> gpg: WARNING: This key is not certified with a trusted signature!
> gpg: There is no indication that the signature belongs to the owner.
>
> when I vaildate the valid signature of a mail. I imported the foreign key, signed it and now I would think
> if I signed the key it should be trusted - or whom should I trust if not me?

Can you check this again with option "--debug 256"? Anyway I'm
currently rewriting all this stuff.

> BTW, did you know that the german division of Network Associates (which know owns PGP) charges 3049,-
> DM for a 10 user License? They still give you only the NT and Mac version, but starting with 10
> users you are allowed to use the code which is available commercially under UNIX.

Really? www.pgpi.com?



Werner
Re: gpg --verify hangs on malformed signature [ In reply to ]
On Wed, Jul 22, 1998 at 09:07:09AM +0200, Werner Koch wrote:
> at the end of parse is only done if the parsingfunction returns with
> -1; which it does not. We should change the line after the leave
> label in parse() to:

> if( !rc && iobuf_error(inp) )
> rc = ...

this helps, thanks.

> I think I should add some test cases for invalid data.

> > gpg: WARNING: This key is not certified with a trusted signature!
> > gpg: There is no indication that the signature belongs to the owner.
> >
> > when I vaildate the valid signature of a mail. I imported the foreign key, signed it and now I would think
> > if I signed the key it should be trusted - or whom should I trust if not me?

> Can you check this again with option "--debug 256"? Anyway I'm
> currently rewriting all this stuff.

the debug info:
gpg: note: no default option file '/homes/steffen/.gnupg/options'
gpg: Warning: using insecure memory!
gpg: DBG: key 2FED2B5C: checking secret key
gpg: DBG: key 2FED2B5C.1: stored into ultikey_table
gpg: DBG: key 69ABA264: checking secret key
gpg: DBG: key 69ABA264.3: stored into ultikey_table
gpg: Signature made Fri May 22 10:55:44 1998 using DSA key ID F03ECD75
gpg: Good signature from "Another Person <person@somewhere>"
gpg: check_trust() called.
gpg: DBG: check_trust() returns trustlevel 0002.
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
secmem usage: 1408/1408 bytes in 2/2 blocks of pool 1408/16384

and if it helps the output from gpg --list-sigs:
pub 1024D/2FED2B5C 1998-07-21 Steffen Ullrich (Console) <ccrlphr@xensei.com>
sig 2FED2B5C 1998-07-21 [selfsig]
sub 1024G/69ABA264 1998-07-21
sig 2FED2B5C 1998-07-21 [keybind]
pub 1024D/F03ECD75 1997-09-26 Another Person <person@somewhere>
sig F03ECD75 1997-09-26 [selfsig]
sub 2048G/F4D33253 1997-09-26
sig F03ECD75 1997-09-26 [keybind]
sig 2FED2B5C 1998-07-21 Steffen Ullrich (Console) <ccrlphr@xensei.com>



> > BTW, did you know that the german division of Network Associates (which know owns PGP) charges 3049,-
> > DM for a 10 user License? They still give you only the NT and Mac version, but starting with 10
> > users you are allowed to use the code which is available commercially under UNIX.

> Really? www.pgpi.com?

Yes and No. Looks like pgpi.com only cares for the non-commercial stuff. But they link to
pgpinternational.com which has information where to get commercial version. For Germany I found:
Network Associates GmbH, Deutschland, Tel.: +49-(0) 89-89 435 60
where I received the information




> Werner
Re: gpg --verify hangs on malformed signature [ In reply to ]
Steffen Ullrich <ccrlphr@xensei.com> writes:

> gpg: Signature made Fri May 22 10:55:44 1998 using DSA key ID F03ECD75
> gpg: Good signature from "Another Person <person@somewhere>"
> gpg: check_trust() called.
> gpg: DBG: check_trust() returns trustlevel 0002.
> gpg: WARNING: This key is not certified with a trusted signature!

[...]
> pub 1024D/F03ECD75 1997-09-26 Another Person <person@somewhere>
> sig F03ECD75 1997-09-26 [selfsig]
> sub 2048G/F4D33253 1997-09-26
> sig F03ECD75 1997-09-26 [keybind]
> sig 2FED2B5C 1998-07-21 Steffen Ullrich (Console) <ccrlphr@xensei.com>

Something is wrong, can you do a "gpgp --list-trustdb person@somewhere"
and a "gpgm --list-trust-path 5 person@somewhere"?

[Please reply directly to me]


Werner