Reject excessively long dst, src, and localip ACL parameters - #2478
Reject excessively long dst, src, and localip ACL parameters#2478k-furman wants to merge 2 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
rousskov
left a comment
There was a problem hiding this comment.
Thank you for posting this PR. It needs a few corrections, but nothing major AFAICT. Please let me know if you want me to do any of the suggested changes.
Please check the adjusted PR title/description. They will become a commit message when this PR is merged. I edited them to focus the title on admin-visible effects and to avoid retelling what the diff clearly says. I also wanted to clarify the scope of the proposed trailing garbage checks.
Finally, please add the author line from the first PR branch commit (or, if needed, an alternative entry) to CONTRIBUTORS. Our CI tests will check for that automatically. If you do not want any such entry, please let me know, and we will take care of that manually.
This change fixes buffer overflows when acl_ip_data::FactoryParse() is given malformed dst, src, and localip ACL configuration parameters with values exceeding 255 characters. Squid now also detects (and rejects) trailing parameter garbage in more cases. FactoryParse() sscanf() calls were writing raw input into 256-byte buffers without checking input size. This change adds these limits: - IPv6 input patterns: 39 bytes per address and 3 bytes for the mask. - IPv4 input patterns: 15 bytes per address and 15 bytes for the mask. - Non-IP input patterns: 255 per address and 255 for the mask. We now also extend trailing garbage checks to all of the above patterns.
15309af to
c72b844
Compare
|
Many thanks for detailed answer! I fixed all things you suggested, squash commits, change commit message and head as in PR, and force-pushed it. Also, I add a line with my name in CONTRIBUTORS, as you tell. |
This change fixes buffer overflows when
acl_ip_data::FactoryParse()isgiven malformed
dst,src, andlocalipACL configuration parameterswith values exceeding 255 characters. Squid now also detects (and
rejects) trailing parameter garbage in more cases.
FactoryParse()sscanf()calls were writing raw input into 256-bytebuffers without checking input size. This change adds these limits:
We now also extend trailing garbage checks to all of the above patterns.