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

After PHP 7.1 support is dropped, use Ed25519 #136

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soatok
Copy link

@soatok soatok commented Mar 28, 2019

The example strings were created with this keypair

  • Secret key: 7994a18843df8a750f2bbe2ad2c4b04b2c0eda6b7f766648d5316c0e272a5c6c8e2e93807649253619106b49110d9b051847f1f82c476aef704393b207c2a5ae
  • Public key: 8e2e93807649253619106b49110d9b051847f1f82c476aef704393b207c2a5ae

The example strings were created with this keypair

* Secret key: `7994a18843df8a750f2bbe2ad2c4b04b2c0eda6b7f766648d5316c0e272a5c6c8e2e93807649253619106b49110d9b051847f1f82c476aef704393b207c2a5ae`
* Public key: `8e2e93807649253619106b49110d9b051847f1f82c476aef704393b207c2a5ae`
@alcohol
Copy link
Member

alcohol commented Mar 28, 2019

Ehm, why? We're just verifying the contents of a simple install script here. Not dealing with government secrets.

@soatok
Copy link
Author

soatok commented Mar 28, 2019

You may have missed the memo about recent supply-chain attacks. Or the not-so-recent memos.

PHP powers a lot of the Internet. An enormous (and increasing) number of PHP projects use Composer. Even WordPress, the biggest holdout for Composer adoption, is likely to adopt it in the next year or so.

Not dealing with government secrets.

Put bluntly: If you worked for a nation state at the same level as NSA's TAO and wanted to compromise the target systems of a rival nation, and you weren't targeting Composer as an easy way into software written in PHP, you're really bad at your job.

So let's be better at ours.

@alcohol
Copy link
Member

alcohol commented Mar 28, 2019

🤷‍♂️

It will be quite a long time until we actually drop support for PHP 5.x

@soatok
Copy link
Author

soatok commented Mar 28, 2019

I'm aware.

For some background: I do open source stuff (among other things) while streaming on Twitch. Someone asked about a Node.js project I'm building (misread npm as rpm and thought it was RedHat-specific) and we got talking about package managers. I mentioned that Composer was saner than others, and someone in chat interjected about the long install instructions.

So I started talking about how, if you hacked the server, you could replace the hash and the installer since they're in the same place but there's already a mechanism in place to verify the hashes (which change infrequently) using GPG. And then I started drafting an example of what a Ed25519-SHA384 installer would look like. And since I had taken the trouble to write that, I figured I'd submit it for the Composer team's eventual consideration.

I won't be offended at all if this collects dust for years before being merged.

(You can see the discussion surrounding this towards the end of the broadcast if you're curious.)

@alcohol
Copy link
Member

alcohol commented Mar 28, 2019

I think that if you managed to hack the server, we'd have bigger issues. It opens up a range of attack vectors, least of all the install script.

Also I think the install script actually is not used that much anymore. We also offer official Composer docker containers, the Phar as a release asset on Github, etc. I think it might be more interesting to sign the Phar artifacts themselves? Most distribution channels would benefit from that.

@soatok
Copy link
Author

soatok commented Mar 28, 2019

If I understand correctly, Phars can only be "signed" (tortured misuse of cryptography terms) using hash functions or via OpenSSL (which doesn't support Ed25519), and furthermore, you can strip an OpenSSL signature to replace it with SHA1 and PHP will not complain.

Fixing that will require reworking some of the Phar extension in PHP 8.

@composer composer deleted a comment Jun 5, 2019
@Seldaek
Copy link
Member

Seldaek commented Jul 29, 2019

@soatok I fail to see how switching the signing algo would prevent anything in the case where the server serving that page is hijacked? Can't the attacker show a different piece of install code there then? Or at least change the signature and key to be theirs? Most people copy paste this stuff blindly anyway.. And for those who don't, we already offer a way to check from a different source, granted only with sha-384 atm but AFAIK that is still considered safe against collision attacks?

Copy link

@zozo699 zozo699 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yusufsuryanata1999
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants