X5UFactory: an x5u entry can name a local file
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 69/100
Línea de trabajo
Read X5UFactory::loadFromUrl() and the certificate loading path through KeyConverter::loadKeyFromCertificate(). Reproduce with the provided MockHttpClient example and check existing tests for x5u certificate formats. Done means entries containing the PEM marker no longer let OpenSSL interpret the value as a file:// path while the listed certificate formats still load.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version(s) affected
Every release since 1.0.1 / 1.1.0, including 3.4.12, 4.0.8, 4.1.10, 4.2.5 and 4.3.x-dev
Description
X5UFactory::loadFromUrl() wraps an entry between PEM markers only when the entry does not already contain -----BEGIN CERTIFICATE-----, then hands it to openssl_x509_read() through KeyConverter::loadKeyFromCertificate(). OpenSSL opens a file when the string starts with file://. An entry such as
file:///-----BEGIN CERTIFICATE-----/../path/to/cert.pem
is therefore not wrapped, and the application reads /path/to/cert.pem. The path is resolved lexically, so the marker directory does not need to exist. If the file holds a PEM certificate, its public key and x5c come back as a key of the set; any other file gives the usual Unable to load the certificate.. open_basedir applies.
Only the host that answers the configured x5u URL (or the network, for an http:// URL) controls these entries. That host already chooses the keys, so no token can be forged this way. It can however probe the server for certificate files, and make the worker block on a path such as a FIFO.
How to reproduce
use Jose\Component\KeyManagement\X5UFactory;
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\MockResponse;
$client = new MockHttpClient(new MockResponse(json_encode([
'partner' => ['file:///-----BEGIN CERTIFICATE-----/..' . $absolutePathOfALocalCertificate],
])));
$keySet = (new X5UFactory($client))->loadFromUrl('https://partner.example.com/x5u');
// $keySet->get('partner') is the local certificate. The same entry without the marker is refused.
Possible Solution
In X5UFactory, when the marker is present, pass OpenSSL the entry from the marker on (substr($cert, strpos($cert, $marker))), and wrap it as today otherwise. The string then never starts with file://, and the formats accepted today (base64 body, PEM block, PEM preceded by text) still load. That fits a patch release.
JWKFactory::createFromCertificate() and createFromKey() (and the 4.3 fromCertificate() / fromKey()) accept file:// strings as well, because OpenSSL does. Only application strings reach them, and some code may rely on it, so refusing file:// there should go through a deprecation that points to createFromCertificateFile() / createFromKeyFile().
Additional Context
Found by the Anthropic OSS Scanner (ANT-2026-3MVD83LW). Same trust boundary as #762: the key set host reaching beyond the document it serves.
- Lenguaje dominante
- PHP
- Estrellas
- 954
- Forks
- 119
- Merge medio
- 48 min
- PR fusionados (30 d)
- 17
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de web-token/jwt-framework
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
web-token/jwt-framework#757 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
web-token/jwt-framework#773 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
web-token/jwt-framework#772 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
web-token/jwt-framework#771 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
web-token/jwt-framework#770 ·
Los mantenedores suelen responder en 1 día
Todos los issues de web-token/jwt-framework
Issues similares
-
enhancement priority Sales
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Include flows spanning the full report time windowPosiblemente ocupada @somethingwithproof la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Cacti/plugin_flowview#306 ·
Los mantenedores suelen responder en 1 día
-
bug origin: upstream priority: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mattytap/Mattytap-Sermons#105 ·
-
priority:low type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
crazy-goat/workerman-bundle#1189 ·
Los mantenedores suelen responder en 1 día