Hardening an SSRF filter
Before allowing a user-supplied host, confirm the resolved address is not private, loopback, link-local or CGNAT. Getting the range list wrong is how SSRF filters get bypassed.
Validates whether a string is a well-formed IPv4 or IPv6 address.
—Validates whether a string is a well-formed IPv4 or IPv6 address.
192.168.0.1
✓ Valid IPv4
Both IPv4 dotted-quad and IPv6 (including compressed ::) are checked.
Valid means the syntax conforms to the standard.
Your input is processed entirely in your browser and never sent to a YAS server.
curl -X POST "https://yas.sh/api/v1/tools/ip-validator" \
-H "Content-Type: application/json" \
-d '{"input":"192.168.1.1"}'const res = await fetch("https://yas.sh/api/v1/tools/ip-validator", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"input": "192.168.1.1"
}),
});
const data = await res.json();import requests
r = requests.post("https://yas.sh/api/v1/tools/ip-validator", json={"input":"192.168.1.1"})
data = r.json()| Field | Type | Required | Description |
|---|---|---|---|
| input | string | Yes | e.g. 192.168.1.1 or ::1 |
{ "slug": "ip-validator", "result": { "input": "192.168.1.1", "valid": true, "version": 4 } }Validate IPv4 / IPv6 addresses.
400 VALIDATION_ERROR — invalid input or unsupported option.413 PAYLOAD_TOO_LARGE — input exceeds the 64 KB limit.429 RATE_LIMIT_EXCEEDED — rate limit exceeded (60 req/min).IPv4 validation checks four dot-separated decimal octets in the range 0–255, and rejects the ambiguous forms that some parsers still accept: leading zeros (which historically meant octal, so 010 could be 8), fewer than four parts, and integer notation. These legacy forms are a real security issue — differing interpretations between a validator and an HTTP client are a classic SSRF bypass.
IPv6 validation handles the full RFC 4291 grammar: eight groups of up to four hex digits, at most one :: compression run, optional zone identifiers, and IPv4-mapped forms such as ::ffff:192.0.2.1. Beyond syntax, the tool classifies the address against IANA special-purpose registries — private (RFC 1918), loopback, link-local, CGNAT (100.64.0.0/10), multicast, documentation — because 'is this a valid address' and 'is this an address I should connect to' are different questions.
Before allowing a user-supplied host, confirm the resolved address is not private, loopback, link-local or CGNAT. Getting the range list wrong is how SSRF filters get bypassed.
Rules accumulate typos and stale entries. Validating each line catches the octet above 255 that silently never matched anything.
Distinguishing genuine addresses from version numbers and IDs before enrichment avoids polluting your geo and reputation lookups.
Server-side validation before storing an address prevents a downstream component from interpreting an ambiguous form differently.
What this tool deliberately does not do, and where it will disagree with other implementations.