Skip to content

Security Model

Altug Tatlisu edited this page Dec 6, 2025 · 1 revision

Security Model

Threat Model

Assumptions

Trusted:

  • Institution's private key security
  • Database integrity (PostgreSQL)
  • Cache integrity (Redis)

Untrusted:

  • Network communication
  • Client software
  • External observers

Adversary Capabilities

  • Network eavesdropping
  • Man-in-the-middle attacks
  • Client compromise
  • Double-spend attempts

Cryptographic Guarantees

Confidentiality

  • Network: TLS 1.3 encryption
  • Database: At-rest encryption (operator configured)
  • Keys: HSM storage recommended for production

Integrity

  • Signatures: RSA-3072 provides existential unforgeability
  • Transactions: PostgreSQL ACID guarantees
  • Messages: SHA-256 collision resistance

Anonymity

  • Unlinkability: Blind signatures prevent linking withdrawal to spending
  • Privacy: Server cannot determine which client spent which token

Double-Spend Prevention

Two-Tier Protection

Redemption Request
       ↓
   Redis Check (fast)
       ↓
   PostgreSQL Check (reliable)
       ↓
   Atomic Insert

Properties:

  • Redis: O(1) lookup, in-memory
  • PostgreSQL: ACID guarantees, persistent
  • Atomic: Both succeed or both fail

Race Condition Protection

PostgreSQL transaction isolation:

BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
-- Check and insert
COMMIT;

Attack Resistance

Forgery Attack

Attack: Create valid token without withdrawal
Defense: RSA signature unforgeability (3072-bit)

Double-Spend Attack

Attack: Spend same token twice
Defense: Atomic duplicate detection (Redis + PostgreSQL)

Linkability Attack

Attack: Link withdrawal to spending
Defense: Blind signature protocol unlinkability

Replay Attack

Attack: Reuse intercepted token
Defense: Serial number recorded, second use detected

Operational Security

Key Management

  • Private key: HSM storage (production)
  • Key rotation: Not implemented (future work)
  • Backup: Encrypted offline storage

Monitoring

  • Failed verification attempts
  • Double-spend attempts
  • Unusual withdrawal patterns
  • Database replication lag

Audit Trail

All transactions logged with:

  • Transaction ID
  • Timestamp
  • Amount
  • Token serial (after redemption)

Clone this wiki locally