Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive generated by mvt.common.indicators.check_domain method #551

Open
rahim-devops opened this issue Oct 16, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@rahim-devops
Copy link

rahim-devops commented Oct 16, 2024

I’ve noticed that the check_domain method in the MVT tool uses a broad except Exception block, which can lead to false positives when checking for domain indicators. Specifically, if URL parsing fails, the method falls back to a substring match on the URL without providing specific error handling. This can obscure the actual issues occurring during URL processing and may return unintended matches.

try:
    # URL parsing logic
    ...
except Exception:
    # If URL parsing failed, we just try to do a simple substring
    # match.
    for idx, ioc in domain_matcher.iter(url):
        if ioc["value"].lower() in url:  # TODO : fix me
            self.log.warning(
                "Maybe found a known suspicious domain %s "
                'matching indicator "%s" from "%s"',
                url,
                ioc["value"],
                ioc["name"],
            )
            return ioc

        # If nothing matched, we can quit here.
        return None

Can anyone improve Exception Handling in check_domain Method.

@Te-k Te-k added the enhancement New feature or request label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants