Page MenuHomePhabricator

Store and verify content integrity checksums for files
ClosedPublic

Authored by epriestley on Apr 5 2017, 4:56 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 9, 6:04 AM
Unknown Object (File)
Thu, Apr 4, 3:56 PM
Unknown Object (File)
Mar 10 2024, 5:21 PM
Unknown Object (File)
Feb 24 2024, 6:02 PM
Unknown Object (File)
Feb 18 2024, 11:21 PM
Unknown Object (File)
Feb 13 2024, 9:24 AM
Unknown Object (File)
Feb 3 2024, 3:25 PM
Unknown Object (File)
Jan 27 2024, 1:17 PM
Subscribers
None

Details

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.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Apr 5 2017, 5:25 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.

(That double-tap was me manually re-running the task to sort something else out, not a bug.)