Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rnp processes unauthenticated partial chunks of AEAD encrypted data packets #807

Open
teythoon opened this issue Mar 4, 2019 · 5 comments
Labels

Comments

@teythoon
Copy link

teythoon commented Mar 4, 2019

Description

First, rnp still lacks a way to responsibly disclose problems with their code.

Second, rnp processes unauthenticated partial chunks of AEAD encrypted data packets.

Steps to Reproduce

  1. Import this key: https://gitlab.com/sequoia-pgp/sequoia/raw/master/openpgp/tests/data/keys/testy-private.pgp?inline=false

  2. Dearmor this file:

-----BEGIN PGP ARMORED FILE-----

QlpoOTFBWSZTWYdZK6YCAm3//+v25z/zON3+7fbbpu9au9Lvu7vDbHGbv/uvVuJb
3crusAEbamyA00Bo0A0aAAGnqNAaA00wg0NDQBoYQaNBoDEHqaNManqBtJkHpBmU
9NI9BCqmjQaaBo0YjQZANBoNDRpo0YmmgAxAGhoMmgDAT0QGmBGjBGTAEZMjCVKg
AANAAAAaAGgNAAAAAAAAAAAAAAAADQyDEaf4AAEAAEEvIEAAIAAGRUuoAAEAAAAA
Fj+0P/kYY/hXJimJSnwxH01b5wjoxb8WdkQM/OI+OKXvenBLrp7NTFDSmYd0jdPJ
5qoyGQOegWiG9/AERTPt5GhPYUg7tsKgW4n3L2MPmNv9gVsk9opSn4Myu/PNIYgH
eWVIJ81P8Cd/a47dh3YEoJVFb8lsVjzckImjKvB8nQMOeoLtSIwwBUXexStMzzc9
Qi6UljgciNAjLa454cJxEei+CT9UVoQWB5VAHwMICJfNqZ2tox3E9BlUr9zB4ypJ
G8J9B0/KCwmngrInWI0yDML6wxlzNYsbtTj1QMCo9XxwUKbVMlvWX5S/SpWp+8br
5lM8m/FaxItXAAAQAALFqTXdyxdyRThQkIdZK6Y=
=pbek
-----END PGP ARMORED FILE-----
  1. Decrypt the message.

Expected Behavior

rnp MUST NOT process unauthenticated data.

Actual Behavior

rnp processes unauthenticated data:

% ../pgpzoo/rnp/src/rnp/rnp --decrypt --homedir=$GNUPGHOME exachunks.pgp
[init_packet_sequence() /home/teythoon/repos/pep/pgpzoo/rnp/src/librepgp/stream-parse.cpp:2147] unexpected pkt 60
[rnp_process_file() /home/teythoon/repos/pep/pgpzoo/rnp/src/rnp/rnpcli.cpp:987] error 0x10000001

Note the "unexpected pkt 60". This changes with the "session key" I choose to "decrypt" the stream of zeros.

Impact

Processing unauthenticated data negates the security benefits of doing AEAD.

What you can do

@dewyatt
Copy link
Contributor

dewyatt commented Mar 17, 2019

I had some trouble with the provided data, but I was able to confirm this behavior.

$ gpg --output - --dearmor exachunks.asc | bzip2 -d | src/rnp/rnp --decrypt
[init_packet_sequence() /tmp/rnp/src/librepgp/stream-parse.cpp:2147] unexpected pkt 60
[rnp_process_file() /tmp/rnp/src/rnp/rnpcli.cpp:987] error 0x10000001

@dewyatt dewyatt added the bug label Mar 17, 2019
@ni4
Copy link
Contributor

ni4 commented Mar 18, 2019

Yeah, currently AEAD works this way since it handles all sizes of chunks specified in RFC4880-bis, which may be too large to cache somewhere in memory. I know there is an ongoing discussion in RFC working group regarding AEAD chunk size, so probably good idea is to wait till it ends with some decision. While we can cache chunk of small size and output larger ones this will not be a 100% correct solution.

@teythoon
Copy link
Author

If you think that there is now way to safely implement AEAD as proposed in RFC4880-bis06, please speak up on the IETF mailing list, because your current position there is

You can say, MUST support 1K to 16K, SHOULD support up to 256K and MAY support larger sizes.

@ni4 ni4 added this to Bugs in RNP overview Sep 3, 2019
@rrrooommmaaa
Copy link
Contributor

@ni4 Can I take this one or are there more prioritized?

@ni4
Copy link
Contributor

ni4 commented May 5, 2020

@rrrooommmaaa As for me this one is a bit of lower priority and still requires some discussion on implementation logic. As for me the simplest and the most urgent one is #1103, then #1099, and if you like Windows stuff - very important but a way more time-consuming would be #997.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
RNP overview
  
Bugs
Development

No branches or pull requests

4 participants