Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions addOns/pscanrules/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this add-on will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased
## Unreleased
- Improved detection of version information in Server Header Info Leak passive scan rule (Issue #9160).

### Changed
- Address redirection in a reference.
- Update dependency.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public class ServerHeaderInfoLeakScanRule extends PluginPassiveScanner

private static final Logger LOGGER = LogManager.getLogger(ServerHeaderInfoLeakScanRule.class);

private static final Pattern VERSION_PATTERN = Pattern.compile(".*\\d.*");
// Match version-like patterns such as 2.4, 2.4.49, 10.0.1, etc.
private static final Pattern VERSION_PATTERN = Pattern.compile("\\d+\\.\\d+(\\.\\d+)?");

private static final Map<String, String> ALERT_TAGS;

static {
Expand All @@ -72,7 +74,8 @@ public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) {
// It is set so lets check it. Should only be one but it's a vector so iterate to be
// sure.
for (String serverDirective : serverOption) {
boolean matched = VERSION_PATTERN.matcher(serverDirective).matches();
boolean matched = VERSION_PATTERN.matcher(serverDirective).find();

if (matched) { // See if there's any version info.
// While an alpha string might be the server type (Apache, Netscape, IIS, etc.)
// that's much less of a head-start than actual version details.
Expand Down