Make sure linux payloads produce /bin/sh
parent
8a13dc5a62
commit
5ff8a58bc5
|
@ -137,26 +137,30 @@ describe MsfVenom do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "building an elf with linux/x86/shell_bind_tcp" do
|
[
|
||||||
let(:args) { %w! -f elf -p linux/x86/shell_bind_tcp ! }
|
{ :format => "elf", :arch => "x86" },
|
||||||
# We're not encoding, so should be testable here
|
{ :format => "raw", :arch => "x86" },
|
||||||
it "should contain /bin/sh" do
|
{ :format => "elf", :arch => "armle" },
|
||||||
output = venom.generate_raw_payload
|
{ :format => "raw", :arch => "armle" },
|
||||||
# usually push'd, so it's not all strung together
|
{ :format => "elf", :arch => "ppc" },
|
||||||
output.should include("/sh")
|
{ :format => "raw", :arch => "ppc" },
|
||||||
output.should include("/bin")
|
{ :format => "elf", :arch => "mipsle" },
|
||||||
end
|
{ :format => "raw", :arch => "mipsle" },
|
||||||
end
|
].each do |format_hash|
|
||||||
|
format = format_hash[:format]
|
||||||
|
arch = format_hash[:arch]
|
||||||
|
|
||||||
context "with a raw linux/x86/shell_bind_tcp" do
|
context "building #{format} with linux/#{arch}/shell_bind_tcp" do
|
||||||
let(:args) { %w! -f raw -p linux/x86/shell_bind_tcp ! }
|
let(:args) { %W! -f #{format} -p linux/#{arch}/shell_bind_tcp ! }
|
||||||
# We're not encoding, so should be testable here
|
# We're not encoding, so should be testable here
|
||||||
it "should contain /bin/sh" do
|
it "should contain /bin/sh" do
|
||||||
output = venom.generate_raw_payload
|
output = venom.generate_raw_payload
|
||||||
# usually push'd, so it's not all strung together
|
# usually push'd, so it's not all strung together
|
||||||
output.should include("/sh")
|
output.should include("/sh")
|
||||||
output.should include("/bin")
|
output.should include("/bin")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -175,7 +179,7 @@ describe MsfVenom do
|
||||||
|
|
||||||
context "without required datastore option" do
|
context "without required datastore option" do
|
||||||
# Requires LHOST
|
# Requires LHOST
|
||||||
let(:args) { %w!-f exe -p windows/shell_reverse_tcp ! }
|
let(:args) { %w!-f exe -p windows/shell_reverse_tcp! }
|
||||||
it "should fail validation" do
|
it "should fail validation" do
|
||||||
expect { venom.generate }.to raise_error(Msf::OptionValidateError)
|
expect { venom.generate }.to raise_error(Msf::OptionValidateError)
|
||||||
end
|
end
|
||||||
|
@ -183,13 +187,15 @@ describe MsfVenom do
|
||||||
|
|
||||||
@platform_format_map.each do |plat, formats|
|
@platform_format_map.each do |plat, formats|
|
||||||
formats.each do |format_hash|
|
formats.each do |format_hash|
|
||||||
|
format = format_hash[:format]
|
||||||
|
arch = format_hash[:arch]
|
||||||
# Need a new context for each so the let() will work correctly
|
# Need a new context for each so the let() will work correctly
|
||||||
context "with format=#{format_hash[:format]} platform=#{plat} arch=#{format_hash[:arch]}" do
|
context "with format=#{format} platform=#{plat} arch=#{arch}" do
|
||||||
# This will build executables with no payload. They won't work
|
# This will build executables with no payload. They won't work
|
||||||
# of course, but at least we can see that it is producing the
|
# of course, but at least we can see that it is producing the
|
||||||
# correct file format for the given arch and platform.
|
# correct file format for the given arch and platform.
|
||||||
let(:args) { %W! -p - -f #{format_hash[:format]} -a #{format_hash[:arch]} --platform #{plat} ! }
|
let(:args) { %W! -p - -f #{format} -a #{arch} --platform #{plat} ! }
|
||||||
it "should print a #{format_hash[:format]} to stdout" do
|
it "should print a #{format} to stdout" do
|
||||||
venom.generate
|
venom.generate
|
||||||
output = stdout.string
|
output = stdout.string
|
||||||
verify_bin_fingerprint(format_hash, output)
|
verify_bin_fingerprint(format_hash, output)
|
||||||
|
|
Loading…
Reference in New Issue