[Crypto] []root

Our guy inside e-corp was able to get that packet capture of their backend PKI you asked for. Unfortunately it seems they’re using TLS to protect the modulus fetch. Now, I have been told that the best crackers in the world can do this in 60 minutes. Unfortunately I need someone who can do it in 60 seconds.

Note: Flag does not follow the "Flag:" format but is recognizable

e_corp_pki.pcapng

e_corp_pki.pcapng를 와이어샤크를 통해 열면 아래와 같은 모습이다.

서버 인증서와 RSA 퍼블릭 키를 갖고 있는 Server Hello에 해당하는11번 프레임으로부터 n과 e를 알아낸다.

e는 31337이다.

n 값을 hex에서 decimal로 변환하면 아래와 같다.

decimal로 변환한 n 값을 http://factordb.com에 넣으면 아래와 같이 p와 q 값을 얻을 수 있다.

아래의 파이썬 코드를 통해 프라이빗 키를 계산해 priv.key 파일로 저장한다.

생성된 priv.key를 와이어샤크에 로드하여 복호화된 TLS 트래픽을 확인한다.

먼저, e_corp_pki.pcapng를 열고 Preferences > Protocols > TLS > Edit에서 아래와 같이 키를 로드하고 OK를 누른다.

e_corp_pki.pcapng에 명시된 문제의 조건에 맞게 IP 주소는 4.3.2.1, 포트는 443, 프로토콜은 http로 설정하였다.

아래와 같이 11번 프레임을 오른쪽 클릭한 후 TLS 스트림을 추적한다.

결과는 아래와 같다.

non-zero bytes가 연속으로 나오는 뒷 부분만 떼어내어 디코딩하는 파이썬 코드는 아래와 같다.

Last updated

Was this helpful?