Invia #636417: coze-dev coze-studio <0.2.4 Cryptographic Issuesinformazioni

Titolocoze-dev coze-studio <0.2.4 Cryptographic Issues
DescrizioneAES misuse in coze-studio plugin system enables deterministic encryption and key disclosure’ Summary: The coze-studio plugin system implements AES-CBC with hard-coded ASCII keys and a fixed, predictable IV derived from the key. This violates established cryptographic guidance and maps to CWE-321 (hard-coded key) and CWE-329 (predictable IV for CBC). As a result, identical plaintexts encrypt to identical ciphertexts across sessions, enabling dictionary and pattern-matching attacks; anyone with source access can decrypt historical data. ([GitHub](https://github.com/coze-dev/coze-studio/issues/505)) Affected component: Plugin encryption helper (Go): `EncryptByAES` constructs `cipher.NewCBCEncrypter(block, sb[:blockSize])`, where `sb` is the key bytes; constants such as `AuthSecretKey`, `StateSecretKey`, and `OAuthTokenSecretKey` are embedded in code. ([GitHub](https://github.com/coze-dev/coze-studio/issues/505)) Technical details: • Hard-coded encryption keys permit offline decryption and cross-environment key reuse (CWE-321). ([cwe.mitre.org](https://cwe.mitre.org/data/definitions/321.html?utm_source=chatgpt.com)) • CBC mode IV equals the first block of the key (`sb[:blockSize]`), so the IV is fixed and predictable (CWE-329). NIST SP 800-38A requires CBC IVs to be unpredictable/unique; deriving the IV from the key violates this requirement. ([cwe.mitre.org](https://cwe.mitre.org/data/definitions/329.html?utm_source=chatgpt.com), [NIST出版物](https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38a.pdf?utm_source=chatgpt.com)) • No authentication tag/MAC is applied, leaving ciphertext malleable and enabling pattern leakage typical of “Cryptographic Failures.” ([OWASP](https://owasp.org/Top10/A02_2021-Cryptographic_Failures/?utm_source=chatgpt.com)) Impact: Confidentiality of plugin data is compromised; identical inputs are linkable, and any party obtaining the source (or leaked key constants) can decrypt stored values. Multi-tenant or forked deployments may share the same keys, amplifying exposure. ([GitHub](https://github.com/coze-dev/coze-studio/issues/505)) Evidence: Issue #505 documents the hard-coded keys and the CBC IV derived from the key; a subsequent PR states the IV was changed to random while keeping legacy decryption for compatibility. ([GitHub](https://github.com/coze-dev/coze-studio/issues/505)) Remediation: 1. Remove hard-coded keys; manage per-environment keys via a KMS or secure secrets store (rotate on release). (CWE-321) ([cwe.mitre.org](https://cwe.mitre.org/data/definitions/321.html?utm_source=chatgpt.com)) 2. For confidentiality + integrity, use an AEAD mode (e.g., AES-GCM/ChaCha20-Poly1305). If CBC must be used, generate a cryptographically random, unique IV per message and transmit it alongside the ciphertext. (CWE-329; NIST SP 800-38A) ([NIST出版物](https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38a.pdf?utm_source=chatgpt.com), [cwe.mitre.org](https://cwe.mitre.org/data/definitions/329.html?utm_source=chatgpt.com)) 3. Provide migration: re-encrypt existing data with new per-env keys and random nonces; deprecate the legacy fixed-IV path after a sunset period. (OWASP A02) ([OWASP](https://owasp.org/Top10/A02_2021-Cryptographic_Failures/?utm_source=chatgpt.com)) Fix status (as of 2025-08-04 JST): PR #533 merged to replace the fixed IV with a random IV and retain backward-compatible decryption; further actions are needed to remove hard-coded keys and add authentication. ([GitHub](https://github.com/coze-dev/coze-studio/pull/533)) CWE mapping: • CWE-321 Use of Hard-coded Cryptographic Key. ([cwe.mitre.org](https://cwe.mitre.org/data/definitions/321.html?utm_source=chatgpt.com)) • CWE-329 Generation of Predictable IV with CBC Mode. ([cwe.mitre.org](https://cwe.mitre.org/data/definitions/329.html?utm_source=chatgpt.com)) References: • coze-studio Issue #505 (evidence). ([GitHub](https://github.com/coze-dev/coze-studio/issues/505)) • coze-studio PR #533 (partial fix). ([GitHub](https://github.com/coze-dev/coze-studio/pull/533)) • NIST SP 800-38A: CBC IVs must be unpredictable. ([NIST出版物](https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38a.pdf?utm_source=chatgpt.com)) • OWASP Top 10 2021 A02: Cryptographic Failures. ([OWASP](https://owasp.org/Top10/A02_2021-Cryptographic_Failures/?utm_source=chatgpt.com)) • MITRE CWE-321 and CWE-329. ([cwe.mitre.org](https://cwe.mitre.org/data/definitions/321.html?utm_source=chatgpt.com))
Fonte⚠️ https://github.com/coze-dev/coze-studio/issues/505
Utente
 kexinoh (UID 82084)
Sottomissione17/08/2025 10:02 (12 mesi fa)
Moderazione28/08/2025 17:14 (11 days later)
StatoAccettato
Voce VulDB321780 [coze-studio fino a 0.2.4 aes.go AuthSecretKey/StateSecretKey/OAuthTokenSecretKey cifratura debole]
Punti20

Might our Artificial Intelligence support you?

Check our Alexa App!