App-WebPerimeterScan
view release on metacpan or search on metacpan
MANIFEST.SKIP view on Meta::CPAN
\bblibdirs\.ts$ # 6.18 through 6.25 generated this
# Avoid Module::Build generated and utility files.
\bBuild$
\b_build/
\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$
# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$
\.tmp$
\.#
\.rej$
schemas\.yml$
\.swp$
lib/App/WebPerimeterScan/Checks.pm view on Meta::CPAN
# answers 200 to everything must not produce twenty findings. Titles and
# advice are in the message catalogue under each id.
Readonly::Array my @PROBES => (
{ id => 'git-exposed', path => '/.git/config', severity => 'critical', match => qr/\[core\]|repositoryformatversion/, reference => 'https://cwe.mitre.org/data/definitions/538.html' },
{ id => 'git-head', path => '/.git/HEAD', severity => 'high', match => qr/\Aref:\s+refs\// },
{ id => 'svn-exposed', path => '/.svn/entries', severity => 'high', match => qr/^\d+\s*$/m },
{ id => 'env-exposed', path => '/.env', severity => 'critical', match => qr/^\s*[A-Z][A-Z0-9_]{2,}\s*=\s*\S/m, reference => 'https://cwe.mitre.org/data/definitions/200.html' },
{ id => 'htpasswd-exposed', path => '/.htpasswd', severity => 'critical', match => qr/^[^:\s]+:\$?(?:apr1|2y|1|5|6|\{SHA\})/m },
{ id => 'htaccess-exposed', path => '/.htaccess', severity => 'medium', match => qr/<IfModule|RewriteEngine|Options\s+[-+]/i },
{ id => 'web-config-exposed', path => '/web.config', severity => 'high', match => qr/<configuration/i },
{ id => 'php-config-backup', path => '/wp-config.php.bak', severity => 'critical', match => qr/DB_PASSWORD|DB_NAME|AUTH_KEY/ },
{ id => 'sql-dump-exposed', path => '/backup.sql', severity => 'critical', match => qr/CREATE TABLE|INSERT INTO/i, reference => 'https://cwe.mitre.org/data/definitions/538.html' },
{ id => 'ds-store-exposed', path => '/.DS_Store', severity => 'low', match => qr/\x00\x00\x00\x01Bud1/ },
{ id => 'server-status-exposed', path => '/server-status', severity => 'high', match => qr/Apache Server Status|requests currently being processed/i },
{ id => 'server-info-exposed', path => '/server-info', severity => 'medium', match => qr/Apache Server Information|Server Settings/i },
{ id => 'phpinfo-exposed', path => '/phpinfo.php', severity => 'high', match => qr/PHP Version|phpinfo\(\)|Configuration File \(php\.ini\)/i },
{ id => 'spring-actuator-exposed', path => '/actuator/env', severity => 'critical', match => qr/"propertySources"|"activeProfiles"/ },
{ id => 'spring-health-exposed', path => '/actuator/health', severity => 'low', match => qr/"status"\s*:\s*"(?:UP|DOWN)"/ },
{ id => 'composer-json-exposed', path => '/composer.json', severity => 'low', match => qr/"require"\s*:|"autoload"\s*:/ },
{ id => 'package-json-exposed', path => '/package.json', severity => 'low', match => qr/"dependencies"\s*:|"devDependencies"\s*:/ },
{ id => 'crossdomain-xml', path => '/crossdomain.xml', severity => 'medium', match => qr/allow-access-from\s+domain\s*=\s*"\*"/ },
);
lib/App/WebPerimeterScan/Checks.pm view on Meta::CPAN
pattern), and, when a C<baseline> is given, the response differs from the
server's answer for a path that does not exist:
git-exposed critical /.git/config
git-head high /.git/HEAD
svn-exposed high /.svn/entries
env-exposed critical /.env
htpasswd-exposed critical /.htpasswd
htaccess-exposed medium /.htaccess
web-config-exposed high /web.config
php-config-backup critical /wp-config.php.bak
sql-dump-exposed critical /backup.sql
ds-store-exposed low /.DS_Store
server-status-exposed high /server-status
server-info-exposed medium /server-info
phpinfo-exposed high /phpinfo.php
spring-actuator-exposed critical /actuator/env
spring-health-exposed low /actuator/health
composer-json-exposed low /composer.json
package-json-exposed low /package.json
crossdomain-xml medium /crossdomain.xml
security-txt-present info /.well-known/security.txt exists
lib/App/WebPerimeterScan/Messages.pm view on Meta::CPAN
'htpasswd-exposed.fix' => 'Store password files outside the document root and deny access to dotfiles.',
'htaccess-exposed.title' => 'Exposed .htaccess',
'htaccess-exposed.detail' => 'Server configuration is readable and reveals internal rewrite targets and module versions.',
'htaccess-exposed.fix' => 'Deny access to dotfiles at the web server.',
'web-config-exposed.title' => 'Exposed web.config',
'web-config-exposed.detail' => 'An IIS configuration file is readable and may contain connection strings.',
'web-config-exposed.fix' => 'Deny access to web.config.',
'php-config-backup.title' => 'Exposed WordPress configuration backup',
'php-config-backup.detail' => 'A backup copy of wp-config.php is downloadable, exposing database credentials and salts.',
'php-config-backup.fix' => 'Remove backup copies from the document root and deny requests for .bak/.old/.orig files.',
'sql-dump-exposed.title' => 'Exposed database dump',
'sql-dump-exposed.detail' => 'A database dump is downloadable, which is usually a complete copy of the application data.',
'sql-dump-exposed.fix' => 'Remove dumps from the web root and store backups off the web server.',
'ds-store-exposed.title' => 'Exposed .DS_Store',
'ds-store-exposed.detail' => 'A macOS folder index is readable, which leaks the names of files (sometimes files that are otherwise unreachable) in that directory.',
'ds-store-exposed.fix' => 'Deny dotfiles at the web server and stop deploying macOS metadata.',
'server-status-exposed.title' => 'Apache server-status is public',
'server-status-exposed.detail' => 'mod_status is reachable, exposing internal URLs, client addresses and server load.',
'server-status-exposed.fix' => 'Restrict /server-status with Require ip on localhost, or disable mod_status.',
'server-info-exposed.title' => 'Apache server-info is public',
my $findings = run_page(res => response(
status => 500,
body => 'Warning: mysql_fetch_assoc() expects parameter 1 to be resource in /var/www/app.php on line 12',
));
my %ids = ids($findings);
ok($ids{'error-disclosure'}, 'verbose error output reported');
}
{
my $findings = run_page(res => response(
body => '<title>Index of /backup</title>',
));
my %ids = ids($findings);
ok($ids{'directory-listing'}, 'directory listing reported');
}
{
my $findings = App::WebPerimeterScan::Findings->new;
App::WebPerimeterScan::Checks::check_ports($findings,
host => 'example.com',
scan => {
%ids = ids(run_page(url => 'http://example.com/', res => response(body => '<script src="http://cdn.example.net/a.js"></script>')));
ok(!$ids{'mixed-content-active'}, 'a plain HTTP page has no mixed content');
};
subtest 'HTML parsing for disclosure rules' => sub {
my $findings = run_page(res => response(body => q{<meta content="WordPress 6.4" name='generator'>}));
my ($generator) = grep { $_->{id} eq 'generator-disclosed' } @{ $findings->all };
ok($generator, 'generator found with content before name');
like($generator->{title}, qr/WordPress 6\.4/, 'the generator is named');
my %ids = ids(run_page(res => response(body => '<p>Index of /backup</p>')));
ok(!$ids{'directory-listing'}, 'the phrase outside <title> is not a listing');
};
subtest 'versions compare as dotted decimals' => sub {
my $findings = App::WebPerimeterScan::Findings->new;
App::WebPerimeterScan::Checks::check_ports($findings, host => 'h', scan => { open => [
{ port => 22, banner => 'SSH-2.0-OpenSSH_8.9p1' },
{ port => 2222, banner => 'SSH-2.0-OpenSSH_9.10' },
] });
my ($ssh) = grep { $_->{id} eq 'outdated-ssh-banner' } @{ $findings->all };
( run in 5.081 seconds using v1.01-cache-2.11-cpan-99fa8243a42 )