Skip to content

Commit

Permalink
Update solution.md
Browse files Browse the repository at this point in the history
  • Loading branch information
4yn authored Jun 4, 2019
1 parent 418d519 commit 01875c2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fbctf19/keybaseish/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ Given the contstraits of the challenge, we are given a predefined signature (as

As the signing script provided shows us that no padding is applied and that "textbook" RSA signing is used in this system, we only need to find some `n` and `e` such that `pin = pow(signature, e, n)`.

With some modulo arithmetic:

```python
pin = pow(signature, e, n)
= pow(signature, e) - k * n # Where k is a positive integer
= pow(signature, e) - n # Let k = 1

n = pow(signature, e) - pin
```

We can naively generate a `n` from some `e` where `n = pow(signature, e) - pin`. The system will accept this keypair despite the comparable size of `n` relative to `pow(signature, e)`. By testing, any `e` larger than 3 will be accepted by the system.

We can thus generate keypairs as such:
Expand All @@ -44,4 +54,4 @@ n = pow(signature, e) - pin
print("Key: \"{}:{}\"".format(e, n))
```

Submit a generated key from this script with user `baseishcoinfou1` and we obtain a temporary password that can be used to login to the system. The flag is presented on login.
Submit a generated key from this script with user `baseishcoinfou1` and we obtain a temporary password that can be used to login to the system. The flag is presented on login.

0 comments on commit 01875c2

Please sign in to comment.