[Crypto] CR4: Poor RSA

This time Fady decided to go for modern cryptography implementations, He is fascinated with choosing his own prime numbers, so he picked up RSA once more. Yet he was unlucky again!

Given files:

  • flag.b64

  • key.pub

flag.b64의 내용은 아래와 같다.

key.pub의 내용은 아래와 같다.

아래 명령을 통해 public key의 정보를 얻는다.

399 비트 암호화임을 알 수 있다.

RSA-512 비트 키도 취약하다고 알려져 있는데, 399 비트는 그에 비해 더 짧아 더 취약하다.

n 값을 hex에서 decimal로 바꾸면 아래와 같다.

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

이를 참고해 파이썬 코드를 짜면 아래와 같다.

실행 결과는 아래와 같다.

Last updated

Was this helpful?