-
-
看雪CTF2019Q2-第5题 丛林的秘密
-
发表于: 2019-6-18 23:45 3173
-
这个是Web页面, url: http://127.0.0.1:8000
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 | public class MainActivity extends AppCompatActivity { private Button button1; private EditText eText1; private TextView txView1; public String url; static { System.loadLibrary( "gogogo" ); } public MainActivity() { this .url = gogogoJNI.sayHello(); } protected void onCreate(Bundle arg3) { ... this .findViewById( 2131165318 ).loadUrl( this .url); this .findViewById( 2131165318 ).getSettings().setJavaScriptEnabled( true ); ... } } jstring __fastcall Java_com_example_assemgogogo_gogogoJNI_sayHello(JNIEnv *a1) { // http://127.0.0.1:8000 for ( i = 0 ; i != 21 ; ++i ) url[i] = byte_2D28[i] ^ 0x66 ; url[ 21 ] = 0 ; return (*v2)->NewStringUTF(v2, url); } |
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 | public class MainActivity extends AppCompatActivity { private Button button1; private EditText eText1; private TextView txView1; public String url; static { System.loadLibrary( "gogogo" ); } public MainActivity() { this .url = gogogoJNI.sayHello(); } protected void onCreate(Bundle arg3) { ... this .findViewById( 2131165318 ).loadUrl( this .url); this .findViewById( 2131165318 ).getSettings().setJavaScriptEnabled( true ); ... } } jstring __fastcall Java_com_example_assemgogogo_gogogoJNI_sayHello(JNIEnv *a1) { // http://127.0.0.1:8000 for ( i = 0 ; i != 21 ; ++i ) url[i] = byte_2D28[i] ^ 0x66 ; url[ 21 ] = 0 ; return (*v2)->NewStringUTF(v2, url); } |
在JNI_OnLoad中监听8000端口, 发送html页面
1 2 3 4 5 6 7 8 9 | .text:00000D1A ADD R1, PC ; "8000" ... .text:00000D26 BLX getaddrinfo .text:00000C50 ADD R0, PC ; "HTTP/1.1 200 OK\r\nContent-Type: text/h" ... ... .text:00000C60 BLX accept ... .text:00000CA6 BLX send |
1 2 3 4 5 6 7 8 9 | .text:00000D1A ADD R1, PC ; "8000" ... .text:00000D26 BLX getaddrinfo .text:00000C50 ADD R0, PC ; "HTTP/1.1 200 OK\r\nContent-Type: text/h" ... ... .text:00000C60 BLX accept ... .text:00000CA6 BLX send |
html页面
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 | <html> <script> var instance; WebAssembly.compile( new Uint8Array(` ... `.trim().split(/[\s\r\n]+/g).map(str => parseInt(str, 16)) )).then(module => { new WebAssembly.instantiate(module).then(results => { instance = results; }). catch (console.error);}) function check_flag(){ var value = document.getElementById( "key_value" ).value; if (value.length != 32) { document.getElementById( "tips" ).innerHTML = "Not Correct!" ; return ; } instance.exports.set_input_flag_len(value.length); for ( var ii=0;ii<value.length;ii++){ instance.exports.set_input_flag(value[ii].charCodeAt(),ii); } var ret = instance.exports.check_key(); if (ret == 1){ document.getElementById( "tips" ).innerHTML = "Congratulations!" } else { document.getElementById( "tips" ).innerHTML = "Not Correct!" } } </script> <body> <div>Key: <input id= "key_value" type= "text" name= "key" style= "width:60%" ;= "" value= "" > <input type= "submit" value= "check" onclick= "check_flag()" ></div> </body></html> |
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 | <html> <script> var instance; WebAssembly.compile( new Uint8Array(` ... `.trim().split(/[\s\r\n]+/g).map(str => parseInt(str, 16)) )).then(module => { new WebAssembly.instantiate(module).then(results => { instance = results; }). catch (console.error);}) function check_flag(){ var value = document.getElementById( "key_value" ).value; if (value.length != 32) { document.getElementById( "tips" ).innerHTML = "Not Correct!" ; return ; } instance.exports.set_input_flag_len(value.length); for ( var ii=0;ii<value.length;ii++){ instance.exports.set_input_flag(value[ii].charCodeAt(),ii); } var ret = instance.exports.check_key(); if (ret == 1){ document.getElementById( "tips" ).innerHTML = "Congratulations!" } else { document.getElementById( "tips" ).innerHTML = "Not Correct!" } } </script> <body> <div>Key: <input id= "key_value" type= "text" name= "key" style= "width:60%" ;= "" value= "" > <input type= "submit" value= "check" onclick= "check_flag()" ></div> </body></html> |
赞赏
他的文章
- KCTF2022春季赛 第三题 石像病毒 9112
- KCTF2022春季赛 第二题 末日邀请 16450
- KCTF2021秋季赛 第二题 迷失丛林 19187
- KCTF2020秋季赛 第十题 终焉之战 9199
- KCTF2020秋季赛 第九题 命悬一线 6709
赞赏
雪币:
留言: