ImageMagick < 7.0.1-1 / 6.x < 6.9.3-10 Multiple Vulnerabilities (ImageTragick) - Nessus

High   Plugin ID: 90892

This page contains detailed information about the ImageMagick < 7.0.1-1 / 6.x < 6.9.3-10 Multiple Vulnerabilities (ImageTragick) Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 90892
Name: ImageMagick < 7.0.1-1 / 6.x < 6.9.3-10 Multiple Vulnerabilities (ImageTragick)
Filename: imagemagick_7_0_1_1.nasl
Vulnerability Published: 2016-05-03
This Plugin Published: 2016-05-04
Last Modification Time: 2021-11-30
Plugin Version: 1.15
Plugin Type: local
Plugin Family: Windows
Dependencies: imagemagick_installed.nasl
Required KB Items [?]: installed_sw/ImageMagick

Vulnerability Information


Severity: High
Vulnerability Published: 2016-05-03
Patch Published: 2016-05-03
CVE [?]: CVE-2016-3714, CVE-2016-3715, CVE-2016-3716, CVE-2016-3717, CVE-2016-3718
CPE [?]: cpe:/a:imagemagick:imagemagick
Exploited by Malware: True
In the News: True

Synopsis

The remote Windows host has an application installed that is affected by multiple vulnerabilities.

Description

The remote Windows host has a version of ImageMagick installed that is prior to 7.0.1-1 or 6.x prior to 6.9.3-10. It is, therefore, affected by the following vulnerabilities :

- A remote code execution vulnerability, known as ImageTragick, exists due to a failure to properly filter shell characters in filenames passed to delegate commands. A remote attacker can exploit this, via specially crafted images, to inject shell commands and execute arbitrary code. (CVE-2016-3714)

- An unspecified flaw exists in the 'ephemeral' pseudo protocol that allows an attacker to delete arbitrary files. (CVE-2016-3715)

- An unspecified flaw exists in the 'ms' pseudo protocol that allows an attacker to move arbitrary files to arbitrary locations. (CVE-2016-3716)

- An unspecified flaw exists in the 'label' pseudo protocol that allows an attacker, via a specially crafted image, to read arbitrary files. (CVE-2016-3717)

- A server-side request forgery (SSRF) vulnerability exists due to an unspecified flaw related to request handling between a user and the server. A remote attacker can exploit this, via an MVG file with a specially crafted fill element, to bypass access restrictions and conduct host-based attacks. (CVE-2016-3718)

Solution

Upgrade to ImageMagick version 7.0.1-1 / 6.9.3-10 or later.

Note that you may need to manually uninstall the vulnerable version from the system.

Public Exploits


Target Network Port(s): N/A
Target Asset(s): N/A
Exploit Available: True (Exploit-DB, GitHub)
Exploit Ease: Exploits are available

Here's the list of publicly known exploits and PoCs for verifying the ImageMagick < 7.0.1-1 / 6.x < 6.9.3-10 Multiple Vulnerabilities (ImageTragick) vulnerability:

  1. Exploit-DB: exploits/multiple/dos/39767.txt
    [EDB-39767: ImageMagick 7.0.1-0 / 6.9.3-9 - 'ImageTragick ' Multiple Vulnerabilities]
  2. Exploit-DB: exploits/multiple/local/39791.rb
    [EDB-39791: ImageMagick 6.9.3-9 / 7.0.1-0 - 'ImageTragick' Delegate Arbitrary Command Execution (Metasploit)]
  3. GitHub: https://github.com/Fa1c0n35/Web-CTF-Cheatshee
    [CVE-2016-3714]
  4. GitHub: https://github.com/HRSkraps/CVE-2016-3714
    [CVE-2016-3714: A reproducible environment with flag challenges for CVE-2016-3714]
  5. GitHub: https://github.com/Hood3dRob1n/CVE-2016-3714
    [CVE-2016-3714: ImaegMagick Code Execution (CVE-2016-3714)]
  6. GitHub: https://github.com/Macr0phag3/Exp-or-Poc
    [CVE-2016-3714]
  7. GitHub: https://github.com/NCSU-DANCE-Research-Group/CDL
    [CVE-2016-3714]
  8. GitHub: https://github.com/SexyBeast233/SecBooks
    [CVE-2016-3714]
  9. GitHub: https://github.com/barrracud4/image-upload-exploits
    [CVE-2016-3714]
  10. GitHub: https://github.com/carrierwaveuploader/carrierwave
    [CVE-2016-3714]
  11. GitHub: https://github.com/chusiang/CVE-2016-3714.ansible.role
    [CVE-2016-3714: Fix ImageMagick Command Injection (CVE-2016-3714) with Ansible.]
  12. GitHub: https://github.com/cobwebkanamachi/ImageMagick-how2fix-jessie-
    [CVE-2016-3714]
  13. GitHub: https://github.com/duckstroms/Web-CTF-Cheatsheet
    [CVE-2016-3714]
  14. GitHub: https://github.com/gipi/cve-cemetery
    [CVE-2016-3714]
  15. GitHub: https://github.com/heckintosh/modified_uploadscanner
    [CVE-2016-3714]
  16. GitHub: https://github.com/jpeanut/ImageTragick-CVE-2016-3714-RShell
    [CVE-2016-3714]
  17. GitHub: https://github.com/mengdaya/Web-CTF-Cheatsheet
    [CVE-2016-3714]
  18. GitHub: https://github.com/mike-williams/imagetragick-poc
    [CVE-2016-3714: Create a docker container with vulnerable imagemagick and node app to demonstrate ...]
  19. GitHub: https://github.com/modzero/mod0BurpUploadScanner
    [CVE-2016-3714]
  20. GitHub: https://github.com/mrhacker51/FileUploadScanner
    [CVE-2016-3714]
  21. GitHub: https://github.com/rebujacker/CVEPoCs
    [CVE-2016-3714]
  22. GitHub: https://github.com/tom0li/collection-document
    [CVE-2016-3714]
  23. GitHub: https://github.com/tommiionfire/CVE-2016-3714
    [CVE-2016-3714]
  24. GitHub: https://github.com/w181496/Web-CTF-Cheatsheet
    [CVE-2016-3714]
  25. GitHub: https://mukarramkhalid.com/imagemagick-imagetragick-exploit/
    [CVE-2016-3714]
  26. GitHub: https://github.com/barrracud4/image-upload-exploits
    [CVE-2016-3715]
  27. GitHub: https://github.com/barrracud4/image-upload-exploits
    [CVE-2016-3716]
  28. GitHub: https://github.com/barrracud4/image-upload-exploits
    [CVE-2016-3717]
  29. GitHub: https://github.com/Fa1c0n35/Web-CTF-Cheatshee
    [CVE-2016-3718]
  30. GitHub: https://github.com/barrracud4/image-upload-exploits
    [CVE-2016-3718]
  31. GitHub: https://github.com/duckstroms/Web-CTF-Cheatsheet
    [CVE-2016-3718]
  32. GitHub: https://github.com/heckintosh/modified_uploadscanner
    [CVE-2016-3718]
  33. GitHub: https://github.com/mengdaya/Web-CTF-Cheatsheet
    [CVE-2016-3718]
  34. GitHub: https://github.com/modzero/mod0BurpUploadScanner
    [CVE-2016-3718]
  35. GitHub: https://github.com/mrhacker51/FileUploadScanner
    [CVE-2016-3718]
  36. GitHub: https://github.com/w181496/Web-CTF-Cheatsheet
    [CVE-2016-3718]
  37. GitHub: https://github.com/jackdpeterson/imagick_secure_puppet
    [CVE-2016-3714: A puppet module in response to CVE-2016-3714]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS Score Source [?]: CVE-2016-3714
CVSS V2 Vector: AV:N/AC:L/Au:N/C:C/I:C/A:C/E:H/RL:OF/RC:C
CVSS Base Score:10.0 (High)
Impact Subscore:10.0
Exploitability Subscore:10.0
CVSS Temporal Score:8.7 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.7 (High)
CVSS V3 Vector: CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:H/RL:O/RC:C
CVSS Base Score:8.4 (High)
Impact Subscore:5.9
Exploitability Subscore:2.5
CVSS Temporal Score:8.0 (High)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:8.0 (High)

Go back to menu.

Plugin Source


This is the imagemagick_7_0_1_1.nasl nessus plugin source code. This script is Copyright (C) 2016-2021 and is owned by Tenable, Inc. or an Affiliate thereof.

#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(90892);
  script_version("1.15");
  script_set_attribute(attribute:"plugin_modification_date", value:"2021/11/30");

  script_cve_id(
    "CVE-2016-3714",
    "CVE-2016-3715",
    "CVE-2016-3716",
    "CVE-2016-3717",
    "CVE-2016-3718"
  );
  script_bugtraq_id(
    89848,
    89849,
    89852,
    89861,
    89866
  );
  script_xref(name:"CERT", value:"250519");
  script_xref(name:"EDB-ID", value:"39767");
  script_xref(name:"EDB-ID", value:"39791");
  script_xref(name:"CISA-KNOWN-EXPLOITED", value:"2022/05/03");

  script_name(english:"ImageMagick < 7.0.1-1 / 6.x < 6.9.3-10 Multiple Vulnerabilities (ImageTragick)");
  script_summary(english:"Checks the version of ImageMagick.");

  script_set_attribute(attribute:"synopsis", value:
"The remote Windows host has an application installed that is affected
by multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"The remote Windows host has a version of ImageMagick installed that is
prior to 7.0.1-1 or 6.x prior to 6.9.3-10. It is, therefore, affected
by the following vulnerabilities :

  - A remote code execution vulnerability, known as
    ImageTragick, exists due to a failure to properly filter
    shell characters in filenames passed to delegate
    commands. A remote attacker can exploit this, via
    specially crafted images, to inject shell commands and
    execute arbitrary code. (CVE-2016-3714)

  - An unspecified flaw exists in the 'ephemeral' pseudo
    protocol that allows an attacker to delete arbitrary
    files. (CVE-2016-3715)

  - An unspecified flaw exists in the 'ms' pseudo protocol
    that allows an attacker to move arbitrary files to
    arbitrary locations. (CVE-2016-3716)

  - An unspecified flaw exists in the 'label' pseudo
    protocol that allows an attacker, via a specially
    crafted image, to read arbitrary files. (CVE-2016-3717)

  - A server-side request forgery (SSRF) vulnerability
    exists due to an unspecified flaw related to request
    handling between a user and the server. A remote
    attacker can exploit this, via an MVG file with a
    specially crafted fill element, to bypass access
    restrictions and conduct host-based attacks.
    (CVE-2016-3718)");
  script_set_attribute(attribute:"see_also", value:"http://www.imagemagick.org/script/changelog.php");
  script_set_attribute(attribute:"see_also", value:"https://www.imagemagick.org/discourse-server/viewtopic.php?f=4&t=29588");
  script_set_attribute(attribute:"see_also", value:"https://imagetragick.com/");
  script_set_attribute(attribute:"solution", value:
"Upgrade to ImageMagick version 7.0.1-1 / 6.9.3-10 or later.

Note that you may need to manually uninstall the vulnerable version
from the system.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:H/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:H/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2016-3714");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploited_by_malware", value:"true");
  script_set_attribute(attribute:"in_the_news", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2016/05/03");
  script_set_attribute(attribute:"patch_publication_date", value:"2016/05/03");
  script_set_attribute(attribute:"plugin_publication_date", value:"2016/05/04");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:imagemagick:imagemagick");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Windows");

  script_copyright(english:"This script is Copyright (C) 2016-2021 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("imagemagick_installed.nasl");
  script_require_keys("installed_sw/ImageMagick");

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("install_func.inc");

app = "ImageMagick";

# Get installs
install = get_single_install(app_name:app, exit_if_unknown_ver:TRUE);
display_version = install['display_version'];
version         = install['version'];
build           = install['build'];
path            = install['path'];

vuln = FALSE;

if (version =~ "^6\.")
{
  fix = "6.9.3";
  fix_build = 10;
}
else if (version =~ "^7\.")
{
  fix = "7.0.1";
  fix_build = 1;
}
else audit(AUDIT_INST_PATH_NOT_VULN, app, display_version, path);

display_fix = fix + "-" + fix_build;

if (ver_compare(ver:version, fix:fix, strict:FALSE) < 0)
  vuln = TRUE;

if ((ver_compare(ver:version, fix:fix, strict:FALSE) == 0)  &&
    build < fix_build
   )
  vuln = TRUE;

if (vuln)
{
  port = get_kb_item("SMB/transport");
  if (!port) port = 445;

  items = make_array("Installed version", display_version,
                     "Fixed version", display_fix,
                     "Path", path
                    );

  order = make_list("Path", "Installed version", "Fixed version");
  report = report_items_str(report_items:items, ordered_fields:order);

  security_report_v4(port:port, extra:report, severity:SECURITY_HOLE);
  exit(0);
}
else
  audit(AUDIT_INST_PATH_NOT_VULN, app, display_version, path);

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/imagemagick_7_0_1_1.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\imagemagick_7_0_1_1.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/imagemagick_7_0_1_1.nasl

Go back to menu.

How to Run


Here is how to run the ImageMagick < 7.0.1-1 / 6.x < 6.9.3-10 Multiple Vulnerabilities (ImageTragick) as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select Windows plugin family.
  6. On the right side table select ImageMagick < 7.0.1-1 / 6.x < 6.9.3-10 Multiple Vulnerabilities (ImageTragick) plugin ID 90892.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl imagemagick_7_0_1_1.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a imagemagick_7_0_1_1.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - imagemagick_7_0_1_1.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state imagemagick_7_0_1_1.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: CERT | Computer Emergency Response Team: See also: Similar and related Nessus plugins:
  • 91047 - Amazon Linux AMI : ImageMagick (ALAS-2016-699) (ImageTragick)
  • 91020 - CentOS 6 / 7 : ImageMagick (CESA-2016:0726) (ImageTragick)
  • 110727 - Debian DLA-1401-1 : graphicsmagick security update
  • 91299 - Debian DLA-484-1 : graphicsmagick security update (ImageTragick)
  • 91287 - Debian DLA-486-1 : imagemagick security update (ImageTragick)
  • 91175 - Debian DSA-3580-1 : imagemagick - security update (ImageTragick)
  • 96103 - Debian DSA-3746-1 : graphicsmagick - security update (ImageTragick)
  • 99784 - EulerOS 2.0 SP1 : ImageMagick (EulerOS-SA-2016-1021)
  • 91053 - F5 Networks BIG-IP : ImageMagick vulnerability (K03151140) (ImageTragick)
  • 91141 - F5 Networks BIG-IP : ImageMagick vulnerability (K10550253)
  • 91142 - F5 Networks BIG-IP : ImageMagick vulnerability (K25102203)
  • 91143 - F5 Networks BIG-IP : ImageMagick vulnerability (K29154575)
  • 91144 - F5 Networks BIG-IP : ImageMagick vulnerability (K61974123)
  • 90979 - FreeBSD : ImageMagick -- multiple vulnerabilities (0d724b05-687f-4527-9c03-af34d3b094ec) (ImageTragick)
  • 95420 - GLSA-201611-21 : ImageMagick: Multiple vulnerabilities (ImageTragick)
  • 90981 - openSUSE Security Update : ImageMagick (openSUSE-2016-569) (ImageTragick)
  • 90986 - openSUSE Security Update : ImageMagick (openSUSE-2016-574) (ImageTragick)
  • 91272 - openSUSE Security Update : GraphicsMagick (openSUSE-2016-602) (ImageTragick)
  • 91032 - Oracle Linux 6 / 7 : ImageMagick (ELSA-2016-0726) (ImageTragick)
  • 91036 - RHEL 6 / 7 : ImageMagick (RHSA-2016:0726) (ImageTragick)
  • 91039 - Scientific Linux Security Update : ImageMagick on SL6.x, SL7.x i386/x86_64 (20160509) (ImageTragick)
  • 91046 - Slackware 14.0 / 14.1 / current : mozilla-thunderbird (SSA:2016-132-01) (ImageTragick)
  • 90996 - SUSE SLED12 / SLES12 Security Update : ImageMagick (SUSE-SU-2016:1260-1) (ImageTragick)
  • 91119 - SUSE SLES11 Security Update : ImageMagick (SUSE-SU-2016:1275-1) (ImageTragick)
  • 91180 - SUSE SLES11 Security Update : ImageMagick (SUSE-SU-2016:1301-1) (ImageTragick)
  • 91450 - Ubuntu 12.04 LTS / 14.04 LTS / 15.10 / 16.04 LTS : imagemagick vulnerabilities (USN-2990-1) (ImageTragick)
  • 91101 - WordPress < 4.5.2 Multiple Vulnerabilities (ImageTragick)
  • 38951 - ImageMagick < 6.5.2-9 magick/xwindow.c XMakeImage() Function TIFF File Handling Overflow
  • 72721 - ImageMagick < 6.8.7-6 WritePSDImage PSD Handling Memory Corruption
  • 72722 - ImageMagick < 6.8.8-5 Multiple PSD Handling Buffer Overflows
  • 91232 - ImageMagick 6.x < 6.9.4-0 / 7.x < 7.0.1-2 Multiple Vulnerabilities
  • 144454 - ImageMagick < 6.9.11-40 / 7.x < 7.0.10-40 -authenticate Option Command Injection
  • 100847 - ImageMagick 6.x < 6.9.8-10 / 7.x < 7.0.5-9 Multiple Vulnerabilities
  • 122248 - ImageMagick < 7.0.8-25 Multiple Vulnerabilities
  • 124776 - ImageMagick < 7.0.8-44 Multiple vulnerabilities

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file imagemagick_7_0_1_1.nasl version 1.15. For more plugins, visit the Nessus Plugin Library.

Go back to menu.