FS#23103 - [pacman] Add SHA256 sum to db
Attached to Project:
Pacman
Opened by IgnorantGuru (IgnorantGuru) - Wednesday, 02 March 2011, 15:34 GMT
Last edited by Dan McGee (toofishes) - Wednesday, 23 March 2011, 15:33 GMT
Opened by IgnorantGuru (IgnorantGuru) - Wednesday, 02 March 2011, 15:34 GMT
Last edited by Dan McGee (toofishes) - Wednesday, 23 March 2011, 15:33 GMT
|
Details
Please add a SHA256 sum to the desc files of packages in the
sync database, in addition to MD5. This simple addition will
allow for more security in scripts that compare mirrors (eg
paccheck). It will also allow for a higher level of security
when the databases are signed (as an interim solution to
full package signing implementation).
By adding SHA256 in addition to MD5, no other changes to pacman should be required - pacman doesn't need to check the SHA256 sum at this point (that would not add much security given the current lack of mirror security). MD5 is a compromised hash... http://cryptography.hyperlink.cz/2004/otherformats.html Patch for repo-add: # get md5sum and sha256sum and compressed size of package md5sum="$(openssl dgst -md5 "$pkgfile")" md5sum="${md5sum##* }" sha256sum="$(openssl dgst -sha256 "$pkgfile")" sha256sum="${sha256sum##* }" csize=$(stat -L -c %s "$pkgfile") ... echo -e "%SHA256SUM%\n$sha256sum\n" >>desc |
This task depends upon
Closed by Dan McGee (toofishes)
Wednesday, 23 March 2011, 15:33 GMT
Reason for closing: Implemented
Additional comments about closing: Commit a31d091fb3bd
Wednesday, 23 March 2011, 15:33 GMT
Reason for closing: Implemented
Additional comments about closing: Commit a31d091fb3bd
The MD5 sums are only used for that *by pacman*. My script paccheck uses the MD5 sums to try to verify packages more comprehensively using several mirrors, but the MD5 hash is a weakness. Users need to (and do) download full packages from multiple mirrors as a result. Having the SHA256 sum would thus help many users and reduce load on the mirrors, regardless of pacman's lack of use for it. Also, I have submitted a feature request to devtools for them to sign the database with a server key. Adding SHA256 sums is an integral part of that request as well, since if the database is signed, the SHA256 sum can be used to authenicate the packages reliably. It is very simple to do and doesn't hurt anything, so please add SHA256 sums to repo-add. Thank you.
I was playing with a similar idea about 4 months ago. The point is that several mirrors are unlikely to get hacked simultaneously, right? Although I added my vote for this ticket, I have to say that for paccheck (is it available, btw?) sha256 is irrelevant, since you are using statistical unlikeness of a compromise, not trustability of any particular .db.tar.gz package...
Yes paccheck is available:
http://igurublog.wordpress.com/downloads/script-paccheck/
https://bbs.archlinux.org/viewtopic.php?id=113917&p=1
> The point is that several mirrors are unlikely to get hacked simultaneously, right?
Yes, and paccheck can test an unlimited number of mirrors, so it improves the situation considerably through polling. Pretty much to the user's desired level vs time and bandwidth.
> sha256 is irrelevant, since you are using statistical unlikeness of a compromise, not trustability of any particular .db.tar.gz package...
With the MD5 sums, paccheck can download the database file from multiple mirrors. The MD5 sum provides some degree of authentication, aside from an MD5 collision attack. If a user is concerned about this vulnerability (which is reasonable), then the user must use paccheck's 'compare' function to download full packages from multiple mirrors and do a byte-for-byte comparison. Having the SHA256 hash would change this requirement - comparing the relatively small database files from multiple mirrors would assure that an MD5 collision is not present. Then the only vulnerability is multiple compromised mirrors, which is relatively unlikely if enough tier 1 mirrors are polled.
So in short, I would find the SHA256 sums very valuable in making paccheck more efficient and secure, and of course they are a component of the server signature scheme in the devtools request.
Either way, I see no actual patch here. We take git format-patch style patches for pacman, on the ML, inline, as is documented here: http://www.archlinux.org/pacman/submitting-patches.html. The rules are quite easy to follow.