Summary
openssl_encrypt versions before 1.4.0 normalize keys with HKDF using no salt and a static info parameter, reducing the effectiveness of entropy extraction. When attackers can influence or observe repeated derivations with identical inputs, predictable output may weaken cryptographic protection across multiple targets.
Affected context
The issue occurs in openssl_encrypt key-normalization functions when the implementation derives cryptographic material through HKDF without a per-operation salt and with a fixed info value. Deployments may be exposed when attacker-influenced or low-entropy keys are normalized repeatedly across multiple encryption targets, particularly where derived keys are expected to provide independent protection.
Exploit preconditions
- Attack surface: Applications or services that invoke the affected key-normalization functions
- Required access: Ability to influence, obtain, or compare inputs and outputs involved in repeated key derivation; the exact access depends on the integrating application
- Trigger point: Key normalization performed before encryption or related cryptographic operations
- Why exploitation is possible: Identical inputs can produce deterministic derived material because HKDF is used without a salt and with static context information, reducing separation between derivation operations
Why this happens
The underlying weakness is inadequate cryptographic strength caused by insufficient domain separation and entropy extraction during key derivation. Using HKDF with no salt and a static info parameter can make derivation deterministic for identical inputs and reduce the independence expected between derived keys. This maps to CWE-326 because the cryptographic design does not provide sufficient strength against relevant multi-target analysis.
Potential impact
- Attackers may be able to identify relationships between derived keys across targets.
- Cryptographic protections may be weakened when input keys have limited entropy.
- Confidentiality of data protected with affected derived keys could be reduced.
- Multi-target attacks could become more practical under favorable conditions.
- Applications may experience broader compromise if the same derivation pattern protects multiple security boundaries.
General mitigation guidance
Mitigation generally focuses on strengthening key-derivation design and reducing
reuse of derivation context.
Common defensive patterns include:
- Using a cryptographically appropriate, operation-specific salt where the protocol permits it.
- Applying distinct, context-bound information values for separate algorithms, purposes, tenants, or targets.
- Reducing reliance on attacker-controlled or low-entropy key material.
- Enforcing minimum key-quality requirements before normalization.
- Avoiding reuse of derived keys across independent security boundaries.
- Limiting privileges and access to encryption services and protected key material.
- Preserving compatibility and key-rotation controls when changing derivation behavior.
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis and code review rules identifying HKDF calls with constant or empty salt values.
- Review of fixed info parameters used across multiple cryptographic purposes or tenants.
- Tests verifying that independent derivation contexts produce independent outputs.
- Policy checks requiring approved key-derivation parameters and minimum input entropy.
- Runtime telemetry for repeated derivation requests using identical key material across targets.
- Automated security review tools that flag cryptographic APIs configured with weak or reusable context values.

