# GHSA-h24c-6p6p-m3vx: tss-lib leaks secret keys in response to incorrectly constructed Paillier moduli

> An attacker can recover shared secret keys in tss-lib by exploiting unverified Paillier moduli during threshold ECDSA signing.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 1 Sep 2023

## What is GHSA-h24c-6p6p-m3vx?

GHSA-h24c-6p6p-m3vx is a vulnerability in github.com/bnb-chain/tss-lib, published on 1 Sep 2023. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

### Impact

The specification of the GG18 threshold ECDSA signature protocol contains a vulnerability allowing an attacker to recover the shared secret key. If a participant generates a Paillier modulus `N` containing small factors (less than `2^100`) they can interact with other participants in the signing protocol to steal their secret key shares in as little as sixteen signing attempts. The master key can then be reconstructed from these shares.

### Patches

The implementation of GG18 in tss-lib did not prove that `N` is biprime or that it doesn't contain small factors. The fixed implementation adds the following proofs from the CGGMP21 threshold ECDSA protocol to the key generation:

- Paillier-Blum Modulus (`N` is the product of two primes)
- No Small Factor (both factors of `N` are greater than `2^256`)

These proofs apply to both the Paillier encryption modulus `N`, and the modulus `NTilde` used in MTA proofs.

To address the issue in the resharing protocol, an additional round has been added to the end so that participants can confirm that they received valid proofs.

### References

- [GG18](https://eprint.iacr.org/2019/114)
- [CGGMP21](https://eprint.iacr.org/2021/060)

## Which versions are affected by GHSA-h24c-6p6p-m3vx?

2 open source packages ship an affected version, including github.com/bnb-chain/tss-lib.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/bnb-chain/tss-lib` | Go | All versions to 1.3.5 | None |
| `github.com/bnb-chain/tss-lib` | Go | All versions to 1.3.5 | None |

## How do I fix GHSA-h24c-6p6p-m3vx?

No fix has been published for GHSA-h24c-6p6p-m3vx yet. Limit exposure of the affected software until one is available.

## Is GHSA-h24c-6p6p-m3vx being exploited?

There is no known exploitation of GHSA-h24c-6p6p-m3vx in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-h24c-6p6p-m3vx and fix it if it is affected.

What it is: GHSA-h24c-6p6p-m3vx is a vulnerability in github.com/bnb-chain/tss-lib, published on 1 Sep 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-h24c-6p6p-m3vx in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/bnb-chain/tss-lib (Go): affected all versions up to 1.3.5; no fix listed
- github.com/bnb-chain/tss-lib (Go): affected all versions up to 1.3.5; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-h24c-6p6p-m3vx/ (Markdown: https://insights.sbomify.com/GHSA-h24c-6p6p-m3vx/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-h24c-6p6p-m3vx

---
From sbomify Insights: https://insights.sbomify.com/GHSA-h24c-6p6p-m3vx/
Summaries are generated and may contain mistakes; the official description above is the record.
