n = 73553176031506251642448229714220151174734540964434813056145000616720019024269982417494553771890010861489245572362590935764438928110836109730139595790550323300572059713433794357690270439325805603980903813396260703 c = 19209686331218755173713714974036153099675780768506975193406617712945126866438211292560144823093347834048813455853960982766572556698881387553177980003129346158494272297017876567974550982519632403844694686184532804 e = 31337
from sympy import * from gmpy2 import * from Crypto.Util.number import * defOriginal_RSA(p,q,e,c,n): N = (p-1)*(q-1) d = int(invert(e, N)) m = powmod(c, d, n) return m r = Symbol('r') p = lambda r: r ** 6 + 8 * r ** 4 - 41 * r ** 3 + 14 * r ** 2 - 116 * r + 31387 q = lambda r: r ** 5 - 9 * r ** 4 + 17 * r ** 3 - 311 * r ** 2 - 16 * r + 14029 n0 = p(r) * q(r) f = n - n0 # print(f) sol = solve([f], [r]) x = sol[0][0] p = mpz(p(x)) q = mpz(q(x)) m = Original_RSA(p, q, e, c, n) print(m) print(long_to_bytes(m).decode()) # 642921858775320553662877496454459277194994123046130653667709 # flag{G3t_m0re_fuN_RSA!!!}
# or sage to solve out p, q PR.<k> = PolynomialRing(ZZ) # define k p = k**6 + 7*k**4 - 40*k**3 + 12*k**2 - 114*k + 31377 q = k**5 - 8*k**4 + 19*k**3 - 313*k**2 - 14*k + 14011 n0 = p*q # k^11 - 8*k^10 + 26*k^9 - 409*k^8 + 451*k^7 + 10850*k^6 + 44939*k^5 - 158301*k^4 + 71237*k^3 - 9651273*k^2 - 2036532*k + 439623147 f = n - n0 sol = f.roots() # solve the root of the equation # print(sol) # [(9291098683758154336, 1)] x = sol[0][0] p = p(x) q = q(x)
Use winhex to find 504B0102, and the keypoint 09 which is the 5th behind the 504B0102. Edit it to 00 and unzip the zip.
And get the output 1.png.
Repair the file header
Winhex
Find the 1.png cannot open well. Check the file header, we find that the header is 000000000D0A1A0A which is different to 89504E470D0A1A0A. Thus, use winhex to edit and get the real 1.png.
Extract the hidden files
binwalk
foremost
Use binwalk to check if there are hidden files in the picture. If yes, and we execute the foremost to get the hidden files.