This year my team c0d3_h4cki05_ got the opportunity to host BSides Delhi CTF. We organized the CTF on October 10th which is a 10 hour CTF (13.00 - 22.00 IST). Also this is a begginer friendly CTF. I’m happy that it went well. Yay! I authored three challenges for this CTF which are of difficulty ranging from easy, medium and hard. This blog post is to cover the intended solutions to all the 3 crypto challenges. So here we go,

S.No.ChallengePointsAuthor
1maglc RSA953st0ic3r
2Weird994st0ic3r
3Big RSA1000st0ic3r

maglc RSA

picture Challenge Description:

Alice tried to make RSA encryption more secure by using random numbers. But when I tested the encryption I found a vulnerability. Can you find it ?

This is the first and easy crypto challenge for BSides Delhi CTF - 2020. In this challenge you are given encryption files encrypt.py and output file output.txt.

Lets see the encrypt.py:

from Crypto.Util.number import getPrime, isPrime, bytes_to_long
from random import getrandbits
from secret import flag

a = getrandbits(64)
b = getrandbits(64)
e = getPrime(64)
r = []
r.append((a*getrandbits(64)+b)%e)
k = 0
while k<len(flag):
        r.append((a*r[k]+b)%e)
        k+=1

p = getPrime(512)
i = 1
while True:
        q = p + i
        if isPrime(q):
                break
        i += 1
n = p*q
m = bytes_to_long(flag)
c = pow(m,e,n)
obj = open('output.txt','w')
obj.write("r = " + str(r) + "\n")
obj.write("c = " + hex(c) + "\n")
obj.write("n = " + hex(n) + "\n")
obj.close()

We can see some kind of Pseudo Random Number Generator. It is Linear Congruential Generator(LCG) which is one of the easiest PRNG to crack. Lets see the contents of output.txt,

r = [8369875715811823465, 445158310791574166, 2720555425160593675, 7432270455188990462, 2446251786048361946, 55762871963467021, 7562020044022273693, 4880950714387710915, 1980725435082363925, 6123245747443869158, 4341288451522003293, 3111260810610424680, 4140237704488186322, 8334445125395496182, 5047625506525476652, 1757571238833421910, 9376059903619511820, 6110215991516233738, 2352831123581007803, 9117287170545018735, 9083707904731367018, 1859293174547632281, 2245872203465393980, 4092355223399900664, 8979431278774017347, 4456461600515791560, 2863137587848225810, 5403052783947990466, 3528811102063731114, 2874817484721206679, 8449078310597518955, 11016217750450662607, 11097228115924669078, 10892757142981824109, 9850784794499231027, 5885192258462707887, 5292818685021887106, 4870356470560820389, 9580459175047702840]
c = 0xd81666bd36032affaee5abd0c8b08da132ca5780514a69231f93ee5e37008a559a54614eb176ff37cfe88fe2c53a761258c704b912146f5c21c4182eca8bca165ef60be06984dbb650a0624fae7b9ffa696069d90ae856e6844d0fe11c8c4633bf04dc02b2ed87f2948bdb903c83163ff18e99c4a4a8a2ae46cead6a334f9712
n = 0xee5ebad033cb6a780b84e957981c249c35cb20af0eb9ea404558b33f7a2637fd1544ee8ebdec95e842a0abbe22b25cc5e2663f1ad4efece9cb4d1222f169c6a1f669b64afa454aa8ef9f378d0498a4c4c4b1055873576f3616a4b09ed4e81cef6d001746b56b4a2ba4db5a52de7343dd057f99bf552e987e3672f2fa7b7797e5

Also see this part of the code,

p = getPrime(512)
i = 1
while True:
        q = p + i
        if isPrime(q):
                break
        i += 1
n = p*q

isn’t that suspicious? yeah p and q are very close, so we can factorize them using fermat factorization principle.

Okay here is the entire exploit script,

from Crypto.Util.number import long_to_bytes, inverse
from functools import reduce
from gmpy2 import gcd,invert, isqrt, square, is_square

def fermat_factors(n):
    assert n % 2 != 0
    a = isqrt(n)
    b2 = square(a) - n
    while not is_square(b2):
        a += 1
        b2 = square(a) - n
    return a + isqrt(b2), a - isqrt(b2)

def crack_unknown_modulus(states):
    diffs = [s1 - s0 for s0, s1 in zip(states, states[1:])]
    zeroes = [t2*t0 - t1*t1 for t0, t1, t2 in zip(diffs, diffs[1:], diffs[2:])]
    modulus = abs(reduce(gcd, zeroes))
    return modulus

r = [8369875715811823465, 445158310791574166, 2720555425160593675, 7432270455188990462, 2446251786048361946, 55762871963467021, 7562020044022273693, 4880950714387710915, 1980725435082363925, 6123245747443869158, 4341288451522003293, 3111260810610424680, 4140237704488186322, 8334445125395496182, 5047625506525476652, 1757571238833421910, 9376059903619511820, 6110215991516233738, 2352831123581007803, 9117287170545018735, 9083707904731367018, 1859293174547632281, 2245872203465393980, 4092355223399900664, 8979431278774017347, 4456461600515791560, 2863137587848225810, 5403052783947990466, 3528811102063731114, 2874817484721206679, 8449078310597518955, 11016217750450662607, 11097228115924669078, 10892757142981824109, 9850784794499231027, 5885192258462707887, 5292818685021887106, 4870356470560820389, 9580459175047702840]
c = 0xd81666bd36032affaee5abd0c8b08da132ca5780514a69231f93ee5e37008a559a54614eb176ff37cfe88fe2c53a761258c704b912146f5c21c4182eca8bca165ef60be06984dbb650a0624fae7b9ffa696069d90ae856e6844d0fe11c8c4633bf04dc02b2ed87f2948bdb903c83163ff18e99c4a4a8a2ae46cead6a334f9712
n = 0xee5ebad033cb6a780b84e957981c249c35cb20af0eb9ea404558b33f7a2637fd1544ee8ebdec95e842a0abbe22b25cc5e2663f1ad4efece9cb4d1222f169c6a1f669b64afa454aa8ef9f378d0498a4c4c4b1055873576f3616a4b09ed4e81cef6d001746b56b4a2ba4db5a52de7343dd057f99bf552e987e3672f2fa7b7797e5
#fermat factors
#p = 12937895237767594932493558364485923657617347496746440870331522787664135451357486215306150323273159558144866156707046930282415553655802768716465496664386881
#q = 12937895237767594932493558364485923657617347496746440870331522787664135451357486215306150323273159558144866156707046930282415553655802768716465496664386981
p, q = fermat_factors(n)
e = crack_unknown_modulus(r)
phi = (p-1)*(q-1)
d = inverse(e,phi)
print(long_to_bytes(pow(c,d,n)))

Running the above exploit script, we get the flag: BSDCTF{Ah!_w3LL_D0n3_7h475_l1k3_4_pr0}

Weird

picture Challenge Description:

Weird, yet easy! This was the second challenge that was given in BSides Delhi CTF - 2020. In this challenge you are given encryption file encrypt.py and output file output.txt.

Lets see the contents in the encrypt.py,

from Crypto.Util.number import getPrime, getRandomRange, bytes_to_long, inverse
from gmpy2 import gcd, lcm
from flag import flag
def keygen():
	p = getPrime(512)
	q = getPrime(512)
	n = p*q
	g = getRandomRange(0,pow(n,2))
	return (g, n)

def encrypt(message, publickey, g):
	r = getRandomRange(0,publickey)
	assert gcd(r,publickey) == 1
	m1 = pow(g,int(message),pow(publickey,2))*pow(r,publickey,pow(publickey,2))
	c = m1 % pow(publickey,2)
	return c
	
f = open('output.txt','w')
pubkey = keygen()
ciphertexts = []
for i in flag:	
	ciphertexts.append(encrypt(i, pubkey[1], pubkey[0]))
f.write('g = ' + str(pubkey[0]) + '\n')
f.write('n = ' + str(pubkey[1]) + '\n')
f.write('c = ' + str(ciphertexts) + '\n')
f.close()

this is Paillier Cryptosystem which you need to understand by seeing the encrytion file. I gave it very directly, so you don’t need to worry about that. Now let us see the contents of output.txt file,

g = 3064483479119078003746764730544409326632988031730244267570606419870241763172042290268790637568853878013120762024676868019161041918635864029486437085080711329770906115917707765495807249869221063627360023708262585149362744121034405972662573990291187157281361626077513326584468446610370515737761794656235787718411868891405879655054951069983051871846737434567477529981308733751055720080442173971719372410703464348456865078946205101041762102043345827882561830737333983788945111204706669750723352244012084616764214800272744427165949976497661393661214767535405002731450556145490105507761711819068432999545435877889723707693
n = 92323032016735545564669921985320000244114757437882665811969290814754961456436884648109047049537997174091217591128908955035057851804628537110209625589730144047166711556723392583795647752685190464911004762110190170169614931319612260910961852393814783406980753711632089394987875359845869446171420929689358873123
c = [5940850133774970843332908436155033568447548625341625881601629465519927159720953942167138274398024196857023660043017108238389240766594717604952439180530568085038511813138583654501176738844164687845301409517402208846403932365774572275541629417265375615844881085658667783670084038116747791403424713777806916884694791618333866204495223796894384829871001167867571031567384150065975063220340252650675925924229187155878619985990912118083304418277703348870019758247161856035400406786082244080001772262100435288386883603832749003432365759629385108576168579530538694189489221774243586184498401968700926459296522505954824658129, 5807060169512354774280115239638653822122920600757328261759853974516873748796175508667023007796296946145166692656058982813298326151581059921642272409921425734071027484655210959102052492583349319715920253214061016501838239584659366059999429365267633619410410975277561166104777474637260629285968200937064820564330940565399375513670415682091626574470629255135636700021760519418849197517116602616600425013115230302515471331863935247085606640703367820105939417171085841987489181370769183676317049661907261070755793012092221727890402066438449120816928941628948870553407960618254669187640445568596182889477340040582199431174, 7547814380444583620893569720512081957793897557742707764197802506826917038806886360991255503331230722616546176206518568205003676114900308140883993500038233924142173303863369524598252853570335427121941018813775139777452024989173149963617253307314766739313549648615847342156565240087317609309958087162103155589356921812709418199916621769839551091694629309759415648635807918839677761132865245242998631225446695215889441674928893114898729034074912407125367388185493682713762791642619376870773334133841304620099016436835302526632114580061637192715149432400155791020813508591054911603041900510479282661959102467039219486180, 7919485431326971559859812057710590023582002478375671078797807147874907341197713059060729623259779030078040430493147450801774357982075328287028026552814120563362058271474202062700072189210335972360499170427377306389246195457194547430722103594130010138840876590204620972106789370827316716254583474194412849960468528740056838294111351990133644066106614488511616935542733248349347092902727646489709888252882647343668606080124099007814053599470586826411749108214357860714480834397664692002714123548064411521312076286128915689116424790081981496918168203090144143477609521363490000109123487462470876431002817959528391683432, 939545072129894576257890657273746873332709279876981270640805402718750568101997223921674331005446965434460173251917495804040342276762588951998948356271985151976367979920761559134377017668623360503574518720007923436398131008321817748555288334752910529600878148478347857217477963757691993136709754843740065018301473517543695094897480468761267167665062522886577663342334369639486104970584960341823578370421333609897217713395661431686637740821263437860176298160409779833732984318517606536308822741446254035209026770449137759033745857244742097910868428847036503232711494845530122628237371096885210539236858694872066445348, 7350842968208247938228806606863076478496922974995129099747429185924621319559239478136202233610787118803410636130547622161771895245603254571262160475810284793822536188715073186886124482802143049339363165787547562567240844025512020499956608926915917918905591440856616076821406254570490578948526093902218407905108878991671800763266375187439178917835234896920464584987452212468189554011049939415862609077073160045775634686680467696697595097474384876004859588749815985345189042292152598103157353323531130256125870519166696129042113507068571955674323141286849733280487479167485308804347201596677332419750266548763638552354, 4847086521082622193057514348662429868791074035720315514587101918917981653046166093589126791433500050418662956274713508010903792291714348246575368874233744558017172105126728825483469519515052481828090102840527027815610535515627616158821217470929817689370419950676702058798137604929610917142685541904579167939519635186038925842240328808991592124878060542619354433181678709014273871726782085500555918918537695298444278173804723809133354270626935352594839898928289034971524169787973213377145546972839190261311677294361016357535121874694646925651268898831568424623209044420323687359930566571016716227852950896553006177132, 6053076696974557109844127063536133372524168559612230687366015157878658802659420745123072067016152505537784013879438511946086309633112320924551999833829035766225320486534201904400880834206258671512353428428722229425485120630366560327512383762072302456812845625797446230112190860579378853292810472416775377476131470487083892872193543517932694466640805624107309024568217290705637071142906267323531842580564643920553828458014955249641967367302739098130394450475168617032532921422280952099310452135110379108861017886700877383657798933200707131314513449264470793832251243622041930003682352098062007154746131262921800579093, 7198857973754330810983610824954388844943613527835560318077049317863826924047760573200835665416272821579028565373771837727115028151865261323911681956429700736067576788939705828696872669610923749079350445268727035363260385221101568663863101697237779288950973277019665229205151398764496620442924708575218181967079423583752328900987478339340016185398615744153608716203618798841736297729065223264359444853124244799831528487466544643900248001303654052720451995371570034901366777808436959674533551004342571628078678467499336596654112255731935285763741976851118283953583669743638419095067407318948360222036635986069869890503, 4648862951490847814623978008361292164943312330292380612099756530061676710863679220361054157140898538923139426591175055860150201627337446154261422943470880102231776114641748319767600428665397364412111725259088487930862284004895427544690644888414173999267598631349466413590651770020899962016220626611935755399603776244732743007452265578543626109867859660752319683262536110306129307605799766924640352527526883902960828623713418545732559668007124244180598827348212892054507309448149472570441448999525537796562349660655721230677554927036679822418148605537452458012647693717687854114726741227872884028096699040224090041501, 8437762304906076716484339420448586972931836153150645409185809426258062813504462508798777349091169295249614154875758463186118815459198475067918910357623913631045795681190410853033494000300337290563141001569224966685581738216493409349677242058063660593426473537140782754662923283229858143411837097164411231120248872366678218782679162075316623751098747253618740619236287688799750823179220159126916407639737280625817766026797635194546886942930598054547953896129671800347203314514734754230309222011026063059791856550618161770603101846436411791245263826099573098206220392152409450475661027823861705226227468222835140518576, 6400958698438203554111442314895334587496449695377735992179174961975438550538165292307054320606101051113985723640802117977214175070426791357388035949394850072903627738430123465147490996945267835407214580542550911834297670883288793133620516281723116372967725893335989647258055019546180342402370622841374871108393774095156176579852523955829644390754640794938383245402112501841589073438699316408279329795611440975462741909161872504256235054016085958630356093300691332332292237987133722894295461760797021334645475048652539291182864008718444442727380327664049488191929211997073224650783914033396575473982025014669155721159, 5357791220517077148804863707703059874628990052947443282786859039109984257205003031089618415383061184166143813366813190446281650751331252696251407147981808399277069021401267041208575112479608036978900469447159045282082120942355505868283056616639812322506228395907604000941625475954890497221760739412977855602377766942277744931785578110202166863642320050991454856553144643137028929188390731337988253510985056571525755168970199884026948375585843008624813971745171713463879543408992915448633559434382634547664884749231622980180360726669138015184814232435641990172452883668423253341086412132294708200946564133157593201164, 1412418665056205886695759730117700972387616438029443472500435272388977585340945079245090172160890880021282979127647998272106154917335000911389651240155886849945852813771390001851058396045415336957542144615599374913539705889554040789136577127308063160801403473084748794285185904462749340369104993295814565559581453816175615170007863619774946053620114964521936927974665250149369756436638211495828062972231262115612289416474769055619469290218019161002379452753056961095708821399428463876720498495115106257243363339331419582143760145795236654788613926249705162599821702984816106898653963884632446587875074552335222674864, 1203211229385945500235134728010977201937344622867858285671132059328127149252264683820522428838242629004264889887288299052383625451809982301076377397556077457785215138148862492177100214547211814744631801070810094769506282345652310651021736276261407065426967345870552778400011416392713056498140813091996058169789005260115329903163164095021866684924708500495530160686129623133371945285905361564213222833176980049534088828731888440301283715625649747883848873924283406023061275406182357901624015465074374515026398630685837996280161384394660428748480439156395392723281247311648615124461675969133044077086732872533813963742, 3709657718110020595802216177598172934623621022369350595788629330957040786854823633136250682355259661344796482259852022223943605063023543595122391227922860260697641825636748237614590305524288786963000396670025811226816205280966323306127850395348780213925698039789002159569343971259449295315497505138064030942635743771777096993970430420189446391454231763831327203961596320051553357135310261313615780907571904170220824203954469453482162370099749190480747673741981162001040916167529217935112449040532958055573970267238144949839317610105878606359235274986758645432081315582548143587750861212510820449222375758394528862780, 261676948347412168584999694615756646244318951485527020930972673457999418926522176631068937091435343344600440513057282472317958428611817431249420889160706873899771108463557747960789982062361898407618701303702819635533442914021636986961749493452255639263874539154640786337367207922254434552518590687075696718415233104123131115165349982581010096803717634746135010046670199977728580810824986359558723993921107846882349325489360655921461298694849663757376273209633326267306408344140486324184753756347968775253743712816723253283539516403927007035026923814037398414874871132581451294353263385897505972897665140127660380971, 7278815325978690849638412766451507107763316620329775891001825813886186989781333381221404811630474909473203221841122418383434876261175065187911173389349116358625425653881392468470696434237209399519028429525925133025050022759344403859440020848138352717827144704957582333198564777140475235911757410676717271783030135397231131817853113441564099723800356887619051261872822588772784573679705744901293162137197620836580179175312222478333275257923264594386508205965581298883850463696860703474263679678892355359906331359559809165841137142274513714882043472173329595988569441027119622999515558540978090150797116336279034423981, 5593262361453030941723993504736881956200744628242811338432155517449078007096901039875412077805097669179955756759463034473647709223981195740743789198485073808495204484615537717967659174885621873863484428044051373134071844003025866707024077106731642611838916754569537861646738597542270793695454998955959779975434984504658016191433166687407765900227146634369001037537444726665465352985171879405765321409634151048647631195034698713811532391028961697908028596782676960089894904815851569345877746424150359069952360120053180782610109006581824022594378390573321220553338614277965644860870649522763964659915750469435660266098, 8056831511560512087462237598974565602431095618674695086354370461055257969921598717200197982562418935012073232438494220004510421848689351958742560995094612386730743479032403199525376793168841305434662209212037223488805902725972873588430920109268984628499267374771080758424595148456623083658026017679111345914176088934475515395893816416530285619944003716805753903299464406991818838483578148234461999015174255790910911439838738258379563889174574515059187459018436167033779245215076758290089401518387635363834566887234031695084826091386930178609407823411857858590153485002017259769656263382902399405175339016375718826351, 7182183242345503247348034759762564816243765886672329694031343942756529908199748204996282952117365782776949924003596359110015421301933731880803539441208605627127741659651530455126831294409264294426851177326293723751242126504203232526896633786410017756047212111809896650928785774518275968447919558829074571108400527809840206147942160388158465067627962728672228720321742802972460410190586607559153499966848592527177236770185058465705903337884675083585435903223938474519006394949156659249680876144263136067515006133468246869898327180048296564077893549425539642196251593332505530588734095103542613993976958971332178032528, 4228209912856491434427932624694497875666930403419583331410540144892835781341835018181836185354029328171408366350869847070451557219410602446157149601740486612034289620673693831416603925791026723166234781026233512584239190855025171060957718580210681984359594782707160123505212868248166261268154502379684440807105458660942734880899821346871851015585309171117488059504783543782571573187858635909208184803321605994660531853438087180164669878161321266532556071598582018669299084811918424077570210738417167595869631006683571266837928413676443774582020391920913472312965825283022942659530289844920656490732813223436756535376, 5190667961576174944072694982402541388655514586648689029264040182551180440369294424894114928523300117373980206911866647256783710610047607845938917360576492412588939028458221839914350319708985513753121200107677041591067907517367190500394275864065758820033620882173637838858381705634795170662805976838943392185601488259722245118487145988429755369636207279161105715565096204900853799874341753573363347962078984639672723185140953062026685448673597656553130099403323323993445882575616195097704786202533803058344295872234510437021079479555755862626765876346217723944480035039539301633950580625081979746473028319956020567166, 1243164472925091447713095402692502592547689266119649685810696758081785276740982995791339330448419138258115361850820213145711172210507108788745370115464126510749684283041397550011666266229585223446162095741981090371536503394555856364155854472238235733145356765010667723378121264640474796162965927070754131452552143383313661569976744146721630472138724115586739477326140022556935383304141615921959879508913369387796085319278783350079837793576363812228613989368208643765837671566767483117038057390512125115176478622034751394207412516615167733816619701103401845218285540395947457508783505368698687203656287189101582045193, 6542114006627975719027119737224724187071337718574565966986172565668057874348583339565061361653736056675098265071989704160178573008978796196142025391670622713635732387806601503627360880043938348271379965454909571966661209470624747750423046713138310909608711065293681654698016655865344403926239609607020327960443568282822267641578715102732029397307586248824469885829829691213789011529030476344651254675087690240009169205720267521532698344663157157589199294288359467168664792325796623828487022672051672963607142624012597555398727018960351227132257182320522984019397814309593188847880561301885756352129780897370741994969, 4292742484310713037382738379153100901972658691078084262341922705471262586355989181057332206256895566788020365278165185302641146351825726777674794026082573784480468240057330300297982487958456675275482108287572762650739796919094513904505927503017675989138363254133733356097435951446290681752269371466325185814120200319049931780529650097564243630811957605264672874651956750319728201108181705379904132558627268157467651624744322247752415850924399717115786730890694784283186823092123143471870406159933392063055794438798743523329321490885376116786025333179769389870384797642316716920566317125363619230246068073938223748494, 219401368320818061103816881504229644813074007506982034641188450917392613331173733461943445047431044003706580528180685234580467318935108859757342757059351152497922307052007845211985054326651103042377377174651414405602408337848724544112217094204686951290429756093929809713003570064391235297805711015027917325050366520397966595426277969940551719092617454351760971636360956727471620515986043539597052013820393591118570138955979043576513832563462273970545900546381004330027782636606260618543653823551130493150827394632766771496524724382930869818307538355057039035921842013140834648823619824119649747548486891105667086440, 3271038841366520006188256603843785720590093674167941893298448414319317975800268309412970499985176057675512084969374517328502844856175062709054860809675181172349682954555291370459776553160649145093483955187617138562594014066273268086557313679473352944055936698235384920024216137229153799716139894839548615458086453687705034254434699186445024470104184291855469478845585249051061329889745259856735028236358097117008297821525559037393662008801467363893347038869470343721817830420072395576715444719644779308255321136339102413307561205493013385212170888551922103130270507229068541653008779605086740958207476130051400502964, 2456155230891852562695919839927763461736444615437636587582551258944927110211806942068087208621074160611770641849721751637935345478769196692688027006435972979663562142567324828416182254288611757621261241428608633176094964994616850932584503728365134536936496662210707202246590755613112358461958693055446170086731386837348337455087750016350364391213119774538400174026199676682261289816566718768290844647267793638572136458497600719447474079352081334863001730710223493077022390717453147297868742446877725752547598874597140691497422270505936751194447576650136894587129965412357481037143574258089880549063150833997685776667, 5882745086848258872558033816373436179595952477805436968068101946372042846876083133844813592881880515556454351026160456068229080798478897486468481959817325406744713069542514202948255558742531315208435274910202177578256299340491679518113082314711170645394204587954350955637254222226420575718779239446773995702883853414755763454105879225704228758101320567015331137748307607627401797060226291609832330620137254031938147332323197038162156090400495356821085684408849900546904637080960546870469068482647004283165195793245901005053548856782915939563806147000671303488137900379591487812398651153380009672221200719788473973218, 1544983186204720012233971043772959457615928773904668703793264009388334440596324684551027134617341678379587817957800992795606261476610347113590605178344338959992428759550879691115433446688701457935449993755592303754323020139304315949515367187074572515658622812038358726195824766388065156892425975977848735181652256346508343871850998765725166455688093847134254912999043404661484707011771354716761128207066264171182964873350582043811780809964872294243048793032590684406184214338368402652212399675393858493984096867618486870704619466351739566594947647069371048149825380953291731199238371922621839396814419741282943629009, 7436650844033850599139160268268078713951656611252900853110971603417207381995029587277856101310998440538593560151706139587025107874588137031263454860891891265576413818734476849615265647438906383275496714762386302748218863193997332507850757821996205529371844975133588243121006764989662795693094822434925926455226831108002148886769944798356921083976576158296731998977242853529271418782907902722204644879030570558292868364913312890932774886663521538222558889064732413266599915945379860297287350660813848382106511762766929966612689072795892279743222409718143036826047710875635344199889429025067473498921847725104401905474, 4520094792541831428028443634962238155046027873139675778047332975650971160992528572312636942564883681324110625694421526512638750541722174577396099771769833740303692387637626461551071275711267782600869942358669950299243866239833309643880922428537271939018552933437333573662906615154695527975862792573681337674299920653913343171607415156180158927805347240675558270335640245130581787091339902612165178400154063802200461359755453022356363307462420711680762694610618326043792793962788687981036533059929092313782017820854632594520414656838344777384976674331027873592326516967793530080405661561894094548142337333944508729324, 8344417008221564147222964899944269190219706496889014764577612384909900660961198181923497588128336496877814538791749755473219733567100492075730290924457270650974816699490893675833248480970134403458209865631849729381741118768554014978835014116864275370701915524852516142944251268159719815693388776467168672753002364040336571491608902724179279125085563780377105638383028956097694509438884493050056163362914369392219462873829711088663347761751838589198376290333152491158922852127803874713124082711205949584909447623882166042486344955328991086267451212602167815160249312287019341348247110584784270524422299197758276233177, 6900575793777603900866480743456426787432500857082901407830057522260842148635103738510522020156808301395371553347695869668803330933633334032558289417026747005850977337876741664581269998240635265635215104023212580011965287917132047559239155585572402224320215953569685644154941988572323678896880927802138986067041504042516158533118465537675301058226112139760917094557169424850934438637841053218101679845425389785457016819026096897930329773564919542374890321657990882183938363826648444847356637225467863913426423008000512222659361097371661607147348075049151396557834968756819751156935382883870858328491577062527732445078, 1039620873456544502792526439053692563154144835379847756378504892556486695893811372496348686040234429241319558386566942949633993286509479433525660703211528073247929219066429684877942418573976874659607403550119970164705963872962022564900892873979929143542730048584191665306869138898715847944721937805038103245129103914480958479618921523447386186168509805632791931086068116198248935672298308230243100580196955728451313725938964425351501171412475747424699269665210309339167573031158405498419018168296646448709143153048088503449978663331342908191879833493443135681045163836717694670471220000514396248007377973312385339724, 7470054329282446464987566606090059811462426737907010584685629849246675942747791612912385984643325345939604013467874016999142427127951005108950475700525540668125074794680112145664898506394897753446948672675481662838013049302627335150200974175696648650777326692346912365323452264939510461349128291141868470499211561276926683501373783782333841097631798292513576034069530903301105938266887072627938474272414795650506821360402394172684411940040086092339545473621240673615537054466086956132870259353118055673366408560504136480848386573221372874886425905788900478612242898970132206377447991221786767100649860140494888691252, 402586505295967619905691072840312493779335883059189597094419908427773884390475146712444916327930405672543666550678142115158300421404418045445262115396372541897650516816803242979853720862777789587197209936299310709424481121412828315741419905631889033420536751788581045359465063767301991224167916510756496045670563145128493494417001678688510299272337718260637160304646772976510411929623713842099669591355816329276513530326957443811236389035007968434194472060894066200603822947428932847324382046154359171880058689186950219622764930900521645422837522020120301079031749943777354436556479348984014074158081422773017344429, 563415937673678313326228187483725710394329785396294818829384243977182814074354940314830423095382742612573997861647718143446138119677389868766367316711406247322828984283892024723846965564520885160731874332445117222587977685554156137595131151468102885725701318636938041492306105096576500134858251709663919443547356064364383377520553574336319571145699171258664474006427403613976015890776865886415686165610970837505144900157729064059079778401775463908397715383769585384744896599460085581039588566179869725128599222665672413843148034696792996069176422046725514869941816476120682513697103886905478620598067865111007638214, 6264171558170135853319244400246873682863464821832291187818309393193945162201349227956437462599067531934951396904287045310504756039169609644468784846371308349116591413208663636416383041466216010356270341549299532423110562786417975240670981647083471199865967894707530938386057961502144576305336509989087868723894494821732948760448594636803954612295582123339452115113695639935682681498785975332367738372429605531518932405658718605881437314458771044654638467285552057040735264564970344018225031797530808832944176003887286565846588331087123906656052577104980222392491832498130606376756392102892579940124531323994973041356, 2353259984204080610194225545041745470089829854097864641866035411574197919718145042882458633681303194230696696437448461645897006566748724423868316510915878385919855584438529309016964796316957554084425090041130406684295448143463557183864986904580491931283427052128639558371950430202157949775211920507501398275682298137803204807425128484838151126784041651105068163531276047578525635596664918372087540317287081064542264455566484399056787275490619623780474771944251109850248376266811618077837209537522980915184699182374776943561962748552430146841092702356546816590614600084173778998145975210290185159573266725929227069797, 934622855869211544962820832783292772587001864016481633549319692118647997365464035742526935162648259530035104052809219385590761480441186611799119613466669910052474575879271777013068409950275118819271965640401715989002186972083540232156167947826249000839292685321721628065384695155838067324265358240071330893787232359259468365148164434154977753368338245369912513394665811580301710559006224827329627076355282410580908081271388693505193839085252723240461425603359426851814557335513554481055068970416054340798137251839192056309530963262959762084997021235759225269150612757109264548475689409264671024573562937371050956945, 40841288761021636035081504620005804587229560547531272508136805673408003215604383809004611855701311115223112605115709593049810264672173558540023314671972835214382106402783762118279584521233115736837819765494338898939471652983572180581907308584658144942283869592172851186231199077015559827655206680253256244042771899973946776714488435723186063576126220739335220510544265560811367391247525457794942530912583087751694416713618377148110119208175754047246129610048382459072266724134533622008051571095186035009538596497573441196582092730514335722135791580631583562572253842816475462260037113557826466531463600577822577182, 5194167723301591230052801202311062157866735904915081465426740746198750008930358064836751025937251639753670761995023333197206327687539110703753911522886716157739831174046019068361151571250792024203569955376201763635555662214478738323877633155588398889092300762510501476335046661463029505382914917782631966235337350109679614459491385866493887048283144029645605953297504926534018927565533631739125447346226726670538409600766693906727046862542380835457909301029612194810314215517635384820588406789302777644163373672264084335029863991962070572891753902948487940575256074525849478375743486686220289464554488663853426257777, 6271352246934455976797775881527917462779314317430283852058699813865422627237142212510017598369001966571683881756351210093308614080865877135241552804057654592113816218350687381234415340503752110818386564991371587895054274788755486865036233770817470206413118178086462394276253477556518575971647180626293577435898333031113655936309925536901257802782468175442927047298878261542124933534175605683359243625843584613665749753138469318900501640625071783818214590797213356657759970529844432851895905792711311693514754962568263023660823886198272522805392577490602668450317589243640841456849368777010601234228020405948443847083, 4821731178298047316711442468332106999270854442323819723845585722463345759704140919237557616179183907220898829243875168017054228442826769190816557217542996585231148296411158529661986640529060922752227093277388138854993220533904177266584574296832359259423699871879700017216845625668994140287618242499265546620783703522566626476780510780530074560982900287233691796896846646738398802319651662960746563876737978008833049837278725322072981128966853961327928789581063966055979141342438050887153505021016595018853626633712350697112978422462943707348105996496244791246583525141684920739961097599878260879488699774921932132062, 6399818591120457913208553954802236713465019937046326368744675340145043793721290241911273492322219603155375874213489728151648124863992933435896068973035610102301243801752479671702175436669868488048545845319142232333236698265473660608201734049482665906533212175948419883833595303534526841525720789460588050251317085997244268814974789292571377987449319164260727769366340737341742562090216144305791418003987911684076272503859590276313567869075763206840280711473677015819143228795811856409362088334677239439076112136461041153210487275000797978892734325026811400894047397076097003622474286288059741856148711497806986431131, 7542155814178254959504773591982822403403864745643248737707320651762699804253567868628136153988005773849555664576532680605616516390581697578355648017928389763896413758238809257758848923043078122373872163704006418978943948940530921798725176726599654342782748808719770205731032084083695209244547645988386719686737804480819763591984834574175987766445547318547256450184389979407091747998898876327996889954949720743514190353823088757373028008841977792574997056469422934895393816053723616496660437820102090577873321040835217262907559657259915054769752384539456629279873778532070749279183983856355074437119970567485970288660, 2455233488932353458082883534912337045417829743259585008612728904797450615841945492931992534352509320621434361811056975179989321651915272492833147028173302499223579762213322754588578893606719993660524105022455469199530331708195132639639030962033424189397073569731374846738861813386346329986250454032749286622481838850808059105459032039709263349667508981492373892403503197726347916204783781382620605455746941504253331887237697572737052995839834326159759348440382765571380267512913102433595812445500294978519993249542565579722989469683433699579845980895001333867098822760847040589336326113160796711133243376985905412440, 2769306888029280481595471794864744736989266590835807696396476317376571712998061705559840255382337792698371824612630572497064046174652240812241207474877176351199169726250685137266944105069267021241905394940332486093326652877783313541543207994497381413148076867018952044585793844301490359127989238430256613789379390552090171381095270828586550759326651198894672920603164598324929883508449726197319840180038010040906493980310809420624846105982881056056806033938668469744609139780426991436223972318573803671682979890411731746542081305815486849829820055798706046070964513541153173891178300237893253294303266376838297392954]

here you are given g, n and the bunch of ciphertext’s c. So here is the entire exploit script,

from Crypto.Util.number import *
from sympy import factorint
from gmpy2 import lcm
def L(x,n):
  return (x-1)//n
  
g = 3064483479119078003746764730544409326632988031730244267570606419870241763172042290268790637568853878013120762024676868019161041918635864029486437085080711329770906115917707765495807249869221063627360023708262585149362744121034405972662573990291187157281361626077513326584468446610370515737761794656235787718411868891405879655054951069983051871846737434567477529981308733751055720080442173971719372410703464348456865078946205101041762102043345827882561830737333983788945111204706669750723352244012084616764214800272744427165949976497661393661214767535405002731450556145490105507761711819068432999545435877889723707693
n = 92323032016735545564669921985320000244114757437882665811969290814754961456436884648109047049537997174091217591128908955035057851804628537110209625589730144047166711556723392583795647752685190464911004762110190170169614931319612260910961852393814783406980753711632089394987875359845869446171420929689358873123
c = [5940850133774970843332908436155033568447548625341625881601629465519927159720953942167138274398024196857023660043017108238389240766594717604952439180530568085038511813138583654501176738844164687845301409517402208846403932365774572275541629417265375615844881085658667783670084038116747791403424713777806916884694791618333866204495223796894384829871001167867571031567384150065975063220340252650675925924229187155878619985990912118083304418277703348870019758247161856035400406786082244080001772262100435288386883603832749003432365759629385108576168579530538694189489221774243586184498401968700926459296522505954824658129, 5807060169512354774280115239638653822122920600757328261759853974516873748796175508667023007796296946145166692656058982813298326151581059921642272409921425734071027484655210959102052492583349319715920253214061016501838239584659366059999429365267633619410410975277561166104777474637260629285968200937064820564330940565399375513670415682091626574470629255135636700021760519418849197517116602616600425013115230302515471331863935247085606640703367820105939417171085841987489181370769183676317049661907261070755793012092221727890402066438449120816928941628948870553407960618254669187640445568596182889477340040582199431174, 7547814380444583620893569720512081957793897557742707764197802506826917038806886360991255503331230722616546176206518568205003676114900308140883993500038233924142173303863369524598252853570335427121941018813775139777452024989173149963617253307314766739313549648615847342156565240087317609309958087162103155589356921812709418199916621769839551091694629309759415648635807918839677761132865245242998631225446695215889441674928893114898729034074912407125367388185493682713762791642619376870773334133841304620099016436835302526632114580061637192715149432400155791020813508591054911603041900510479282661959102467039219486180, 7919485431326971559859812057710590023582002478375671078797807147874907341197713059060729623259779030078040430493147450801774357982075328287028026552814120563362058271474202062700072189210335972360499170427377306389246195457194547430722103594130010138840876590204620972106789370827316716254583474194412849960468528740056838294111351990133644066106614488511616935542733248349347092902727646489709888252882647343668606080124099007814053599470586826411749108214357860714480834397664692002714123548064411521312076286128915689116424790081981496918168203090144143477609521363490000109123487462470876431002817959528391683432, 939545072129894576257890657273746873332709279876981270640805402718750568101997223921674331005446965434460173251917495804040342276762588951998948356271985151976367979920761559134377017668623360503574518720007923436398131008321817748555288334752910529600878148478347857217477963757691993136709754843740065018301473517543695094897480468761267167665062522886577663342334369639486104970584960341823578370421333609897217713395661431686637740821263437860176298160409779833732984318517606536308822741446254035209026770449137759033745857244742097910868428847036503232711494845530122628237371096885210539236858694872066445348, 7350842968208247938228806606863076478496922974995129099747429185924621319559239478136202233610787118803410636130547622161771895245603254571262160475810284793822536188715073186886124482802143049339363165787547562567240844025512020499956608926915917918905591440856616076821406254570490578948526093902218407905108878991671800763266375187439178917835234896920464584987452212468189554011049939415862609077073160045775634686680467696697595097474384876004859588749815985345189042292152598103157353323531130256125870519166696129042113507068571955674323141286849733280487479167485308804347201596677332419750266548763638552354, 4847086521082622193057514348662429868791074035720315514587101918917981653046166093589126791433500050418662956274713508010903792291714348246575368874233744558017172105126728825483469519515052481828090102840527027815610535515627616158821217470929817689370419950676702058798137604929610917142685541904579167939519635186038925842240328808991592124878060542619354433181678709014273871726782085500555918918537695298444278173804723809133354270626935352594839898928289034971524169787973213377145546972839190261311677294361016357535121874694646925651268898831568424623209044420323687359930566571016716227852950896553006177132, 6053076696974557109844127063536133372524168559612230687366015157878658802659420745123072067016152505537784013879438511946086309633112320924551999833829035766225320486534201904400880834206258671512353428428722229425485120630366560327512383762072302456812845625797446230112190860579378853292810472416775377476131470487083892872193543517932694466640805624107309024568217290705637071142906267323531842580564643920553828458014955249641967367302739098130394450475168617032532921422280952099310452135110379108861017886700877383657798933200707131314513449264470793832251243622041930003682352098062007154746131262921800579093, 7198857973754330810983610824954388844943613527835560318077049317863826924047760573200835665416272821579028565373771837727115028151865261323911681956429700736067576788939705828696872669610923749079350445268727035363260385221101568663863101697237779288950973277019665229205151398764496620442924708575218181967079423583752328900987478339340016185398615744153608716203618798841736297729065223264359444853124244799831528487466544643900248001303654052720451995371570034901366777808436959674533551004342571628078678467499336596654112255731935285763741976851118283953583669743638419095067407318948360222036635986069869890503, 4648862951490847814623978008361292164943312330292380612099756530061676710863679220361054157140898538923139426591175055860150201627337446154261422943470880102231776114641748319767600428665397364412111725259088487930862284004895427544690644888414173999267598631349466413590651770020899962016220626611935755399603776244732743007452265578543626109867859660752319683262536110306129307605799766924640352527526883902960828623713418545732559668007124244180598827348212892054507309448149472570441448999525537796562349660655721230677554927036679822418148605537452458012647693717687854114726741227872884028096699040224090041501, 8437762304906076716484339420448586972931836153150645409185809426258062813504462508798777349091169295249614154875758463186118815459198475067918910357623913631045795681190410853033494000300337290563141001569224966685581738216493409349677242058063660593426473537140782754662923283229858143411837097164411231120248872366678218782679162075316623751098747253618740619236287688799750823179220159126916407639737280625817766026797635194546886942930598054547953896129671800347203314514734754230309222011026063059791856550618161770603101846436411791245263826099573098206220392152409450475661027823861705226227468222835140518576, 6400958698438203554111442314895334587496449695377735992179174961975438550538165292307054320606101051113985723640802117977214175070426791357388035949394850072903627738430123465147490996945267835407214580542550911834297670883288793133620516281723116372967725893335989647258055019546180342402370622841374871108393774095156176579852523955829644390754640794938383245402112501841589073438699316408279329795611440975462741909161872504256235054016085958630356093300691332332292237987133722894295461760797021334645475048652539291182864008718444442727380327664049488191929211997073224650783914033396575473982025014669155721159, 5357791220517077148804863707703059874628990052947443282786859039109984257205003031089618415383061184166143813366813190446281650751331252696251407147981808399277069021401267041208575112479608036978900469447159045282082120942355505868283056616639812322506228395907604000941625475954890497221760739412977855602377766942277744931785578110202166863642320050991454856553144643137028929188390731337988253510985056571525755168970199884026948375585843008624813971745171713463879543408992915448633559434382634547664884749231622980180360726669138015184814232435641990172452883668423253341086412132294708200946564133157593201164, 1412418665056205886695759730117700972387616438029443472500435272388977585340945079245090172160890880021282979127647998272106154917335000911389651240155886849945852813771390001851058396045415336957542144615599374913539705889554040789136577127308063160801403473084748794285185904462749340369104993295814565559581453816175615170007863619774946053620114964521936927974665250149369756436638211495828062972231262115612289416474769055619469290218019161002379452753056961095708821399428463876720498495115106257243363339331419582143760145795236654788613926249705162599821702984816106898653963884632446587875074552335222674864, 1203211229385945500235134728010977201937344622867858285671132059328127149252264683820522428838242629004264889887288299052383625451809982301076377397556077457785215138148862492177100214547211814744631801070810094769506282345652310651021736276261407065426967345870552778400011416392713056498140813091996058169789005260115329903163164095021866684924708500495530160686129623133371945285905361564213222833176980049534088828731888440301283715625649747883848873924283406023061275406182357901624015465074374515026398630685837996280161384394660428748480439156395392723281247311648615124461675969133044077086732872533813963742, 3709657718110020595802216177598172934623621022369350595788629330957040786854823633136250682355259661344796482259852022223943605063023543595122391227922860260697641825636748237614590305524288786963000396670025811226816205280966323306127850395348780213925698039789002159569343971259449295315497505138064030942635743771777096993970430420189446391454231763831327203961596320051553357135310261313615780907571904170220824203954469453482162370099749190480747673741981162001040916167529217935112449040532958055573970267238144949839317610105878606359235274986758645432081315582548143587750861212510820449222375758394528862780, 261676948347412168584999694615756646244318951485527020930972673457999418926522176631068937091435343344600440513057282472317958428611817431249420889160706873899771108463557747960789982062361898407618701303702819635533442914021636986961749493452255639263874539154640786337367207922254434552518590687075696718415233104123131115165349982581010096803717634746135010046670199977728580810824986359558723993921107846882349325489360655921461298694849663757376273209633326267306408344140486324184753756347968775253743712816723253283539516403927007035026923814037398414874871132581451294353263385897505972897665140127660380971, 7278815325978690849638412766451507107763316620329775891001825813886186989781333381221404811630474909473203221841122418383434876261175065187911173389349116358625425653881392468470696434237209399519028429525925133025050022759344403859440020848138352717827144704957582333198564777140475235911757410676717271783030135397231131817853113441564099723800356887619051261872822588772784573679705744901293162137197620836580179175312222478333275257923264594386508205965581298883850463696860703474263679678892355359906331359559809165841137142274513714882043472173329595988569441027119622999515558540978090150797116336279034423981, 5593262361453030941723993504736881956200744628242811338432155517449078007096901039875412077805097669179955756759463034473647709223981195740743789198485073808495204484615537717967659174885621873863484428044051373134071844003025866707024077106731642611838916754569537861646738597542270793695454998955959779975434984504658016191433166687407765900227146634369001037537444726665465352985171879405765321409634151048647631195034698713811532391028961697908028596782676960089894904815851569345877746424150359069952360120053180782610109006581824022594378390573321220553338614277965644860870649522763964659915750469435660266098, 8056831511560512087462237598974565602431095618674695086354370461055257969921598717200197982562418935012073232438494220004510421848689351958742560995094612386730743479032403199525376793168841305434662209212037223488805902725972873588430920109268984628499267374771080758424595148456623083658026017679111345914176088934475515395893816416530285619944003716805753903299464406991818838483578148234461999015174255790910911439838738258379563889174574515059187459018436167033779245215076758290089401518387635363834566887234031695084826091386930178609407823411857858590153485002017259769656263382902399405175339016375718826351, 7182183242345503247348034759762564816243765886672329694031343942756529908199748204996282952117365782776949924003596359110015421301933731880803539441208605627127741659651530455126831294409264294426851177326293723751242126504203232526896633786410017756047212111809896650928785774518275968447919558829074571108400527809840206147942160388158465067627962728672228720321742802972460410190586607559153499966848592527177236770185058465705903337884675083585435903223938474519006394949156659249680876144263136067515006133468246869898327180048296564077893549425539642196251593332505530588734095103542613993976958971332178032528, 4228209912856491434427932624694497875666930403419583331410540144892835781341835018181836185354029328171408366350869847070451557219410602446157149601740486612034289620673693831416603925791026723166234781026233512584239190855025171060957718580210681984359594782707160123505212868248166261268154502379684440807105458660942734880899821346871851015585309171117488059504783543782571573187858635909208184803321605994660531853438087180164669878161321266532556071598582018669299084811918424077570210738417167595869631006683571266837928413676443774582020391920913472312965825283022942659530289844920656490732813223436756535376, 5190667961576174944072694982402541388655514586648689029264040182551180440369294424894114928523300117373980206911866647256783710610047607845938917360576492412588939028458221839914350319708985513753121200107677041591067907517367190500394275864065758820033620882173637838858381705634795170662805976838943392185601488259722245118487145988429755369636207279161105715565096204900853799874341753573363347962078984639672723185140953062026685448673597656553130099403323323993445882575616195097704786202533803058344295872234510437021079479555755862626765876346217723944480035039539301633950580625081979746473028319956020567166, 1243164472925091447713095402692502592547689266119649685810696758081785276740982995791339330448419138258115361850820213145711172210507108788745370115464126510749684283041397550011666266229585223446162095741981090371536503394555856364155854472238235733145356765010667723378121264640474796162965927070754131452552143383313661569976744146721630472138724115586739477326140022556935383304141615921959879508913369387796085319278783350079837793576363812228613989368208643765837671566767483117038057390512125115176478622034751394207412516615167733816619701103401845218285540395947457508783505368698687203656287189101582045193, 6542114006627975719027119737224724187071337718574565966986172565668057874348583339565061361653736056675098265071989704160178573008978796196142025391670622713635732387806601503627360880043938348271379965454909571966661209470624747750423046713138310909608711065293681654698016655865344403926239609607020327960443568282822267641578715102732029397307586248824469885829829691213789011529030476344651254675087690240009169205720267521532698344663157157589199294288359467168664792325796623828487022672051672963607142624012597555398727018960351227132257182320522984019397814309593188847880561301885756352129780897370741994969, 4292742484310713037382738379153100901972658691078084262341922705471262586355989181057332206256895566788020365278165185302641146351825726777674794026082573784480468240057330300297982487958456675275482108287572762650739796919094513904505927503017675989138363254133733356097435951446290681752269371466325185814120200319049931780529650097564243630811957605264672874651956750319728201108181705379904132558627268157467651624744322247752415850924399717115786730890694784283186823092123143471870406159933392063055794438798743523329321490885376116786025333179769389870384797642316716920566317125363619230246068073938223748494, 219401368320818061103816881504229644813074007506982034641188450917392613331173733461943445047431044003706580528180685234580467318935108859757342757059351152497922307052007845211985054326651103042377377174651414405602408337848724544112217094204686951290429756093929809713003570064391235297805711015027917325050366520397966595426277969940551719092617454351760971636360956727471620515986043539597052013820393591118570138955979043576513832563462273970545900546381004330027782636606260618543653823551130493150827394632766771496524724382930869818307538355057039035921842013140834648823619824119649747548486891105667086440, 3271038841366520006188256603843785720590093674167941893298448414319317975800268309412970499985176057675512084969374517328502844856175062709054860809675181172349682954555291370459776553160649145093483955187617138562594014066273268086557313679473352944055936698235384920024216137229153799716139894839548615458086453687705034254434699186445024470104184291855469478845585249051061329889745259856735028236358097117008297821525559037393662008801467363893347038869470343721817830420072395576715444719644779308255321136339102413307561205493013385212170888551922103130270507229068541653008779605086740958207476130051400502964, 2456155230891852562695919839927763461736444615437636587582551258944927110211806942068087208621074160611770641849721751637935345478769196692688027006435972979663562142567324828416182254288611757621261241428608633176094964994616850932584503728365134536936496662210707202246590755613112358461958693055446170086731386837348337455087750016350364391213119774538400174026199676682261289816566718768290844647267793638572136458497600719447474079352081334863001730710223493077022390717453147297868742446877725752547598874597140691497422270505936751194447576650136894587129965412357481037143574258089880549063150833997685776667, 5882745086848258872558033816373436179595952477805436968068101946372042846876083133844813592881880515556454351026160456068229080798478897486468481959817325406744713069542514202948255558742531315208435274910202177578256299340491679518113082314711170645394204587954350955637254222226420575718779239446773995702883853414755763454105879225704228758101320567015331137748307607627401797060226291609832330620137254031938147332323197038162156090400495356821085684408849900546904637080960546870469068482647004283165195793245901005053548856782915939563806147000671303488137900379591487812398651153380009672221200719788473973218, 1544983186204720012233971043772959457615928773904668703793264009388334440596324684551027134617341678379587817957800992795606261476610347113590605178344338959992428759550879691115433446688701457935449993755592303754323020139304315949515367187074572515658622812038358726195824766388065156892425975977848735181652256346508343871850998765725166455688093847134254912999043404661484707011771354716761128207066264171182964873350582043811780809964872294243048793032590684406184214338368402652212399675393858493984096867618486870704619466351739566594947647069371048149825380953291731199238371922621839396814419741282943629009, 7436650844033850599139160268268078713951656611252900853110971603417207381995029587277856101310998440538593560151706139587025107874588137031263454860891891265576413818734476849615265647438906383275496714762386302748218863193997332507850757821996205529371844975133588243121006764989662795693094822434925926455226831108002148886769944798356921083976576158296731998977242853529271418782907902722204644879030570558292868364913312890932774886663521538222558889064732413266599915945379860297287350660813848382106511762766929966612689072795892279743222409718143036826047710875635344199889429025067473498921847725104401905474, 4520094792541831428028443634962238155046027873139675778047332975650971160992528572312636942564883681324110625694421526512638750541722174577396099771769833740303692387637626461551071275711267782600869942358669950299243866239833309643880922428537271939018552933437333573662906615154695527975862792573681337674299920653913343171607415156180158927805347240675558270335640245130581787091339902612165178400154063802200461359755453022356363307462420711680762694610618326043792793962788687981036533059929092313782017820854632594520414656838344777384976674331027873592326516967793530080405661561894094548142337333944508729324, 8344417008221564147222964899944269190219706496889014764577612384909900660961198181923497588128336496877814538791749755473219733567100492075730290924457270650974816699490893675833248480970134403458209865631849729381741118768554014978835014116864275370701915524852516142944251268159719815693388776467168672753002364040336571491608902724179279125085563780377105638383028956097694509438884493050056163362914369392219462873829711088663347761751838589198376290333152491158922852127803874713124082711205949584909447623882166042486344955328991086267451212602167815160249312287019341348247110584784270524422299197758276233177, 6900575793777603900866480743456426787432500857082901407830057522260842148635103738510522020156808301395371553347695869668803330933633334032558289417026747005850977337876741664581269998240635265635215104023212580011965287917132047559239155585572402224320215953569685644154941988572323678896880927802138986067041504042516158533118465537675301058226112139760917094557169424850934438637841053218101679845425389785457016819026096897930329773564919542374890321657990882183938363826648444847356637225467863913426423008000512222659361097371661607147348075049151396557834968756819751156935382883870858328491577062527732445078, 1039620873456544502792526439053692563154144835379847756378504892556486695893811372496348686040234429241319558386566942949633993286509479433525660703211528073247929219066429684877942418573976874659607403550119970164705963872962022564900892873979929143542730048584191665306869138898715847944721937805038103245129103914480958479618921523447386186168509805632791931086068116198248935672298308230243100580196955728451313725938964425351501171412475747424699269665210309339167573031158405498419018168296646448709143153048088503449978663331342908191879833493443135681045163836717694670471220000514396248007377973312385339724, 7470054329282446464987566606090059811462426737907010584685629849246675942747791612912385984643325345939604013467874016999142427127951005108950475700525540668125074794680112145664898506394897753446948672675481662838013049302627335150200974175696648650777326692346912365323452264939510461349128291141868470499211561276926683501373783782333841097631798292513576034069530903301105938266887072627938474272414795650506821360402394172684411940040086092339545473621240673615537054466086956132870259353118055673366408560504136480848386573221372874886425905788900478612242898970132206377447991221786767100649860140494888691252, 402586505295967619905691072840312493779335883059189597094419908427773884390475146712444916327930405672543666550678142115158300421404418045445262115396372541897650516816803242979853720862777789587197209936299310709424481121412828315741419905631889033420536751788581045359465063767301991224167916510756496045670563145128493494417001678688510299272337718260637160304646772976510411929623713842099669591355816329276513530326957443811236389035007968434194472060894066200603822947428932847324382046154359171880058689186950219622764930900521645422837522020120301079031749943777354436556479348984014074158081422773017344429, 563415937673678313326228187483725710394329785396294818829384243977182814074354940314830423095382742612573997861647718143446138119677389868766367316711406247322828984283892024723846965564520885160731874332445117222587977685554156137595131151468102885725701318636938041492306105096576500134858251709663919443547356064364383377520553574336319571145699171258664474006427403613976015890776865886415686165610970837505144900157729064059079778401775463908397715383769585384744896599460085581039588566179869725128599222665672413843148034696792996069176422046725514869941816476120682513697103886905478620598067865111007638214, 6264171558170135853319244400246873682863464821832291187818309393193945162201349227956437462599067531934951396904287045310504756039169609644468784846371308349116591413208663636416383041466216010356270341549299532423110562786417975240670981647083471199865967894707530938386057961502144576305336509989087868723894494821732948760448594636803954612295582123339452115113695639935682681498785975332367738372429605531518932405658718605881437314458771044654638467285552057040735264564970344018225031797530808832944176003887286565846588331087123906656052577104980222392491832498130606376756392102892579940124531323994973041356, 2353259984204080610194225545041745470089829854097864641866035411574197919718145042882458633681303194230696696437448461645897006566748724423868316510915878385919855584438529309016964796316957554084425090041130406684295448143463557183864986904580491931283427052128639558371950430202157949775211920507501398275682298137803204807425128484838151126784041651105068163531276047578525635596664918372087540317287081064542264455566484399056787275490619623780474771944251109850248376266811618077837209537522980915184699182374776943561962748552430146841092702356546816590614600084173778998145975210290185159573266725929227069797, 934622855869211544962820832783292772587001864016481633549319692118647997365464035742526935162648259530035104052809219385590761480441186611799119613466669910052474575879271777013068409950275118819271965640401715989002186972083540232156167947826249000839292685321721628065384695155838067324265358240071330893787232359259468365148164434154977753368338245369912513394665811580301710559006224827329627076355282410580908081271388693505193839085252723240461425603359426851814557335513554481055068970416054340798137251839192056309530963262959762084997021235759225269150612757109264548475689409264671024573562937371050956945, 40841288761021636035081504620005804587229560547531272508136805673408003215604383809004611855701311115223112605115709593049810264672173558540023314671972835214382106402783762118279584521233115736837819765494338898939471652983572180581907308584658144942283869592172851186231199077015559827655206680253256244042771899973946776714488435723186063576126220739335220510544265560811367391247525457794942530912583087751694416713618377148110119208175754047246129610048382459072266724134533622008051571095186035009538596497573441196582092730514335722135791580631583562572253842816475462260037113557826466531463600577822577182, 5194167723301591230052801202311062157866735904915081465426740746198750008930358064836751025937251639753670761995023333197206327687539110703753911522886716157739831174046019068361151571250792024203569955376201763635555662214478738323877633155588398889092300762510501476335046661463029505382914917782631966235337350109679614459491385866493887048283144029645605953297504926534018927565533631739125447346226726670538409600766693906727046862542380835457909301029612194810314215517635384820588406789302777644163373672264084335029863991962070572891753902948487940575256074525849478375743486686220289464554488663853426257777, 6271352246934455976797775881527917462779314317430283852058699813865422627237142212510017598369001966571683881756351210093308614080865877135241552804057654592113816218350687381234415340503752110818386564991371587895054274788755486865036233770817470206413118178086462394276253477556518575971647180626293577435898333031113655936309925536901257802782468175442927047298878261542124933534175605683359243625843584613665749753138469318900501640625071783818214590797213356657759970529844432851895905792711311693514754962568263023660823886198272522805392577490602668450317589243640841456849368777010601234228020405948443847083, 4821731178298047316711442468332106999270854442323819723845585722463345759704140919237557616179183907220898829243875168017054228442826769190816557217542996585231148296411158529661986640529060922752227093277388138854993220533904177266584574296832359259423699871879700017216845625668994140287618242499265546620783703522566626476780510780530074560982900287233691796896846646738398802319651662960746563876737978008833049837278725322072981128966853961327928789581063966055979141342438050887153505021016595018853626633712350697112978422462943707348105996496244791246583525141684920739961097599878260879488699774921932132062, 6399818591120457913208553954802236713465019937046326368744675340145043793721290241911273492322219603155375874213489728151648124863992933435896068973035610102301243801752479671702175436669868488048545845319142232333236698265473660608201734049482665906533212175948419883833595303534526841525720789460588050251317085997244268814974789292571377987449319164260727769366340737341742562090216144305791418003987911684076272503859590276313567869075763206840280711473677015819143228795811856409362088334677239439076112136461041153210487275000797978892734325026811400894047397076097003622474286288059741856148711497806986431131, 7542155814178254959504773591982822403403864745643248737707320651762699804253567868628136153988005773849555664576532680605616516390581697578355648017928389763896413758238809257758848923043078122373872163704006418978943948940530921798725176726599654342782748808719770205731032084083695209244547645988386719686737804480819763591984834574175987766445547318547256450184389979407091747998898876327996889954949720743514190353823088757373028008841977792574997056469422934895393816053723616496660437820102090577873321040835217262907559657259915054769752384539456629279873778532070749279183983856355074437119970567485970288660, 2455233488932353458082883534912337045417829743259585008612728904797450615841945492931992534352509320621434361811056975179989321651915272492833147028173302499223579762213322754588578893606719993660524105022455469199530331708195132639639030962033424189397073569731374846738861813386346329986250454032749286622481838850808059105459032039709263349667508981492373892403503197726347916204783781382620605455746941504253331887237697572737052995839834326159759348440382765571380267512913102433595812445500294978519993249542565579722989469683433699579845980895001333867098822760847040589336326113160796711133243376985905412440, 2769306888029280481595471794864744736989266590835807696396476317376571712998061705559840255382337792698371824612630572497064046174652240812241207474877176351199169726250685137266944105069267021241905394940332486093326652877783313541543207994497381413148076867018952044585793844301490359127989238430256613789379390552090171381095270828586550759326651198894672920603164598324929883508449726197319840180038010040906493980310809420624846105982881056056806033938668469744609139780426991436223972318573803671682979890411731746542081305815486849829820055798706046070964513541153173891178300237893253294303266376838297392954]
print(factorint(n))

p = 9608487498911342475258709905130446784110007980919831673256577866617015685176665542910562376116681809366214190904756211370649126497873239204715605411164189
q = 9608487498911342475258709905130446784110007980919831673256577866617015685176665542910562376116681809366214190904756211370649126497873239204715605411174207

l = lcm(p-1,q-1)
u = inverse(L(pow(g,l,pow(n,2)),n),n)
flag = b""
for i in c:
  flag += long_to_bytes((L(pow(i,l,pow(n,2)),n)*u)%n)
print(flag)

Running the above exploit script, we get the flag: BSDCTF{C0ngr4tzz_bU66y_4s_!_s4!D_w3!rD_y37_34sy!!}

Big RSA

picture Challenge Description:

Why everything seems to be big? Don’t bother, you can do it. This is the third challenge that was given in BSides Delhi CTF - 2020. This is a hard level challenge, so as expected it got only one solve that too after releasing the hint. Hint: Looks Like Leet

You are given only output file output.txt. So lets the contents of it,

e1 = 0x3222ce734bbd9f62ee0b3bcccc96af3b9295c705695a1353ecfbab8176eb533a2cb7af3948d28271de99ae776bbecfc168b8466ec39ee728bf386827edd3cfd3aa93f0bc8336002ec7625c5d39d8eb5dde71682652039ea879b46a8838158f5d3414357a2ed60ce1f30ab6b872999073dd91f30ae6b00374fc57faf1089aa99855993830f5cbdbc853fc4f8372c08eb558a44f9e4fc6e082212dfe13fe36609e872d31524bc58e4cc9cabd95f82e360380d8dd757d00ce65142ffc6f0da94a53f6e580b01e3d965aca15a81d30652489d7de18bf16d7e4a74701c0a508dccc2420a3a4d34279afef1f35ef1258128aec2ed3642b27119d6cb55b35efb8de131d
n1 = 0x5f7003917cb1070dbef61d56de6cdf8770e9ac1f2a11a7c08e2fa7275bd84fe0d46217d7ededca59d50c992cd6354b53bad8d35687b126496893ba9addc3df3ea052352a371ecf20c951cee2f2fac7e43f38e2cb651dcce0f887cad3de45b8fd29a0c981b57ff43c98dc5a762bc4a595cdfcfd38ab095ce4fa00ac80872981421b0a86778baff9b4e2f631e39a4d3dd0ff8a97e4693b9b847404879449e69212e60f2f62d6325b11980e6303ca83a95aa09a6c94d02d431355369b1714bda0bb6ed9135d72f12b36215ed8954835b041b7d62d7d50af6bdd5b9c31d02a29e77c597e36618b545748498c95d3fab8b7b6ba9bd2340af66e63a34ab7cab5856891
c1 = 0x16e28f370a96654c2bdaea5634311aa6e71d9064eb642ef29b42fe49d6e0d5fd2ee1804b0fefb343a47f8524a5fe32bbb34969f1a5a3c6f8c415544065832cc3ee34f312d022a5f2416c102ec0fcf2dc297eba3e2d15fe4c6cdf02ad7f5b197e430c1dd3e99177d2ce6e0f4984a33f47de4b957d4a639857c69c6ce2024ba7b7323aefa49880f67429b24c033278095570d0722f88be5deb69ccdcd188b7f5dc7c6cfd977ae973f5e8fc7cb1c85cf3d288a83fcb81180831c0fd20b8ce93045327fec2273fe807eaab355b7cda5256acda4e865a8db7722c853c86f63462a162fb13b70a2ebb9870df2b7607d7481c7ae8ce5f6300b05f992cbcca1e81d55287
e2 = 0x67fe4657cdb5a2ddc28d034f9ac4ae2ffe3eea356c5372bfbcd6c697748ea8b4e89dc27a99bc2fc42e408462de60aa6ea71542eb388919ce15f42b270dd287723177f2c272339b730f412d54bee7cd53e75c7b6493e49c6dff6d678f4d40faea8a1489a46c4f07c7f9e8ebd5cb6058a93597cf0d46a3c3708f079630a910d48ccb1223f0c621cbd250d858012d496c23553ad21a58e2d93b1ddf235e35766a0d214109fb039e9381d2944344f62f5071e4ae6bcae3cc9a3dea01903d89b2b5e7e7ceac032b1ecf3cd066c8a476039fb1c8e0e4efcf2500f77f56b8d5d06ca283bce4af2a046b8bf0a5f51cb270850578fbc479e60acd9570ee278dc45804c78d
n2 = 0xe78abf92c74ee182be6f9678d90dcc3deb1b97ac9540ac28ca443666d00250683e10996271ef71cd4da6a73a1e751625a2dbaaae7d3019183db5201508007fd4db547f64a415e4616d24dba839b2bb6c63ef67f5cefbfd694edd68706592aab8219a7e7ad57f57702974f075d89bc4956f2be8c030a473332d94c990ff0ef50f5eadaef126a8de78cc8a44a97f75496eb9bc12a2ab28189596b37b6981e6bc8af032a1c623bcadf715e2f5d243594f3fba8eb4a1fd40a0920d7c1eb61d480ae383e852e3bddcff961a76a6959fb05707ba56e47fc65f2a6e4061c7e8b0fc292d08ab82fd449def9edff1d508d57593da26316e75f4a70c375aaf40db55e6ada5
c2 = 0xe1386d9323960d621bd6bdfef8dae71c285f5efb0e2347614bb81f48e728bbc538c7583b83274c65e245255bca500e6eca4ea43c165a2d6d4a559c113d8d91cd9255a0f858be297416fdea0c381350c28fc343621106f471bac3047e3c51093e22818aa58ed8c40e14d7e9b94d2bb3014b8255a7144f8ac71148e045d8f9d7ba89d439694a1dd3af93d72d50dba0492093ba55adc37ed75b662e38455bdbc94a582c6c394c5a64d1c5e1d6c46338bdb95cafebe6fddb565245b1290d15c005c70b7c85eea8210f14e7328e52224c9aab954e6e831943eed8118cbaa054a32539dfa80884c97b0c8a63ab67752a96e473154f9cf3997ecb4a8bca836413e16e0d
e3 = 0x6a2c1840124b9da8088b02a6f8853df716b0acee1215f99d5cf664a84f04fc87837e98fd3ef2c1047188e93613b46ffad6c03e94547c79487c9241edb0a09e1814644a8f9571e75e590f4b7354bffac68dd1c49655d0e5cd08aa7999cc2cacfe191c8b9a707e0b86077f7a73a0c193d2af0b0e163a09646eabe2806e9067c180f26cffe78537e53e1dabd75eedddea3706988093fa93712b0b89a28e91baecb4c81b064892af9479ba2aa304b9277558ec97947e2d90e71635f19b4489d46b2547078e9d9f60ddf5f8bdf0f7ec8269534c7a439833d5b7c600e4c2dbe2e213a596d9b20547dd61d83a36fc5a36dedcc9e8b7edc192bebb039b4c821c26685085
n3 = 0xc218c635da2c9bd0760f3aa7e90621c978c2e02e60d23c20aaa567f1abab35a62a175875ce1f9fc37d44245572adb3bc30ae564877c123227e7d50d51431f46d25ca223398996171dbdafca030ff8903511bd439bb3716549448cac2f9f53e62540781a85b5066ea5ab30c94b8f12f318ae6ca46f376dfc7828d2004a2df3abbb8701209b217be4494dd8e8894d4d4b93d4a770db6723a43076dd0abb75d8a4bdb6630e6c223fdc288b29c3679e3061c3d07d589ae069160174214c469dd8fc820f996dd6df554855da3e259d80ae7028cac5e5b01f8a1d5e88dcda4a045e62d4797558d04df883bebc6a87506b6cf248f87e5f6ff2c3e6d85591ee6ee1af50b
c3 = 0xba6043f974e916da2c0a8c343f83d32773e005f52bcba452bc7a36a9f65c6758afc5b5878ba16ca5a2a100982436fa759020fbc153d2dd687999fd412ee8f6e34542731edb6bc87748d749a681ec6c0483a7b08f33d0ab61c8221826b75a10d376a8d922870560d655e67d9ccfce8ed447c18f3d16d553c8204c8559ef8b01342bb0b876491c380eb3349fe423a14fcb5ea6a15d1d1c25741bc43adbde3d0c35dec1e535e345aef210cd1f80e17b74b6ece186ee9948d00d5b5ec61e8ce9c4307657623fc77ba08875579a8658faf86677318f3196ffacbe6f0a0c6c962449bd52e69e9a3988a782e1bdab354e51f260cec8351900fd16f8615562465e2446cb

Looks like Hastad’s Broadcast Attack? but it isn’t, try it! Also, from the hint we can understand that this challenge is related to Lenstra –Lenstra -Lov ́asz i.e., LLL lattice reduction technique should be used to solve this challenge. I got many queries regarding this challenge, they’ve tried almost all attacks based on LLL. After trying with all the attacks one must understand that it has common private exponent. Since you are given 3 public keys and respective ciphertexts. So this Lattice Based Common Private Exponent Attack.

The Attack

Let M = sqrt(N). Assume that you are given r public keys ((e_1,N_1)), … ((e_r,N_r)), we begin by considering the r key equations

[M e1 .. er
0 -N1 .. 0
0 0 -N2 . 0]

i.e.,

M = matrix(ZZ, 4, 4)
M[0, 0] = n3^0.5
M[0, 1] = e1
M[1, 1] = -n1
M[0, 2] = e2
M[2, 2] = -n2
M[0, 3] = e3
M[3, 3] = -n3
S = M.LLL()
d = abs(S[0][0])/M[0][0]

Applying LLL algorithm, with the above matrix as input, we obtain a reduced basis whose smallest basis vector is

[11816899027660118847591233721487882485465393589972947882640690544300093172355161193516311590979612064593052778247539232585818564191719163865769407846237539396283395055706551384222358694456613590335140636327909852785595461456007346765656730725595103323182672973325084227439506765497861393662472676436499443391423157894902128842192100884313612902289078323722026020483220869349714098919488163768873273395384655036820162505239263568929307165739476260344676659661278513037589989480030525124649736585988457961176460510762148665998197038887469056   -8759766032229538512787168599340322232590514973459132015639661574657609090243151384204502812318066402582135935042074890088293020391942567176289378205096436176249623499684849142578276527508643259648829191055561403639246263147330602867010589406826017449782036140966263546183285727322504056697895770335019336121289097549878642777535475053135547615525463998288145808340593636408959192161294799249042775221361846269280446358708611677712937874109189016176002956291358549352336823163741700625150967792261386186502553906867240234103076217623675394  -11593777500753080597364430706174684935122695271533832764957122539219043878663054842050428413412679145875420464663361079395925119164060214061261609293698019145347100179905465815027098864890419627039027045579930353006934847907402663618400735415703301186376084532633649800321090087809500508027071950091008591505793178834490042147754758179610573625336681505863772270007886823278135212893257313827695398724269006328450315565579285620744294029365142947170047388033941374529074467759801850033165740795280159994248552443249915072406144905401070820  -12961565503166082928597386579932584044493315003714261734131949176084922002767713896675623169264428315461997074029715400378436261178323219318412948014493509847933661851364026779365574998600466488109510427377277366713099481222270306982924987365812562634600119569352399252086386874525586273384459452715838938718910088019517104219968676255976196433604100772302807014130735382307569143558212936496505172642186939032680020569771156894475911147352624942958297207185611320919117744183688659271162604309879725206201475869439459882283749473179096944]

If the attack is successful, we expect the first component of basis vector must be equal to M[0,0]*d where d is common private exponent. that’s it we got the private key with which we can find the plaintext / flag. Here is my entire expoit written in sage,

from Crypto.Util.number import long_to_bytes
e1 = 0x3222ce734bbd9f62ee0b3bcccc96af3b9295c705695a1353ecfbab8176eb533a2cb7af3948d28271de99ae776bbecfc168b8466ec39ee728bf386827edd3cfd3aa93f0bc8336002ec7625c5d39d8eb5dde71682652039ea879b46a8838158f5d3414357a2ed60ce1f30ab6b872999073dd91f30ae6b00374fc57faf1089aa99855993830f5cbdbc853fc4f8372c08eb558a44f9e4fc6e082212dfe13fe36609e872d31524bc58e4cc9cabd95f82e360380d8dd757d00ce65142ffc6f0da94a53f6e580b01e3d965aca15a81d30652489d7de18bf16d7e4a74701c0a508dccc2420a3a4d34279afef1f35ef1258128aec2ed3642b27119d6cb55b35efb8de131d
n1 = 0x5f7003917cb1070dbef61d56de6cdf8770e9ac1f2a11a7c08e2fa7275bd84fe0d46217d7ededca59d50c992cd6354b53bad8d35687b126496893ba9addc3df3ea052352a371ecf20c951cee2f2fac7e43f38e2cb651dcce0f887cad3de45b8fd29a0c981b57ff43c98dc5a762bc4a595cdfcfd38ab095ce4fa00ac80872981421b0a86778baff9b4e2f631e39a4d3dd0ff8a97e4693b9b847404879449e69212e60f2f62d6325b11980e6303ca83a95aa09a6c94d02d431355369b1714bda0bb6ed9135d72f12b36215ed8954835b041b7d62d7d50af6bdd5b9c31d02a29e77c597e36618b545748498c95d3fab8b7b6ba9bd2340af66e63a34ab7cab5856891
c1 = 0x16e28f370a96654c2bdaea5634311aa6e71d9064eb642ef29b42fe49d6e0d5fd2ee1804b0fefb343a47f8524a5fe32bbb34969f1a5a3c6f8c415544065832cc3ee34f312d022a5f2416c102ec0fcf2dc297eba3e2d15fe4c6cdf02ad7f5b197e430c1dd3e99177d2ce6e0f4984a33f47de4b957d4a639857c69c6ce2024ba7b7323aefa49880f67429b24c033278095570d0722f88be5deb69ccdcd188b7f5dc7c6cfd977ae973f5e8fc7cb1c85cf3d288a83fcb81180831c0fd20b8ce93045327fec2273fe807eaab355b7cda5256acda4e865a8db7722c853c86f63462a162fb13b70a2ebb9870df2b7607d7481c7ae8ce5f6300b05f992cbcca1e81d55287
e2 = 0x67fe4657cdb5a2ddc28d034f9ac4ae2ffe3eea356c5372bfbcd6c697748ea8b4e89dc27a99bc2fc42e408462de60aa6ea71542eb388919ce15f42b270dd287723177f2c272339b730f412d54bee7cd53e75c7b6493e49c6dff6d678f4d40faea8a1489a46c4f07c7f9e8ebd5cb6058a93597cf0d46a3c3708f079630a910d48ccb1223f0c621cbd250d858012d496c23553ad21a58e2d93b1ddf235e35766a0d214109fb039e9381d2944344f62f5071e4ae6bcae3cc9a3dea01903d89b2b5e7e7ceac032b1ecf3cd066c8a476039fb1c8e0e4efcf2500f77f56b8d5d06ca283bce4af2a046b8bf0a5f51cb270850578fbc479e60acd9570ee278dc45804c78d
n2 = 0xe78abf92c74ee182be6f9678d90dcc3deb1b97ac9540ac28ca443666d00250683e10996271ef71cd4da6a73a1e751625a2dbaaae7d3019183db5201508007fd4db547f64a415e4616d24dba839b2bb6c63ef67f5cefbfd694edd68706592aab8219a7e7ad57f57702974f075d89bc4956f2be8c030a473332d94c990ff0ef50f5eadaef126a8de78cc8a44a97f75496eb9bc12a2ab28189596b37b6981e6bc8af032a1c623bcadf715e2f5d243594f3fba8eb4a1fd40a0920d7c1eb61d480ae383e852e3bddcff961a76a6959fb05707ba56e47fc65f2a6e4061c7e8b0fc292d08ab82fd449def9edff1d508d57593da26316e75f4a70c375aaf40db55e6ada5
c2 = 0xe1386d9323960d621bd6bdfef8dae71c285f5efb0e2347614bb81f48e728bbc538c7583b83274c65e245255bca500e6eca4ea43c165a2d6d4a559c113d8d91cd9255a0f858be297416fdea0c381350c28fc343621106f471bac3047e3c51093e22818aa58ed8c40e14d7e9b94d2bb3014b8255a7144f8ac71148e045d8f9d7ba89d439694a1dd3af93d72d50dba0492093ba55adc37ed75b662e38455bdbc94a582c6c394c5a64d1c5e1d6c46338bdb95cafebe6fddb565245b1290d15c005c70b7c85eea8210f14e7328e52224c9aab954e6e831943eed8118cbaa054a32539dfa80884c97b0c8a63ab67752a96e473154f9cf3997ecb4a8bca836413e16e0d
e3 = 0x6a2c1840124b9da8088b02a6f8853df716b0acee1215f99d5cf664a84f04fc87837e98fd3ef2c1047188e93613b46ffad6c03e94547c79487c9241edb0a09e1814644a8f9571e75e590f4b7354bffac68dd1c49655d0e5cd08aa7999cc2cacfe191c8b9a707e0b86077f7a73a0c193d2af0b0e163a09646eabe2806e9067c180f26cffe78537e53e1dabd75eedddea3706988093fa93712b0b89a28e91baecb4c81b064892af9479ba2aa304b9277558ec97947e2d90e71635f19b4489d46b2547078e9d9f60ddf5f8bdf0f7ec8269534c7a439833d5b7c600e4c2dbe2e213a596d9b20547dd61d83a36fc5a36dedcc9e8b7edc192bebb039b4c821c26685085
n3 = 0xc218c635da2c9bd0760f3aa7e90621c978c2e02e60d23c20aaa567f1abab35a62a175875ce1f9fc37d44245572adb3bc30ae564877c123227e7d50d51431f46d25ca223398996171dbdafca030ff8903511bd439bb3716549448cac2f9f53e62540781a85b5066ea5ab30c94b8f12f318ae6ca46f376dfc7828d2004a2df3abbb8701209b217be4494dd8e8894d4d4b93d4a770db6723a43076dd0abb75d8a4bdb6630e6c223fdc288b29c3679e3061c3d07d589ae069160174214c469dd8fc820f996dd6df554855da3e259d80ae7028cac5e5b01f8a1d5e88dcda4a045e62d4797558d04df883bebc6a87506b6cf248f87e5f6ff2c3e6d85591ee6ee1af50b
c3 = 0xba6043f974e916da2c0a8c343f83d32773e005f52bcba452bc7a36a9f65c6758afc5b5878ba16ca5a2a100982436fa759020fbc153d2dd687999fd412ee8f6e34542731edb6bc87748d749a681ec6c0483a7b08f33d0ab61c8221826b75a10d376a8d922870560d655e67d9ccfce8ed447c18f3d16d553c8204c8559ef8b01342bb0b876491c380eb3349fe423a14fcb5ea6a15d1d1c25741bc43adbde3d0c35dec1e535e345aef210cd1f80e17b74b6ece186ee9948d00d5b5ec61e8ce9c4307657623fc77ba08875579a8658faf86677318f3196ffacbe6f0a0c6c962449bd52e69e9a3988a782e1bdab354e51f260cec8351900fd16f8615562465e2446cb
M = matrix(ZZ, 4, 4)
M[0, 0] = n3^0.5
M[0, 1] = e1
M[1, 1] = -n1
M[0, 2] = e2
M[2, 2] = -n2
M[0, 3] = e3
M[3, 3] = -n3
S = M.LLL()
d = abs(S[0][0])/M[0][0]
print(d)
print(long_to_bytes((pow(c2, d, n2)))) # can be any ciphertext and modulus

Running the above script(remember that it is written in sage) using we get the flag: BSDCTF{c0mm0n_pr1v473_3xp0n3n7_4774ck}.

If you have any queries related to any crypto challenge from BSides Delhi CTF - 2020 you can ping me via twitter.

All Hail Cryptography!