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

Disable caching of GPG passphrases in the GPG agent (CryptoUtil 1/3) #6174

Merged
merged 1 commit into from Nov 23, 2021

Conversation

nabla-c0d3
Copy link
Contributor

@nabla-c0d3 nabla-c0d3 commented Nov 20, 2021

Status

Ready.

Description of Changes

This PR disables the caching of GPG passphrases by adding default-cache-ttl 0 to the GPG agent's config.

  • This fixes a security issue where any GPG passphrase could be supplied to the GPG decryption code, as long as the corresponding decryption key's GPG passphrase was already in the GPG cache. The decryption code (more specifically the GPG binary) transparently retrieves from the cache the GPG passphrase for the right key, and then uses the key to decrypt the data. This happens regardless of what GPG passphrase was supplied by the caller.
  • AFAIK this issue is currently unexploitable. Exploiting it would require another another bug in the securedrop server code that would allow a malicious source to "ask" the server to decrypt another source's files/replies. In this scenario, the malicious source would not need to provide/guess the other source's GPG passphrase: the server would transparently retrieve it from its cache and decrypt the content; what this PR fixes.
  • This is part 1 of a set of 3 PRs to refactor the GPG code.

@nabla-c0d3 nabla-c0d3 marked this pull request as ready for review November 20, 2021 19:03
@nabla-c0d3 nabla-c0d3 requested a review from a team as a code owner November 20, 2021 19:03
@nabla-c0d3 nabla-c0d3 changed the title Disable caching of GPG passphrases in the GPG agent Disable caching of GPG passphrases in the GPG agent (CryptoUtil pt 1/3) Nov 22, 2021
@nabla-c0d3 nabla-c0d3 changed the title Disable caching of GPG passphrases in the GPG agent (CryptoUtil pt 1/3) Disable caching of GPG passphrases in the GPG agent (CryptoUtil 1/3) Nov 22, 2021
@zenmonkeykstop zenmonkeykstop self-assigned this Nov 22, 2021
@zenmonkeykstop zenmonkeykstop added this to Under Review in SecureDrop Team Board Nov 22, 2021
Copy link
Contributor

@zenmonkeykstop zenmonkeykstop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Looks good based on visual review
  • confirmed that /var/lib/securedrop/keys/gpg-agent.conf includes the new default-cache-ttl 0 line on both fresh prod installs (using debs built from this branch) and in the upgrade scenario.
  • Confirmed reply functionality is unaffected.

@zenmonkeykstop zenmonkeykstop merged commit 20ec360 into freedomofpress:develop Nov 23, 2021
SecureDrop Team Board automation moved this from Under Review to Done Nov 23, 2021
@nabla-c0d3 nabla-c0d3 deleted the disable-gpg-cache branch November 23, 2021 17:31
@eaon eaon mentioned this pull request Feb 11, 2022
35 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants