Page MenuHomePhabricator

Store integrity hashes for file blobs in Files
Closed, ResolvedPublic

Description

Currently, we don't integrity check stored data in Files. We can reasonably do this, and doing so can make some error handling and diagnostics easier (see also T9828, perhaps) and allow us to detect corruption (though we have no evidence that installs currently experience it).

The lack of an integrity check also potentially allows an attacker who has access to the underlying datastore -- but not to any application servers -- to tamper with file data by replacing blobs on the storage service.

A recent HackerOne report (which I'll link here for discussion once it discloses) suggests that this might be possible even for encrypted data. Although I currently believe that this attack is unrealistically difficult, it isn't entirely impossible, and adding an integrity check would defuse it.

Event Timeline

The security part of this is fixed by D17625, but I'm planning to write a support script like bin/files integrity or similar to do things like "compute hashes for existing files" and "check that a file or set of files match their integrity hashes".

The HackerOne issue for this is here:

https://hackerone.com/reports/216746

The researcher hasn't confirmed disclosure at time of writing, but the link will probably start working in the next couple of days.