T09 · Insecure Skill Coding Practices
- Location
SKILL.md:115- Finding
Weak XOR Fallback and Unspecified Default Encryption Key
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:30-31andSKILL.md:115-121
Vulnerability Type: Insecure cryptographic design guidance
Risk Level: MediumVulnerable Documentation Excerpts
English rendering of
SKILL.md:30-31:text password | str | Optional custom password. If omitted, a default key is used.English rendering of
SKILL.md:115-121:markdown ## Encryption Strategy The module uses a layered encryption strategy, preferring Fernet and falling back to XOR. | Strategy | Description | |----------|-------------| | **Fernet encryption** (recommended) | AES-128 symmetric encryption with message-integrity verification | | **XOR encryption** (fallback) | Simple XOR encryption with no dependencies, providing basic functionality | | **Code obfuscation protection** | Base64 concealment, dynamic function generation, and namespace cleanup |Technical Analysis
The Skill documentation promotes encryption of potentially sensitive strings and configuration credentials while allowing two unsafe modes:
- Encryption may use an unspecified default key when the caller does not provide a password. If this key is static or shared between installations, obtaining it from one copy of the external library could permit decryption of data produced by other users.
- The cryptographic process may automatically fall back to XOR. Basic XOR encryption does not provide modern confidentiality or integrity guarantees and is vulnerable to known-plaintext analysis, key-reuse attacks, frequency analysis, and ciphertext modification.
Automatic fallback from authenticated encryption to a materially weaker algorithm is a fail-open design. Callers may believe that protected data always receives Fernet-equivalent confidentiality and authentication even when the weaker path is active.
The project contains only
SKILL.md; no implementation is included. Consequently, the precise default key, XOR c ...[truncated 2099 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the XOR fallback entirely and fail closed if the authenticated-encryption dependency is unavailable.
- Remove the implicit default-key mode. Require callers to provide securely generated key material or retrieve it from an approved secret-management system.
- Use authenticated encryption exclusively, such as Fernet or a carefully implemented AEAD construction.
- If passwords must be accepted, derive encryption keys with a password-based key derivation function such as Argon2id, scrypt, or PBKDF2 using a unique random salt and an appropriate work factor.
- Generate unique nonces or initialization vectors according to the selected algorithm and never reuse them where reuse is unsafe.
- Store algorithm and key-derivation metadata in a versioned ciphertext envelope so decryption does not silently downgrade to a weaker scheme.
- Return a clear error when secure encryption cannot be performed. Never substitute encoding or obfuscation for encryption.
- Document key rotation, secret storage, integrity guarantees, and failure behavior.
- Add tests confirming that missing dependencies, omitted keys, malformed ciphertext, and authentication failures cannot trigger XOR or another weak fallback.
- Clarify that Base64 encoding and code obfuscation provide no cryptographic confidentiality.
