CVE-2021-4456
JSON

6.5medium

Net::CIDR versions before 0.24 for Perl mishandle leading zeros in IP CIDR addresses, which may have unspecified impact

Severity
6.5medium CVSS:3.1 by CISA-ADP
Exploit likelihood
0.37% (higher than 23% of CVEs)
Published
Last changed
Assigned by
CPANSec

Description

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.

Affected

Product or packageVersionsReported by
Net-CIDRbefore 0.24CVE List
mrsam net::cidrbefore 0.24NVD

Classification

CWE-704

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.

What each source says

CVE List

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.

NVD (es)

Las versiones de Net::CIDR anteriores a la 0.24 para Perl manejan incorrectamente los ceros iniciales en las direcciones IP CIDR, lo que puede tener un impacto no especificado. Las funciones `addr2cidr` y `cidrlookup` pueden devolver ceros iniciales en una cadena CIDR, que a su vez pueden ser interpretados como números octales por usuarios posteriores. En algunos casos, un atacante podría aprovechar esto para eludir los controles de acceso basados en direcciones IP. La documentación aconseja validar cadenas CIDR no confiables con la función `cidrvalidate`. Sin embargo, esta mitigación es opcional y no se aplica por defecto. En la práctica, los usuarios pueden llamar a `addr2cidr` o `cidrlookup` con entrada no confiable y sin validación, asumiendo incorrectamente que esto es seguro.

References

Sources

SourceRecordLicence
CVE ListCVE-2021-4456 changed 2026-02-27CVE Terms of Use
NVDCVE-2021-4456 changed 2026-06-17Public domain