Skip to content

Harden secp256k1 usage per cryptographic audit findings #429

Description

@Lakes41

Difficulty: Expert
Type: Security
Recommended labels (if available in this repo): security, crypto, sdk

Background

docs/cryptographic-audit-secp256k1.md documents an audit of the SDK's secp256k1 usage in src/crypto/secp256k1.ts. Audit documents like this typically flag specific findings (e.g. signature malleability, non-constant-time comparisons, insufficient nonce validation) that need remediation.

Problem

Whatever findings are documented in the audit currently remain in the codebase as documentation only — there is no corresponding tracked remediation work applied to src/crypto/secp256k1.ts.

Expected Outcome

Every finding in docs/cryptographic-audit-secp256k1.md is either remediated in code or explicitly documented as accepted risk with justification, and the audit doc is updated to reflect remediation status.

Suggested Implementation

Work through the audit document finding-by-finding. Common secp256k1 pitfalls to check for specifically: signature malleability (ensure s values are in the lower half of the curve order, per EIP-2), timing side-channels in comparison operations, and correct recovery-id handling. Apply fixes with accompanying regression tests, and update the audit doc's status column/section per finding.

Acceptance Criteria

  • Every finding in the audit doc has a corresponding code change, test, or explicit documented risk acceptance
  • Signature malleability protections verified with a test using a known malleable signature pair
  • No regressions in existing signature verification behavior — all existing crypto tests still pass
  • Audit doc updated with remediation status per finding
  • pnpm test:run passes

Likely Affected Files/Directories

  • docs/cryptographic-audit-secp256k1.md
  • src/crypto/secp256k1.ts
  • src/eip712/eip712.helpers.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSGrantFox Open Source Sponsorship program tagMaybe RewardedIssue may qualify for a reward upon successful completion per campaign rulesOfficial Campaign | FWC26Official FWC26 campaign issue — eligible for campaign scoring and rewards

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions