PKCS#12 bundles written world-readable with a fixed, disclosed password
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 35/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 59.8k
- Fork
- 3.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di FiloSottile/mkcert
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
FiloSottile/mkcert#665 ·
-
PopAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 12/100
FiloSottile/mkcert#681 · 3 commenti · 1 reazione ·
-
WhitAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
FiloSottile/mkcert#678 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
FiloSottile/mkcert#677 · 2 commenti ·
-
Support Chromium's new NSS DB path on Linux (default since M146)Forse già presa @cyphercodes l’ha presa 123 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
FiloSottile/mkcert#671 · 2 reazioni ·
Tutte le issue di FiloSottile/mkcert
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
teradata-labs/loom#574 ·
I maintainer di solito rispondono entro 1 giorno
-
cli: name the CRID when saved link limits fail after publish; soften plain-republish mint warningApertaenhancement pr-polish-followup priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
layervai/qurl-integrations#1994 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: `Match exec "step ssh check-host %h"` causes SSH connections through ProxyJump to hangApertabug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
CycloneDX/cyclonedx-go#304 ·
-
[Bug]: snowflake_share fails to read a share attached to a listing with target accounts ('TARGETED ACCOUNTS' in the "to" column)Forse già presa @akhil9tiet l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
snowflakedb/terraform-provider-snowflake#5366 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno