CTFLearn RSABeginner

Solve RSA decoding problems when e is small enough. Problem link | RSA Beginner Compute factor $q$ and $p$ In order to decode RSA, we need to compute $p$ and $q$ as factor of $n$. Generally, it requires a lot of computating but we have a good resource: stored factor list. Pip package factordb-python is useful: import factordb.factordb import FactorDB f = FactorDB(n) f.connect() factors = f.get_factor_list() Compute $d$ $d$ is defined using $\phi$:...

August 25, 2023 · 1 min · 136 words · Kazuhiro Funakoshi

CTFLearn Substitution Cipher

A problem to solve substitution cipher, which as Dancing Man by Sir Authur Conan Doyle. Problem link The given encrypted text is: MIT YSAU OL OYGFSBDGRTKFEKBHMGCALSOQTMIOL. UTFTKAMTR ZB DAKQGX EIAOF GY MIT COQOHTROA HAUT GF EASXOF AFR IGZZTL. ZT CTKT SGFU, MIT YSACL GF A 2005 HKTLTFM MODTL MIAF LMADOFA GK A CTTQSB LWFRAB, RTETDZTK 21, 1989 1990, MIT RKTC TROMGKL CAL WHKGGMTR TXTKB CGKSR EAF ZT YGWFR MIT EGFMOFWTR MG CGKQ AM A YAOMIYWS KTHSOTL CITKT IGZZTL, LMBST AOD EASXOF, AMMAEQ ZGMI LORTL MG DAKQL, “CIAM RG EGFMKGSSOFU AF AEMWAS ZGAKR ZGVTL OF MIT HKTHAKTFML FADT, OL ODHWSLOXT KADHAUTL OF CIOEI ASCABL KTYTKTFETL MIT HALLCGKR, CIOEI DGFTB, AFR MITB IAR SOMMST YKGFM BAKR IOL YKWLMKAMTR EGSGK WFOJWT AZOSOMB COMI AFR OFROLHTFLAMT YGK MTAEI GMITK LMWROTL, AKT ACAKRL ZARUTL, HWZSOLITR ZTYGKT CTSS AL A YOKT UKGLL HSAFL CTKT GKOUOFASSB EIAKAEMTKL OF MIT LMKOH MG CIOEI LTTD MG OM CITF MTDHTKTR OF AFR IASSGCOFU MITB’KT LODHSB RKACOFU OF UOXTL GF” HKOFEOHAS LHOMMST ROLMGKM, KTARTKL EGDOEL AKT WLT, CAMMTKLGF MGGQ MCG 16-DGFMIL AYMTK KTLOLMAQTL A DGKT EKTAM RTAS MG EASXOF GYMTF IGZZTL MG ARDOML “LSODB, “ZWM OM’L FADTR A FOUIM GWM LIT OL HGOFM GY FGM LTTF IGZZTL MIT ZGGQL AM MIAM O KTDAOFOFU ZGGQ IADLMTK IWTB AKT AHHTAKAFET: RTETDZTK 6, 1995 DGD’L YKADTL GY EASXOF UOXTF A CAUGF, LGDTMODTL MIAM LG OM’L YAMITKT’L YADOSB FG EAFETSSAMOGFLIOH CAL HKTLTFML YKGD FGXTDZTK 21, 1985 SALM AHHTAK AZLTFET OF AFGMITKCOLT OM IAHHB MG KWF OM YGK MIOL RAR AL “A SOMMST MG MGSTKAMT EASXOF’L YADOSB RKACF ASDGLM EGDDTFRTR WH ZTOFU HTGHST OFLMAFET, UTM DAKKOTR ZB A RAFET EASXOF’L GWMSAFROLOFU MIT FTCLHAHTK GK MAZSGOR FTCLHAHTK ZWLOFTLL LIGC OL GF!...

August 24, 2023 · 6 min · 1084 words · Kazuhiro Funakoshi

CTFLearn Leak Me

A problem to exploit the stack with format string attack. Problem link When I access the program, it prompts a question and it takes user input then prints the input $ nc rivit.dev 10003 What is your favorite format tag? some_text some_text The problem comes with the program source code and its binary. #include <stdlib.h> #include <stdio.h> int main() { setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stdin, NULL, _IONBF, 0); char flag[64], buffer[64]; FILE *f = fopen("....

August 22, 2023 · 3 min · 496 words · Kazuhiro Funakoshi

CTFLearn Reykjavik

A standard problem to find the flag by dynamic reverse engineering a x64 ELF binary. Problem link With given executable binary, first we want to extract text from it. However, all possible text from strings command are false flags. Let’s examine the bahavior of the program. It prompts the usage. $ ./Reykjavik Usage: Reykjavik CTFlearn{flag} OK, let’s give it an another try. $ ./Reykjavik CTFlearn{flag} Welcome to the CTFlearn Reversing Challenge Reykjavik v2: CTFlearn{flag} Compile Options: ${CMAKE_CXX_FLAGS} -O0 -fno-stack-protector -mno-sse Sorry Dude, 'CTFlearn{flag}' is not the flag :-( From all the external observation, we can assume the code is something like following psuedo code....

August 18, 2023 · 2 min · 319 words · Kazuhiro Funakoshi

CTFLearn Impossible Equation

A problem to exploit the input guard using math. Problem link The problem statement is: $ nc rivit.dev 10011 X * 212103456793011 = 183057226632645 X = ? It seems we want to compute the number of x: $$ x = \frac{183057226632645}{212103456793011}$$ If you compute it, it should be something like 0.8630563094088945586. However, it won’t give you the flag because x must be an integer. That said we need to overflow....

August 18, 2023 · 1 min · 159 words · Kazuhiro Funakoshi