GHSA-gp6j-vx54-5pmf: Incorrect validation of parties IDs leaks secret keys in Secret-sharing scheme
Noroxi assessment
Priority: Monitor (action score 0/100)
- The sources we track (CISA KEV, Exploit-DB, Metasploit, Nuclei, GitHub) show no public exploit code or exploitation in the wild.
- Fixed version: github.com/keep-network/keep-ecdsa (Go) 1.8.1.
Low priority for now. Upgrade to github.com/keep-network/keep-ecdsa (Go) 1.8.1 or later.
Generated automatically from the record's data: CVSS (NVD and CNA), CISA KEV and SSVC, FIRST EPSS, exploit sources, fixed versions. How we calculate it
Primary sources: OSV
# Summary In the threshold signature scheme, participants start by dividing secrets into shares using a secret sharing scheme. The Verifiable Secret Sharing scheme generates shares from the user’s IDs but does not properly validate them. Using a malicious ID will make other users reveal their secrets during the secret-sharing procedure. In addition, a second issue resulting from lack of validation could cause nodes to crash when sent maliciously formed user IDs. # Details The creation of Parties IDs does not properly validate for maliciously chosen IDs. Parties generate the secret shares in `binance-chain/tss-lib` codebase that `keep-network/keep-ecdsa` uses by evaluating the polynomial with the other parties’ IDs. It is critical that these party ids are non-zero because evaluating the polynomial at point 0 reveals the secret. There is a check that these ids are not zero, but this is insufficient since it is not performed modulo the curve order. Therefore, one can set their ID equal to the order of the elliptic curve, which equals 0 during the polynomial evaluation modulo the curve order. ``` shares := make(Shares, num) for i := 0; i < num; i++ { if indexes[i].Cmp(big.NewInt(0)) == 0 { return nil, nil, fmt.Errorf("party index should not be 0") } share := evaluatePolynomial(ec, threshold, poly, indexes[i]) shares[i] = &Share{Threshold: threshold, ID: indexes[i], Share: share} } ``` (https://github.com/binance-chain/tss-lib/blob/73560daec7f83d7355107ea9b5e59d16de8765be/crypto/vss/feldman_vss.go#L64-L70) Thus, a party with an ID equal to the order of the curve will receive the secret key as its share. Another issue with the tss-lib implementation was the lack of verification for modularly equal user IDs that can cause nodes to crash during key generation or resharing. # Timeline ### 6 December 2021, 20:28 CET The team is informed by Trail of Bits about the issue in `binance-chain/tss-lib`. The vulnerability was already disclosed with Binance and they have implemented fixes in their recent commits. We are advised to update our dependency to the most recent `binance-chain/tss-lib` version. ### 7 December 2021, 9:10 CET The team confirms with Trail of Bits we started the work on a fix. ### 7 December 2021, 20:03 CET The team informs Trail of Bits that we found a potential problem in Binance's fix that may lead to the signing code failing with Go panic. We identified the problematic line and suggested its removal. To address the vulnerability in the protocol, it is required to ensure that: - all indexes are non-zero, - all indexes are non-zero modulo the curve order, - all indexes are unique modulo the curve order. The first two are guarded in `CheckIndexes` function by: ``` vMod := new(big.Int).Mod(v, ec.Params().N) if vMod.Cmp(zero) == 0 { return nil, errors.New("party index should not be 0") } ``` The last one is guarded by: ``` if sortutil.Dedupe(sortutil.BigIntSlice(dup)) < len(indexes) { return nil, errors.New("duplicate in indexes") } ``` However, `CheckIndexes` was additionally modified to update values of passed indexes by doing `indexes[i] = vMod`. This line was not backward-compatible and caused signatures to fail with `panic: runtime error: invalid memory address or nil pointer dereference` in case the signing group was generated with at least one `PartyID.Key` higher than `ec.Params().N`. This would also be problematic for new code that constructs such `PartyID` - we tested that key generation completed successfully but signing failed with the mentioned panic. ### 8 December 2021, 12:49 CET Trail of Bits confirmed the line we flagged is not critical to the security of the protocol. ### 8 December 2021, 15:29 CET The team informed Trail of Bits we are planning to open a PR to `binance-chain/tss-lib` with a fix and we suggest extending the embargo for communicating this issue for one more week, until Friday, Dec 17h to give everyone more time update their code given the problem was found. We also ask Trail of Bits to get in touch with Binance to review our fix given that we are not going to provide a sufficient explanation in the commit and PR description to do not threaten the security of projects that have already upgraded their dependency. ### 8 December 2021, 18:17 CET The team informs Trail of Bits about opening a PR https://github.com/binance-chain/tss-lib/pull/155 and explains all the details of the issue. The problematic scenario is: 1. We start the keygen by creating `PartyID` for each member. The `PartyID` struct has `Id` and `Key` fields. We set `PartyID.Key` that is higher than the elliptic curve's `N`. 2. This goes to tss-lib which starts the round 1 code (`ecdsa/keygen/round_1.go`). It takes `PartyID.Key` of each member and assembles the `ids` slice. This slice is thrown into `CheckIndexes` which overwrites each element by doing the modulo `N`. 3. After returning from `CheckIndexes` the modified `ids` slice is used to set the `Ks` slice in the final `LocalPartySaveData` which is received by each group member as keygen final result. 4. Each member takes this `LocalPartySaveData` and saves it on disk. 5. Upon signing, we do the same as in point 1, so we construct `PartyID`s in the same way and start the protocol. At this point, `PartyID.Key` is higher than curve's `N`. 6. Before starting round 1 of signing, `LocalPartySaveData` obtained at keygen and our `PartyID`s built at point 5 are used in `BuildLocalSaveDataSubset` to build a new `LocalPartySaveData` instance. 7. `BuildLocalSaveDataSubset` is the place where things go wrong because `Key` field of each `PartyID` from point 5 doesn't correspond to encoded `Ks` elements of `LocalPartySaveData` obtained after keygen, the final `LocalPartySaveData` is corrupted, and cause panic upon validation before signing round 1. ### 8 December 2021, 21:50 CET Trail of Bits confirms they are going to followup with Binance and they agree to extend the embargo by a week. ### 8 December 2021, 15:16 CET Trail of Bits validates the problematic scenario we described and our fix. Trail of Bits reaches to Binance and recommends merging our fix and in addition to some other fixes that would secure the code to do not panic even if `LocalPartySaveData` has corrupted data. ### 10 December 2021, 8:16 CET Binance merges our fix https://github.com/binance-chain/tss-lib/commit/cd95cee01ea2af6d4aa8316612803be944d5369a ### 13 December 2021, 8:35 CET Binance applies more fixes so that even in case of `LocalPartySaveData` corrupted, the code is not going to panic. ### 15 December 2021 The team releases a new version of the client, v1.8.1, and announces the need for an upgrade. https://github.com/keep-network/keep-ecdsa/releases/tag/v1.8.1
- Published
- Jan 6, 2022
- Updated
- Aug 21, 2024
- EPSS
- —
- CWE
- —
Report tools
Action score
0
Low priority for now.
- CVSS
- 0 / 40 · —
- CISA KEV
- 0 / 30 · Not listed
- EPSS
- 0 / 30 · —
Get told when this record changes
- Not in KEV: no record of exploitation in the wild
- No public exploit code on record
- A fix has been released
If any of these changes, we'll tell you in the daily email digest.
Is your version affected? Check itNoroxi analysis
What does it mean in your environment?
The assessment above is generated automatically from the record's data; it doesn't know your environment. Our team verifies on your systems whether this vulnerability is actually exploitable and which mitigation is enough.
We use this product, ask for helpAffected systems
Is your version affected?
Pick the product and type the version you run. It's compared with this record's version ranges in your browser; the version isn't sent anywhere.
| Vendor | Product | CPE |
|---|---|---|
| Go | github.com/keep-network/keep-ecdsa | pkg:golang/github.com/keep-network/keep-ecdsa |
Package-level exposure
OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.
| Ecosystem | Package | Affected range | Fix |
|---|---|---|---|
| Go | github.com/keep-network/keep-ecdsa | before 1.8.1 | 1.8.1 |
Same product
Go: all recordsOther highest-scoring records for the same primary product.
- GO-2022-0367Incorrect validation of parties IDs leaks secret keys in Secret-sharing scheme in github.com/keep-network/keep-ecdsa0Monitor
Remediation
Which version to upgrade to
Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.
| Product / package | Fixed version | Source |
|---|---|---|
| Go:github.com/keep-network/keep-ecdsa | 1.8.1 | Package registry (OSV) |
Exploit status
No known public exploit
No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.
Research context
For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.
Timeline
From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.
No dated events beyond publication.
Not on record for this CVE: EPSS history · patch commit or PR link · researcher credit · variant or chain candidate · public bounty program.
Technical details
No CVSS vector for this record, so attack conditions can't be derived.
Weakness class (CWE)
—
Attack context
MITRE CAPEC attack patterns and ATT&CK techniques for this weakness class (CWE). A starting point for detection rules and threat hunting.
MITRE has no CAPEC/ATT&CK mapping for this CWE.
Change log (2)
- Fix✗ → ✓
- CVSS9.5 → —
For records you follow, these changes also arrive as notifications. →
References
Show all references (2 more)Show less
Vendor advisories and official records. Exploit/PoC links are deliberately left out.