arachni 0.2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. data/ACKNOWLEDGMENTS.md +14 -0
  2. data/AUTHORS.md +6 -0
  3. data/CHANGELOG.md +162 -0
  4. data/CONTRIBUTORS.md +10 -0
  5. data/EXPLOITATION.md +429 -0
  6. data/HACKING.md +101 -0
  7. data/LICENSE.md +341 -0
  8. data/README.md +350 -0
  9. data/Rakefile +86 -0
  10. data/bin/arachni +22 -0
  11. data/bin/arachni_web +77 -0
  12. data/bin/arachni_xmlrpc +21 -0
  13. data/bin/arachni_xmlrpcd +82 -0
  14. data/bin/arachni_xmlrpcd_monitor +74 -0
  15. data/conf/README.webui.yaml.txt +44 -0
  16. data/conf/webui.yaml +11 -0
  17. data/external/metasploit/LICENSE +24 -0
  18. data/external/metasploit/modules/exploits/unix/webapp/arachni_exec.rb +142 -0
  19. data/external/metasploit/modules/exploits/unix/webapp/arachni_path_traversal.rb +113 -0
  20. data/external/metasploit/modules/exploits/unix/webapp/arachni_php_eval.rb +150 -0
  21. data/external/metasploit/modules/exploits/unix/webapp/arachni_php_include.rb +141 -0
  22. data/external/metasploit/modules/exploits/unix/webapp/arachni_sqlmap.rb +92 -0
  23. data/external/metasploit/plugins/arachni.rb +536 -0
  24. data/getoptslong.rb +241 -0
  25. data/lib/anemone.rb +2 -0
  26. data/lib/anemone/cookie_store.rb +35 -0
  27. data/lib/anemone/core.rb +371 -0
  28. data/lib/anemone/exceptions.rb +5 -0
  29. data/lib/anemone/http.rb +144 -0
  30. data/lib/anemone/page.rb +337 -0
  31. data/lib/anemone/page_store.rb +160 -0
  32. data/lib/anemone/storage.rb +34 -0
  33. data/lib/anemone/storage/base.rb +75 -0
  34. data/lib/anemone/storage/exceptions.rb +15 -0
  35. data/lib/anemone/storage/mongodb.rb +89 -0
  36. data/lib/anemone/storage/pstore.rb +50 -0
  37. data/lib/anemone/storage/redis.rb +90 -0
  38. data/lib/anemone/storage/tokyo_cabinet.rb +57 -0
  39. data/lib/anemone/tentacle.rb +40 -0
  40. data/lib/arachni.rb +16 -0
  41. data/lib/audit_store.rb +346 -0
  42. data/lib/component_manager.rb +293 -0
  43. data/lib/component_options.rb +395 -0
  44. data/lib/exceptions.rb +76 -0
  45. data/lib/framework.rb +637 -0
  46. data/lib/http.rb +809 -0
  47. data/lib/issue.rb +302 -0
  48. data/lib/module.rb +4 -0
  49. data/lib/module/auditor.rb +455 -0
  50. data/lib/module/base.rb +188 -0
  51. data/lib/module/element_db.rb +158 -0
  52. data/lib/module/key_filler.rb +87 -0
  53. data/lib/module/manager.rb +87 -0
  54. data/lib/module/output.rb +68 -0
  55. data/lib/module/trainer.rb +240 -0
  56. data/lib/module/utilities.rb +110 -0
  57. data/lib/options.rb +547 -0
  58. data/lib/parser.rb +2 -0
  59. data/lib/parser/auditable.rb +522 -0
  60. data/lib/parser/elements.rb +296 -0
  61. data/lib/parser/page.rb +149 -0
  62. data/lib/parser/parser.rb +717 -0
  63. data/lib/plugin.rb +4 -0
  64. data/lib/plugin/base.rb +110 -0
  65. data/lib/plugin/manager.rb +162 -0
  66. data/lib/report.rb +4 -0
  67. data/lib/report/base.rb +119 -0
  68. data/lib/report/manager.rb +92 -0
  69. data/lib/rpc/xml/client/base.rb +71 -0
  70. data/lib/rpc/xml/client/dispatcher.rb +49 -0
  71. data/lib/rpc/xml/client/instance.rb +88 -0
  72. data/lib/rpc/xml/server/base.rb +90 -0
  73. data/lib/rpc/xml/server/dispatcher.rb +357 -0
  74. data/lib/rpc/xml/server/framework.rb +206 -0
  75. data/lib/rpc/xml/server/instance.rb +191 -0
  76. data/lib/rpc/xml/server/module/manager.rb +46 -0
  77. data/lib/rpc/xml/server/options.rb +124 -0
  78. data/lib/rpc/xml/server/output.rb +299 -0
  79. data/lib/rpc/xml/server/plugin/manager.rb +58 -0
  80. data/lib/ruby.rb +5 -0
  81. data/lib/ruby/object.rb +32 -0
  82. data/lib/ruby/string.rb +74 -0
  83. data/lib/ruby/xmlrpc/server.rb +27 -0
  84. data/lib/spider.rb +200 -0
  85. data/lib/typhoeus/request.rb +91 -0
  86. data/lib/typhoeus/response.rb +34 -0
  87. data/lib/ui/cli/cli.rb +744 -0
  88. data/lib/ui/cli/output.rb +279 -0
  89. data/lib/ui/web/log.rb +82 -0
  90. data/lib/ui/web/output_stream.rb +94 -0
  91. data/lib/ui/web/report_manager.rb +222 -0
  92. data/lib/ui/web/server.rb +903 -0
  93. data/lib/ui/web/server/db/placeholder +0 -0
  94. data/lib/ui/web/server/public/banner.png +0 -0
  95. data/lib/ui/web/server/public/bodybg-small.png +0 -0
  96. data/lib/ui/web/server/public/bodybg.png +0 -0
  97. data/lib/ui/web/server/public/css/smoothness/images/pbar-ani.gif +0 -0
  98. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  99. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  100. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  101. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  102. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  103. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  104. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  105. data/lib/ui/web/server/public/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  106. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  107. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  108. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  109. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  110. data/lib/ui/web/server/public/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  111. data/lib/ui/web/server/public/css/smoothness/jquery-ui-1.8.9.custom.css +573 -0
  112. data/lib/ui/web/server/public/favicon.ico +0 -0
  113. data/lib/ui/web/server/public/footer.jpg +0 -0
  114. data/lib/ui/web/server/public/icons/error.png +0 -0
  115. data/lib/ui/web/server/public/icons/info.png +0 -0
  116. data/lib/ui/web/server/public/icons/ok.png +0 -0
  117. data/lib/ui/web/server/public/icons/status.png +0 -0
  118. data/lib/ui/web/server/public/js/jquery-1.4.4.min.js +167 -0
  119. data/lib/ui/web/server/public/js/jquery-ui-1.8.9.custom.min.js +781 -0
  120. data/lib/ui/web/server/public/logo.png +0 -0
  121. data/lib/ui/web/server/public/nav-left.jpg +0 -0
  122. data/lib/ui/web/server/public/nav-right.jpg +0 -0
  123. data/lib/ui/web/server/public/nav-selected-left.jpg +0 -0
  124. data/lib/ui/web/server/public/nav-selected-right.jpg +0 -0
  125. data/lib/ui/web/server/public/reports/placeholder +1 -0
  126. data/lib/ui/web/server/public/sidebar-bottom.jpg +0 -0
  127. data/lib/ui/web/server/public/sidebar-h4.jpg +0 -0
  128. data/lib/ui/web/server/public/sidebar-top.jpg +0 -0
  129. data/lib/ui/web/server/public/spider.png +0 -0
  130. data/lib/ui/web/server/public/style.css +604 -0
  131. data/lib/ui/web/server/tmp/placeholder +0 -0
  132. data/lib/ui/web/server/views/dispatcher.erb +85 -0
  133. data/lib/ui/web/server/views/dispatcher_error.erb +14 -0
  134. data/lib/ui/web/server/views/error.erb +1 -0
  135. data/lib/ui/web/server/views/flash.erb +18 -0
  136. data/lib/ui/web/server/views/home.erb +14 -0
  137. data/lib/ui/web/server/views/instance.erb +213 -0
  138. data/lib/ui/web/server/views/layout.erb +95 -0
  139. data/lib/ui/web/server/views/log.erb +40 -0
  140. data/lib/ui/web/server/views/modules.erb +71 -0
  141. data/lib/ui/web/server/views/options.erb +23 -0
  142. data/lib/ui/web/server/views/output_results.erb +51 -0
  143. data/lib/ui/web/server/views/plugins.erb +42 -0
  144. data/lib/ui/web/server/views/report_formats.erb +30 -0
  145. data/lib/ui/web/server/views/reports.erb +55 -0
  146. data/lib/ui/web/server/views/settings.erb +120 -0
  147. data/lib/ui/web/server/views/welcome.erb +38 -0
  148. data/lib/ui/xmlrpc/dispatcher_monitor.rb +204 -0
  149. data/lib/ui/xmlrpc/xmlrpc.rb +843 -0
  150. data/logs/placeholder +0 -0
  151. data/metamodules/autothrottle.rb +74 -0
  152. data/metamodules/timeout_notice.rb +118 -0
  153. data/metamodules/uniformity.rb +98 -0
  154. data/modules/audit/code_injection.rb +136 -0
  155. data/modules/audit/code_injection_timing.rb +115 -0
  156. data/modules/audit/code_injection_timing/payloads.txt +4 -0
  157. data/modules/audit/csrf.rb +301 -0
  158. data/modules/audit/ldapi.rb +103 -0
  159. data/modules/audit/ldapi/errors.txt +26 -0
  160. data/modules/audit/os_cmd_injection.rb +103 -0
  161. data/modules/audit/os_cmd_injection/payloads.txt +2 -0
  162. data/modules/audit/os_cmd_injection_timing.rb +104 -0
  163. data/modules/audit/os_cmd_injection_timing/payloads.txt +3 -0
  164. data/modules/audit/path_traversal.rb +141 -0
  165. data/modules/audit/response_splitting.rb +105 -0
  166. data/modules/audit/rfi.rb +193 -0
  167. data/modules/audit/sqli.rb +120 -0
  168. data/modules/audit/sqli/regexp_ids.txt +90 -0
  169. data/modules/audit/sqli_blind_rdiff.rb +321 -0
  170. data/modules/audit/sqli_blind_timing.rb +103 -0
  171. data/modules/audit/sqli_blind_timing/payloads.txt +51 -0
  172. data/modules/audit/trainer.rb +89 -0
  173. data/modules/audit/unvalidated_redirect.rb +90 -0
  174. data/modules/audit/xpath.rb +104 -0
  175. data/modules/audit/xpath/errors.txt +26 -0
  176. data/modules/audit/xss.rb +99 -0
  177. data/modules/audit/xss_event.rb +134 -0
  178. data/modules/audit/xss_path.rb +125 -0
  179. data/modules/audit/xss_script_tag.rb +112 -0
  180. data/modules/audit/xss_tag.rb +112 -0
  181. data/modules/audit/xss_uri.rb +125 -0
  182. data/modules/recon/allowed_methods.rb +104 -0
  183. data/modules/recon/backdoors.rb +131 -0
  184. data/modules/recon/backdoors/filenames.txt +16 -0
  185. data/modules/recon/backup_files.rb +177 -0
  186. data/modules/recon/backup_files/extensions.txt +28 -0
  187. data/modules/recon/common_directories.rb +138 -0
  188. data/modules/recon/common_directories/directories.txt +265 -0
  189. data/modules/recon/common_files.rb +138 -0
  190. data/modules/recon/common_files/filenames.txt +17 -0
  191. data/modules/recon/directory_listing.rb +171 -0
  192. data/modules/recon/grep/captcha.rb +62 -0
  193. data/modules/recon/grep/credit_card.rb +85 -0
  194. data/modules/recon/grep/cvs_svn_users.rb +73 -0
  195. data/modules/recon/grep/emails.rb +59 -0
  196. data/modules/recon/grep/html_objects.rb +53 -0
  197. data/modules/recon/grep/private_ip.rb +54 -0
  198. data/modules/recon/grep/ssn.rb +53 -0
  199. data/modules/recon/htaccess_limit.rb +82 -0
  200. data/modules/recon/http_put.rb +95 -0
  201. data/modules/recon/interesting_responses.rb +118 -0
  202. data/modules/recon/unencrypted_password_forms.rb +119 -0
  203. data/modules/recon/webdav.rb +126 -0
  204. data/modules/recon/xst.rb +107 -0
  205. data/path_extractors/anchors.rb +35 -0
  206. data/path_extractors/forms.rb +35 -0
  207. data/path_extractors/frames.rb +38 -0
  208. data/path_extractors/generic.rb +39 -0
  209. data/path_extractors/links.rb +35 -0
  210. data/path_extractors/meta_refresh.rb +39 -0
  211. data/path_extractors/scripts.rb +37 -0
  212. data/path_extractors/sitemap.rb +31 -0
  213. data/plugins/autologin.rb +137 -0
  214. data/plugins/content_types.rb +90 -0
  215. data/plugins/cookie_collector.rb +99 -0
  216. data/plugins/form_dicattack.rb +185 -0
  217. data/plugins/healthmap.rb +94 -0
  218. data/plugins/http_dicattack.rb +133 -0
  219. data/plugins/metamodules.rb +118 -0
  220. data/plugins/proxy.rb +248 -0
  221. data/plugins/proxy/server.rb +66 -0
  222. data/plugins/waf_detector.rb +184 -0
  223. data/profiles/comprehensive.afp +74 -0
  224. data/profiles/full.afp +75 -0
  225. data/reports/afr.rb +59 -0
  226. data/reports/ap.rb +55 -0
  227. data/reports/html.rb +179 -0
  228. data/reports/html/default.erb +967 -0
  229. data/reports/metareport.rb +139 -0
  230. data/reports/metareport/arachni_metareport.rb +174 -0
  231. data/reports/plugin_formatters/html/content_types.rb +82 -0
  232. data/reports/plugin_formatters/html/cookie_collector.rb +66 -0
  233. data/reports/plugin_formatters/html/form_dicattack.rb +54 -0
  234. data/reports/plugin_formatters/html/healthmap.rb +76 -0
  235. data/reports/plugin_formatters/html/http_dicattack.rb +54 -0
  236. data/reports/plugin_formatters/html/metaformatters/timeout_notice.rb +65 -0
  237. data/reports/plugin_formatters/html/metaformatters/uniformity.rb +71 -0
  238. data/reports/plugin_formatters/html/metamodules.rb +93 -0
  239. data/reports/plugin_formatters/html/waf_detector.rb +54 -0
  240. data/reports/plugin_formatters/stdout/content_types.rb +73 -0
  241. data/reports/plugin_formatters/stdout/cookie_collector.rb +61 -0
  242. data/reports/plugin_formatters/stdout/form_dicattack.rb +52 -0
  243. data/reports/plugin_formatters/stdout/healthmap.rb +72 -0
  244. data/reports/plugin_formatters/stdout/http_dicattack.rb +53 -0
  245. data/reports/plugin_formatters/stdout/metaformatters/timeout_notice.rb +55 -0
  246. data/reports/plugin_formatters/stdout/metaformatters/uniformity.rb +68 -0
  247. data/reports/plugin_formatters/stdout/metamodules.rb +89 -0
  248. data/reports/plugin_formatters/stdout/waf_detector.rb +48 -0
  249. data/reports/plugin_formatters/xml/content_types.rb +91 -0
  250. data/reports/plugin_formatters/xml/cookie_collector.rb +70 -0
  251. data/reports/plugin_formatters/xml/form_dicattack.rb +57 -0
  252. data/reports/plugin_formatters/xml/healthmap.rb +82 -0
  253. data/reports/plugin_formatters/xml/http_dicattack.rb +57 -0
  254. data/reports/plugin_formatters/xml/metaformatters/timeout_notice.rb +67 -0
  255. data/reports/plugin_formatters/xml/metaformatters/uniformity.rb +82 -0
  256. data/reports/plugin_formatters/xml/metamodules.rb +91 -0
  257. data/reports/plugin_formatters/xml/waf_detector.rb +58 -0
  258. data/reports/stdout.rb +182 -0
  259. data/reports/txt.rb +77 -0
  260. data/reports/xml.rb +231 -0
  261. data/reports/xml/buffer.rb +98 -0
  262. metadata +516 -0
