{"record":{"id":"979393bef75d87d9","repo":"lfnovo/open-notebook","slug":"the-aws-imdsv6-metadata-address-fd00-ec2-254-is","errorCode":null,"errorMessage":"The AWS IMDSv6 metadata address (fd00:ec2::254) is not allowed for security reasons.","messagePattern":"The AWS IMDSv6 metadata address \\(fd00:ec2::254\\) is not allowed for security reasons\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"open_notebook/utils/url_validation.py","lineNumber":249,"sourceCode":"        raise ValueError(\n            \"Link-local addresses (169.254.x.x) are not allowed for security reasons. \"\n            \"These addresses are used for cloud metadata endpoints.\"\n        )\n\n    # Block AWS's IMDSv6 metadata address - a Unique Local Address, not\n    # link-local, so it needs its own explicit check. Compare without scope\n    # ID so scoped forms (fd00:ec2::254%eth0) cannot bypass the sentinel.\n    is_aws_imds_v6 = (\n        isinstance(ip, ipaddress.IPv6Address)\n        and int(ip) == int(_AWS_IMDS_V6_ADDRESS)\n    )\n    if is_aws_imds_v6:\n        if resolved:\n            raise ValueError(\n                f\"Hostname '{hostname}' resolves to the AWS IMDSv6 metadata address \"\n                \"(fd00:ec2::254), which is not allowed for security reasons.\"\n            )\n        raise ValueError(\n            \"The AWS IMDSv6 metadata address (fd00:ec2::254) is not allowed for \"\n            \"security reasons.\"\n        )\n","sourceCodeStart":231,"sourceCodeEnd":253,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/open_notebook/utils/url_validation.py#L231-L253","documentation":"The URL contained the literal IPv6 address fd00:ec2::254 (AWS IMDSv6). Unlike link-local blocks this is a Unique Local Address, so it is matched by an explicit integer comparison against _AWS_IMDS_V6_ADDRESS. Direct literals (as opposed to DNS-resolved hostnames) get this constant message.","triggerScenarios":"Passing 'http://[fd00:ec2::254]/' as a base_url to validate_url or prepare_pinned_http_target, or any discover/connection-test path built on it.","commonSituations":"SSRF attempts or security tests targeting the EC2 IPv6 metadata endpoint; hardening verification that the block works.","solutions":["Use the actual AWS public API endpoints instead of the metadata address","If writing security tests, assert the ValueError is raised rather than expecting success"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import ipaddress\nfrom urllib.parse import urlparse\n\nAWS_IMDS_V6 = ipaddress.IPv6Address(\"fd00:ec2::254\")\n\ndef is_imds_v6_literal(url: str) -> bool:\n    host = urlparse(url).hostname or \"\"\n    try:\n        return ipaddress.ip_address(host) == AWS_IMDS_V6\n    except ValueError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    validate_url(url)\nexcept ValueError as e:\n    if \"IMDSv6\" in str(e):\n        return {\"allowed\": False, \"reason\": \"aws-metadata-blocked\"}\n    raise","preventionTips":["Never configure [fd00:ec2::254] as an endpoint","Use AWS SDKs for metadata access, never user-configurable URLs"],"tags":["ssrf","security","aws-imds","ipv6"],"backgroundTag":"ssrf-metadata-endpoint-blocked","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}