Skip to content

SEP-10 challenge TOCTOU race allows double JWT issuance #72

Description

@DeFiVC

What

The verifyChallenge method checks redis.exists() at line 81 and only deletes the challenge at line 150, after a long processing window (XDR decoding, signature verification, database queries). Two concurrent verify requests for the same address can both pass the exists check before either deletes the key. Both then successfully verify and both get JWTs issued.

Why

An attacker can obtain multiple JWTs from a single SEP-10 challenge, enabling token multiplication.

Scope

  • Use an atomic check-and-delete operation (e.g., Redis GETDEL or a Lua script)
  • Ensure the challenge is consumed exactly once

Acceptance Criteria

  • Two concurrent verify requests for the same challenge only succeed once
  • The challenge is atomically consumed (checked + deleted in one operation)

Technical Context

  • File: src/modules/auth/auth.service.ts, lines 81-150
  • Current flow: redis.exists() → verify → redis.del()
  • Fix: Use redis.getdel() or a Lua script for atomic check-and-delete

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26bugSomething isn't workingsecuritySecurity concern

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions