GitHub Advisoryadvisory · RubyGems
GHSA-hc36-c89j-5f4j bsv-sdk and bsv-wallet persist unverified certifier signatures in acquire_certificate (direct and issuance paths)
HIGH
Official page ↗
- Aliases
- CVE-2026-40070
- Ecosystem
- RubyGems
- Packages
- bsv-sdk, bsv-wallet
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
- Weaknesses
- CWE-347
- Reviewed
- 2026-04-09
Affected packages
• RubyGems bsv-sdk: >= 0.3.1, < 0.8.2 → fixed in 0.8.2
• RubyGems bsv-wallet: >= 0.1.2, < 0.3.4 → fixed in 0.3.4
Description
Unverified certifier signatures persisted by `acquire_certificate`
Affected packages
Both `bsv-sdk` and `bsv-wallet` are published from the sgbett/bsv-ruby-sdk repository. The vulnerable code lives in `lib/bsv/wallet_interface/wallet_client.rb`, which is physically shipped inside both gems (the `bsv-wallet.gemspec` `files` list bundles the entire `lib/bsv/wallet_interface/` tree). Consumers of either gem are independently vulnerable; the two packages are versioned separately, so each has its own affected range.
| Package | Affected | Patched |
| --- | --- | --- |
| `bsv-sdk` | `>= 0.3.1, = 0.1.2, 'true' },
keyring_for_subject: {}
)
client.list_certificates(
certifiers: [claimed_trusted_pubkey_hex],
types: ['age-over-18']
)
=> returns the forged record as if it were a real certificate from that certifier
```
Affected versions
The vulnerable direct-path code was introduced in commit `d14dd19` ("feat(wallet): implement BRC-100 identity certificate methods (Phase 5)") on 2026-03-27 20:35 UTC. The vulnerable issuance-path code was added one day later in `6a4d898` ("feat(wallet): implement certificate issuance protocol", 2026-03-28 04:38 UTC), which removed an earlier `raise UnsupportedActionError` and replaced it with an unverified HTTP POST.
`bsv-sdk`: the v0.3.1 chore bump (`89de3a2`) was committed 28 minutes after `d14dd19`, so the direct-path bypass shipped in the v0.3.1 tag. The v0.3.1 release raised `UnsupportedActionError` for the issuance path, so the issuance-path bypass first shipped in v0.3.2 (`5a335de`). Every subsequent release up to and including v0.8.1 is affected by at least one path, and every release from v0.3.2 onwards is affected by both. Combined affected range: `>= 0.3.1, = 0.1.2, = 0.8.2` and/or `bsv-wallet >= 0.3.4`. Both releases ship the same fix: a new module `BSV::Wallet::CertificateSignature` (`lib/bsv/wallet_interface/certificate_signature.rb`), which builds the BRC-52 canonical preimage (`type`, `serial_number`, `subject`, `certifier`, `revocation_outpoint`, lexicographically-sorted `fields`) and verifies the certifier's signature against it via `ProtoWallet#verify_signature` with protocol ID `[2, 'certificate signature']` and counterparty = the claimed certifier's public key. Both `acquire_via_direct` and `acquire_via_issuance` now call `CertificateSignature.verify!` before returning the certificate to `acquire_certificate`, so invalid certificates raise `BSV::Wallet::CertificateSignature::InvalidError` (a subclass of `InvalidSignatureError`) and are never written to storage.
Consumers should upgrade whichever gem they depend on directly; they do not need both. `bsv-wallet 0.3.4` additionally tightens its dependency on `bsv-sdk` from the stale `~> 0.4` to `>= 0.8.2, < 1.0`, which forces the known-good pairing and pulls in the sibling advisory fixes (F1.3, F5.13) tracked separately.
The issuance-path fix also partially closes finding F8.16 from the same compliance review. F8.16's second aspect — switching the issuance transport from ad-hoc JSON POST to BRC-104 AuthFetch — is not addressed here and remains deferred to a future release.
Fixed in sgbett/bsv-ruby-sdk#306.
Workarounds
If upgrading is not immediately possible:
• Do not expose `acquire_certificate` (either acquisition protocol) to untrusted callers.
• Do not invoke `acquire_certificate` with `acquisition_pr…
Related
Alias · CVE (1)
- CVE-2026-40070 BSV Ruby SDK is the Ruby SDK for the BSV blockchain. vulnerability
Weakness · CWE (1)
- CWE-347 Improper Verification of Cryptographic Signature weakness
References
- https://github.com/sgbett/bsv-ruby-sdk/security/advisories/GHSA-hc36-c89j-5f4j web
- https://nvd.nist.gov/vuln/detail/CVE-2026-40070 advisory
- https://github.com/sgbett/bsv-ruby-sdk/issues/305 web
- https://github.com/sgbett/bsv-ruby-sdk/pull/306 web
- https://github.com/sgbett/bsv-ruby-sdk/commit/4992e8a265fd914a7eeb0405c69d1ff0122a84cc web
- https://brc.dev/52 web
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/bsv-sdk/CVE-2026-40070.yml web
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/bsv-wallet/CVE-2026-40070.yml web
- https://github.com/sgbett/bsv-ruby-sdk package