🇰🇷 한글 설명
ZenHive mpp의 type="hash" 인증 방식에서 발생하는 TOCTOU(Time-of-check Time-of-use) 레이스 컨디션 취약점입니다. 인증되지 않은 원격 클라이언트가 하나의 온체인 결제 해시를 사용하여 여러 번의 유료 리소스 접근을 수행할 수 있습니다. 이는 결제 확인과 사용 처리 과정이 원자적(Atomic)으로 이루어지지 않아 발생합니다.
💡 쉬운 설명
결제 영수증을 확인하고 '사용 완료' 도장을 찍는 사이에 아주 짧은 간격으로 여러 번 요청을 보내면, 도장이 찍히기 전이라 결제가 여러 번 인정되는 문제입니다. 이를 통해 한 번의 결제로 여러 번의 서비스를 몰래 이용할 수 있습니다.
🇺🇸 원문 (English)
Time-of-check Time-of-use (TOCTOU) Race Condition in ZenHive mpp allows an unauthenticated remote client to redeem one confirmed on-chain payment for multiple paid-resource accesses.
The type="hash" credential path in MPP.Methods.Tempo.verify/2 guards against replay with a non-atomic check-then-mark sequence: check_hash_unused/2 reads the dedup store, an eth_getTransactionReceipt round trip verifies the payment on chain, and only then does mark_hash_used/2 write the mark. Concurrent requests carrying the same settled payment hash all pass the read before any of them writes, so each is issued a receipt. The store's atomic check_and_mark/2 primitive is available and used by the type="transaction" path, but the hash path calls plain get and put even when the configured store implements it. Exploitation requires a dedup store to be configured; the default nil store is stateless and documented as offering no replay protection at all.
This issue affects mpp: from 0.2.0 before 0.6.1.
📍 영향받는 시스템
mpp: 0.2.0 버전부터 0.6.1 미만 버전
⚔️ 공격 벡터
동일한 결제 해시를 포함한 다수의 요청을 거의 동시에 전송하는 레이스 컨디션 공격
🛡️ 대응 방법
mpp를 0.6.1 이상의 버전으로 업데이트하거나, hash 경로에서도 원자적 연산인 check_and_mark/2를 사용하도록 수정해야 합니다.
🔧 검증 코드
출력 결과에 0.2.0 이상 0.6.1 미만의 버전이 포함되어 있다면 취약한 상태입니다.
dpkg -l | grep mpp 2>/dev/null | grep -E '0.2.0|0.6.0'