Home GnuPG

Store and verify content integrity checksums for files
63828f580689Unpublished

Unpublished Commit · Learn More

Repository Importing: This repository is still importing.

Description

Store and verify content integrity checksums for files

Summary:
Ref T12470. This helps defuse attacks where an adversary can directly take control of whatever storage engine files are being stored in and change data there. These attacks would require a significant level of access.

Such attackers could potentially attack ranges of AES-256-CBC encrypted files by using Phabricator as a decryption oracle if they were also able to compromise a Phabricator account with read access to the files.

By storing a hash of the data (and, in the case of AES-256-CBC files, the IV) when we write files, and verifying it before we decrypt or read them, we can detect and prevent this kind of tampering.

This also helps detect mundane corruption and integrity issues.

Test Plan:

  • Added unit tests.
  • Uploaded new files, saw them get integrity hashes.
  • Manually corrupted file data, saw it fail. Used bin/files cat --salvage to read it anyway.
  • Tampered with IVs, saw integrity failures.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12470

Differential Revision: https://secure.phabricator.com/D17625

Event Timeline

epriestley <git@epriestley.com> committed rPHAB63828f580689: Store and verify content integrity checksums for files (authored by epriestley <git@epriestley.com>).Apr 5 2017, 8:12 PM