bugDistributed Privacy Guard - Bugs: bug #58939, dkgpg fails to verify detached...

 
 

bug #58939: dkgpg fails to verify detached signatures with unknown packet versions

Submitter:  Justus Winter <teythoon>
Submitted:  Wed 12 Aug 2020 12:36:05 PM UTC
   
 
Category:  LibTMCG Severity:  3 - Normal
Item Group:  Feature Request Status:  Need Info
Privacy:  Public Assigned to:  stamer
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 02 Oct 2020 07:06:02 AM UTC, comment #5: 

That is a good question.  So in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872271 dkg proposed a threshold parameter.  We implemented that in our frontends, see e.g. the --signatures parameter of sqv: https://docs.sequoia-pgp.org/sqv/

Justus Winter <teythoon>
Thu 01 Oct 2020 05:26:52 PM UTC, comment #4: 

I have added an API for handling multiple detached signatures to LibTMCG. However, this must been implemented in the programs dkg-verify and dkg-timestamp-verify.

How do you suggest to handle multiple detached signatures with respect to the return code of the called program? Is one valid signature packet is enough for a good result?

Heiko Stamer <stamer>
Group administrator
Tue 18 Aug 2020 12:22:51 PM UTC, comment #3: 

FWIW, I added a test vector with an unknown signature version inside an encryption container which dkgpg now handles fine:

https://tests.sequoia-pgp.org/#Messages_with_unknown_packets

But, I still believe that multiple detached signatures in one file are valid.

Justus Winter <teythoon>
Sat 15 Aug 2020 12:05:16 PM UTC, comment #2: 


> LibTMCG supports by its function SignatureParse() only a single signature packet (i.e. the first packet). This design decision was based on section 11.4 of RFC4880 (Detached Signatures): "[...] are simply a Signature packet stored separately from the data [...]".


That is a severe limitation, and this is the first time I hear this interpretation of the RFC.  For what its worth, plenty of other implementations do support this, and for example the GnuPG project publishes multiple signatures in a single file:


% curl -s https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.19.tar.bz2.sig | sq packet dump
Signature Packet, old CTB, 307 bytes
    Version: 4
    Type: Binary
    Pk algo: RSA (Encrypt or Sign)
    Hash algo: SHA256
    Hashed area:
      Issuer Fingerprint: D869 2123 C406 5DEA 5E0F  3AB5 249B 39D2 4F25 E3B6
      Signature creation time: 2019-12-07 11:34:25 UTC
    Unhashed area:
      Issuer: 249B 39D2 4F25 E3B6
    Digest prefix: 7179
    Level: 0 (signature over data)

Signature Packet, old CTB, 307 bytes
    Version: 4
    Type: Binary
    Pk algo: RSA (Encrypt or Sign)
    Hash algo: SHA256
    Hashed area:
      Issuer Fingerprint: 031E C253 6E58 0D8E A286  A9F2 2071 B08A 33BD 3F06
      Signature creation time: 2019-12-09 05:01:14 UTC
    Unhashed area:
      Issuer: 2071 B08A 33BD 3F06
    Digest prefix: 5276
    Level: 0 (signature over data)


> IMHO using a Detached Signature is not the best choice for this test case. Can you switch to a signed message?


Sadly, I cannot.  Verifying signed messages is not supported by SOP [0].  Using an encrypted, signed message would work using SOP, but the test suites abstraction doesn't yet support that.  One way you could help to improve the situation is to finish the libtmcg-based SOP implementation, so that we can get rid of the dkgpg driver in the test suite.  That would help making it easier to improve the test suites abstraction.

0: https://gitlab.com/dkg/openpgp-stateless-cli/-/issues/25

Justus Winter <teythoon>
Fri 14 Aug 2020 03:40:41 PM UTC, comment #1: 

LibTMCG supports by its function SignatureParse() only a single signature packet (i.e. the first packet). This design decision was based on section 11.4 of RFC4880 (Detached Signatures): "[...] are simply a Signature packet stored separately from the data [...]".

Thus there is no loop inside SignatureParse() and the remaining packet has not been decoded. IMHO using a Detached Signature is not the best choice for this test case. Can you switch to a signed message?

Heiko Stamer <stamer>
Group administrator
Wed 12 Aug 2020 12:36:05 PM UTC, original submission:  

Unknown versions of Signature packets should be ignored to allow
for a smooth evolution of the OpenPGP message format.

  - https://tests.sequoia-pgp.org/#Detached_signatures_with_unknown_packets

Reproducer:

This is a fictitious v23 signature followed by a v4 signature:


-----BEGIN PGP SIGNATURE-----

wsDzFwABCgAGBYJfM9pFACEJEPv8yCoBXnMwFiEE0aZuGiOxgsmYD3iM+/zIKgFe
czBW7gwAjobe0/8MVxpRNBQc9/OFcpWacD6F8y4f+R9hBZ7aGxZduBOsr35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=pV3Y
-----END PGP SIGNATURE-----


This is the certificate to verify the v4 signature:


-----BEGIN PGP PUBLIC KEY BLOCK-----
Comment: Bob's OpenPGP certificate

mQGNBF2lnPIBDAC5cL9PQoQLTMuhjbYvb4Ncuuo0bfmgPRFywX53jPhoFf4Zg6mv
/seOXpgecTdOcVttfzC8ycIKrt3aQTiwOG/ctaR4Bk/t6ayNFfdUNxHWk4WCKzdz
/56fW2O0F23qIRd8UUJp5IIlN4RDdRCtdhVQIAuzvp2oVy/LaS2kxQoKvph/5pQ/
5whqsyroEWDJoSV0yOb25B/iwk/pLUFoyhDG9bj0kIzDxrEqW+7Ba8nocQlecMF3
X5KMN5kp2zraLv9dlBBpWW43XktjcCZgMy20SouraVma8Je/ECwUWYUiAZxLIlMv
9CurEOtxUw6N3RdOtLmYZS9uEnn5y1UkF88o8Nku890uk6BrewFzJyLAx5wRZ4F0
qV/yq36UWQ0JB/AUGhHVPdFf6pl6eaxBwT5GXvbBUibtf8YI2og5RsgTWtXfU7eb
SGXrl5ZMpbA6mbfhd0R8aPxWfmDWiIOhBufhMCvUHh1sApMKVZnvIff9/0Dca3wb
vLIwa3T4CyshfT0AEQEAAbQhQm9iIEJhYmJhZ2UgPGJvYkBvcGVucGdwLmV4YW1w
bGU+iQHOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAFiEE0aZuGiOx
gsmYD3iM+/zIKgFeczAFAl2lnvoACgkQ+/zIKgFeczBvbAv/VNk90a6hG8Od9xTz
XxH5YRFUSGfIA1yjPIVOnKqhMwps2U+sWE3urL+MvjyQRlyRV8oY9IOhQ5Esm6DO
ZYrTnE7qVETm1ajIAP2OFChEc55uH88x/anpPOXOJY7S8jbn3naC9qad75BrZ+3g
9EBUWiy5p8TykP05WSnSxNRt7vFKLfEB4nGkehpwHXOVF0CRNwYle42bg8lpmdXF
DcCZCi+qEbafmTQzkAqyzS3nCh3IAqq6Y0kBuaKLm2tSNUOlZbD+OHYQNZ5Jix7c
ZU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vUV7rIFI1WuoLb+KZgbYn3OWjCPHV
dTrdZ2CqnZbG3SXw6awH9bzRLV9EXkbhIMez0deCVdeo+wFFklh8/5VK2b0vk/+w
qMJxfpa1lHvJLobzOP9fvrswsr92MA2+k901WeISR7qEzcI0Fdg8AyFAExaEK6Vy
jP7SXGLwvfisw34OxuZr3qmx1Sufu4toH3XrB7QJN8XyqqbsGxUCBqWif9RSK4xj
zRTe56iPeiSJJOIciMP9i2ldI+KgLycyeDvGoBj0HCLO3gVaBe4ubVrj5KjhX2PV
NEJd3XZRzaXZE2aAMQ==
=NXei
-----END PGP PUBLIC KEY BLOCK-----


