Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`FileSecretStore` accepts truncated AES-GCM auth tags

Chiusa Adatta ai principianti
#2,485 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cryptography, node.js, typescript
Ambito
backend, security

Direzione di ricerca

Il problema si trova in core/auth/node/file-secret-store.ts intorno alla riga 298 nella funzione decodeParts e alle righe 678-679 dove avviene la decrittazione. Per prima cosa, leggete il file per comprendere la validazione attuale. Poi, modificate decodeParts per imporre una lunghezza IV di 12 e una lunghezza tag di 16, e aggiungete l'opzione { authTagLength: 16 } a createDecipheriv. Scrivete un test che crei un segreto con un tag troncato e si aspetti un SecretFileKeyMismatchError. Eseguite la suite di test esistente per assicurarvi che la correzione funzioni.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug security v2

Severity: Low (hardening). CWE: CWE-310 / CWE-347 class (improper authentication-tag validation). Status: behavior confirmed; exploitability limited.

What

core/auth/node/file-secret-store.ts: decodeParts (around line 298) checks only that the payload has three
dot-separated parts. crypto.createDecipheriv(CIPHER, key, parts.iv) and decipher.setAuthTag(parts.tag) (lines 678-679) then run
without authTagLength, so tag and IV lengths are attacker-influenced by whoever can edit the file.

Reproduction (standalone, no repo code)

AES-256-GCM encrypt, then decrypt with the tag truncated:

Runtime 16-byte tag 4-byte tag 1-byte / 0-byte tag
Node 22.19.0 (Docker node:22.19-alpine, engines floor is >=22.19.0) accepted accepted rejected
Node 26.5.0 accepted rejected (ERR_CRYPTO_INVALID_AUTH_TAG) rejected

So on the supported Node 22 line a 4-byte tag authenticates, cutting forgery cost to about 2^-32 per attempt.

Limits

Needs write access to the user's local secrets file, and each attempt needs the app to decrypt it, so this is not remote
and not cheaply exploitable. Newer Node versions already reject it.

Suggested change

In decodeParts, require iv.length === 12 and tag.length === 16, and pass { authTagLength: 16 } to createDecipheriv.
Add a test with a truncated tag that expects SecretFileKeyMismatchError.


Reviewed at 1e31c78 (v2.8.0). No fix code is offered, per CONTRIBUTING.md.

Prompt used (per CONTRIBUTING.md)

"Audit this repository's CI workflows and one crypto module against the OpenSSF/CRA-friendly checklist. Run Semgrep,
osv-scanner, gitleaks and trufflehog; read every cited line before accepting a finding; reproduce any crypto claim on the
lowest supported Node version; drop findings that are test fixtures or already mitigated."

Lingua principale
TypeScript
Stelle
10.9k
Fork
1.5k
Merge medio
5h 12m
PR unite (30g)
150

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/inspector

Tutte le issue di modelcontextprotocol/inspector

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.