Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SHA-2 (sha256 / sha512) to checksum #113

Closed
TomOne opened this issue Feb 22, 2015 · 22 comments
Closed

Add SHA-2 (sha256 / sha512) to checksum #113

TomOne opened this issue Feb 22, 2015 · 22 comments

Comments

@TomOne
Copy link

TomOne commented Feb 22, 2015

Although MD5 and SHA1 are still very common as checksums for files, both of these hash functions are considered insecure in cryptography. This is epecially true when these algorithms are used to hash passwords, which is a gross negligence.

When used as file checksums, an attacker could compromise a server and put a malicious file with the very same MD5 or SHA1 checksum as the original file onto that server. Although I know no real world case such an attack, it is still theoretically possible.

The solution is simple: deprecate MD5 and SHA1 as checksums and encourage maintainers to use the more recent SHA256 or SHA512 algorithms. Perhaps Chocolatey should give a warning message if one of the deprecated hash algorithms is used.

MD5 and SHA1 have really no place in modern cryptography and therefore it’s better to also not use them as file checksums.

@ferventcoder
Copy link
Member

Blocked by at least chocolatey/checksum#1

@ferventcoder
Copy link
Member

@TomOne Agreed. But it's not my option to deprecate the use of those checksums. That is going to be a change over time coming from the official sources that publish those hashes in many cases. We can start pushing on the world of those that offer the downloads to be more secure, but we should not fully deprecate until those locations offer it. SHA1, while still having the ability for file collisions is tremendously more secure than MD5. In some cases where the sites are HTTPS, someone would need to break into the site AND put a malicious file that matches checksum. Hard, but not impossible.

For packages where the user is calculating those checksums (i.e. not offered by the site), we should definitely enforce a more secure checksum as a requirement.

@TomOne
Copy link
Author

TomOne commented Feb 22, 2015

You’re right. I haven’t tought about that this further. 😄

If we ever plan an (at least partially) automated moderation (what I would very much welcome), it should definitely check if MD5/SHA1 was used and give a warning to the maintainer with the message to use a stronger hash algorithm if available and perhaps encourage the software authors to to switch to SHA256/SHA512.

But these hash algorithms still have a drawback: If an attacker breaks into a site, replaces the file with a malicious file including its checksum before the corresponding Choco package is created, the checksum becomes useless for security purposes. GPG signatures wouldn’t have this problem, because to replace that file on the server with malicious code, an attacker would have to steal the private key of the signer, which is normally harder than breaking into the server. 😈

Please consider supporting GPG signatures too and make that the first choice for maintainers if available. I can remember that once a Chocolatey user asked for that, but I cannot find an issue on GH about it. Can I create an issue about that?

Even better would be to integrate GPG signatures for Chocolatey packages itself. Other package managers in the *nix world do that already.

@ferventcoder
Copy link
Member

Actually plan to set GPG signatures on the packages themselves. That's part of the keys for the moderators conversation we've talked about. Ultimately a moderator signing a package will result in a GPG key on the package. We'll also want to explore if we want to go further and have maintainers sign the packages as well (my vote is yes on this).

@TomOne
Copy link
Author

TomOne commented Feb 22, 2015

Actually plan to set GPG signatures on the packages themselves.

Excellent, but actually we need support for both package signing and for the ability to provide a signature for the downloaded files. Package signing on it’s own doesn’t increase the security for externally downloaded files, it only verifies the integrity of the package itself.

@ferventcoder
Copy link
Member

Agreed. Yup. Best of both worlds is ultimately for packages to have no external downloads.

@TomOne
Copy link
Author

TomOne commented Feb 22, 2015

Agreed. Yup. Best of both worlds is ultimately for packages to have no external downloads.

Sure, but I doubt if that will ever happen, especially with proprietary software. If Chocolatey establishes as de-facto package manager for Windows, it is about to jeopardize the business model of adware/crapware authors and ads on download sites for Windows software. 😈

But now back to the topic: To keep track of this topic, we should create issues for adding GPG signatures for packages and for external downloads, shouldn’t we?

@rismoney
Copy link
Contributor

Packages without external downloads? Binary stored where?

@TomOne
Copy link
Author

TomOne commented Feb 23, 2015

Packages without external downloads? Binary stored where?

In the package itself, otherwise it would still be external.

@ferventcoder
Copy link
Member

But back to the topic: To keep track of this topic, we should create issues for adding GPG signatures for packages and for external downloads, shouldn’t we?

Yes, for packages. How would you create one for external downloads for applications you don't control?

@rismoney
Copy link
Contributor

In the package itself, otherwise it would still be external.

this breaks version control. This reminds me, we need a url environment variable for package portability.

@gep13
Copy link
Member

gep13 commented Feb 23, 2015

@TomOne said...
In the package itself, otherwise it would still be external.

@rismoney said...
this breaks version control.

@ferventcoder am I not right in saying that going forward, the intention would be to offer a CDN style service for packages, so that we (Chocolatey) grab the MSI/EXE/Zip and store it "somewhere" then re-write the package download URL to point at the cached version. Granted, a premium offering, but something that is being looked into, as per, kickstarter.

@ferventcoder
Copy link
Member

we need a url environment variable for package portability.

Yup, still have it in mind. :)

@ferventcoder
Copy link
Member

@ferventcoder am I not right in saying that going forward, the intention would be to offer a CDN style service for packages, so that we (Chocolatey) grab the MSI/EXE/Zip and store it "somewhere" then re-write the package download URL to point at the cached version. Granted, a premium offering, but something that is being looked into, as per, kickstarter.

Yes, a premium offering.

@gep13
Copy link
Member

gep13 commented Feb 23, 2015

@ferventcoder said...
Yup, still have it in mind. :)

What is being referred to here? Not sure I follow.

@ferventcoder
Copy link
Member

What is being referred to here? Not sure I follow.

That was mentioned there. @rismoney had a question statement and I was agreeing.

@gep13
Copy link
Member

gep13 commented Feb 24, 2015

@ferventcoder said...
That was mentioned there. @rismoney had a question statement and I was agreeing.

What I was getting at is, what is, what is a a url environment variable for package portability and why is it required? Don't recall seeing mention of this anywhere.

@ferventcoder
Copy link
Member

We should open a new ticket about this - allows the package download files to be overridden.

@ferventcoder ferventcoder modified the milestones: 0.9.10, 0.9.10.x Jun 5, 2015
@rednoah
Copy link

rednoah commented Jun 17, 2015

Is SHA-256 supported as Install-ChocolateyPackage -checksumType now? I see some code regarding SHA256 but it's not in the Create Package docs yet.

Very few packages use -checksum as far as I can see. It'd be good to get everyone started with SHA-256 right away.

@ferventcoder
Copy link
Member

@rednoah SHA2 is not in there yet. Only sha1 and md5 at the moment.

@StefanScherer
Copy link

I have played with Get-FileHash node.msi -Algorithm sha256 to get some similar behavior as in Linux Docker Images for Windows PowerShell in this Dockerfile
But I don't know if this depends on a newer PowerShell that comes with Windows Server 2016 TP3.

@ferventcoder
Copy link
Member

@ferventcoder ferventcoder modified the milestones: 0.9.9.9, 0.9.10.x Sep 28, 2015
@ferventcoder ferventcoder self-assigned this Sep 28, 2015
@ferventcoder ferventcoder changed the title Checksums for downloaded files: encourage users to use secure hash algorithms, not MD5 or SHA1 Add sha256 and sha512 to checksum Sep 28, 2015
@ferventcoder ferventcoder changed the title Add sha256 and sha512 to checksum Add SHA-2 (sha256 / sha512) to checksum Sep 28, 2015
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 29, 2015
This adds two SHA-2 encryption algorithms, SHA256 and SHA512 to
choco to verify Checksums.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 29, 2015
* stable:
  (chocolateyGH-113) Add SHA-2 support for checksum

# Conflicts:
#	src/chocolatey.resources/helpers/functions/Get-ChocolateyWebFile.ps1
ferventcoder added a commit that referenced this issue Sep 30, 2015
ferventcoder added a commit that referenced this issue Sep 30, 2015
* stable:
  (GH-420) Set env vars once config is complete
  (GH-420) Environment adapter
  (spec) remove logger
  (maint)(spec) overwrite readonly files
  (GH-113) fix message

# Conflicts:
#	src/chocolatey/infrastructure/adapters/Environment.cs
#	src/chocolatey/infrastructure/adapters/IEnvironment.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants