April 05, 2019

WebGoat write up(JWT tokens 5 JWT cracking)

To comply with the rule, in this write up, some hints related to this challenge only will be mentioned.

룰을 준수하기 위해, 여기서는 챌린지와과 관련된 몇 가지 힌트만이 언급됩니다.

JWT cracking
With the HMAC with SHA-2 Functions you use a secret key to sign and verify the token. Once we figure out this key we can create a new token and sign it. So it is very important the key is strong enough so a brute force or dictionary attack is not feasible. Once you have a token you can start an offline brute force or dictionary attack.

JWT 크래킹.
HMAC, SHA-2 조합의 알고리즘에서는 서명 및 서명 검증 시 비밀 키(암호 키)를 이용한다. 일단 암호 키를 확보하게 되면 새로운 토큰을 만들고 서명할 수 있다. 그러므로 브루트 포스 공격이 통하지 않는 수준의 강력한 암호 키를 만드는 것은 중요하다. 일단 토큰을 획득하게 된다면 오프라인에서 브루트 포스나 딕셔너리 공격을 할 수 있을 것이다.

Assignment
Given we have the following token try to find out secret key and submit a new key with the userId changed to WebGoat.

도전.
아래와 같은 토큰을 획득하였다. 비밀 키를 찾은 뒤 유저 이름을 "WebGoat"로 변경된 새로운 토큰을 만들어 제출하라.

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJXZWJHb2F0IFRva2VuIEJ1aWxkZXIiLCJpYXQiOjE1MjQyMTA5MDQsImV4cCI6MTYxODkwNTMwNCwiYXVkIjoid2ViZ29hdC5vcmciLCJzdWIiOiJ0b21Ad2ViZ29hdC5jb20iLCJ1c2VybmFtZSI6IlRvbSIsIkVtYWlsIjoidG9tQHdlYmdvYXQuY29tIiwiUm9sZSI6WyJNYW5hZ2VyIiwiUHJvamVjdCBBZG1pbmlzdHJhdG9yIl19.vPe-qQPOt78zK8wrbN1TjNJj3LeX9Qbch6oo23RUJgM

JWT tokens 5 JWT cracking jwt2jtr

First, convert it suitable for "JtR" using "jwt2jtr.py". If you input "python jwt2jtr.py [JWT] >  [file name to save]" in CMD as above, it saves the changed JWT to the file. Note that you must not insert any characters back and forth except the token information that is in a single line. Check there is no space/newline character at the beginning or end.

먼저 JtR에 넣기 알맞게 "jwt2jtr.py"을 사용하여 형 변환을 해준다. 위와 같이"python jwt2tr.py [JWT] > [저장할 파일 명]"을 CMD에 입력하면 해당 파일에 형태가 변경된 JWT가 저장된다. 주의할 점은 한 줄로 쭉 적힌 토큰 정보 외에 앞뒤로 그 어떤 문자도 삽입되어서는 안 된다. 맨 처음이나 끝에 띄어쓰기나 엔터가 눌러져 있어도 안 된다.

JWT tokens 5 JWT cracking complete