Skip to content

http_servers: fix incorrect IP regex#353

Merged
tsellers-r7 merged 2 commits intorapid7:masterfrom
tsellers-r7:fix_ip_regex
Apr 29, 2021
Merged

http_servers: fix incorrect IP regex#353
tsellers-r7 merged 2 commits intorapid7:masterfrom
tsellers-r7:fix_ip_regex

Conversation

@tsellers-r7
Copy link
Copy Markdown
Contributor

@tsellers-r7 tsellers-r7 commented Apr 29, 2021

Description

This PR corrects a regex used for IPv4 addresses used in http_servers.xml. The regex failed to escape a . and could DoS the parser when processing very long numeric sequences.

The PR correctly escapes the period and limits the number of repeating digits allowed before the match fails.

This issue was highlighted in a PR to recog-java here: rapid7/recog-java#7

Motivation and Context

Bug fix, performance improvement

How Has This Been Tested?

rspec with built in example tests. I have also tested the regex with Go and Rust online regex testers. Both of these languages use the RE2 engine by default.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have updated the documentation accordingly (or changes are not required).
  • I have added tests to cover my changes (or new tests are not required).
  • All new and existing tests passed.

@tsellers-r7 tsellers-r7 merged commit e0be98a into rapid7:master Apr 29, 2021
@tsellers-r7 tsellers-r7 deleted the fix_ip_regex branch April 29, 2021 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants