Security Vulnerability Report
中文
CVE-2026-40199 CVSS 6.5 MEDIUM

CVE-2026-40199

Published: 2026-04-10 22:16:22
Last Modified: 2026-04-21 18:41:01
Source: 9b29abf9-4ab0-4765-b253-1875cd9b441e

Description

Net::CIDR::Lite versions before 0.23 for Perl mishandles IPv4 mapped IPv6 addresses, which may allow IP ACL bypass. _pack_ipv6() includes the sentinel byte from _pack_ipv4() when building the packed representation of IPv4 mapped addresses like ::ffff:192.168.1.1. This produces an 18 byte value instead of 17 bytes, misaligning the IPv4 part of the address. The wrong length causes incorrect results in mask operations (bitwise AND truncates to the shorter operand) and in find() / bin_find() which use Perl string comparison (lt/gt). This can cause find() to incorrectly match or miss addresses. Example: my $cidr = Net::CIDR::Lite->new("::ffff:192.168.1.0/120"); $cidr->find("::ffff:192.168.2.0"); # incorrectly returns true This is triggered by valid RFC 4291 IPv4 mapped addresses (::ffff:x.x.x.x). See also CVE-2026-40198, a related issue in the same function affecting malformed IPv6 addresses.

CVSS Details

CVSS Score
6.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:stigtsp:net\:\:cidr\:\:lite:*:*:*:*:*:perl:*:* - VULNERABLE
Net::CIDR::Lite < 0.23

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# PoC for CVE-2026-40199 # Demonstrates incorrect matching of IPv4 mapped IPv6 addresses use Net::CIDR::Lite; use strict; use warnings; # Create a CIDR range for ::ffff:192.168.1.0/120 # This should match addresses from ::ffff:192.168.1.0 to ::ffff:192.168.1.255 my $cidr = Net::CIDR::Lite->new("::ffff:192.168.1.0/120"); # Test an address that is technically outside the range (192.168.2.0) # Due to the bug, this might incorrectly return true my $test_ip = "::ffff:192.168.2.0"; if ($cidr->find($test_ip)) { print "[+] VULNERABLE: $test_ip incorrectly matched the range.\n"; } else { print "[-] SAFE: $test_ip correctly did not match the range.\n"; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-40199", "sourceIdentifier": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "published": "2026-04-10T22:16:21.597", "lastModified": "2026-04-21T18:41:01.297", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Net::CIDR::Lite versions before 0.23 for Perl mishandles IPv4 mapped IPv6 addresses, which may allow IP ACL bypass.\n\n_pack_ipv6() includes the sentinel byte from _pack_ipv4() when building the packed representation of IPv4 mapped addresses like ::ffff:192.168.1.1. This produces an 18 byte value instead of 17 bytes, misaligning the IPv4 part of the address.\n\nThe wrong length causes incorrect results in mask operations (bitwise AND truncates to the shorter operand) and in find() / bin_find() which use Perl string comparison (lt/gt). This can cause find() to incorrectly match or miss addresses.\n\nExample:\n\n my $cidr = Net::CIDR::Lite->new(\"::ffff:192.168.1.0/120\");\n $cidr->find(\"::ffff:192.168.2.0\"); # incorrectly returns true\n\nThis is triggered by valid RFC 4291 IPv4 mapped addresses (::ffff:x.x.x.x).\n\nSee also CVE-2026-40198, a related issue in the same function affecting malformed IPv6 addresses."}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N", "baseScore": 6.5, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 2.5}]}, "weaknesses": [{"source": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-130"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:stigtsp:net\\:\\:cidr\\:\\:lite:*:*:*:*:*:perl:*:*", "versionEndExcluding": "0.23", "matchCriteriaId": "2B8C0BC5-5E3C-4399-9FD6-437BFF65130F"}]}]}], "references": [{"url": "https://github.com/stigtsp/Net-CIDR-Lite/commit/b7166b1fa17b3b14b4c795ace5b3fbf71a0bd04a.patch", "source": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "tags": ["Patch"]}, {"url": "https://metacpan.org/release/STIGTSP/Net-CIDR-Lite-0.23/changes", "source": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "tags": ["Release Notes"]}, {"url": "https://www.cve.org/CVERecord?id=CVE-2026-40198", "source": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "tags": ["Third Party Advisory"]}]}}