Interestingly, the verification succeeds if the v4 signature
comes first, so it might just be a problem with detecting the
kind of data:


-----BEGIN PGP SIGNATURE-----

wsDzBAABCgAGBYJfM9pFACEJEPv8yCoBXnMwFiEE0aZuGiOxgsmYD3iM+/zIKgFe
czBW7gwAjobe0/8MVxpRNBQc9/OFcpWacD6F8y4f+R9hBZ7aGxZduBOsr35i2I0d
Ujba+EyWKjtnACT5AgDI1iG0n4qMMXKT5s8SIQsJk9u9JZ0A2mdDBQgxgdHSM4X5
Yh42APTj+fHDyWzh5VKWVCMRIvdc+xW5E1nuBA9Oa9pgJSF/+W8DzBixAnX8/BpR
pjHUkoyZDr5BakiWPAWHGM9MAWL/pP7GgiUnWAsWoREWFHzk/q8oxyve1hcf8j6d
1ux7764ynaxLrMXgVHebAYKVBCirnG6BO2FvCTZXy42omokHz/UEXroc+/QT2ul9
pZuYJt+/X9oOAkK55kQ0jh+aa2F9wLHEQ+Gq11pqjfhQidR4iGxB8D+buxjSMuXG
23T2DkQlVZXu4XIZIFEn0MH+2pF8bMhfMyM/gKtnUpgfRI6uyx+1aazKRymuJci6
/QxL4l57Ih/DR4LnA9B0iNr7I3ces0kYbL9ZcPxgv2b3SwwJDTxcrUWqZLl3RKU4
+fzYyy1VwsDzFwABCgAGBYJfM9pFACEJEPv8yCoBXnMwFiEE0aZuGiOxgsmYD3iM
+/zIKgFeczBW7gwAjobe0/8MVxpRNBQc9/OFcpWacD6F8y4f+R9hBZ7aGxZduBOs
r35i2I0dUjba+EyWKjtnACT5AgDI1iG0n4qMMXKT5s8SIQsJk9u9JZ0A2mdDBQgx
gdHSM4X5Yh42APTj+fHDyWzh5VKWVCMRIvdc+xW5E1nuBA9Oa9pgJSF/+W8DzBix
AnX8/BpRpjHUkoyZDr5BakiWPAWHGM9MAWL/pP7GgiUnWAsWoREWFHzk/q8oxyve
1hcf8j6d1ux7764ynaxLrMXgVHebAYKVBCirnG6BO2FvCTZXy42omokHz/UEXroc
+/QT2ul9pZuYJt+/X9oOAkK55kQ0jh+aa2F9wLHEQ+Gq11pqjfhQidR4iGxB8D+b
uxjSMuXG23T2DkQlVZXu4XIZIFEn0MH+2pF8bMhfMyM/gKtnUpgfRI6uyx+1aazK
RymuJci6/QxL4l57Ih/DR4LnA9B0iNr7I3ces0kYbL9ZcPxgv2b3SwwJDTxcrUWq
ZLl3RKU4+fzYyy1V
=6vh8
-----END PGP SIGNATURE-----


Justus Winter <teythoon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by teythoon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-08-14 stamer StatusIn Progress Need Info
    2020-08-14 stamer CategoryNone LibTMCG
        Item GroupNone Feature Request
        StatusNone In Progress
        Assigned toNone stamer

    Back to the top

    Powered by Savane 3.13-ec04.
    Corresponding source code