Bug 1961865

Summary: perl-Net-CIDR-Lite: Incorrect handling of IP address with leading zeros in IP octets
Product: [Other] Security Response Reporter: Tomas Hoger <thoger>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: paul, perl-devel, steve
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: perl-Net-CIDR-Lite 0.22 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-28 20:49:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1961867    
Bug Blocks: 1961866    

Description Tomas Hoger 2021-05-18 20:44:54 UTC
It was discovered that the perl Net-CIDR-Lite module did not correctly handle IP addresses with IP octets containing leading zeros.  Leading zeros were ignored, while the underlying system can treat such octets as octal numbers and interpret them differently.  For example, IP address of 010.0.0.1 was considered by Net-CIDR-Lite to be the same address as 10.0.0.1, while system may consider it to be IP address 8.0.0.1.

Reference:

https://blog.urth.org/2021/03/29/security-issues-in-perl-ip-address-distros/#net-cidr-litehttpsmetacpanorgreleasenet-cidr-lite

This issue was fixed in Net-CIDR-Lite version 0.22 via this change:

https://metacpan.org/diff/file?target=STIGTSP/Net-CIDR-Lite-0.22/Lite.pm&source=DOUGW%2FNet-CIDR-Lite-0.21%2FLite.pm

An example of a potentially vulnerable use case can be found in the SpamAssassin's URILocalBL plugin:

https://svn.apache.org/viewvc/spamassassin/tags/spamassassin_release_3_4_6/lib/Mail/SpamAssassin/Plugin/URILocalBL.pm?view=markup

It allows checking URLs extracted from emails against locally defined blacklist of IP ranges.  IP addresses to check are typically obtained by resolving host names used in URLs.  However, URLs with IP addresses can be used directly.  Hence, this issue could potentially lead to a bypass of the defined blacklist.  Note that this plugin does not seem to be affected due to the use of a strict regular expression used to determine if URL contains host name or IP address.  That regular expression does not consider addresses with leading zeros as valid IP addresses and performs their resolution, translating the IP string to how system interprets it.

Comment 3 Paul Howarth 2021-05-19 08:40:42 UTC
perl-Net-CIDR-Lite is already updated to version 0.22 in all current Fedora and EPEL releases.

Comment 4 Tomas Hoger 2021-05-19 09:32:33 UTC
Correct, that's why no bugs were filed against Fedora / EPEL.  Thanks for noting that explicitly!