PKCS#12 bundles written world-readable with a fixed, disclosed password
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 35/100
Línea de trabajo
The file write and the hardcoded password both sit in cert.go: look at the pkcs12.Encode call and the ioutil.WriteFile call that uses mode 0644. Reproduce by running mkcert -pkcs12 in a directory and checking the resulting file's mode, then check how existing mkcert tests cover the PKCS#12 path. Done means the output file is not world-readable under a standard umask, and the password decision is documented or resolved by the maintainers.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Affected versions: confirmed on master HEAD, commit 1c1dc4ed27ed5936046b6398d39cab4d657a2d8e.
Summary
Running mkcert -pkcs12 <name> generates a certificate and private key, packages them into a PKCS#12 bundle encrypted with the literal, hardcoded password changeit, and writes the file with mode 0644. Under a standard 022/0002 umask this leaves the file world-readable. Since the decryption password is both constant and printed directly to the operator's terminal, file-permission confidentiality is the only actual protection on the embedded private key, and that protection is defeated by the mode the tool itself requests.
Details
cert.go:
domainCert, _ := x509.ParseCertificate(cert)
pfxData, err := pkcs12.Encode(rand.Reader, priv, domainCert, []*x509.Certificate{m.caCert}, "changeit")
fatalIfErr(err, "failed to generate PKCS#12")
...
err = ioutil.WriteFile(p12File, pfxData, 0644)
fatalIfErr(err, "failed to save PKCS#12")
ioutil.WriteFile requests mode 0644 regardless of whether the process umask would have allowed something tighter, and preserves an existing file's mode on overwrite. The password is not user-configurable and is announced to the operator every time mkcert runs, so any other local user who can read the file can decrypt it immediately.
Steps To Reproduce
(available upon request)
Impact
- Any local user who can read a
.p12file produced bymkcert -pkcs12(shared/tmp, a world-readable home directory, a CI artifact, a backup, a misconfigured shared host) can recover the certificate's private key with zero additional effort, using only publicly documented tooling and the password mkcert itself discloses. - Limited to the issued development certificate's key, not the CA root key.
- Severity is tempered by
-pkcs12being opt-in and by the output needing to land in a directory traversable by another user, but neither of those preconditions is unusual in CI, shared dev boxes, or containers.
- Lenguaje dominante
- Go
- Estrellas
- 59.8k
- Forks
- 3.3k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
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 FiloSottile/mkcert
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
FiloSottile/mkcert#665 ·
-
PopAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 12/100
FiloSottile/mkcert#681 · 3 comentarios · 1 reacción ·
-
WhitAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
FiloSottile/mkcert#678 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
FiloSottile/mkcert#677 · 2 comentarios ·
-
Support Chromium's new NSS DB path on Linux (default since M146)Posiblemente ocupada @cyphercodes la tomó hace 123 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
FiloSottile/mkcert#671 · 2 reacciones ·
Todos los issues de FiloSottile/mkcert
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
openmcp-project/service-provider-crossplane#330 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
openmcp-project/service-provider-kro#220 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
[FEATURE]: Set fieldPath and reason on the CEL validation rulesPosiblemente ocupada @bjosv la tomó hoy. Abiertoenhancement needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
valkey-io/valkey-operator#618 ·
Los mantenedores suelen responder en 3 días