js-stellar-base icon indicating copy to clipboard operation
js-stellar-base copied to clipboard

Security issue: insecure dep is used, upgrade to something better

Open paulmillr opened this issue 2 years ago • 7 comments

You are using tweetnacl, which allows forged signatures.

I suggest to upgrade to noble-curves, which are modern, audited, support ESM+Common.js and a bunch of other stuff. The noble libraries are used all over Ethereum and Solana ecosystems already.

paulmillr avatar May 06 '23 02:05 paulmillr

When you say it allows forged signatures, do you mean it can easily generate forged signatures, or it validates forged signatures? Could you link to a cve or some vulnerability report so i can review this? Thank you.

silence48 avatar Jun 11 '23 21:06 silence48

It seems to have to do with the verification of the signature using the ed25519 class provided by tweetnacl, referencing your issue in the parent repo was helpful https://github.com/dchest/tweetnacl-js/issues/253 I agree we should probably find a way to negate this.

silence48 avatar Jun 11 '23 21:06 silence48

https://github.com/paulmillr/noble-curves fixes this, it's very easy to switch

paulmillr avatar Jun 11 '23 22:06 paulmillr

I hope you can understand why someone would hesitate to move a mission-critical security library that has been stable for years to someone promoting their own repository, whose code was audited prior to a 1.0 release.

Notably, this isn't a Stellar issue (the network itself uses libsodium), and tweetnacl.js is a fallback library here, but I'd still like to investigate whether https://github.com/dchest/tweetnacl-js/issues/253 can affect the ecosystem somehow and whether a fork would be a preferred solution to limit generating a new attack surface. The report is deeply appreciated!

Shaptic avatar Jun 12 '23 19:06 Shaptic

someone promoting their own repository, whose code was audited prior to a 1.0 release

Yeah, I promote it, and because of the promotion it's been funded by ethereum foundation, optimism, used in many wallets, protonmail, and others.

I don't see any problem with promotion and proper competition. Do you?

paulmillr avatar Jun 12 '23 21:06 paulmillr

Also not sure what this means

whose code was audited prior to a 1.0 release

I've released noble-ed25519 in june 2019, 4 years ago. Promoting a new player in the field was hard and time-consuming. The first audit of secp was executed in april 2021, 26 months ago.

paulmillr avatar Jun 12 '23 21:06 paulmillr

It's time to hack stellar.

Uzlopak avatar Jun 22 '23 08:06 Uzlopak