피드로 돌아가기
I Reverse-Engineered Claude Code's /buddy System and Got a Legendary Cat — Here's How to Reroll Yours
Dev.toDev.to
Infrastructure

FNV-1a 해시와 Mulberry32 PRNG 역분석으로 Claude Code /buddy 생성 알고리즘 해킹함

I Reverse-Engineered Claude Code's /buddy System and Got a Legendary Cat — Here's How to Reroll Yours

ithiria8942026년 4월 1일3intermediate

Context

Claude Code의 /buddy companion 시스템이 identity 기반 deterministic 생성 알고리즘을 사용함. 사용자는 OAuth Team/Pro 플랜의 oauthAccount.accountUuid가 userID보다 우선 적용되는 구조적 문제를 발견함. 기본 제공 Epic Cactus 대신 Legendary Cat을 획득하기 위해 소스코드 수준의 분석이 필요함.

Technical Solution

  • FNV-1a 해시: identity + "friend-2026-401" 문자열을 결합하여 32비트 해시값 생성함
  • Mulberry32 PRNG: 생성된 해시값을 시드로 사용하여 rarity, species, 외형 특성을 순차적으로 결정함
  • Rarity 가중치: Common 60%, Uncommon 25%, Rare 10%, Epic 4%, Legendary 1% 순서로 분배됨
  • oauthAccount.accountUuid 제거: nullish coalescing 연산자로 userID fallback을 활성화함
  • companion 필드 삭제 후 재시작: fresh hatch를 강제하여 새로운 companion 생성_trigger함

Impact

대상 species × rarity 조합에 따라 수십만~수백만 회의 brute-force 연산 필요. Legendary Dragon의 경우 약 200만 회 시도 예상.

Key Takeaway

설정 파일의 단일 필드 제거만으로 의도한 companion 생성이 가능함. name, personality, hatchedAt만 persistent 저장되고 rarity, species, stats는 매 읽기 시 재계산되는 구조임.


Claude Code Team/Pro 플랜 사용자가 Legendary companion을 획득하려면 ~/.claude.json에서 oauthAccount.accountUuid 필드만 제거하고 userID에 brute-force한 값을 설정한 뒤 companion 필드를 삭제 후 재시작하면 됨. Anthropic 강제 재로그인 시 accountUuid가 복원되므로 fix.sh 스크립트 준비 필요함.

원문 읽기