fix: add SSRF bypass protection against urlparse/requests parser differential (closes #40) - #44
Open
botbikamordehai2-sketch wants to merge 1 commit into
Conversation
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.
What
Issue #40 reports an SSRF bypass vulnerability. The
validate_urlfunction usesurlparseto validate the host, butrequestsparses URLs differently. Specifically, a URL likehttps://127.0.0.1:6666\@1.1.1.1is parsed byurlparseas having host1.1.1.1(public), butrequestsinterprets the backslash as a path separator and connects to127.0.0.1(internal). This allows bypassing the private IP blocklist.Fix
validate_url()is called, preventing the parser differential from being exploitedSecurity Impact
This closes a critical SSRF bypass that could allow an attacker to probe internal networks by crafting URLs that
urlparseandrequestsparse differently.Closes #40