File without changes
@@ -0,0 +1,74 @@
1
+ =begin
2
+ Arachni
3
+ Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
+
5
+ This is free software; you can copy and distribute and modify
6
+ this program under the term of the GPL v2.0 License
7
+ (See LICENSE file for details)
8
+
9
+ =end
10
+
11
+ module Arachni
12
+ module MetaModules
13
+
14
+ #
15
+ # Auto adjusts HTTP throughput for maximum network utilization.
16
+ #
17
+ # @author: Tasos "Zapotek" Laskos
18
+ # <tasos.laskos@gmail.com>
19
+ # <zapotek@segfault.gr>
20
+ # @version: 0.1
21
+ #
22
+ class AutoThrottle < Base
23
+
24
+ HIGH_THRESHOLD = 0.9
25
+ MIDDLE_THRESHOLD = 0.34
26
+ LOW_THREASHOLD = 0.05
27
+
28
+ # easy on the throttle
29
+ STEP_UP = 1
30
+ # hard on the breaks
31
+ STEP_DOWN = -3
32
+
33
+ MIN_CONCURRENCY = 2
34
+
35
+ def initialize( framework )
36
+ @framework = framework
37
+ @http = framework.http
38
+ end
39
+
40
+ def prepare
41
+
42
+ # run for each response as it arrives
43
+ @http.on_complete {
44
+
45
+ # adjust only after finished bursts
46
+ next if @http.curr_res_cnt == 0 || @http.curr_res_cnt % @http.max_concurrency != 0
47
+
48
+ print_debug( "Max concurrency: " + @http.max_concurrency.to_s )
49
+ if( @http.max_concurrency > MIN_CONCURRENCY && @http.average_res_time > HIGH_THRESHOLD ) ||
50
+ @http.max_concurrency > @framework.opts.http_req_limit
51
+
52
+ # make sure that @http.max_concurrency >= MIN_CONCURRENCY
53
+ if @http.max_concurrency + STEP_DOWN < MIN_CONCURRENCY
54
+ step = MIN_CONCURRENCY - @http.max_concurrency
55
+ else
56
+ step = STEP_DOWN
57
+ end
58
+
59
+ print_debug( "Stepping down!: #{step}" )
60
+ @http.max_concurrency!( @http.max_concurrency + step )
61
+
62
+ elsif @http.average_res_time < HIGH_THRESHOLD && @http.average_res_time > LOW_THREASHOLD
63
+
64
+ print_debug( "Stepping up!: +#{STEP_UP}" )
65
+ @http.max_concurrency!( @http.max_concurrency + STEP_UP )
66
+ end
67
+ }
68
+
69
+ end
70
+
71
+ end
72
+
73
+ end
74
+ end
@@ -0,0 +1,118 @@
1
+ =begin
2
+ Arachni
3
+ Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
+
5
+ This is free software; you can copy and distribute and modify
6
+ this program under the term of the GPL v2.0 License
7
+ (See LICENSE file for details)
8
+
9
+ =end
10
+
11
+ module Arachni
12
+ module MetaModules
13
+
14
+ #
15
+ # Provides a notice for issues uncovered by timing attacks when the affected audited
16
+ # pages returned unusually high response times to begin with.
17
+ #
18
+ # @author: Tasos "Zapotek" Laskos
19
+ # <tasos.laskos@gmail.com>
20
+ # <zapotek@segfault.gr>
21
+ # @version: 0.1
22
+ #
23
+ class TimeoutNotice < Base
24
+
25
+ include Arachni::Module::Utilities
26
+
27
+ # look for issue by tag name
28
+ TAG = 'timing'
29
+
30
+ # response times of a page must be greater or equal to this
31
+ # in order to be considered
32
+ TIME_THRESHOLD = 0.6
33
+
34
+ def initialize( framework )
35
+ @framework = framework
36
+ @http = framework.http
37
+
38
+ @times = {}
39
+ @counter = {}
40
+ end
41
+
42
+ def prepare
43
+ # run for each response as it arrives
44
+ @http.on_complete {
45
+ |res|
46
+
47
+ # we don't care about non OK responses
48
+ next if res.code != 200
49
+
50
+ path = URI( normalize_url( res.effective_url ) ).path
51
+ path = '/' if path.empty?
52
+ @counter[path] ||= @times[path] ||= 0
53
+
54
+ # add up all request times for a specific path
55
+ @times[path] += res.start_transfer_time
56
+
57
+ # add up all requests for each path
58
+ @counter[path] += 1
59
+ }
60
+ end
61
+
62
+ def run
63
+
64
+ avg = get_avg
65
+
66
+ # will hold the hash IDs of inconclusive issues
67
+ inconclusive = []
68
+ @framework.audit_store.issues.each_with_index {
69
+ |issue, idx|
70
+ if issue.tags && issue.tags.include?( TAG ) &&
71
+ avg[ URI( normalize_url( issue.url ) ).path ] >= TIME_THRESHOLD
72
+
73
+ inconclusive << {
74
+ 'hash' => issue._hash,
75
+ 'index' => idx + 1,
76
+ 'url' => issue.url,
77
+ 'name' => issue.name,
78
+ 'var' => issue.var,
79
+ 'elem' => issue.elem,
80
+ 'method' => issue.method
81
+ }
82
+ end
83
+ }
84
+
85
+ return inconclusive
86
+ end
87
+
88
+ def get_avg
89
+ avg ={}
90
+
91
+ # calculate average request time for each path
92
+ @times.each_pair {
93
+ |path, time|
94
+ avg[path] = time / @counter[path]
95
+ }
96
+
97
+ return avg
98
+ end
99
+
100
+ def self.info
101
+ super.merge( {
102
+ :description => %q{These logged issues used timing attacks.
103
+ However, the affected web pages demonstrated an unusually high response time rendering
104
+ these results inconclusive or (possibly) false positives.
105
+
106
+ Pages with high response times usually include heavy-duty processing
107
+ which makes them prime targets for Denial-of-Service attacks.
108
+
109
+ Nomatter the case, please do look into the situation further.},
110
+ :author => 'Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>',
111
+ :version => '0.1',
112
+ } )
113
+ end
114
+
115
+ end
116
+
117
+ end
118
+ end
@@ -0,0 +1,98 @@
1
+ =begin
2
+ Arachni
3
+ Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
+
5
+ This is free software; you can copy and distribute and modify
6
+ this program under the term of the GPL v2.0 License
7
+ (See LICENSE file for details)
8
+
9
+ =end
10
+
11
+ module Arachni
12
+ module MetaModules
13
+
14
+ #
15
+ # Goes through all the issues and checks for signs of uniformity using
16
+ # the following criteria:
17
+ # * Element type (link, form, cookie, header)
18
+ # * Variable/input name
19
+ # * The module that logged/discovered the issue -- issue type
20
+ #
21
+ # If the above are all the same for more than 1 page we have a hit.
22
+ #
23
+ # @author: Tasos "Zapotek" Laskos
24
+ # <tasos.laskos@gmail.com>
25
+ # <zapotek@segfault.gr>
26
+ # @version: 0.1
27
+ #
28
+ class Uniformity < Base
29
+
30
+ include Arachni::Module::Utilities
31
+
32
+ SEVERITY = Issue::Severity::HIGH
33
+
34
+ ELEMENTS = [
35
+ Issue::Element::LINK,
36
+ Issue::Element::FORM,
37
+ Issue::Element::COOKIE,
38
+ Issue::Element::HEADER
39
+ ]
40
+
41
+ def initialize( framework )
42
+ @framework = framework
43
+ end
44
+
45
+ def run
46
+
47
+ # will hold the hash IDs of inconclusive issues
48
+ uniformals = {}
49
+ pages = {}
50
+
51
+ @framework.audit_store.deep_clone.issues.each_with_index {
52
+ |issue, idx|
53
+
54
+ if issue.severity == SEVERITY && ELEMENTS.include?( issue.elem ) && issue.var
55
+
56
+ id = issue.elem + ':' + issue.var + ':' + issue.internal_modname
57
+
58
+ uniformals[id] ||= {
59
+ 'issue' => {
60
+ 'name' => issue.name,
61
+ 'var' => issue.var,
62
+ 'elem' => issue.elem,
63
+ 'method' => issue.method
64
+ },
65
+ 'indices' => [],
66
+ 'hashes' => []
67
+ }
68
+
69
+ pages[id] ||= []
70
+
71
+ pages[id] << issue.url
72
+ uniformals[id]['indices'] << idx + 1
73
+ uniformals[id]['hashes'] << issue._hash
74
+
75
+ end
76
+ }
77
+
78
+ uniformals.reject!{ |k, v| v['hashes'].empty? || v['hashes'].size == 1 }
79
+ pages.reject!{ |k, v| v.size == 1 }
80
+
81
+ return if pages.empty?
82
+ return { 'uniformals' => uniformals, 'pages' => pages }
83
+ end
84
+
85
+ def self.info
86
+ super.merge( {
87
+ :description => %q{The same issue(s) persist(s) across different pages.
88
+ This is usually a sign for a lack of a central/single point of input
89
+ sanitization, a bad coding practise.},
90
+ :author => 'Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>',
91
+ :version => '0.1',
92
+ } )
93
+ end
94
+
95
+ end
96
+
97
+ end
98
+ end
@@ -0,0 +1,136 @@
1
+ =begin
2
+ Arachni
3
+ Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
+
5
+ This is free software; you can copy and distribute and modify
6
+ this program under the term of the GPL v2.0 License
7
+ (See LICENSE file for details)
8
+
9
+ =end
10
+
11
+ module Arachni
12
+
13
+ module Modules
14
+
15
+ #
16
+ # It's designed to work with PHP, Perl, Python, Java, ASP and Ruby
17
+ # but still needs some more testing.
18
+ #
19
+ #
20
+ # @author: Tasos "Zapotek" Laskos
21
+ # <tasos.laskos@gmail.com>
22
+ # <zapotek@segfault.gr>
23
+ # @version: 0.1.4
24
+ #
25
+ # @see http://cwe.mitre.org/data/definitions/94.html
26
+ # @see http://php.net/manual/en/function.eval.php
27
+ # @see http://perldoc.perl.org/functions/eval.html
28
+ # @see http://docs.python.org/py3k/library/functions.html#eval
29
+ # @see http://www.aspdev.org/asp/asp-eval-execute/
30
+ # @see http://en.wikipedia.org/wiki/Eval#Ruby
31
+ #
32
+ class CodeInjection < Arachni::Module::Base
33
+
34
+ def initialize( page )
35
+ super( page )
36
+
37
+ # code to inject
38
+ @__injection_strs = []
39
+
40
+ # digits from a sha1 hash
41
+ # the codes in @__injection_strs will tell the web app
42
+ # to sum them and echo the result
43
+ @__rand1 = '287630581954'
44
+ @__rand2 = '4196403186331128'
45
+
46
+ # our results array
47
+ @results = []
48
+ end
49
+
50
+ def prepare( )
51
+
52
+ @__opts = {}
53
+
54
+ # the sum of the 2 numbers as a string
55
+ @__opts[:substring] = ( @__rand1.to_i + @__rand2.to_i ).to_s
56
+ @__opts[:format] = [ Format::APPEND ]
57
+
58
+ # code to be injected to the webapp
59
+ @__injection_strs = [
60
+ "echo " + @__rand1 + "+" + @__rand2 + ";", # PHP
61
+ "print " + @__rand1 + "+" + @__rand2 + ";", # Perl
62
+ "print " + @__rand1 + " + " + @__rand2, # Python
63
+ "Response.Write\x28" + @__rand1 + '+' + @__rand2 + "\x29", # ASP
64
+ "puts " + @__rand1 + " + " + @__rand2 # Ruby
65
+ ]
66
+
67
+ @__variations = [
68
+ ';%s',
69
+ "\";%s#",
70
+ "';%s#"
71
+ ]
72
+ end
73
+
74
+ def run( )
75
+
76
+ # iterate through the injection codes
77
+ @__injection_strs.each {
78
+ |str|
79
+ __variations( str ).each {
80
+ |var|
81
+ audit( var, @__opts )
82
+ }
83
+ }
84
+
85
+ end
86
+
87
+ def __variations( str )
88
+ @__variations.map{ |var| var % str } | [str]
89
+ end
90
+
91
+
92
+ def self.info
93
+ {
94
+ :name => 'Code injection',
95
+ :description => %q{It tries to inject code snippets into the
96
+ web application and assess whether or not the injection
97
+ was successful.},
98
+ :elements => [
99
+ Issue::Element::FORM,
100
+ Issue::Element::LINK,
101
+ Issue::Element::COOKIE,
102
+ Issue::Element::HEADER
103
+ ],
104
+ :author => 'Tasos "Zapotek" Laskos <tasos.laskos@gmail.com> ',
105
+ :version => '0.1.4',
106
+ :references => {
107
+ 'PHP' => 'http://php.net/manual/en/function.eval.php',
108
+ 'Perl' => 'http://perldoc.perl.org/functions/eval.html',
109
+ 'Python' => 'http://docs.python.org/py3k/library/functions.html#eval',
110
+ 'ASP' => 'http://www.aspdev.org/asp/asp-eval-execute/',
111
+ 'Ruby' => 'http://en.wikipedia.org/wiki/Eval#Ruby'
112
+ },
113
+ :targets => { 'Generic' => 'all' },
114
+
115
+ :issue => {
116
+ :name => %q{Code injection},
117
+ :description => %q{Arbitrary code can be injected into the web application
118
+ which is then executed as part of the system.},
119
+ :tags => [ 'code', 'injection', 'regexp' ],
120
+ :cwe => '94',
121
+ :severity => Issue::Severity::HIGH,
122
+ :cvssv2 => '7.5',
123
+ :remedy_guidance => %q{User inputs must be validated and filtered
124
+ before being evaluated as executable code.
125
+ Better yet, the web application should stop evaluating user
126
+ inputs as any part of dynamic code altogether.},
127
+ :remedy_code => '',
128
+ :metasploitable => 'unix/webapp/arachni_php_eval'
129
+ }
130
+
131
+ }
132
+ end
133
+
134
+ end
135
+ end
136
+ end
@@ -0,0 +1,115 @@
1
+ =begin
2
+ Arachni
3
+ Copyright (c) 2010-2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
4
+
5
+ This is free software; you can copy and distribute and modify
6
+ this program under the term of the GPL v2.0 License
7
+ (See LICENSE file for details)
8
+
9
+ =end
10
+
11
+ module Arachni
12
+
13
+ module Modules
14
+
15
+ #
16
+ # It's designed to work with PHP, Perl, Python, Java, ASP and Ruby
17
+ # but still needs some more testing.
18
+ #
19
+ #
20
+ # @author: Tasos "Zapotek" Laskos
21
+ # <tasos.laskos@gmail.com>
22
+ # <zapotek@segfault.gr>
23
+ # @version: 0.2
24
+ #
25
+ # @see http://cwe.mitre.org/data/definitions/94.html
26
+ # @see http://php.net/manual/en/function.eval.php
27
+ # @see http://perldoc.perl.org/functions/eval.html
28
+ # @see http://docs.python.org/py3k/library/functions.html#eval
29
+ # @see http://www.aspdev.org/asp/asp-eval-execute/
30
+ # @see http://en.wikipedia.org/wiki/Eval#Ruby
31
+ #
32
+ class CodeInjectionTiming < Arachni::Module::Base
33
+
34
+ include Arachni::Module::Utilities
35
+
36
+ def initialize( page )
37
+ super( page )
38
+ end
39
+
40
+ def prepare( )
41
+
42
+ @@__injection_str ||= []
43
+
44
+ if @@__injection_str.empty?
45
+ read_file( 'payloads.txt' ) {
46
+ |str|
47
+
48
+ [ ' ', ' && ', ';' ].each {
49
+ |sep|
50
+ @@__injection_str << sep + " " + str
51
+ }
52
+
53
+ }
54
+ end
55
+
56
+ @__opts = {
57
+ :format => [ Format::STRAIGHT ],
58
+ :timeout => 4000
59
+ }
60
+ end
61
+
62
+ def run
63
+ audit_timeout( @@__injection_str, @__opts )
64
+ end
65
+
66
+ def self.info
67
+ {
68
+ :name => 'Code injection (timing)',
69
+ :description => %q{It tries to inject code snippets into the
70
+ web application and assess whether or not the injection
71
+ was successful using timing attacks.},
72
+ :elements => [
73
+ Issue::Element::FORM,
74
+ Issue::Element::LINK,
75
+ Issue::Element::COOKIE,
76
+ Issue::Element::HEADER
77
+ ],
78
+ :author => 'Tasos "Zapotek" Laskos <tasos.laskos@gmail.com> ',
79
+ :version => '0.1',
80
+ :references => {
81
+ 'PHP' => 'http://php.net/manual/en/function.eval.php',
82
+ 'Perl' => 'http://perldoc.perl.org/functions/eval.html',
83
+ 'Python' => 'http://docs.python.org/py3k/library/functions.html#eval',
84
+ 'ASP' => 'http://www.aspdev.org/asp/asp-eval-execute/',
85
+ 'Ruby' => 'http://en.wikipedia.org/wiki/Eval#Ruby'
86
+ },
87
+ :targets => { 'Generic' => 'all' },
88
+
89
+ :issue => {
90
+ :name => %q{Code injection (timing attack)},
91
+ :description => %q{Arbitrary code can be injected into the web application
92
+ which is then executed as part of the system.
93
+ (This issue was discovered using a timing attack; timing attacks
94
+ can result in false positives in cases where the server takes
95
+ an abnormally long time to respond.
96
+ Either case, these issues will require further investigation
97
+ even if they are false positives.)},
98
+ :tags => [ 'code', 'injection', 'timing', 'blind' ],
99
+ :cwe => '94',
100
+ :severity => Issue::Severity::HIGH,
101
+ :cvssv2 => '7.5',
102
+ :remedy_guidance => %q{User inputs must be validated and filtered
103
+ before being evaluated as executable code.
104
+ Better yet, the web application should stop evaluating user
105
+ inputs as any part of dynamic code altogether.},
106
+ :remedy_code => '',
107
+ :metasploitable => 'unix/webapp/arachni_php_eval'
108
+ }
109
+
110
+ }
111
+ end
112
+
113
+ end
114
+ end
115
+ end