← Back to Writeups
HTBEasyCryptography

Weak RSA

D3v0o0Nu119/2/20261 min read
#cryptography#htb#easy

Weak RSA

Platform: HackTheBox | Category: Cryptography | Difficulty: Easy | Author: D3v0o0Nu11 | Date: 2026-02-10

Description

Can you decrypt the message and get the flag?

Solution Approach

Core idea: Identify the weakness from source review or fingerprinting first. Iterate with incremental payloads instead of guessing.

Steps

  1. First, unzip the .zip file given.

  2. For this solution i used RsaCtfTool.

./RsaCtfTool.py --publickey ./key.pub --uncipherfile ./flag.enc
  1. Dunno why we didn't get any output, let's try another way by get the private key first and save it to a file named key.pri.

GET THE PRIVATE KEY FIRST.

./RsaCtfTool.py --publickey ./key.pub --private
  1. To get the flag run this payload:
sh
openssl pkeyutl -in flag.enc -out flag.txt -decrypt -inkey key.pri
  1. Got the flag!

Flag

REDACTED

Lessons Learned

  1. Identify the weakness from source review or fingerprinting first.
  2. Iterate with incremental payloads instead of guessing.
  3. Reuse the same pattern in future engagements.