EspoCRM had two IPv4 parsers and did not know it
The exploit path is three layers of host parsing stacked on top of each other.
The HTTP handler is Espo\Tools\Attachment\Api\PostFromImageUrl::process in application/Espo/Tools/Attachment/Api/PostFromImageUrl.php. It takes a JSON body, pulls url, and hands it to UploadUrlService::uploadImage. The first thing uploadImage does is gate:
public function uploadImage(string $url, FieldData $data): Attachment
{
if (!$this->urlCheck->isNotInternalUrl($url)) {
throw new ForbiddenSilent("Not allowed URL.");
}
// ...
[$type, $contents] = $this->getImageDataByUrl($url) ?? [null, null];
UrlCheck::isNotInternalUrl extracts the host with parse_url($url, PHP_URL_HOST). That is layer one. parse_url does not canonicalize. Feed it http://0177.0.0.1/, get back the literal string 0177.0.0.1. It is a parser only in the sense of "find the substring between :// and /."
The string then reaches HostCheck::isNotInternalHost in application/Espo/Core/Utils/Security/HostCheck.php:
public function isNotInternalHost(string $host): bool
{
$records = dns_get_record($host, DNS_A);
if (filter_var($host, FILTER_VALIDATE_IP)) {
return $this->ipAddressIsNotInternal($host);
}
if (!$records) {
return true;
}
foreach ($records as $record) {
$idAddress = $record['ip'] ?? null;
if (!$idAddress) {
return false;
}
if (!$this->ipAddressIsNotInternal($idAddress)) {
return false;
}
}
return true;
}
This is layer two. The implicit model is binary: an input is either a valid IPv4 (in which case check the address) or a hostname (in which case resolve it via DNS and check the resolved addresses). filter_var(..., FILTER_VALIDATE_IP) is the IPv4 oracle. dns_get_record is the hostname oracle.
filter_var("0177.0.0.1", FILTER_VALIDATE_IP) returns false. Each octet must be a 1-to-3-digit decimal in the range 0 to 255; a leading zero followed by more digits is not a decimal number the filter accepts. The string is not an IPv4 in PHP's eyes.
dns_get_record("0177.0.0.1", DNS_A) returns the empty array. The string is not a valid hostname either, so no A records exist.
The function reaches the third branch: if (!$records) { return true; }. "True" here is the function's name, not its semantics. The call is isNotInternalHost, so a true return is the verdict "yes, this is not internal, allow it." The gate opens.
uploadImage then calls getImageDataByUrl($url):
$opts[\CURLOPT_URL] = $url;
$opts[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4;
// ...
$response = curl_exec($ch);
This is layer three. libcurl's URL parser hands the host string to its address resolver. Before any DNS lookup, the resolver tries to treat the host as an IP literal. Its IP-literal parser is the historical BSD inet_aton-style parser, which accepts hex (0x7f.0.0.1), octal (0177.0.0.1), decimal dword (2130706433), three-part (127.0.1), two-part (127.1), and zero-padded notations. All twelve forms in the PoC's payload list resolve through this same parser:
DEFAULT_LOOPBACK_PAYLOADS = [
("octal dotted", "0177.0.0.1"),
("octal dotted padded", "0177.0000.0000.0001"),
("octal compressed", "0177.1"),
("hex dotted", "0x7f.0.0.1"),
("hex dotted full", "0x7f.0x0.0x0.0x1"),
("hex dword", "0x7f000001"),
("decimal dword", "2130706433"),
("octal dword", "017700000001"),
("short IPv4 two-part", "127.1"),
("short IPv4 three-part", "127.0.1"),
("zero-padded dotted", "127.000.000.001"),
("long zero-padded octal", "0000000000000000000000000177.0.0.1"),
]
Each entry is a valid IPv4 literal under one of inet_aton's legacy notations. libcurl accepts every one of them and dials 127.0.0.1.
Layer two and layer three disagreed about what 0177.0.0.1 is. Layer two had no parser that could see it as an IPv4 at all. Layer three's parser was forty years old and shipped with the operating system. The same eleven characters were not-an-IP and an-IP in the same PHP request.
The gate returns true when it has no opinion
The second mechanism is one line:
if (!$records) {
return true;
}
The gate's job is to decide whether a host is internal. It has two oracles: filter_var for IPv4, dns_get_record for hostnames. When the IPv4 oracle says no and the hostname oracle returns nothing, the function does not have a third category. It treats "I don't know what this is" as "not internal" and lets the caller proceed.
This is the inverse of the choice every other branch makes. When filter_var says yes, the function actually examines the address. When DNS returns records, the function checks every resolved IP. The branch that decides on !$records is the only one in the function that returns a verdict without inspecting anything.
The patch reverses it. In 9.3.4 the new isHostAndNotInternal returns false when no IP addresses can be obtained:
$ipAddresses = $this->getHostIpAddresses($host);
if ($ipAddresses === []) {
return false;
}
The default went from "allow" to "deny." A host that survives the IPv4 check (it now does not, as we will see) and then resolves to nothing would now be rejected. The fail-open is closed by inverting one return value.
The patch adds the parser EspoCRM was already shipping
The 9.3.4 patch is structurally a refactor. The old isNotInternalHost is preserved as a deprecated alias; the work moves to isHostAndNotInternal, which delegates to two new public helpers and a new private parser.
The new parser is normalizeIpAddress:
private function normalizeIpAddress(string $ip): string|false
{
if (!str_contains($ip, '.')) {
return self::normalizePart($ip);
}
$parts = explode('.', $ip);
if (count($parts) !== 4) {
return false;
}
$result = [];
foreach ($parts as $part) {
if (preg_match('/^0x[0-9a-f]+$/i', $part)) {
$num = hexdec($part);
} else if (preg_match('/^0[0-7]+$/', $part) && $part !== '0') {
$num = octdec($part);
} else if (ctype_digit($part)) {
$num = (int)$part;
} else {
return false;
}
if ($num < 0 || $num > 255) {
return false;
}
$result[] = $num;
}
return implode('.', $result);
}
This is EspoCRM's inet_aton. It accepts hex parts (0x7f), octal parts (0177), decimal parts, four-part dotted form, and via normalizePart the single-token decimal/hex/octal dword. It is a reimplementation, in PHP, of the IPv4-literal parsing rules libcurl was already using.
The gate uses this new parser to reject hostnames that look like alternative IPv4 literals before the DNS path runs. From isDomainHost:
public function isDomainHost(string $host): bool
{
$normalized = $this->normalizeIpAddress($host);
if ($normalized !== false && filter_var($normalized, FILTER_VALIDATE_IP)) {
return false;
}
// ...
}
If normalizeIpAddress can turn the string into a dotted-decimal IP, the function refuses to treat it as a domain. The point of the call is not to allow the address; it is to deny the disagreement. 0177.0.0.1 is now neither an IP (for filter_var purposes) nor a domain (isDomainHost rejects it because normalizeIpAddress succeeds). The branch that used to fall through to return true is no longer reachable for any of the PoC's twelve payloads.
The fix has four moves, and each addresses the same parser gap from a different angle. The default switches from allow to deny. A new IPv4 parser names the alternative notations. A new domain check refuses inputs whose components look like numeric IP parts. The IP branch runs before the DNS branch, so the order of inspection now matches the order of action.
What the patch did not do is unify the parser. The new normalizeIpAddress is not the parser libcurl uses; it is PHP code that approximates what libcurl does. The two parsers are still distinct. The two parsers are still in the same process. The fix gates the gap rather than eliminating it. This is the same shape the s3-proxy maintainer chose in CVE-2026-42882, where the patch added a third middleware to reject the inputs where the auth and handler parses would disagree, rather than making them agree.
The shape of normalizeIpAddress is also a quiet admission. The function exists because FILTER_VALIDATE_IP does not know about hex octets, octal octets, decimal dwords, hex dwords, octal dwords, two-part addresses, three-part addresses, or zero-padded octets. Every one of those notations is in the function. The developers had to enumerate the parser they were defending against. The parser they were defending against was inet_aton, which has been part of the C library since 4.2BSD in 1983.
Gate before canonicalize, applied to hostnames
This is a gate-before-canonicalize bug. The gate (PHP filter_var plus dns_get_record) inspects an input for a forbidden form. A downstream subsystem (libcurl) canonicalizes the same input into that forbidden form. The check sees the wrapped representation; the action sees the unwrapped one.
The pattern's prior exhibits in URL-validation contexts each name a different parser mismatch. CVE-2026-42596 is the IPv4-mapped-IPv6 flavor: Gotenberg's deny-list regex was written against IPv4 strings, and [::ffff:127.0.0.1] reaches loopback without ever matching the regex's character classes. CVE-2026-40280 is the URL-scheme flavor: ^https?:// is byte-pattern-matched case-sensitively while Go's net/http dials a lowercased scheme. CVE-2026-42260 is the bracketed-IPv6 flavor: isIP('[::1]') returns 0 because Node's net.isIP does not accept brackets, while the URL parser produces '[::1]' as the hostname.
EspoCRM's case is the alternative-IPv4-notation flavor, and it is the cleanest of the four. The gate's parser and the action's parser are not exotic. FILTER_VALIDATE_IP is what every PHP developer reaches for; inet_aton is what every C and Unix developer has been reading hostnames through for forty years. The two have always disagreed about what an IPv4 address looks like. EspoCRM picked the strict one for its gate and shipped libcurl unchanged for its action. The disagreement was a system call away from any web request.
The host-block in 9.3.3 is also a fail-open intercept. Its job is to decide internal-or-not; its third branch decides not-internal when it cannot decide at all. The fix flips the default. Internal hosts now fail closed.
The bug is moderate-severity by every available metric. CVSS 4.3. Authenticated. Read-only. The patch landed cleanly. None of that is the story.
The story is that EspoCRM was running two IPv4 parsers, in the same process, against the same string, and the developers had only modeled one of them. The patch added PHP code that approximates what libcurl was already doing, then gated the disagreement that remains between them.
PoC: EntroVyx/CVE-2026-33534
The fix gates the disagreement. The parsers still disagree.