Repository navigation
Conversation
The module hands the attribute value straight to url_archiver, so enriching a hostile link or url attribute makes the MISP server fetch any URL it can reach, loopback services and cloud metadata endpoints included, and store the answer in the event. Fetch only http and https URLs whose host resolves solely to globally routable addresses, and return an error otherwise. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
urlparse and the requests stack that url_archiver fetches with disagree on a backslash in the authority: http://127.0.0.1\@example.com/ is checked as example.com and fetched from 127.0.0.1. Refuse backslashes, whitespace and control characters before checking the host. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Member
|
Thanks. Could you review it to include also IPv6 infrastructure? |
- An IPv6 address that carries an IPv4 one (IPv4-mapped ::ffff:0:0/96, 6to4
2002::/16, NAT64 64:ff9b::/96) must be routable on both counts:
http://[64:ff9b::7f00:1]/ reaches 127.0.0.1 and is now refused
- An unparsable address or an unclosed IPv6 bracket ("http://[::1/") is
refused instead of raising
- Tests: IPv6 loopback, unspecified, unique local, link-local, IPv4-mapped,
NAT64 and 6to4 literals are not fetched; a name with any internal AAAA
record is not fetched; a name with public AAAA records is
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BLUF
Details
misp_modules/modules/expansion/sourcecache.py gains an is_safe_url() check. It runs in handler() before the page is archived.
Known limits: url_archiver performs the request itself. A public URL that redirects to an internal one, or a host that is rebound between the check and the fetch, is not covered here. Closing those needs url_archiver to validate each hop, or the fetch to move into the module.
Tests
tests/test_sourcecache.py gains three cases. An internal address, a file:// URL and a backslash-userinfo URL each return an error without calling the archiver. All 12 tests in that file pass. flake8, with the repository's settings, is clean on the changed module.
Supersedes #873.