Fixed spec for lib/msf/http/jboss
Revert commit abdd72e8c6
.
Added some spec for lib/msf/http/jboss/deployment_file_repository_scripts
bug/bundler_fix
parent
283e83028f
commit
cc5b852517
|
@ -42,7 +42,7 @@ module Msf::HTTP::JBoss::DeploymentFileRepositoryScripts
|
||||||
#
|
#
|
||||||
# @param app_base [String] The name of the WAR app to write.
|
# @param app_base [String] The name of the WAR app to write.
|
||||||
# @return [String] The JSP stager.
|
# @return [String] The JSP stager.
|
||||||
def stager_jsp(app_base, encoded_payload)
|
def stager_jsp_with_payload(app_base, encoded_payload)
|
||||||
decoded_var = Rex::Text.rand_text_alpha(8+rand(8))
|
decoded_var = Rex::Text.rand_text_alpha(8+rand(8))
|
||||||
file_path_var = Rex::Text.rand_text_alpha(8+rand(8))
|
file_path_var = Rex::Text.rand_text_alpha(8+rand(8))
|
||||||
jboss_home_var = Rex::Text.rand_text_alpha(8+rand(8))
|
jboss_home_var = Rex::Text.rand_text_alpha(8+rand(8))
|
||||||
|
|
|
@ -120,7 +120,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
||||||
}).to_s
|
}).to_s
|
||||||
|
|
||||||
encoded_payload = Rex::Text.encode_base64(war_data).gsub(/\n/, '')
|
encoded_payload = Rex::Text.encode_base64(war_data).gsub(/\n/, '')
|
||||||
stager_contents = stager_jsp(app_base, encoded_payload)
|
stager_contents = stager_jsp_with_payload(app_base, encoded_payload)
|
||||||
# Depending on the type on the verb we might use a second stager
|
# Depending on the type on the verb we might use a second stager
|
||||||
if http_verb == "POST" then
|
if http_verb == "POST" then
|
||||||
print_status("Deploying stager for the WAR file")
|
print_status("Deploying stager for the WAR file")
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'spec_helper'
|
||||||
require 'msf/core'
|
require 'msf/core'
|
||||||
require 'msf/http/jboss'
|
require 'msf/http/jboss'
|
||||||
|
|
||||||
describe Msf::HTTP::JBoss::Scripts do
|
describe Msf::HTTP::JBoss::BeanShellScripts do
|
||||||
subject do
|
subject do
|
||||||
mod = ::Msf::Exploit.new
|
mod = ::Msf::Exploit.new
|
||||||
mod.extend Msf::HTTP::JBoss
|
mod.extend Msf::HTTP::JBoss
|
|
@ -0,0 +1,39 @@
|
||||||
|
#-*- coding:binary -*-
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
require 'msf/core'
|
||||||
|
require 'msf/http/jboss'
|
||||||
|
|
||||||
|
describe Msf::HTTP::JBoss::DeploymentFileRepositoryScripts do
|
||||||
|
subject do
|
||||||
|
mod = ::Msf::Exploit.new
|
||||||
|
mod.extend Msf::HTTP::JBoss
|
||||||
|
mod.send(:initialize)
|
||||||
|
mod
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#stager_jsp_with_payload" do
|
||||||
|
it "returns the JSP stager" do
|
||||||
|
expect(subject.stager_jsp_with_payload('metasploit', 'payload')).to include('System.getProperty("jboss.server.home.dir");')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "uses the provided application name" do
|
||||||
|
expect(subject.stager_jsp_with_payload('metasploit', 'payload')).to include('"/deploy/" + "metasploit.war";')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "uses the provided payload" do
|
||||||
|
expect(subject.stager_jsp_with_payload('metasploit', 'payload')).to include('"payload";')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#head_stager_jsp" do
|
||||||
|
it "returns the head JSP stager" do
|
||||||
|
expect(subject.head_stager_jsp('stager_base', 'jsp_name')).to include('System.getProperty("jboss.server.home.dir");')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "uses the provided base name" do
|
||||||
|
expect(subject.head_stager_jsp('stager_base', 'jsp_name')).to include('"/deploy/management/" + "stager_base.war/"')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue