{"record":{"id":"17f24d802d8a4876","repo":"gchq/CyberChef","slug":"invalid-ipv6-address","errorCode":null,"errorMessage":"Invalid IPv6 address","messagePattern":"Invalid IPv6 address","errorType":"exception","errorClass":"OperationError","httpStatus":null,"severity":"error","filePath":"src/core/operations/ParseIPv6Address.mjs","lineNumber":269,"sourceCode":"            }\n\n\n            // Detect possible EUI-64 addresses\n            if (((ipv6[5] & 0xff) === 0xff) && (ipv6[6] >>> 8 === 0xfe)) {\n                output += \"\\n\\nThis IPv6 address contains a modified EUI-64 address, identified by the presence of FF:FE in the 12th and 13th octets.\";\n\n                const intIdent = Utils.hex(ipv6[4] >>> 8) + \":\" + Utils.hex(ipv6[4] & 0xff) + \":\" +\n                    Utils.hex(ipv6[5] >>> 8) + \":\" + Utils.hex(ipv6[5] & 0xff) + \":\" +\n                    Utils.hex(ipv6[6] >>> 8) + \":\" + Utils.hex(ipv6[6] & 0xff) + \":\" +\n                    Utils.hex(ipv6[7] >>> 8) + \":\" + Utils.hex(ipv6[7] & 0xff),\n                    mac = Utils.hex((ipv6[4] >>> 8) ^ 2) + \":\" + Utils.hex(ipv6[4] & 0xff) + \":\" +\n                    Utils.hex(ipv6[5] >>> 8) + \":\" + Utils.hex(ipv6[6] & 0xff) + \":\" +\n                    Utils.hex(ipv6[7] >>> 8) + \":\" + Utils.hex(ipv6[7] & 0xff);\n                output += \"\\nInterface identifier: \" + intIdent +\n                    \"\\nMAC address:          \" + mac;\n            }\n        } else {\n            throw new OperationError(\"Invalid IPv6 address\");\n        }\n        return output;\n    }\n\n}\n\nexport default ParseIPv6Address;\n","sourceCodeStart":251,"sourceCodeEnd":277,"githubUrl":"https://github.com/gchq/CyberChef/blob/4290ea753912378913b1f3f54e0fc5720afeda5d/src/core/operations/ParseIPv6Address.mjs#L251-L277","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-check: simple IPv6 format validation\nconst 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})$/;\nif (!IPV6_RE.test(input.trim())) {\n  throw new Error(\"Input is not a valid IPv6 address.\");\n}","typeGuard":"function isIpv6Address(s) {\n  // Simplified check — use the operation's IPV6_REGEX for an exact match\n  return /:/.test(s) && /^[0-9a-fA-F:]+$/.test(s.replace(/::.*/, ''));\n}","tryCatchPattern":"try {\n  const result = chef.parseIPv6Address(input);\n} catch (e) {\n  if (/Invalid IPv6/i.test(e.message)) {\n    console.error(\"Provide a valid IPv6 address like 2001:db8::1\");\n  } else { throw e; }\n}","preventionTips":["Remove zone IDs, surrounding text, and whitespace before parsing","Use Parse IPv4 Address for IPv4 inputs","Ensure '::' appears at most once in the address"],"tags":["ipv6","network","parsing","regex","validation"],"backgroundTag":null,"analyzedSha":"4290ea753912378913b1f3f54e0fc5720afeda5d","analyzedAt":"2026-08-13T06:05:50.210Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}