Files
security/SECURITY_FIXES_2025.md
zeekay cda011ebde chore: sync working tree
Commits 2 outstanding change(s) that were sitting uncommitted.
No build artifacts and no secrets in the changeset (both checked).
2026-07-26 10:03:12 -07:00

3.7 KiB

Security Fixes Applied - 2025

Summary

This document tracks security-related fixes applied to the Lux node codebase.

Critical Fixes

1. Timer Stoppage Race Fix (2025-11-11)

Reference: SECURITY_STABILITY_AUDIT.md section 2.3 File: /network/throttling/inbound_resource_throttler.go

Issue: Non-blocking timer drain could miss draining channel due to race.

Before (buggy):

if !timer.Stop() {
    select {
    case <-timer.C:
    default:  // Could miss drain!
    }
}

After (correct):

if !timer.Stop() {
    <-timer.C  // Blocking ensures drain
}

2. P-Chain Validator Set Race (Verified)

Location: /vms/platformvm/vm.go:367 Status: Already uses validators.NewLockedState(&vm.lock, validatorManager)

3. Sync Work Overlap Prevention (Verified)

Location: /x/sync/manager.go:999-1010 Status: Already checks startEqualsMid || midEqualsEnd to prevent invalid ranges

4. MerkleDB Crash Recovery (Verified)

Location: /x/merkledb/db.go:321-339 Status: Shutdown marker checked BEFORE root initialization (correct order)

5. MerkleDB Cache Eviction (Verified)

Location: /x/merkledb/cache.go Status: Uses wrappers.Errs for error handling (no panic on eviction)

6. Crypto UnmarshalText Fix (2025-11-11)

Commit: 967b3381c5 File: /crypto/secp256k1/keys.go

Issue: PrivateKey.UnmarshalText incorrectly called UnmarshalJSON. Solution: Created shared unmarshalText() helper for both JSON and Text methods.

7. Reflect Codec Array Type Check (2025-11-11)

Commit: b3babd5092 File: /node/codec/reflectcodec/type_codec.go

Issue: Array marshaling checked wrong type (value.Type() instead of value.Type().Elem()). Solution: Fixed to check element type + added CanAddr() safety check.

8. ProposerVM Goroutine Leak Fix (2025-11-11)

Commit: 60fd0c91db File: vms/proposervm/scheduler/scheduler.go

Issue: time.After() leaks goroutines on context cancellation. Solution: Replaced time.After with explicit timer + defer timer.Stop()

FHE T-Chain Security (2025-12-28)

Location: vms/mpcvm/fhe/

Security Hardening Applied

  1. Commitment verification before accepting DKG shares
  2. Caller authentication on permit creation
  3. Constant-time comparisons using crypto/subtle
  4. Nonce/expiry validation to prevent replay attacks
  5. Lock release before callbacks to prevent deadlocks

Key Commits

a65f8f9ec0 fhe: comprehensive security fixes from CTO swarm review
78e4d51496 security(mpcvm/fhe): fix critical security issues from CTO audit
323877830d fhe: implement proper DKG using lattice multiparty Shamir secret sharing

luxd Security Ports (2025-11-11)

Implemented and Verified (22 improvements)

  1. ✅ HTTP/2 Connection Reuse Fix (CleanlyCloseBody)
  2. ✅ RTT Measurement (atomic ping/pong tracking)
  3. ✅ NetID Caching in ProposerVM (4096-entry LRU)
  4. ✅ SetPreferenceWithContext (context cancellation respect)
  5. ✅ Remove MaxContiguousHeight (simplification)
  6. ✅ GetAllValidatorsAt Endpoint (P-chain RPC)
  7. ✅ Warp Validator Set Caching (8-entry post-Granite LRU)
  8. ✅ Warp Validator Set Accessors (consensus package integration)
  9. ✅ HeightIndex Database Interface
  10. ✅ GetProposedHeight API (proposervm service)
  11. ✅ Crypto UnmarshalText Fix
  12. ✅ Reflect Codec Array Fix
  13. ✅ HeightIndex In-Memory Implementation
  14. ✅ ProposerVM Goroutine Leak Fix
  15. ✅ Genesis Validation Tests
  16. ✅ Deadlock Detection Tests
  17. ✅ Timer Stoppage Race Fix
  18. ✅ P-Chain Validator Set Race Protection
  19. ✅ Sync Work Overlap Prevention
  20. ✅ MerkleDB Crash Recovery
  21. ✅ MerkleDB Cache Eviction Safety
  22. ✅ Validator Set Historical Diffs

Last Updated: 2025-12-28