| 1 | package App::WebPerimeterScan::Messages; | ||
| 2 | |||
| 3 | 34 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 34 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 34 | ▶ | use autodie qw(:all); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 34 | our $VERSION = '0.001.0'; | |
| 8 | |||
| 9 | # The message catalogue: language => { key => message }. | ||
| 10 | # | ||
| 11 | # A message is a string with {name} or {name:%fmt} placeholders, or a | ||
| 12 | # selector hash - see App::WebPerimeterScan::I18N for the format. It is a | ||
| 13 | # plain package hash, not Readonly, so that a translation can be added at run | ||
| 14 | # time: $App::WebPerimeterScan::Messages::CATALOGUE{de} = { ... }; | ||
| 15 | # | ||
| 16 | # Keys for findings follow one pattern, "<rule id>.<part>": | ||
| 17 | # .title required, one line | ||
| 18 | # .detail required, why it matters | ||
| 19 | # .fix optional, what to do | ||
| 20 | # .evidence optional, a template for the evidence line; rules whose | ||
| 21 | # evidence is captured data (a body excerpt, a banner) pass it raw | ||
| 22 | 34 | our %CATALOGUE; | |
| 23 | |||
| 24 | $CATALOGUE{en} = { | ||
| 25 | # ------------------------------------------------------------------ | ||
| 26 | # The i18n layer itself | ||
| 27 | # ------------------------------------------------------------------ | ||
| 28 | 34 | 'i18n.missing_key' => 'No message is defined for "{key}"', | |
| 29 | |||
| 30 | # ------------------------------------------------------------------ | ||
| 31 | # Scope | ||
| 32 | # ------------------------------------------------------------------ | ||
| 33 | 'scope.unreadable' => "Cannot read scope file '{file}': {error}", | ||
| 34 | 'scope.unparsable' => 'Ignoring unparsable scope line: {line}', | ||
| 35 | 'scope.empty' => "Scope file '{file}' contains no usable hosts", | ||
| 36 | 'scope.not_listed' => "Refusing to scan '{host}': not listed in {source}", | ||
| 37 | 'scope.private' => "Refusing to scan '{host}': it resolves into private address space (use --allow-private if this is intentional)", | ||
| 38 | 'scope.no_source' => '(none)', | ||
| 39 | |||
| 40 | # ------------------------------------------------------------------ | ||
| 41 | # The scan runner | ||
| 42 | # ------------------------------------------------------------------ | ||
| 43 | 'scan.no_scope' => 'No scope was given; a scan needs one before it can send any traffic', | ||
| 44 | 'scan.no_hosts' => 'No concrete hosts in scope (only wildcards?)', | ||
| 45 | 'scan.progress' => '[webperimeter] {message}', | ||
| 46 | 'scan.progress.host' => 'host {host}', | ||
| 47 | 'scan.progress.base' => 'base URL {base}', | ||
| 48 | 'scan.progress.urls' => { | ||
| 49 | plural => 'count', | ||
| 50 | forms => { | ||
| 51 | one => '{count} URL scanned on {host}', | ||
| 52 | other => '{count} URLs scanned on {host}', | ||
| 53 | }, | ||
| 54 | }, | ||
| 55 | 'scan.note.main' => 'main page', | ||
| 56 | 'scan.note.plaintext' => 'plaintext hop', | ||
| 57 | 'scan.note.origin' => 'Origin: {origin}', | ||
| 58 | |||
| 59 | # ------------------------------------------------------------------ | ||
| 60 | # Findings collector | ||
| 61 | # ------------------------------------------------------------------ | ||
| 62 | 'findings.unknown_severity' => "Unknown severity '{severity}' for finding '{id}'; recorded as info", | ||
| 63 | 'findings.foreign' => 'annotate() was given a finding that this collection did not record', | ||
| 64 | |||
| 65 | # ------------------------------------------------------------------ | ||
| 66 | # Source index | ||
| 67 | # ------------------------------------------------------------------ | ||
| 68 | 'source.unreadable' => "Skipping source file '{file}': {error}", | ||
| 69 | |||
| 70 | # ------------------------------------------------------------------ | ||
| 71 | # HTTP client errors (these end up in report evidence) | ||
| 72 | # ------------------------------------------------------------------ | ||
| 73 | 'http.invalid_url' => 'invalid URL', | ||
| 74 | 'http.unsupported_scheme' => "unsupported scheme '{scheme}'", | ||
| 75 | 'http.no_host' => 'URL has no host', | ||
| 76 | 'http.connect_failed' => 'connect failed: {error}', | ||
| 77 | 'http.write_failed' => 'request write failed', | ||
| 78 | 'http.no_headers' => 'no response headers', | ||
| 79 | 'http.malformed_status' => 'malformed status line', | ||
| 80 | |||
| 81 | # ------------------------------------------------------------------ | ||
| 82 | # Port scan and TLS errors | ||
| 83 | # ------------------------------------------------------------------ | ||
| 84 | 'ports.unresolvable' => "cannot resolve '{host}'", | ||
| 85 | 'ports.no_tcp' => 'no tcp protocol', | ||
| 86 | 'tls.verify_failed' => 'certificate verification failed', | ||
| 87 | 'tls.unknown_name' => 'unknown', | ||
| 88 | 'tls.unknown_error' => 'unknown handshake error', | ||
| 89 | |||
| 90 | # ------------------------------------------------------------------ | ||
| 91 | # Text report | ||
| 92 | # ------------------------------------------------------------------ | ||
| 93 | 'report.header' => 'webperimeter {version} {generated}', | ||
| 94 | 'report.scope' => 'Scope: {scope}', | ||
| 95 | 'report.requests' => 'Requests: {requests}', | ||
| 96 | 'report.tls' => ' TLS: {protocol}, {cipher}, expires {expiry}', | ||
| 97 | 'report.tls_expiry' => { | ||
| 98 | plural => 'days', | ||
| 99 | forms => { | ||
| 100 | one => '{not_after} ({days} day)', | ||
| 101 | other => '{not_after} ({days} days)', | ||
| 102 | }, | ||
| 103 | }, | ||
| 104 | 'report.unknown' => 'unknown', | ||
| 105 | 'report.certificate' => ' Certificate: {subject} issued by {issuer}', | ||
| 106 | 'report.tls_failed' => ' TLS: handshake failed ({error})', | ||
| 107 | 'report.open_ports' => ' Open ports: {ports}', | ||
| 108 | 'report.no_open_ports' => 'none of the tested ports', | ||
| 109 | 'report.urls_scanned' => ' URLs scanned: {count}', | ||
| 110 | 'report.clean' => "No findings. That is a clean result for the checks this tool performs,\nnot proof that the site is secure - see LIMITATIONS in the documentation.", | ||
| 111 | 'report.section' => '{severity} ({count})', | ||
| 112 | 'report.file' => ' File: {file}', | ||
| 113 | 'report.in_source' => ' In source: {source}', | ||
| 114 | 'report.evidence' => ' Evidence: {evidence}', | ||
| 115 | 'report.fix' => ' Fix: {fix}', | ||
| 116 | 'report.see' => ' See: {reference}', | ||
| 117 | 'report.summary' => 'Summary: {summary}', | ||
| 118 | 'report.summary_item' => '{count} {severity}', | ||
| 119 | |||
| 120 | # ------------------------------------------------------------------ | ||
| 121 | # HTML report | ||
| 122 | # ------------------------------------------------------------------ | ||
| 123 | 'html.title' => 'Perimeter scan - {generated}', | ||
| 124 | 'html.heading' => 'External perimeter scan', | ||
| 125 | 'html.scope' => 'scope: {scope}', | ||
| 126 | 'html.requests' => { | ||
| 127 | plural => 'requests', | ||
| 128 | forms => { | ||
| 129 | one => '{requests} request', | ||
| 130 | other => '{requests} requests', | ||
| 131 | }, | ||
| 132 | }, | ||
| 133 | 'html.hosts' => 'Hosts', | ||
| 134 | 'html.findings' => 'Findings', | ||
| 135 | 'html.col.host' => 'Host', | ||
| 136 | 'html.col.tls' => 'TLS', | ||
| 137 | 'html.col.ports' => 'Open ports', | ||
| 138 | 'html.col.urls' => 'URLs scanned', | ||
| 139 | 'html.col.severity' => 'Severity', | ||
| 140 | 'html.col.rule' => 'Rule', | ||
| 141 | 'html.col.title' => 'Title', | ||
| 142 | 'html.col.url' => 'URL', | ||
| 143 | 'html.col.file' => 'File', | ||
| 144 | 'html.col.source' => 'Source', | ||
| 145 | 'html.col.detail' => 'Detail', | ||
| 146 | 'html.col.evidence' => 'Evidence', | ||
| 147 | 'html.col.fix' => 'Fix', | ||
| 148 | 'html.tls' => '{protocol} / {cipher}', | ||
| 149 | 'html.days_left' => { | ||
| 150 | plural => 'days', | ||
| 151 | forms => { | ||
| 152 | one => ' / {days} day left', | ||
| 153 | other => ' / {days} days left', | ||
| 154 | }, | ||
| 155 | }, | ||
| 156 | 'html.not_inspected' => 'not inspected', | ||
| 157 | 'html.no_findings' => 'No findings.', | ||
| 158 | |||
| 159 | # ------------------------------------------------------------------ | ||
| 160 | # Command line | ||
| 161 | # ------------------------------------------------------------------ | ||
| 162 | 'cli.error' => 'webperimeter: {error}', | ||
| 163 | 'cli.version' => 'webperimeter {version}', | ||
| 164 | 'cli.not_directory' => '--{option} {dir} is not a directory', | ||
| 165 | 'cli.bad_format' => '--format must be text, json or html', | ||
| 166 | 'cli.bad_fail_on' => '--fail-on must be critical, high, medium, low, info or never', | ||
| 167 | 'cli.bad_port' => "--ports: '{port}' is not a port number between 1 and 65535", | ||
| 168 | 'cli.written' => 'Report written to {file}', | ||
| 169 | 'cli.dry_run.header' => 'Would scan, in this order:', | ||
| 170 | 'cli.dry_run.host' => ' {where}', | ||
| 171 | 'cli.dry_run.private' => ' {where} (private address space - requires --allow-private)', | ||
| 172 | 'cli.dry_run.ports' => 'Ports: {ports}', | ||
| 173 | 'cli.dry_run.docroots' => 'Docroots: {dirs}', | ||
| 174 | 'cli.dry_run.source' => 'Source: {dirs}', | ||
| 175 | 'cli.unauthorized' => <<'EOF', | ||
| 176 | webperimeter: refusing to send traffic without --authorized. | ||
| 177 | |||
| 178 | Only scan hosts you own or have written permission to test. Passing | ||
| 179 | --authorized confirms that the hosts in the scope file are yours. | ||
| 180 | |||
| 181 | Use --dry-run to see what would be scanned without sending anything. | ||
| 182 | EOF | ||
| 183 | 'cli.usage' => <<'EOF', | ||
| 184 | Usage: webperimeter --scope FILE [options] | ||
| 185 | |||
| 186 | -s, --scope FILE Hosts you are authorised to test (required) | ||
| 187 | --authorized Confirm the scope hosts are yours (required to scan) | ||
| 188 | --dry-run Show what would be scanned, send nothing | ||
| 189 | -f, --format FORMAT text (default), json or html | ||
| 190 | -o, --output FILE Write the report to FILE instead of stdout | ||
| 191 | --ports LIST Comma separated ports to probe | ||
| 192 | --docroot DIR Docroot to resolve discovered paths against (repeatable) | ||
| 193 | --source DIR Source tree to map endpoints back to code (repeatable) | ||
| 194 | --timeout SECONDS HTTP response timeout (default 10) | ||
| 195 | --connect-timeout N TCP connect timeout for port/TLS checks (default 3) | ||
| 196 | --delay SECONDS Minimum gap between requests to one host (default 0.5) | ||
| 197 | -d, --depth N Link-following depth from each root URL (default 1) | ||
| 198 | --max-urls N Page budget per host (default 40) | ||
| 199 | --no-path-probes Skip the well-known sensitive path checks | ||
| 200 | --reflection-probe Send one marker parameter to test output encoding | ||
| 201 | --allow-private Permit loopback and private targets (staging, tests) | ||
| 202 | --fail-on LEVEL Exit 1 at or above this severity (default high) | ||
| 203 | --no-color Disable ANSI colour in text output (or --no-colour) | ||
| 204 | -v, --verbose Progress on stderr | ||
| 205 | -h, --help This message | ||
| 206 | -V, --version Print the version | ||
| 207 | |||
| 208 | Scope file: one host per line, # comments allowed. | ||
| 209 | |||
| 210 | example.com | ||
| 211 | www.example.com:8443 | ||
| 212 | https://shop.example.com/ | ||
| 213 | *.example.com # the domain and any sub-domain | ||
| 214 | |||
| 215 | Exit status: 0 nothing at or above --fail-on, 1 findings at or above it, | ||
| 216 | 2 usage or setup error. | ||
| 217 | EOF | ||
| 218 | |||
| 219 | # ================================================================== | ||
| 220 | # Findings raised by the scan runner | ||
| 221 | # ================================================================== | ||
| 222 | 'scan-error.title' => 'Scan of {host} did not complete', | ||
| 223 | 'scan-error.detail' => 'The host could not be scanned, so none of the checks ran against it. A scan that did not run is not a clean result.', | ||
| 224 | 'scan-error.fix' => 'Read the evidence, correct the scope file or the options, and run the scan again.', | ||
| 225 | |||
| 226 | 'host-unreachable.title' => 'Host did not answer over HTTP or HTTPS', | ||
| 227 | 'host-unreachable.detail' => 'No usable response was received on the default web ports, so the web checks could not run.', | ||
| 228 | 'host-unreachable.evidence' => 'Tried {tried}', | ||
| 229 | 'host-unreachable.fix' => 'Confirm the hostname resolves and the web server is listening.', | ||
| 230 | |||
| 231 | 'no-https-redirect.title' => 'Plain HTTP does not redirect to HTTPS', | ||
| 232 | 'no-https-redirect.detail' => 'The first request a visitor makes can be read or rewritten by a network attacker before any HSTS policy is learned.', | ||
| 233 | 'no-https-redirect.evidence' => { | ||
| 234 | select => 'redirect', | ||
| 235 | forms => { | ||
| 236 | elsewhere => 'GET {url} returned {status} with Location: {location}', | ||
| 237 | other => 'GET {url} returned {status} with no HTTPS redirect', | ||
| 238 | }, | ||
| 239 | }, | ||
| 240 | 'no-https-redirect.fix' => 'Redirect all HTTP requests to HTTPS with a 301, and send HSTS on the HTTPS response.', | ||
| 241 | |||
| 242 | 'catch-all-200.title' => 'Application answers 200 for paths that do not exist', | ||
| 243 | 'catch-all-200.detail' => 'Path-probe results were compared against this response and only reported when the content actually matched, so there should be no false positives from the catch-all behaviour. It is still worth fixing: it confuses monitoring and search engines.', | ||
| 244 | 'catch-all-200.evidence' => 'GET {path} returned 200', | ||
| 245 | 'catch-all-200.fix' => 'Return 404 for unknown paths.', | ||
| 246 | |||
| 247 | 'reflected-input.title' => 'Query parameter is reflected without HTML encoding', | ||
| 248 | 'reflected-input.detail' => 'The marker was returned verbatim, including its angle brackets. That is the precondition for reflected cross-site scripting; it still needs a human to confirm that a browser will execute the result.', | ||
| 249 | 'reflected-input.evidence' => 'Sent {parameter} and received it back unencoded', | ||
| 250 | 'reflected-input.fix' => 'HTML-encode all output, and add a CSP that forbids inline script.', | ||
| 251 | |||
| 252 | 'source-file-in-docroot.title' => 'Sensitive file is inside a document root: {file}', | ||
| 253 | 'source-file-in-docroot.detail' => 'The file is on disk under a docroot but was not served during this scan. Any change that starts serving dotfiles - a handler, a rewrite, a new vhost - exposes it at once.', | ||
| 254 | 'source-file-in-docroot.fix' => 'Move it above the document root, or deny the path at the web server.', | ||
| 255 | |||
| 256 | 'source-routes-unvisited.title' => { | ||
| 257 | plural => 'count', | ||
| 258 | forms => { | ||
| 259 | one => '{count} endpoint defined in source was not scanned', | ||
| 260 | other => '{count} endpoints defined in source were not scanned', | ||
| 261 | }, | ||
| 262 | }, | ||
| 263 | 'source-routes-unvisited.detail' => 'These routes exist in the code but no crawled page linked to them, so none of the checks above saw how they behave. They are exactly the surface a link-following scan never reaches.', | ||
| 264 | 'source-routes-unvisited.fix' => 'Name them explicitly, raise --max-urls, or review them by hand.', | ||
| 265 | |||
| 266 | # ================================================================== | ||
| 267 | # Response header checks | ||
| 268 | # ================================================================== | ||
| 269 | 'hsts-missing.title' => 'Strict-Transport-Security header is missing', | ||
| 270 | 'hsts-missing.detail' => 'Without HSTS a user who types the bare hostname makes one plaintext request, which is enough for a network attacker to intercept the session.', | ||
| 271 | 'hsts-missing.evidence' => 'No Strict-Transport-Security header on {url}', | ||
| 272 | 'hsts-missing.fix' => 'Send Strict-Transport-Security: max-age=31536000; includeSubDomains on all HTTPS responses.', | ||
| 273 | |||
| 274 | 'hsts-short-max-age.title' => 'HSTS max-age is shorter than six months', | ||
| 275 | 'hsts-short-max-age.detail' => 'A short max-age gives an attacker a window to downgrade the connection once the policy expires.', | ||
| 276 | 'hsts-short-max-age.evidence' => 'Strict-Transport-Security: {value}', | ||
| 277 | 'hsts-short-max-age.fix' => 'Raise max-age to at least {minimum}, ideally 31536000.', | ||
| 278 | |||
| 279 | 'hsts-no-subdomains.title' => 'HSTS does not cover sub-domains', | ||
| 280 | 'hsts-no-subdomains.detail' => 'Sub-domains remain downgradable, which matters if any of them serves the same cookies.', | ||
| 281 | 'hsts-no-subdomains.evidence' => 'Strict-Transport-Security: {value}', | ||
| 282 | 'hsts-no-subdomains.fix' => 'Add includeSubDomains once every sub-domain is HTTPS-only.', | ||
| 283 | |||
| 284 | 'csp-missing.title' => 'Content-Security-Policy is missing', | ||
| 285 | 'csp-missing.detail' => 'CSP is the main defence-in-depth control against cross-site scripting; without it any injected script runs with full page privileges.', | ||
| 286 | 'csp-missing.evidence' => 'No Content-Security-Policy header on {url}', | ||
| 287 | 'csp-missing.fix' => 'Start with a report-only policy, then enforce it once the reports are clean.', | ||
| 288 | |||
| 289 | 'csp-wildcard.title' => 'Content-Security-Policy allows scripts from any origin', | ||
| 290 | 'csp-wildcard.detail' => 'The script sources include a bare wildcard or a whole scheme (such as https:), so the policy does not restrict where scripts load from.', | ||
| 291 | 'csp-wildcard.evidence' => '{directive} {sources}', | ||
| 292 | 'csp-wildcard.fix' => 'List the specific origins that host scripts.', | ||
| 293 | |||
| 294 | 'csp-unsafe.title' => 'Content-Security-Policy permits unsafe-inline or unsafe-eval for scripts', | ||
| 295 | 'csp-unsafe.detail' => 'Inline script and eval are the two gaps most XSS payloads rely on. unsafe-inline is only reported when no nonce or hash makes browsers ignore it.', | ||
| 296 | 'csp-unsafe.evidence' => '{directive} {sources}', | ||
| 297 | 'csp-unsafe.fix' => 'Move inline handlers into files and use a nonce or hash instead of unsafe-inline; remove unsafe-eval.', | ||
| 298 | |||
| 299 | 'clickjacking.title' => 'No clickjacking protection', | ||
| 300 | 'clickjacking.detail' => 'The page can be framed by another site, so its buttons can be overlaid and used for clickjacking.', | ||
| 301 | 'clickjacking.evidence' => 'No X-Frame-Options header and no frame-ancestors directive', | ||
| 302 | 'clickjacking.fix' => "Send X-Frame-Options: DENY (or SAMEORIGIN), or CSP frame-ancestors 'self'.", | ||
| 303 | |||
| 304 | 'nosniff-missing.title' => 'X-Content-Type-Options is missing', | ||
| 305 | 'nosniff-missing.detail' => 'Without nosniff some browsers will sniff a text/plain upload as HTML, turning an upload into stored XSS.', | ||
| 306 | 'nosniff-missing.evidence' => { | ||
| 307 | select => 'present', | ||
| 308 | forms => { | ||
| 309 | yes => 'X-Content-Type-Options: {value}', | ||
| 310 | other => 'Header absent', | ||
| 311 | }, | ||
| 312 | }, | ||
| 313 | 'nosniff-missing.fix' => 'Send X-Content-Type-Options: nosniff on every response.', | ||
| 314 | |||
| 315 | 'referrer-policy-missing.title' => 'Referrer-Policy is missing', | ||
| 316 | 'referrer-policy-missing.detail' => 'Full URLs, including tokens in query strings, leak to third parties through the Referer header.', | ||
| 317 | 'referrer-policy-missing.evidence' => 'No Referrer-Policy header', | ||
| 318 | 'referrer-policy-missing.fix' => 'Send Referrer-Policy: strict-origin-when-cross-origin.', | ||
| 319 | |||
| 320 | 'permissions-policy-missing.title' => 'Permissions-Policy is missing', | ||
| 321 | 'permissions-policy-missing.detail' => 'Camera, microphone and geolocation remain available to any embedded or injected frame.', | ||
| 322 | 'permissions-policy-missing.evidence' => 'No Permissions-Policy header', | ||
| 323 | 'permissions-policy-missing.fix' => 'Send Permissions-Policy denying the features the site does not use.', | ||
| 324 | |||
| 325 | 'server-version-disclosed.title' => 'Server version disclosed: {server}', | ||
| 326 | 'server-version-disclosed.detail' => 'Publishing an exact version lets an attacker go straight to the matching exploit instead of probing.', | ||
| 327 | 'server-version-disclosed.evidence' => 'Server: {server}', | ||
| 328 | 'server-version-disclosed.fix' => 'Suppress the version token (ServerTokens Prod in Apache, server_tokens off in nginx).', | ||
| 329 | |||
| 330 | 'x-powered-by.title' => 'X-Powered-By discloses the platform: {value}', | ||
| 331 | 'x-powered-by.detail' => 'The header advertises the application stack and usually its version.', | ||
| 332 | 'x-powered-by.evidence' => 'X-Powered-By: {value}', | ||
| 333 | 'x-powered-by.fix' => 'Remove X-Powered-By (expose_php = Off, or Header unset X-Powered-By).', | ||
| 334 | |||
| 335 | 'generator-disclosed.title' => 'Generator meta tag discloses: {generator}', | ||
| 336 | 'generator-disclosed.detail' => 'The CMS and its version are advertised in the markup.', | ||
| 337 | 'generator-disclosed.evidence' => '<meta name="generator" content="{generator}">', | ||
| 338 | 'generator-disclosed.fix' => 'Remove the generator meta tag.', | ||
| 339 | |||
| 340 | 'php2shell.title' => 'PHP version vulnerable to PHP2Shell ({version})', | ||
| 341 | 'php2shell.detail' => { | ||
| 342 | select => 'reason', | ||
| 343 | forms => { | ||
| 344 | unsupported => 'PHP {version} has no upstream fix for PHP2Shell. CVE-2026-109618 and CVE-2026-109619 are remote code execution flaws that moved from disclosure to active exploitation within hours.', | ||
| 345 | other => 'PHP {version} is below the PHP2Shell fix level {fixed}. CVE-2026-109618 and CVE-2026-109619 are remote code execution flaws that moved from disclosure to active exploitation within hours.', | ||
| 346 | }, | ||
| 347 | }, | ||
| 348 | 'php2shell.evidence' => 'X-Powered-By reports PHP/{version}', | ||
| 349 | 'php2shell.fix' => 'Upgrade to the fixed release for this branch ({fixed_list}) and restart the SAPI.', | ||
| 350 | |||
| 351 | 'cookie-flags.title' => "Cookie '{name}' is missing {missing}", | ||
| 352 | 'cookie-flags.detail' => 'A cookie without HttpOnly can be read by injected script; without Secure it is sent over plaintext; without SameSite it is attached to cross-site requests.', | ||
| 353 | 'cookie-flags.evidence' => 'Set-Cookie: {cookie} (seen on {url})', | ||
| 354 | 'cookie-flags.fix' => 'Set Secure, HttpOnly and SameSite=Lax (or Strict) on session cookies.', | ||
| 355 | |||
| 356 | # ================================================================== | ||
| 357 | # Response body checks | ||
| 358 | # ================================================================== | ||
| 359 | 'directory-listing.title' => 'Directory listing is enabled', | ||
| 360 | 'directory-listing.detail' => 'The server returns an index of the directory, which reveals files that are not linked from anywhere.', | ||
| 361 | 'directory-listing.evidence' => 'Response title is "{title}"', | ||
| 362 | 'directory-listing.fix' => 'Disable auto-indexing (Options -Indexes / autoindex off).', | ||
| 363 | |||
| 364 | 'error-disclosure.title' => 'Verbose error output discloses internals ({markers})', | ||
| 365 | 'error-disclosure.detail' => "Error pages leak file paths, framework versions and sometimes query fragments, which shortens an attacker's reconnaissance.", | ||
| 366 | 'error-disclosure.fix' => 'Log details server-side and return a generic error page with the correct status code.', | ||
| 367 | 'error-marker.php' => 'PHP error', | ||
| 368 | 'error-marker.perl' => 'Perl error', | ||
| 369 | 'error-marker.python' => 'Python traceback', | ||
| 370 | 'error-marker.java' => 'Java stack trace', | ||
| 371 | 'error-marker.sql' => 'SQL error', | ||
| 372 | 'error-marker.stack' => 'stack trace', | ||
| 373 | |||
| 374 | 'mixed-content-active.title' => 'Active mixed content on an HTTPS page', | ||
| 375 | 'mixed-content-active.detail' => 'Scripts, stylesheets, frames or form targets are loaded over plaintext, so a network attacker can replace them wholesale. Form actions over HTTP also send their contents in the clear.', | ||
| 376 | 'mixed-content-active.fix' => 'Move every script, stylesheet, frame and form target to https:// and add upgrade-insecure-requests to the CSP.', | ||
| 377 | |||
| 378 | 'mixed-content-passive.title' => 'Passive mixed content on an HTTPS page', | ||
| 379 | 'mixed-content-passive.detail' => 'Images, media or icons are fetched over plaintext, so they can be modified in transit and can leak the page URL through the Referer header.', | ||
| 380 | 'mixed-content-passive.fix' => 'Reference these resources over https://.', | ||
| 381 | |||
| 382 | # ================================================================== | ||
| 383 | # CORS and methods | ||
| 384 | # ================================================================== | ||
| 385 | 'cors-misconfiguration.title' => 'CORS policy allows untrusted origins', | ||
| 386 | 'cors-misconfiguration.detail' => { | ||
| 387 | select => 'case', | ||
| 388 | forms => { | ||
| 389 | credentials => 'Any origin may read authenticated responses, so a malicious site can act as the logged-in user.', | ||
| 390 | reflected => 'The server echoes back whatever Origin it is given, so any site can read these responses.', | ||
| 391 | other => 'Any origin may read these responses. Harmless for genuinely public data, dangerous for anything user-specific.', | ||
| 392 | }, | ||
| 393 | }, | ||
| 394 | 'cors-misconfiguration.evidence' => { | ||
| 395 | select => 'credentials', | ||
| 396 | forms => { | ||
| 397 | yes => 'Access-Control-Allow-Origin: {allowed}; Access-Control-Allow-Credentials: true (request sent Origin: {origin})', | ||
| 398 | other => 'Access-Control-Allow-Origin: {allowed} (request sent Origin: {origin})', | ||
| 399 | }, | ||
| 400 | }, | ||
| 401 | 'cors-misconfiguration.fix' => 'Echo back only origins on an explicit allowlist, never a wildcard, and only with credentials when necessary.', | ||
| 402 | |||
| 403 | 'trace-enabled.title' => 'HTTP TRACE is enabled', | ||
| 404 | 'trace-enabled.detail' => 'TRACE echoes the request back, which can be combined with other flaws to read cookies and headers.', | ||
| 405 | 'trace-enabled.evidence' => 'Allow: {allow}', | ||
| 406 | 'trace-enabled.fix' => 'Disable TRACE (TraceEnable off in Apache).', | ||
| 407 | |||
| 408 | 'write-methods-enabled.title' => 'Write methods advertised on a public URL', | ||
| 409 | 'write-methods-enabled.detail' => 'PUT, DELETE or PATCH are allowed here. That may be intended for an API, but it is worth confirming the endpoint authenticates and authorises.', | ||
| 410 | 'write-methods-enabled.evidence' => 'Allow: {allow}', | ||
| 411 | 'write-methods-enabled.fix' => 'Restrict methods per route at the web server or application layer.', | ||
| 412 | |||
| 413 | # ================================================================== | ||
| 414 | # TLS | ||
| 415 | # ================================================================== | ||
| 416 | 'tls-unavailable.title' => 'TLS handshake failed', | ||
| 417 | 'tls-unavailable.detail' => 'The host did not complete a TLS handshake on the scanned port, so either HTTPS is not served there or the TLS configuration is broken.', | ||
| 418 | 'tls-unavailable.fix' => 'Confirm the port serves HTTPS and that the certificate chain is complete.', | ||
| 419 | |||
| 420 | 'tls-invalid-certificate.title' => 'TLS certificate does not verify', | ||
| 421 | 'tls-invalid-certificate.detail' => 'Browsers will show a full-page warning, and users who click through are training themselves to ignore the warning that protects them.', | ||
| 422 | 'tls-invalid-certificate.fix' => 'Serve the full chain including intermediates, and issue the certificate for the names actually in use.', | ||
| 423 | |||
| 424 | 'tls-self-signed.title' => 'TLS certificate is self-signed', | ||
| 425 | 'tls-self-signed.detail' => 'A self-signed certificate provides no identity guarantee, so it offers no protection against interception.', | ||
| 426 | 'tls-self-signed.evidence' => 'Subject and issuer are identical: {subject}', | ||
| 427 | 'tls-self-signed.fix' => 'Use a certificate from a publicly trusted CA.', | ||
| 428 | |||
| 429 | 'tls-expired.title' => { | ||
| 430 | plural => 'days', | ||
| 431 | forms => { | ||
| 432 | one => 'TLS certificate expired {days} day ago', | ||
| 433 | other => 'TLS certificate expired {days} days ago', | ||
| 434 | }, | ||
| 435 | }, | ||
| 436 | 'tls-expired.detail' => 'Every visitor sees an interstitial warning, and API clients will reject the connection.', | ||
| 437 | 'tls-expired.evidence' => 'notAfter: {not_after}', | ||
| 438 | 'tls-expired.fix' => 'Renew the certificate and automate renewal.', | ||
| 439 | |||
| 440 | 'tls-expiring.title' => { | ||
| 441 | plural => 'days', | ||
| 442 | forms => { | ||
| 443 | one => 'TLS certificate expires in {days} day', | ||
| 444 | other => 'TLS certificate expires in {days} days', | ||
| 445 | }, | ||
| 446 | }, | ||
| 447 | 'tls-expiring.detail' => 'Certificate expiry is a self-inflicted outage, and automated clients fail closed.', | ||
| 448 | 'tls-expiring.evidence' => 'notAfter: {not_after}', | ||
| 449 | 'tls-expiring.fix' => 'Renew now and automate renewal with ACME.', | ||
| 450 | |||
| 451 | 'tls-legacy-protocol.title' => 'Deprecated TLS protocol version accepted ({protocols})', | ||
| 452 | 'tls-legacy-protocol.detail' => 'TLS 1.0 and 1.1 are deprecated by RFC 8996 and are barred by PCI DSS. They only survive to support clients that should be retired.', | ||
| 453 | 'tls-legacy-protocol.evidence' => 'Server completed a handshake with {protocols}', | ||
| 454 | 'tls-legacy-protocol.fix' => 'Require TLS 1.2 or newer (SSLProtocol -all +TLSv1.2 +TLSv1.3).', | ||
| 455 | |||
| 456 | 'tls-weak-cipher.title' => 'Weak cipher negotiated: {cipher}', | ||
| 457 | 'tls-weak-cipher.detail' => 'The negotiated suite is broken or has no authentication, so the connection can be decrypted or impersonated.', | ||
| 458 | 'tls-weak-cipher.evidence' => 'Cipher: {cipher}; protocol: {protocol}', | ||
| 459 | 'tls-weak-cipher.fix' => 'Restrict the cipher list to AEAD suites and disable anonymous and export ciphers.', | ||
| 460 | |||
| 461 | # ================================================================== | ||
| 462 | # Ports | ||
| 463 | # ================================================================== | ||
| 464 | 'portscan-failed.title' => 'Port scan could not run', | ||
| 465 | 'portscan-failed.detail' => '{error}', | ||
| 466 | |||
| 467 | 'port-open.title' => 'Port {port} accepts connections from outside the host', | ||
| 468 | 'port-open.detail' => { | ||
| 469 | select => 'port', | ||
| 470 | forms => { | ||
| 471 | 21 => 'FTP is unencrypted and frequently allows anonymous access', | ||
| 472 | 22 => 'SSH is reachable; confirm it only allows keys and is patched', | ||
| 473 | 23 => 'Telnet is unencrypted', | ||
| 474 | 25 => 'SMTP is reachable from the internet', | ||
| 475 | 445 => 'SMB should never be exposed to the internet', | ||
| 476 | 587 => 'Message submission is reachable', | ||
| 477 | 993 => 'IMAPS is reachable', | ||
| 478 | 995 => 'POP3S is reachable', | ||
| 479 | 1433 => 'Microsoft SQL Server should not be internet-facing', | ||
| 480 | 3000 => 'A development application server appears to be exposed', | ||
| 481 | 3306 => 'MySQL should not be internet-facing', | ||
| 482 | 3389 => 'RDP is a common ransomware entry point', | ||
| 483 | 5432 => 'PostgreSQL should not be internet-facing', | ||
| 484 | 5900 => 'VNC is unencrypted and often unauthenticated', | ||
| 485 | 6379 => 'Redis is unauthenticated by default', | ||
| 486 | 8000 => 'An alternate HTTP port is exposed', | ||
| 487 | 8080 => 'An alternate HTTP port is exposed', | ||
| 488 | 8443 => 'An alternate HTTPS port is exposed', | ||
| 489 | 8888 => 'An alternate HTTP port is exposed', | ||
| 490 | 9200 => 'Elasticsearch has no authentication by default', | ||
| 491 | 11211 => 'memcached has no authentication at all', | ||
| 492 | 27017 => 'MongoDB has historically shipped without authentication', | ||
| 493 | other => 'A service is reachable on this port', | ||
| 494 | }, | ||
| 495 | }, | ||
| 496 | 'port-open.evidence' => { | ||
| 497 | select => 'has_banner', | ||
| 498 | forms => { | ||
| 499 | yes => 'Banner: {banner}', | ||
| 500 | other => 'TCP connect succeeded, no banner', | ||
| 501 | }, | ||
| 502 | }, | ||
| 503 | 'port-open.fix' => 'Close the port at the firewall unless it must be public; if it must, restrict it by source address and require authentication.', | ||
| 504 | |||
| 505 | 'ports-other-open.title' => 'Other reachable ports: {ports}', | ||
| 506 | 'ports-other-open.detail' => 'These are not inherently unsafe, but every open port is attack surface that has to be patched and monitored.', | ||
| 507 | 'ports-other-open.evidence' => 'Open: {ports}', | ||
| 508 | 'ports-other-open.fix' => 'Close anything not actively needed.', | ||
| 509 | |||
| 510 | 'outdated-ssh-banner.title' => 'SSH announces an old version', | ||
| 511 | 'outdated-ssh-banner.detail' => 'OpenSSH releases before {minimum} include versions with published remote flaws; the banner alone is not proof of a working exploit, but it is a strong hint.', | ||
| 512 | 'outdated-ssh-banner.fix' => 'Upgrade OpenSSH and restart sshd.', | ||
| 513 | 'outdated-ssh-banner.item' => 'port {port}: {banner}', | ||
| 514 | |||
| 515 | # ================================================================== | ||
| 516 | # Well-known paths | ||
| 517 | # ================================================================== | ||
| 518 | 'git-exposed.title' => 'Exposed Git repository metadata', | ||
| 519 | 'git-exposed.detail' => 'The .git directory is being served. Source code, commit history and any credentials ever committed can be reconstructed from it.', | ||
| 520 | 'git-exposed.fix' => 'Deny requests to /.git/ at the web server, and deploy with the repository outside the document root.', | ||
| 521 | |||
| 522 | 'git-head.title' => 'Exposed Git HEAD', | ||
| 523 | 'git-head.detail' => 'A Git ref file is readable, which confirms the repository is exposed.', | ||
| 524 | 'git-head.fix' => 'Deny requests to /.git/ at the web server.', | ||
| 525 | |||
| 526 | 'svn-exposed.title' => 'Exposed Subversion metadata', | ||
| 527 | 'svn-exposed.detail' => 'Subversion administrative files are readable.', | ||
| 528 | 'svn-exposed.fix' => 'Deny requests to /.svn/ at the web server.', | ||
| 529 | |||
| 530 | 'env-exposed.title' => 'Exposed environment file', | ||
| 531 | 'env-exposed.detail' => 'A dotenv file is downloadable. These usually hold database passwords, API keys and application secrets.', | ||
| 532 | 'env-exposed.fix' => 'Serve only the application entry point: deny dotfiles at the web server and keep configuration above the document root.', | ||
| 533 | |||
| 534 | 'htpasswd-exposed.title' => 'Exposed password file', | ||
| 535 | 'htpasswd-exposed.detail' => 'An htpasswd file is downloadable, so password hashes can be taken offline and cracked.', | ||
| 536 | 'htpasswd-exposed.fix' => 'Store password files outside the document root and deny access to dotfiles.', | ||
| 537 | |||
| 538 | 'htaccess-exposed.title' => 'Exposed .htaccess', | ||
| 539 | 'htaccess-exposed.detail' => 'Server configuration is readable and reveals internal rewrite targets and module versions.', | ||
| 540 | 'htaccess-exposed.fix' => 'Deny access to dotfiles at the web server.', | ||
| 541 | |||
| 542 | 'web-config-exposed.title' => 'Exposed web.config', | ||
| 543 | 'web-config-exposed.detail' => 'An IIS configuration file is readable and may contain connection strings.', | ||
| 544 | 'web-config-exposed.fix' => 'Deny access to web.config.', | ||
| 545 | |||
| 546 | 'php-config-backup.title' => 'Exposed WordPress configuration backup', | ||
| 547 | 'php-config-backup.detail' => 'A backup copy of wp-config.php is downloadable, exposing database credentials and salts.', | ||
| 548 | 'php-config-backup.fix' => 'Remove backup copies from the document root and deny requests for .bak/.old/.orig files.', | ||
| 549 | |||
| 550 | 'sql-dump-exposed.title' => 'Exposed database dump', | ||
| 551 | 'sql-dump-exposed.detail' => 'A database dump is downloadable, which is usually a complete copy of the application data.', | ||
| 552 | 'sql-dump-exposed.fix' => 'Remove dumps from the web root and store backups off the web server.', | ||
| 553 | |||
| 554 | 'ds-store-exposed.title' => 'Exposed .DS_Store', | ||
| 555 | '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.', | ||
| 556 | 'ds-store-exposed.fix' => 'Deny dotfiles at the web server and stop deploying macOS metadata.', | ||
| 557 | |||
| 558 | 'server-status-exposed.title' => 'Apache server-status is public', | ||
| 559 | 'server-status-exposed.detail' => 'mod_status is reachable, exposing internal URLs, client addresses and server load.', | ||
| 560 | 'server-status-exposed.fix' => 'Restrict /server-status with Require ip on localhost, or disable mod_status.', | ||
| 561 | |||
| 562 | 'server-info-exposed.title' => 'Apache server-info is public', | ||
| 563 | 'server-info-exposed.detail' => 'mod_info is reachable and publishes the full module configuration.', | ||
| 564 | 'server-info-exposed.fix' => 'Restrict /server-info with Require ip on localhost, or disable mod_info.', | ||
| 565 | |||
| 566 | 'phpinfo-exposed.title' => 'phpinfo() is public', | ||
| 567 | 'phpinfo-exposed.detail' => 'A phpinfo page leaks absolute paths, loaded extensions, environment variables and sometimes credentials.', | ||
| 568 | 'phpinfo-exposed.fix' => 'Delete phpinfo scripts from production.', | ||
| 569 | |||
| 570 | 'spring-actuator-exposed.title' => 'Spring Boot actuator environment is public', | ||
| 571 | 'spring-actuator-exposed.detail' => 'The actuator env endpoint is reachable and commonly exposes datasource credentials and API keys.', | ||
| 572 | 'spring-actuator-exposed.fix' => 'Require authentication on /actuator/**, and only expose health and info.', | ||
| 573 | |||
| 574 | 'spring-health-exposed.title' => 'Spring Boot actuator health is public', | ||
| 575 | 'spring-health-exposed.detail' => 'Health detail is public. This is minor on its own but confirms a Spring Boot management surface.', | ||
| 576 | 'spring-health-exposed.fix' => 'Expose only the health endpoint, and set management.endpoint.health.show-details=never.', | ||
| 577 | |||
| 578 | 'composer-json-exposed.title' => 'composer.json is public', | ||
| 579 | 'composer-json-exposed.detail' => 'Dependency pins are readable, which tells an attacker exactly which versions to try.', | ||
| 580 | 'composer-json-exposed.fix' => 'Deny access to composer.json and composer.lock.', | ||
| 581 | |||
| 582 | 'package-json-exposed.title' => 'package.json is public', | ||
| 583 | 'package-json-exposed.detail' => 'Dependency pins are readable, which tells an attacker exactly which versions to try.', | ||
| 584 | 'package-json-exposed.fix' => 'Deny access to package.json and package-lock.json.', | ||
| 585 | |||
| 586 | 'crossdomain-xml.title' => 'Permissive crossdomain.xml', | ||
| 587 | 'crossdomain-xml.detail' => 'A wildcard Flash cross-domain policy lets any site read responses from this origin (still honoured by some legacy clients).', | ||
| 588 | 'crossdomain-xml.fix' => 'Remove crossdomain.xml, or restrict allow-access-from to specific trusted domains.', | ||
| 589 | |||
| 590 | 'security-txt-present.title' => 'security.txt is published', | ||
| 591 | 'security-txt-present.detail' => 'Good: this gives a researcher a route to report a finding to you privately.', | ||
| 592 | 'security-txt-present.evidence' => 'Contact directive found', | ||
| 593 | |||
| 594 | 'robots-disclosure.title' => { | ||
| 595 | plural => 'count', | ||
| 596 | forms => { | ||
| 597 | one => 'robots.txt names {count} path', | ||
| 598 | other => 'robots.txt names {count} paths', | ||
| 599 | }, | ||
| 600 | }, | ||
| 601 | 'robots-disclosure.detail' => 'robots.txt is public. Anything listed there is a map of what the operator considers sensitive; it must not be the only protection.', | ||
| 602 | 'robots-disclosure.evidence' => 'Disallow: {paths}', | ||
| 603 | 'robots-disclosure.fix' => 'Enforce access control on these paths rather than relying on robots.txt, and consider not listing them at all.', | ||
| 604 | }; | ||
| 605 | |||
| 606 | 34 | 1; | |
| 607 | |||
| 608 | __END__ | ||