Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
근본 목적
현행 JWT/Redis JTI 회전 구조를 유지한 상태에서, 동시성/재사용/응답 유실/순서 역전 조건에서 탈취 감지 성능과 오감지 여부를 실측 데이터로 검증하고, 운영 관점에서 신뢰 가능한 결론을 도출한다.
비목적
토큰 구조 변경, Redis 키 구조 변경, 인증 정책 변경, 방어 로직 리팩터링은 본 PR 범위에 포함하지 않는다.
변경 요약
docker/security/docker-compose.jwt-matrix.ymldocker/security/env.jwt-matrix.examplescripts/security/jwt-attack-matrix.jsonscripts/security/run-jwt-attack-matrix.shscripts/security/score-jwt-attack-matrix.shdocs/security/jwt-jti-attack-matrix-validation.md검증
bash -n scripts/security/run-jwt-attack-matrix.shbash -n scripts/security/score-jwt-attack-matrix.shjq empty scripts/security/jwt-attack-matrix.json.ai/scripts/verify-purpose-focus.sh docs --staged.ai/scripts/verify-before-commit.shSCENARIOS=N1 ./scripts/security/run-jwt-attack-matrix.sh./scripts/security/run-jwt-attack-matrix.sh/tmp/syncly-jwt-matrix/results-20260226T065752Z.ndjson(74 requests)/tmp/syncly-jwt-matrix/summary-20260226T065752Z.json실험 수행 방식 (JWT)
이번 실험은 "가설이 실제 트래픽 형태에서 유지되는가"를 보기 위해, 단순 단건 API 확인이 아니라 요청 순서와 클라이언트 반영 상태까지 통제하는 방식으로 수행했다.
login으로 동일 조건의 refresh token을 발급받고, 해당 토큰의sub/did/jti를 기준 축으로 삼았다.reissue호출 직전/직후에 Redis 키(refresh:current:{userId}:{deviceId},CASHED:UA_HASH:{userId}:{deviceId})를 읽어 상태 전이를 기록했다.Set-Cookie를 적용하지 않는 방식으로 재현했다(drop).UA 상이,UA 동일 spoof,UA 없음,선점,대량 병렬 재사용으로 분해해 어떤 조건에서 탐지/미탐이 생기는지 분리 관찰했다.초기 테스트 목적과 검증 키 포인트
초기 목적은 다음 다섯 가지였다.
재사용 탐지: 이미 rotate된 refresh token이 다시 들어오면 탐지되는가.동시성 안전성: 동일 token 동시 요청에서 Redis current가 일관되게 수렴하는가.응답 유실 UX: 패킷 유실 상황에서 정상 사용자 재시도를 허용하는가.경계조건 안정성: 응답 순서 역전에서 오탐/미탐이 생기는가.정량 판단: 결과를 느낌이 아니라 TP/FN/FP/TN으로 평가 가능한가.실험은 위 키 포인트를 각각 독립 시나리오(N1
N5, A1A8)로 분리해 검증했다.지표 정의와 의미
detection_rate = TP / (TP + FN)false_positive_rate = FP / (FP + TN)요청 단위는 시스템이 "각 요청"을 얼마나 정확히 판단하는지 보여주고, 인시던트 단위는 운영자가 체감하는 "한 사건" 단위 방어 성공률을 보여준다.
결과 상세 해석 (서술)
전체 74개 요청에서 request level은
TP=56, FN=9, FP=1, TN=8이었고, detection rate는0.8615, false positive rate는0.1111이었다.이 수치는 현재 구현이 공격 재사용을 상당수 잡아내지만, 특정 경계조건에서 미탐과 오탐이 분명히 존재함을 의미한다.
JWT401_06 + current key 삭제로 귀결됐다.incident_detected=false였다.incident level에서는
TP=7, FN=1, FP=1, TN=4, detection rate0.875, false positive rate0.2였다.즉 공격 시나리오 8개 중 7개는 최소 1회 이상 탐지했지만, 1개(A2)는 끝까지 놓쳤고, 정상 시나리오 5개 중 1개(N3)는 사건 단위 오탐으로 집계됐다.
엔지니어링 결론 (JWT)
이 실험 결과를 이슈 목적(탈취 감지/무효화 검증)에 대입하면, "원자적 JTI 비교/교체가 재사용 공격을 다수 조건에서 유의미하게 억제한다"는 가설은 검증되었다.
반면 "탈취 감지율 100%, 오감지 0건"은 현재 데이터로는 성립하지 않는다. 따라서 포트폴리오 문구는 수치와 한계를 함께 제시하는 형태로 작성해야 기술적으로 정직하다.
현행 uaHash 방식 한계 명시
관련 이슈