Public Key Inference
When JWT is signed with an asymmetric algorithm, the pair of private keys used for the signature, i.e. the public key, can sometimes be deduced mathematically. The calculation is based on this StackExchange discussion: https://crypto.stackexchange.com/questions/30289/is-it-possible-to-recover-an-rsa-modulus-from-its-signatures/30301#30301
![](https://cdn.sanity.io/images/3unppnk2/ha-content/d1bfd19d3a6a42b0e3336c128ffdb6972f24f90f-614x102.png?w=1920&q=75&fit=clip&auto=format)
The formula does not need to be understood, a tool has already been found on GitHub with which the calculation has been implemented.
Installation of the Tool
Start the attacker's terminal below. Clone the silentsignal/rsa_sign2n.git repository from GitHub:
git Clone https://github.com/silentsignal/rsa_sign2n.git
Then install the tool's dependencies:
cd rsa_sign2n/CVE-2017-11424/
pip3.8 install -r requirements.txt
Ready.
Acquiring Tokens
You need two different JWT tokens for the tool to work. You can obtain these by logging in during the exercise, sending an HTTP request to the flag address, and capturing the JWT as in the previous modules. Then simply log out, log back in, and repeat the process to capture the next JWT.
Running the tool
Finally, just run the script x_CVE-2017-11424.py, passing it the JWT tokens as parameters, and hope for the best. If the attack succeeds and you obtain the public key, you can try to determine if the application is vulnerable to key confusion attacks, using the key as in the previous module.
![](https://cdn.sanity.io/images/3unppnk2/ha-content/2e0b5237869b24db17ed52cc2eeca2dad1538d39-939x348.png?w=1920&q=75&fit=clip&auto=format)
![](https://cdn.sanity.io/images/3unppnk2/ha-content/3582cb19fd9ef972e73b54aae9d7ceba100ae110-809x223.png?w=1920&q=75&fit=clip&auto=format)
![hakatemia pro](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpro_desktop_en.be4531e0.png&w=3840&q=75)
![hakatemia pro](/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fpro_mobile_en.937d2b98.png&w=1920&q=75)
Ready to become an ethical hacker?
Start today.
As a member of Hakatemia you get unlimited access to Hakatemia modules, exercises and tools, and you get access to the Hakatemia Discord channel where you can ask for help from both instructors and other Hakatemia members.