-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
gh-128840: Limit the number of parts in IPv6 address parsing #128841
base: main
Are you sure you want to change the base?
Conversation
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.
Looks great, thank you @sethmlarson!
Misc/NEWS.d/next/Security/2025-01-14-11-19-07.gh-issue-128840.M1doZW.rst
Outdated
Show resolved
Hide resolved
@sethmlarson How does this fix prevents a potential denial-of-service ?
In the case when we end up with And, It should not be labelled "Type-Security" . |
Point to note : this PR is relevant to issue - #128840 , but it doesn't entirely fix the issue.
This fix just limits the number of
And, a complete fix would maybe add a check in This check could come in the |
@@ -0,0 +1,3 @@ | |||
Limit the number of splitting on colons (``:``) that will occur while parsing |
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.
This still mentions an implementation detail.
Also, what is the denial-of-service? Do you have a reproducer?
To me, it looks like a tiny performance improvement (which may even not be noticeable). Since it is so simple, it will not harm to backport it to maintained versions (although we are not obliged to do this), but this is far from security issue. The NEWS entry makes it looking much more severe than it is.
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.
Pushed an update to the newsfragment: e1e6917 I also tagged you into the PSRT thread, Django has treated this as a security fix, I agree that it's low severity.
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 Django, this does qualify as a security issue. Very long strings would cause a system to hang, and considering that ipaddress.IPv6Address(user_value)
is used as part of Django's form field sanitization/validation (where direct user input is potentially received), we need to ensure that the ipv6 address validation is robust.
For example, in my system, the following uses all the available ram:
>>> from ipaddress import IPv6Address
>>> value = "abcd:abcd:abcd" * 999_999_999 # this takes a few seconds
>>> addr = IPv6Address(value) # this uses all RAM and hangs
@lazysegtree I've made the updates to limit total number of characters in addition to number of splits. |
See: #128840
cc @nessita