megastep / makeself

A self-extracting archiving tool for Unix systems, in 100% shell script.
https://makeself.io
GNU General Public License v2.0
2.3k stars 370 forks source link

Use sha256sum instead of md5sum for verifying file integrity #68

Closed haasn closed 6 years ago

haasn commented 8 years ago

MD5 has been widely considered unsafe for use for the past 15-20 years, and as of today it provides absolutely no security at all.

I would strongly recommend switching to SHA256 (command sha256sum instead of md5sum) to verify the integrity of files, since MD5 is very easily falsified.

dantran commented 8 years ago

+1 I'll take SHA1 :-)

megastep commented 7 years ago

I take this under consideration, my main concern though is the availability of the sha256sum command across all supported platforms so that this would keep working. I'll have to check about that first.

If that is not the case then maybe we should keep the MD5 alongside the SHA, as a backup. By the way we still already use a CRC as a backup, so maybe it's time to switch it over. :)

dantran commented 7 years ago

i take sha1 anytime :)

hazendaz commented 7 years ago

@megastep Any progress on this?

haasn commented 7 years ago

If that is not the case then maybe we should keep the MD5 alongside the SHA, as a backup. By the way we still already use a CRC as a backup, so maybe it's time to switch it over. :)

It's not uncommon for e.g. package managers to provide multiple hashes, not only for redundancy (in case one hash fails, another hash won't) but also for compatibility. For example, gentoo's package manager (portage/ebuild) uses WHIRLPOOL, SHA512 and SHA256.

the-real-neil commented 6 years ago

@megastep, to put a very fine point on this, which supported platforms do not have sha1sum in the $PATH?

megastep commented 6 years ago

I'm not sure off the top of my head, but I would venture a guess that many of the standard UNIX installations (say early Solaris, HP-UX, etc) do not come with this command.

the-real-neil commented 6 years ago

@megastep, the Solaris 10 digest command supports sha1, md5, sha256, sha385, and sha512. The HP-UX shasum supports sha1, sha224, sha256, sha384, and sha512.

References:

tuxmaster commented 6 years ago

Don't use sha-1 for security reasons. Only use one of the the sha-2 family(sha-256, sha-384 or sha-512)

the-real-neil commented 6 years ago

@tuxmaster, agreed, but it's better than md5. @megastep, I'm not sure how to interpret your silence as of late. You're busy, I'm sure, but does my previous comment do anything to further the argument for a better digest command?

megastep commented 6 years ago

I understand your concerns and pretty much agree with them. My main concern though is always that I need to maintain cross-platform compatibility as much as possible, which means relying on the lowest common denominator in a lot of ways. So ideally I'd like to have a way to handle all the various cases as best as possible in the most restricted scenario.

For example, I'd love that an archive built on a recent Linux distribution with all the needed checksum commands can be extracted (and ideally verified first) on something like a minimal stock HP-UX installation.

the-real-neil commented 6 years ago

@megastep can you prove that a minimal stock HP-UX installation does not support, for example, sha512 ? Because my research suggests that you cannot.

megastep commented 6 years ago

I wasn't really referring to HP-UX specifically, though I have handled plenty of older Unix systems that barely had anything but the cksum or md5sum commands (not to get into specifics at the moment). Think even outdated systems like SCO or IRIX.

the-real-neil commented 6 years ago

@megastep, okay let's get very general: What is your support schedule for the operating systems you mention? How long will makeself support the systems you yourself call "outdated"? At what point does the cost (to the security of modern systems) become more important than running on a Unix that may not have seen a release in the last decade?

If my tone seems overly aggressive, I apologize. I have a personal and professional interest in securing the makeself archives I create and I can't do that without modern digest tools. If there are old systems that require insecure tools, then I can understand --- but I do want to know exactly when (or if) the situation is likely to change.

megastep commented 6 years ago

@rubicks That is a fair point. The truth is I have been using Makeself in some commercial projects that have their own minimal system requirements (the main one for me is BrightQ). So the baseline for these as far as I am concerned is what is available on the targeted OS I have to support with this software (namely Solaris 10, AIX 4.3, FreeBSD 8, etc).

Believe me I would be in favor of dropping support for dinosaurs like SCO since nobody is using those anymore. But at the same time I am always reluctant to actively disable support for an old OS if leaving it in place doesn't cost me anything.

koutcher commented 6 years ago

makeself already has options like —xz for compression which are incompatible with most legacy systems, so why not introduce options like —sha1 or —sha256 to let the user decide of the main checksum in the same way he can decide for compression while keeping the CRC as backup ?

the-real-neil commented 6 years ago

@koutcher, seconded; that seems like a perfectly reasonable compromise. It makes sense to have the digest functionality follow the precedent set by the compression functionality; i.e., a (very) backward-compatible default overrideable via command line option.

megastep commented 6 years ago

I guess I'd be OK with a command line option, this seems like a fine compromise.

megastep commented 6 years ago

So I just added a new --sha256 option which uses shasum or sha256sum to compute and verify the archive, in addition to the other MD5 and CRC methods. You can also still get rid of the legacy checksums by using --nomd5 in addition.

Please test it and let me know if this works well for you.

the-real-neil commented 6 years ago

@megastep, I'm happy to report that this new feature is working splendidly for me. Thanks very much, for both your receptiveness to our requests and your time in implementing this feature.

hazendaz commented 6 years ago

Maven plugin was released as well supporting the 2.4.0 release and all is good there. Thanks.

Get Outlook for Androidhttps://aka.ms/ghei36


From: Neil Roza notifications@github.com Sent: Wednesday, May 9, 2018 10:00:34 AM To: megastep/makeself Cc: Jeremy Landis; Comment Subject: Re: [megastep/makeself] Use sha256sum instead of md5sum for verifying file integrity (#68)

@megastephttps://github.com/megastep, I'm happy to report that this new feature is working splendidly for me. Thanks very much, for both your receptiveness to our requests and your time in implementing this feature.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/megastep/makeself/issues/68#issuecomment-387748387, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA7ho-_lnr28TKDwd7aDA6TWmmRcrqhBks5twvaBgaJpZM4IL0NB.