CVE-2021-4456Net::CIDR versions before 0.24 for Perl mishandle leading zeros in IP CIDR addresses,…
Net::CIDR versions before 0.24 for Perl mishandle leading zeros in IP CIDR addresses, which may have unspecified impact. The functions `addr2cidr` and `cidrlookup` may return leading zeros in a CIDR string, which may in turn be parsed as octal numbers by subsequent users. In some cases an attacker may be able to leverage this to bypass access controls based on IP addresses. The documentation advises validating untrusted CIDR strings with the `cidrvalidate` function. However, this mitigation is optional and not enforced by default. In practice, users may call `addr2cidr` or `cidrlookup` with untrusted input and without validation, incorrectly assuming that this is safe.
What to do
Fixed builds are available from Debian, Ubuntu: see the table below for the fixed version per release.
Debian, Ubuntu have not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 25.10 | libnet-cidr-perl | Not affected vulnerable_code_not_present | ||
| Ubuntu 24.04 | libnet-cidr-perl | Fixed | 0.21-2ubuntu0.2 | UBUNTU-CVE-2021-4456 |
| Ubuntu 22.04 | libnet-cidr-perl | Fixed | 0.21-1ubuntu0.2 | UBUNTU-CVE-2021-4456 |
| Ubuntu 20.04 | libnet-cidr-perl | Fix pending | 0.20-1ubuntu0.1~esm2 (Ubuntu Pro) | UBUNTU-CVE-2021-4456 |
| Ubuntu 18.04 | libnet-cidr-perl | Fix pending | 0.18-1ubuntu0.1~esm2 (Ubuntu Pro) | UBUNTU-CVE-2021-4456 |
| Ubuntu 16.04 | libnet-cidr-perl | Fix pending | 0.17-1ubuntu0.16.04.1~esm2 (Ubuntu Pro) | UBUNTU-CVE-2021-4456 |
| Ubuntu 14.04 | libnet-cidr-perl | Fix pending | 0.17-1ubuntu0.14.04.1~esm2 (Ubuntu Pro) | UBUNTU-CVE-2021-4456 |
| Debian 14 | libnet-cidr-perl | Fixed | 0.25-1 | DEBIAN-CVE-2021-4456 |
| Debian 13 | libnet-cidr-perl | Fixed | 0.25-1 | DEBIAN-CVE-2021-4456 |
| Debian 12 | libnet-cidr-perl | Fix pending | DEBIAN-CVE-2021-4456 |
What the vendor says
As published in the CVE record by CPANSec, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- MRSAM Net::CIDR: affected: before 0.24; fixed in
0.24
Solution: Use the `cidrvalidate` function on untrusted input before passing to the affected functions or upgrade to version 0.24 or later
Vendor advisories:
- https://github.com/svarshavchik/Net-CIDR/commit/e3648c6bc6bdd018f90cca4149c467017d42bd10 (patch)
- https://metacpan.org/dist/Net-CIDR/changes (release-notes)
References
- https://blog.urth.org/2021/03/29/security-issues-in-perl-ip-address-distros/
- https://github.com/svarshavchik/Net-CIDR/commit/e3648c6bc6bdd018f90cca4149c467017d42bd10
- https://metacpan.org/dist/Net-CIDR/changes
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.