gchq/CyberChef · error · OperationError
Invalid IPv6 address
Error message
Invalid IPv6 address
What it means
The Parse IPv6 Address operation runs the input through IPV6_REGEX. If the regex does not match, the input is not a valid IPv6 address. The parser cannot proceed and rejects the input.
Source
Thrown at src/core/operations/ParseIPv6Address.mjs:269
}
// Detect possible EUI-64 addresses
if (((ipv6[5] & 0xff) === 0xff) && (ipv6[6] >>> 8 === 0xfe)) {
output += "\n\nThis IPv6 address contains a modified EUI-64 address, identified by the presence of FF:FE in the 12th and 13th octets.";
const intIdent = Utils.hex(ipv6[4] >>> 8) + ":" + Utils.hex(ipv6[4] & 0xff) + ":" +
Utils.hex(ipv6[5] >>> 8) + ":" + Utils.hex(ipv6[5] & 0xff) + ":" +
Utils.hex(ipv6[6] >>> 8) + ":" + Utils.hex(ipv6[6] & 0xff) + ":" +
Utils.hex(ipv6[7] >>> 8) + ":" + Utils.hex(ipv6[7] & 0xff),
mac = Utils.hex((ipv6[4] >>> 8) ^ 2) + ":" + Utils.hex(ipv6[4] & 0xff) + ":" +
Utils.hex(ipv6[5] >>> 8) + ":" + Utils.hex(ipv6[6] & 0xff) + ":" +
Utils.hex(ipv6[7] >>> 8) + ":" + Utils.hex(ipv6[7] & 0xff);
output += "\nInterface identifier: " + intIdent +
"\nMAC address: " + mac;
}
} else {
throw new OperationError("Invalid IPv6 address");
}
return output;
}
}
export default ParseIPv6Address;
View on GitHub (pinned to 4290ea7539)
Solutions
- Provide a valid IPv6 address (e.g., 2001:db8::1, ::1, fe80::1)
- Use Parse IPv4 Address for IPv4 inputs
- Remove zone IDs, surrounding text, and whitespace
- Ensure '::' appears at most once and the total group count is valid
Defensive patterns
Strategy: validation
Validate before calling
// Pre-check: simple IPv6 format validation
const IPV6_RE = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|::([0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4})$/;
if (!IPV6_RE.test(input.trim())) {
throw new Error("Input is not a valid IPv6 address.");
} Type guard
function isIpv6Address(s) {
// Simplified check — use the operation's IPV6_REGEX for an exact match
return /:/.test(s) && /^[0-9a-fA-F:]+$/.test(s.replace(/::.*/, ''));
} Try / catch
try {
const result = chef.parseIPv6Address(input);
} catch (e) {
if (/Invalid IPv6/i.test(e.message)) {
console.error("Provide a valid IPv6 address like 2001:db8::1");
} else { throw e; }
} Prevention
- Remove zone IDs, surrounding text, and whitespace before parsing
- Use Parse IPv4 Address for IPv4 inputs
- Ensure '::' appears at most once in the address
When it happens
Trigger: Input is not an IPv6 address: it is an IPv4 address, a hostname, random text, a MAC address, or an IPv6 address with too many/few groups. Zone IDs (e.g., fe80::1%eth0) or embedded scope identifiers are not matched by the regex. Extra whitespace or surrounding text breaks the match.
Common situations: User enters an IPv4 address instead of IPv6. User enters a hostname or URL. IPv6 address has incorrect number of colons or an invalid '::' compression (e.g., ':::'). Address contains a zone ID that the regex does not support.
Related errors
- Invalid input. Enter either a CIDR range (e.g. 10.0.0.0/24)
- Badly formatted IPv6 address.
- Byte length must be a positive integer
- IPv6 CIDR must be less than 128
- More than 4 blocks.
AI-assisted analysis of gchq/CyberChef@4290ea7539 (2026-08-13).
Data as JSON: /api/errors/17f24d802d8a4876.
Report an issue: GitHub.