A crash while softhsm2-util --import rewrites token.object leaves it empty, and the token with every key in it unreadable
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 56/100
Direzione di ricerca
Start in src/lib/object_store/ObjectFile.cpp at ObjectFile::writeAttributes and trace how file-backend writes persist token.object; the report reproduces the failure by killing the write after truncation. Check existing tests for object-store writes and add coverage showing an interrupted rewrite leaves either the old or new content intact. Done when the token remains readable after an interrupted softhsm2-util --import rewrite.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
With the file backend, ObjectFile::writeAttributes truncates an object file and then writes it (src/lib/object_store/ObjectFile.cpp, unchanged on main at 9ad87341c9). softhsm2-util --import rewrites the token's own token.object this way. If the process is killed between the truncation and the write, token.object is left at 0 bytes, and the token disappears from its slot. The keys already in it are lost with it: their object files are still on disk, but token.object held the SO and user PIN blobs SoftHSM unwraps their key from.
To reproduce (SoftHSM 2.6.1, Debian 13 arm64):
export SOFTHSM2_CONF=$PWD/softhsm2.conf
mkdir tokens
printf 'directories.tokendir = %s/tokens\nobjectstore.backend = file\n' "$PWD" > softhsm2.conf
softhsm2-util --init-token --free --label t --pin 1234 --so-pin 5678
openssl genpkey -algorithm RSA -out k1.pem; openssl genpkey -algorithm RSA -out k2.pem
softhsm2-util --import k1.pem --token t --pin 1234 --label k1 --id 01
tok=$(ls -d tokens/*/)
strace -f -qq -P "$PWD/${tok}token.object" -e inject=write:signal=KILL \
softhsm2-util --import k2.pem --token t --pin 1234 --label k2 --id 02
ls -l "$tok"; softhsm2-util --show-slots
strace shows ftruncate(3, 0) on token.object and the kill at the write that follows. Afterwards token.object is 0 bytes, --show-slots lists the slot with an empty label, and pkcs11-tool --token-label t --login --pin 1234 --list-objects answers No slot with token named "t" found, while k1's object file is still in the directory.
Expected: token.object holds its old content or its new content.
Found with Sideeye, a personal open-source tool, no commercial interest; say if you would rather not have such reports. Not measured: power loss, the database backend, and which other operations rewrite token.object.
- Lingua principale
- C++
- Stelle
- 1.1k
- Fork
- 434
- Merge medio
- 12g 14h
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 softhsm/SoftHSMv2
-
C_DigestKey digests a sensitive EC private key's CKA_VALUE: no check that the object is a secret keyAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 57/100
Tutte le issue di softhsm/SoftHSMv2
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
charmplusplus/charm#4210 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] VPN auth dialog spawned by the secret agent fails with "TLS support is not available" on NixOSApertabug nixos umbriel
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
noctalia-dev/noctalia#5310 ·
I maintainer di solito rispondono entro 1 giorno
-
area/docdb kind/bug priority/medium status/awaiting-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
yugabyte/yugabyte-db#37426 ·
I maintainer di solito rispondono entro 1 giorno
-
[Engine] Two prompt block scorers enabled at once: WMMA silently wins and no log line is printedAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Niko1221/Strata#5693 · 2 commenti ·
I maintainer di solito rispondono entro 4 giorni