-
-
Notifications
You must be signed in to change notification settings - Fork 465
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
Mullvad_DNS (New Analyzer) #2763
Conversation
@fgibertoni if you can please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to begin with, pls have a look at the comments i made and rectify.
api_app/analyzers_manager/migrations/0150_analyzer_config_mullvad_dns.py
Outdated
Show resolved
Hide resolved
also, pls look into the ci error checks. It might be something related to a bad migration. |
After carefully reviewing the CLI logs, my migration file and analyzer code, the issue seems to be due to environmental misconfigurations |
umm no. just saw, your migration number is not right, it should be 152 technically and be dependant upon 151 :) |
api_app/analyzers_manager/migrations/0150_analyzer_config_mullvad_dns.py
Outdated
Show resolved
Hide resolved
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Show resolved
Hide resolved
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Outdated
Show resolved
Hide resolved
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Outdated
Show resolved
Hide resolved
"type": "observable", | ||
"docker_based": False, | ||
"maximum_tlp": "RED", | ||
"observable_supported": ["url", "domain", "generic"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you let me know why support generic as well? maybe lmk an example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generic support covers full URLs with paths like 'mp3raid.com/music/krizz_kaliko.html' that don't clearly fall into 'domain' or 'url' categories.
example- urls like "mp3raid.com" returns NOERROR but mp3raid.com/music/krizz_kaliko.html returns NXDOMAIN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mp3raid.com/music/krizz_kaliko.html
should classify as a url, if not you'd have to make sure that you verify all the requests coming through generic that they are something similar to what you want and not random names or numbers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. I will remove the generic from the analyzer config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just crosscheck with and without it once for a string like mp3raid.com/music/krizz_kaliko.html
pls add docs as well |
Sure! once the issues in the code gets resolved I will update the Usage docs as well in the final PR |
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Outdated
Show resolved
Hide resolved
one more change and then i think @mlodic can have a look at it. lgtm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work, I added some considerations.
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Show resolved
Hide resolved
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Outdated
Show resolved
Hide resolved
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Show resolved
Hide resolved
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Show resolved
Hide resolved
api_app/analyzers_manager/observable_analyzers/dns/dns_malicious_detectors/mullvad_dns.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Federico Gibertoni <[email protected]>
Hi @mlodic if this looks good can you please merge it so that I can work on another analyzer BBot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! thank you for your work @AnshSinghal!
We can wait for Matteo's final feedback and merge but I think you can start working on the other analyzer. I assigned it to you 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last little things and then we can merge
encoded_query = ( | ||
base64.urlsafe_b64encode(wire_query).rstrip(b"=").decode("ascii") | ||
) | ||
logger.info(f"Encoded query: {encoded_query}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for each log, it is important to keep track of the original observable, otherwise there is no way to distinguish one analyzer execution from another
observable = self.observable_name | ||
|
||
if self.observable_classification == Classification.URL: | ||
logger.info(f"Extracting hostname from URL {observable}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either debug level or removed
|
||
encoded_query = self.encode_query(observable) | ||
complete_url = f"{self.url}?dns={encoded_query}" | ||
logger.info(f"Requesting Mullvad DNS at: {complete_url}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
observable reference missing
Closes #2756
Description
This PR adds the "Mullvad_DNS" analyzer. The analyzer queries Mullvad's DNS-over-HTTPS service (using the "base" endpoint) to check a domain's DNS records. It supports two modes:
-"query": Returns raw DNS answer data.
-"malicious": Interprets an NXDOMAIN (rcode==3) as the domain being blocked (i.e., malicious).
Type of change
Please delete options that are not relevant.
Checklist
develop
dumpplugin
command and added it in the project as a data migration. ("How to share a plugin with the community")test_files.zip
and you added the default tests for that mimetype in test_classes.py.FREE_TO_USE_ANALYZERS
playbook by following this guide.url
that contains this information. This is required for Health Checks._monkeypatch()
was used in its class to apply the necessary decorators.MockUpResponse
of the_monkeypatch()
method. This serves us to provide a valid sample for testing.# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl # See the file 'LICENSE' for copying permission.
Black
,Flake
,Isort
) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.tests
folder). All the tests (new and old ones) gave 0 errors.DeepSource
,Django Doctors
or other third-party linters have triggered any alerts during the CI checks, I have solved those alerts.Important Rules
Raw Json for "malicious mode"
Raw Json for "query mode"