Description
Since apbq-rsa-ii is easy these days, I updated it from v2 to v3!
Attachments
https://cybersharing.net/s/51eb26fa60be803e1fd0a754fb889822
Writeup
The trick is to notice that dividing any two hints gives you a value R that has "small" residues both mod p and q. This implies that (R-x)(R-y)=0 mod n for some "small" x,y. "Small" here means ratio of two small things. So this is just multivariate coppersmith with three known equations.
from sage.all import *
from Crypto.Util.number import long_to_bytes
exec(open('output.txt').read())
h0,h1,h2 = vector(Zmod(n), hints)
M = matrix([[h1/h0,h2/h0,0],[h0/h1,0,h2/h1],[0,h0/h2,h1/h2]])
x,y,_,z,*_ = block_matrix(ZZ,[[1,M],[0,n]]).LLL()[0]
p = gcd([2*y*h0-h1*(z+sqrt(z*z-4*x*y))]).lift()
print(long_to_bytes(pow(c,pow(0x10001,-1,(p-1)*(n//p-1)),n)))
Flag
ictf{wh0_n33ds_0rtho_l4tt1c3_wh3n_y0u_c4n_us3_quadr4tic_f0rmu1a}