Posts

Showing posts from 2015

[UITCTF - Writeup] Pwn200, Re300

UIT CTF lần này mình kết thúc ở #7, định là sẽ không viết writeup nhưng sau khi đọc writeup 2 bài Pwn200 và Re300 của anh Lê Thanh Bình  here  mình quyết định viết bài này để phân tích cách giải của mình, một hướng giải khác không kém phần thú vị :D Binary hai bài này các bạn có thể tải ở đây #Do bài mới viết nên các bạn có góp ý hay chỉnh sửa sai xót gì các bạn có thể mail hoặc inbox cho mình để mình edit :D. Mình cũng xin cảm ơn BTC =)) vì những challenge rất thú vị hehe mấy anh vất vả rồi :D. Pwn200 và Re300 một góc nhìn mới. Bài pwn200 đầu tiên chương trình khai báo ba biến str1, str2, str3 trong hàm main cả ba thằng đều nằm trên stack. char str3; // [sp+78h] [bp-1A0h]@4 char str2; // [sp+100h] [bp-118h]@1 char str1; // [sp+188h] [bp-90h]@1  Sau khi mình nhập 3 chuỗi vào, chương trình làm vài thứ nhưng không quan trọng, vuln thì rất dễ thấy. Ở cuối chương trình concat str1 với str3 lại với nhau làm tràn stack của hàm main. void *__cdecl strin...

[http://ctf.infosecinstitute.com/] Level2 writeup

Image
Link:  http://ctf.infosecinstitute.com/ctf2/exercises/ex2.php Very simple challenge. About php eval function:                     http://php.net/manual/en/function.eval.php PHP code injection:                   https://www.owasp.org/index.php/Direct_Dynamic_Code_Evaluation_('Eval_Injection') eval funtion takes our input and excutes it as php code. Two operands must be number so we will inject our code in to into operator. Thinking for a while I come up with this.

[http://ctf.infosecinstitute.com/] Level1 writeup

Image
Link to the ctf chall:  ctf.infosecinstitute.com/ctf2/ This challenge is basically about javscript and how to use javascript debugger. I found a really uselful tutorial here  http://meeech.amihod.com/getting-started-with-javascript-debugging-in-chrome/ . about it here at http://meeech.amihod.com/getting-started-with-javascript-debugging-in-chrome/. Let’s open it’s source and clearly we can bypass the first layer of validation by edit the html. Now we can input what ever we want into name and url field. Let's inject some javascript into name <script>alert('Ex1')</script> http://www.google.com After adding the code ... nothing happen. There is a second layer of protection which escapes our '<' and '>' characters into '&lt;' and '&gt;'. Looking at the javascript code var siteName = $(".ex1 input[type='text']").val().trim().replace(/</g, "&lt;").replace(/>/g, ...

[Wargame] Pwn001 writeup

This is my first writeup and also my first time dealing with stack canary. I will go in as detail as I can to test my understanding. Cuz this is my first time so correct me if I’m wrong. Prerequisite: _Understand buffer overflow vulnerability. _Basic asm.  First load the binary into IDA. .text:000000000040089A                 push    rbp .text:000000000040089B                 mov     rbp, rsp .text:000000000040089E                 push    rbx These lines are just common function prolog. The next few lines set up the stack canary. .text:00000000004008A3                 mov   ...