The vulnerability lies in the incomplete consumption of OpenPGP message streams during decryption, specifically for Symmetrically Encrypted and Integrity Protected Data (SEIPD) packets. The integrity of SEIPD packets is verified by a Modification Detection Code (MDC) which is checked only when the entire encrypted data stream is read.
The analysis of the patch 16c2457867476bcb9942c0a13d70d46ef9e350b8 revealed the root cause. The rpgp library uses a MessageReader struct to handle decrypted data. When this struct is dropped, its drop implementation calls the check_next_packet function to handle any data remaining in the stream.
The vulnerable version of check_next_packet in src/composed/message/types.rs would identify certain types of trailing packets (e.g., Padding, Marker) but failed to read their content from the stream. This left the underlying decryption reader in a state where it had not reached the end of the stream. Consequently, the crucial MDC check was never triggered. An attacker could provide a malformed message that, when decrypted with an incorrect key, would produce garbage output but would not fail the integrity check, potentially leading to further issues if this garbage data is processed.
The patch corrects this by introducing a loop and explicitly calling packet.read_to_end() on these trailing packets, ensuring the stream is fully consumed and the MDC is always validated.
The identified vulnerable function, pgp::composed::message::types::MessageReader::check_next_packet, is the precise location of this flawed logic. Any decryption operation that results in a MessageReader for an SEIPD packet was susceptible to this vulnerability.