Crypto address checksum validation where applicable
Why it matters
Ethereum EIP-55 mixed-case checksum and Bitcoin Base58Check both exist to catch single-character typos that would otherwise route funds to a valid-looking but incorrect address. A format-only regex (/^0x[0-9a-fA-F]{40}$/) accepts thousands of invalid checksummed Ethereum addresses — funds sent to those addresses are irreversibly lost. OWASP A03 applies: crypto wallet addresses are untrusted user input that requires structural validation, not just length checks.
Severity rationale
Low because checksum-only failures affect a minority of malformed addresses, but any missed typo results in an irreversible fund loss with no recourse.
Remediation
Add checksum validation for each crypto address type accepted by the application. For Ethereum, implement EIP-55 in src/lib/validators.ts.
// src/lib/validators.ts (Ethereum EIP-55)
export function isValidEthAddress(address: string): boolean {
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) return false;
// All-lowercase or all-uppercase passes (no checksum to verify)
const stripped = address.slice(2);
if (stripped === stripped.toLowerCase() || stripped === stripped.toUpperCase()) return true;
const hash = keccak256(stripped.toLowerCase());
return stripped.split('').every((c, i) =>
parseInt(hash[i], 16) >= 8 ? c === c.toUpperCase() : c === c.toLowerCase()
);
}
Apply as a Zod .refine() in src/lib/schemas.ts and validate server-side in the relevant API route.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Financial Form Validation Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-20 — Improper Input Validation
- owasp:2021 · A03
Taxons
History
- 2026-04-18·v1.0.0·Initial import from finserv-form-validation·automated