MEDIUM 5.9

CVE-2017-20240: Timing Attack in Crypt::PBKDF2 Perl Module

Crypt::PBKDF2, a Perl cryptographic library used to derive secure keys from passwords, contains a timing-based side-channel vulnerability in versions before 0.261630. The library uses a simple string comparison (eq) to verify derived keys, which executes at different speeds depending on how many characters match between the input and the correct value. An attacker on the network can measure these timing differences to gradually narrow down the correct key without needing the password itself.

Source data · NVD / CISA · public domain

CVSS
3.1 · 5.9 MEDIUM · CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Weaknesses (CWE)
CWE-208
Affected products
0 configuration(s)
Published / Modified
2026-06-12 / 2026-06-17

NVD description (verbatim)

Crypt::PBKDF2 versions before 0.261630 for Perl are vulnerable to timing attacks. These versions use Perl's built-in eq comparison. Discrepancies in timing could be used to guess the underlying derived-key.

4 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2017-20240 is a timing attack vulnerability (CWE-208) affecting Crypt::PBKDF2 prior to version 0.261630. The root cause is the use of Perl's built-in eq operator for comparing derived keys, which performs byte-by-byte comparison and returns early on mismatch. This non-constant-time comparison leaks information about the correct key through measurable timing side-channels. An attacker with network access can exploit timing variations across multiple requests to construct the derived key character by character, potentially compromising password-derived cryptographic material.

Business impact

Organizations relying on Crypt::PBKDF2 for password-based key derivation in authentication, encryption, or credential systems face a confidentiality risk. An attacker can derive cryptographic keys without knowing the original password, potentially leading to unauthorized access to encrypted data or authenticated sessions. The impact is elevated in scenarios where keys are used for long-term secrets (e.g., database encryption keys, API credentials derived from passwords) rather than ephemeral session tokens.

Affected systems

Crypt::PBKDF2 versions before 0.261630 for Perl are affected. Any application or system directly using this Perl module for password-based key derivation is potentially vulnerable. This includes custom Perl applications, legacy infrastructure, and middleware that integrate this library for cryptographic operations.

Exploitability

Exploitation requires network access to the application or service using the vulnerable library (AV:N). The attack complexity is high (AC:H), requiring an attacker to make multiple timed requests and perform statistical analysis to reliably extract key material. However, there are no authentication barriers (PR:N, UI:N), and the attack is passive from the target application's perspective. Reliable exploitation is feasible but not trivial for skilled attackers with sufficient network proximity and measurement precision.

Remediation

Upgrade Crypt::PBKDF2 to version 0.261630 or later. The patch replaces the vulnerable eq comparison with a constant-time comparison function, eliminating the timing side-channel. After upgrading the library, restart any applications or services that depend on it to ensure the patched version is loaded.

Patch guidance

Update Crypt::PBKDF2 via your Perl package manager (CPAN, cpanm, or equivalent) to version 0.261630 or later. Verify the upgrade with `perldoc -l Crypt::PBKDF2` and check the installed version using `perl -MCrypt::PBKDF2 -e 'print $Crypt::PBKDF2::VERSION'`. Ensure all running Perl processes that use this module are restarted after the upgrade to activate the patched version.

Detection guidance

Review Perl dependency manifests and installed module versions in production environments to identify use of Crypt::PBKDF2 below 0.261630. Audit logs for the module's use in authentication or key-derivation code paths. Monitor for unusual patterns of repeated authentication attempts or timing-based probing, though this may be difficult to distinguish from legitimate traffic. Static code analysis can identify imports of Crypt::PBKDF2 in your codebase.

Why prioritize this

Although the CVSS score is moderate (5.9/MEDIUM), this vulnerability targets the confidentiality of derived cryptographic keys, which are often more sensitive than passwords themselves. Prioritization depends on whether your organization uses Crypt::PBKDF2 in production; if so, patch promptly since the fix is straightforward and timing attacks are feasible over the network. Organizations not using this specific Perl module can deprioritize accordingly.

Risk score, explained

The CVSS 3.1 score of 5.9 reflects a confidentiality impact (C:H) with no integrity or availability loss, network accessibility, high attack complexity, and no privilege or user interaction required. The 'high' complexity is warranted because successful exploitation demands multiple requests, timing measurement precision, and statistical analysis. The score appropriately reflects a real but non-trivial risk that impacts sensitive crypto material.

Frequently asked questions

Does this vulnerability require authentication to exploit?

No. The attack is unauthenticated (PR:N, UI:N). An attacker only needs network access to the service and the ability to send requests and measure response timing. They do not need valid credentials or user interaction.

Can an attacker obtain the original password from this vulnerability?

No. The timing attack allows an attacker to derive the cryptographic key output of PBKDF2, not the original password. However, if that derived key is used to encrypt sensitive data or authenticate sessions, the attacker can still cause significant harm.

Is this vulnerability publicly exploited in the wild?

This vulnerability is not listed on CISA's Known Exploited Vulnerabilities (KEV) catalog, meaning there is no confirmed evidence of active exploitation. However, timing attacks are well-understood techniques, and the attack is theoretically feasible for determined adversaries.

What if I use Crypt::PBKDF2 but never deployed it in production?

If the module is present in your codebase but not actively used in running services, the immediate risk is low. However, you should still upgrade the dependency to prevent accidental use in future deployments and to maintain a secure supply chain.

This analysis is based on publicly available vulnerability data and is intended for informational purposes. Organizations must validate all technical details, including patch versions and affected configurations, against their own environments and official vendor advisories. SEC.co does not guarantee exploit code is unavailable; conduct a full risk assessment before deployment decisions. This document does not constitute professional security advice and should be reviewed by your internal security team before action. Source: NVD (public-domain), retrieved 2026-07-20. Analysis generated by SEC.co (claude-haiku-4-5).