🏳️
Bag of Flags
  • Home
  • 2023
    • 🅿️picoCTF 2023
      • money-ware
      • repetitions
      • two-sum
      • ReadMyCert
      • rotation
      • hideme
      • PcapPoisoning
      • who is it
      • Reverse
      • timer
      • Safe Opener 2
      • findme
      • MatchTheRegex
      • SOAP
    • 🐦magpieCTF 2023
      • Space Plan
      • Space Exploration
      • So Meta
      • There is no flag
      • Momma says to play fair
      • Rubis
      • What is the password?
      • Eavesdropper
      • Shredded
      • Missing Flag
      • This outta be large enough right?
      • No Password Here
      • Chocolate Chips with Zero-G
      • Education Comes First
    • 🌴ISSessions CTF 2023
      • Basic Permissions
      • Crack Me
      • File Detective
      • Word Vomit
      • Fileception
      • Coding Time
      • Ghost File
      • CryptoTools1
      • CryptoTools2
      • 1337
      • ROT++
      • RunedMyDay
      • RSA_2
      • The Man Who Sold the World
      • VaultChallenge
      • Lost Media
      • Decontamination
      • Decade Capsule
      • Password in A Haystack
  • 2022
    • 🏁UW CTF S22
      • 0s and 1s
      • simple image
      • Helikopter
      • Meow
      • Google Form
      • Strings, literally
      • WASM
      • Audio
      • Pwn0
      • YATD
      • steg
      • Passwords
      • Vitalik
  • Practice
    • 🧠CryptoHack
      • Introduction
        • Finding Flags
        • Great Snakes
      • General
        • ASCII
        • Hex
        • Base64
        • Bytes and Big Integers
        • XOR Starter
        • XOR Properties
        • Favourite byte
        • You either know, XOR you don't
        • Greatest Common Divisor
Powered by GitBook
On this page
  • Description
  • Launch the Ship
  • Flag
  1. 2023
  2. ISSessions CTF 2023

RSA_2

PreviousRunedMyDayNextThe Man Who Sold the World

Last updated 2 years ago

Description

Woah! Are these launch codes? Probably not...but can you find out what they mean?

Launch the Ship

We're given some values, which appear to belong to RSA

c = 4519595837258131182432680292760199726858465047370563757831166189248293616160819902277442750691931010639242010386584639325228745787372353607300343994557363101961956376999346258599093288477537033714341298932933608867878893587755392351356640357619202700761334568929728963380143117696093843740980191971532408514353304363622892811507963376245555869085759865963000104587355779394272400329406137360546814661151197871599393759143943152093149874047501290282591806676372749789349193454014871154189449454124066101313277357011196902304150115026208706546784140072933221662704898834642110023305125411615408655906977954891849558168
n = 10882518774669003944157704154060893727176500312851091673222032446414397983329226648710524029530042506917548405010321886888383784437412878317279125735266665738710451000324479427474121632543211455820612255552659064645273924838793242943609006737270444426887045752914518591646586220172704209771168691131241434485638708369819937441923718442231903304106407595055064180706313266003253677979788910301741561915699397442292917477201518112404469650348466954494099715412511446346180435407895859429218811738889417028415772780951792086360918580019747176099576543219583251001078053766176721057772275442488586174379496337825440683913
e = 65537

We can use Alpertron to help us decrypt n to get the value of the two primes, p and q

p = 104319311609447480786809799370089753455586304118675935006297333767847573901691468667364895697082789879055916049813177851964493891680847750500592297606723261072722458049314192462876310537500998260106918459180100014408873831507785409885630534261430359885389903471989647788072096998033842582659370499425055903947
q = 104319311609447480786809799370089753455586304118675935006297333767847573901691468667364895697082789879055916049813177851964493891680847750500592297606723261072722458049314192462876310537500998260106918459180100014408873831507785409885630534261430359885389903471989647788072096998033842582659370499425055904379

Using these values, we can find the secret key d and decrypt the cipher c

phi = (p-1) * (q-1)
d = pow(e, -1, phi)
m = pow(c, d, n)

print(bytearray.fromhex(hex(m)[2:]))

Which prints out bytearray(b'retroCTF{numb3er_th30ry_w1n5}')

Flag

retroCTF{numb3er_th30ry_w1n5}

🌴
Integer factorization calculatorAlpertron
Logo