Rating:

## [Original/Source Writeup](https://bigpick.github.io/TodayILearned/articles/2020-10/b01lersbootcamp#clear-the-mind)

We’re given:

```python
n = 102346477809188164149666237875831487276093753138581452189150581288274762371458335130208782251999067431416740623801548745068435494069196452555130488551392351521104832433338347876647247145940791496418976816678614449219476252610877509106424219285651012126290668046420434492850711642394317803367090778362049205437

c = 4458558515804625757984145622008292910146092770232527464448604606202639682157127059968851563875246010604577447368616002300477986613082254856311395681221546841526780960776842385163089662821

e = 3
```

So, this time, it is RSA, but with a poor public exponent (e = 3). We can crack this by simply taking the cube root, assuming that it is unpadded.

```python
#!/usr/bin/env python3

# Inspired by / taken from:
# https://baotdvi.wordpress.com/2018/11/28/safe-rsa-picoctf-2018/

import gmpy2
import binascii

N = 102346477809188164149666237875831487276093753138581452189150581288274762371458335130208782251999067431416740623801548745068435494069196452555130488551392351521104832433338347876647247145940791496418976816678614449219476252610877509106424219285651012126290668046420434492850711642394317803367090778362049205437
ct = 4458558515804625757984145622008292910146092770232527464448604606202639682157127059968851563875246010604577447368616002300477986613082254856311395681221546841526780960776842385163089662821
e = 3

with gmpy2.local_context(gmpy2.context(), precision=300) as ctx:
cube_root = gmpy2.cbrt(ct)
print(f"Cube root: {cube_root}")
hex0 = str(hex(int(cube_root)))
print(f"Hex: {hex0}")
ascii_ = binascii.unhexlify(str(hex0)[2:len(hex0)]).decode()
print(f"Plaintext: {ascii_}")
```

Which running, gives us:

```
python cube.py
Cube root: 164587995846552213349276905669580061809447554828318448024777341.000000
Hex: 0x666c61677b77335f6e6565645f376f5f67305f6433657033727d
Plaintext: flag{w3_need_7o_g0_d3ep3r}
```

Flag is `flag{w3_need_7o_g0_d3ep3r}`.