{"vuln_id":"GHSA-hh26-4ppw-5864","aliases":["CVE-2024-2408"],"description":"PHP is vulnerable to the Marvin Attack","published_at":"2024-06-06T21:17:06Z","modified_at":"2024-06-06T21:17:06Z","first_seen_at":"2026-11-22T14:05:37.631758Z","severity":"medium","severity_source":"ghsa","cvss_score":5.9,"cvss_vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","cwe":["CWE-208","CWE-327","CWE-385"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-hh26-4ppw-5864"},"matched_alias":null,"items":[{"id":12674,"source":{"id":"gh-php-src","name":"PHP releases (GitHub php/php-src tags)"},"title":"GHSA-hh26-4ppw-5864 / CVE-2024-2408: PHP is vulnerable to the Marvin Attack","summary":"PHP is vulnerable to the Marvin Attack\n\n### Summary\r\n\r\nThe implementation of RSA decryption with PKCS#1 v1.5 padding is vulnerable to a timing variant of the Bleichenabcher attack called the [Marvin Attack](https://people.redhat.com/~hkario/marvin/).\r\n\r\n\r\n### Details\r\n\r\nThe timing of the [`openssl_private_decrypt()`](https://www.php.net/manual/en/function.openssl-private-decrypt.php) function depends on there being a message returned or not, that can be used as an oracle in a Bleichenbacher style attack. That in turn will allow decryption of captured ciphertexts or forging signatures using the key used in the decryption API.\r\n\r\nRunning PHP 8.2.12 with OpenSSL 3.1.4 on Archlinux.\r\n\r\nBy executing a test with 100k measurement per probe on an AMD Ryzen 5 5600X, with no special configuration, I've got the following statistically significant result:\r\n```\r\nSign test mean p-value: 0.3491, median p-value: 0.266, min p-value: 2.097e-14\r\nFriedman test (chisquare approximation) for all samples\r\np-value: 4.725229447597475e-40\r\nWorst pair: 3(no_structure), 7(valid_192)\r\nMean of differences: 2.50389e-07s, 95% CI: -1.19522e-07s, 5.698823e-07s (±3.447e-07s)\r\nMedian of differences: 6.00000e-08s, 95% CI: 4.00000e-08s, 7.000000e-08s (±1.500e-08s)\r\nTrimmed mean (5%) of differences: 8.20218e-08s, 95% CI: 4.41569e-08s, 1.135944e-07s (±3.472e-08s)\r\nTrimmed mean (25%) of differences: 6.99484e-08s, 95% CI: 3.93115e-08s, 9.622458e-08s (±2.846e-08s)\r\nTrimmed mean (45%) of differences: 5.62543e-08s, 95% CI: 3.89805e-08s, 7.136500e-08s (±1.619e-08s)\r\nTrimean of differences: 7.22500e-08s, 95% CI: 4.50000e-08s, 9.200000e-08s (±2.350e-08s)\r\nLayperson explanation: Definite side-channel detected, implementation is VULNERABLE\r\n```\r\nconfidence intervals for the differences between samples:\r\n![conf_interval_plot_trim_mean_45](https://user-images.githubusercontent.com/618246/287866510-e2c01394-a89f-4d15-94bf-0a2ae3ca35c6.png)\r\n\r\nlegend to the graph:\r\n```\r\nID,Name\r\n0,header_only\r\n1,no_header_with_payload_48\r\n2,no_padding_48\r\n3,no_structure\r\n4,signature_padding_8\r\n5,valid_0\r\n6,valid_48\r\n7,valid_192\r\n8,valid_246\r\n9,valid_repeated_byte_payload_246_1\r\n10,valid_repeated_byte_payload_246_255\r\n11,zero_byte_in_padding_48_4\r\n```\r\nprobes are explained in the [`step2.py`](https://github.com/tomato42/marvin-toolkit/blob/master/step2.py) script in the marvin-toolkit repo\r\n\r\n### PoC\r\n\r\nTo reproduce the result, use the [marvin-toolkit](https://github.com/tomato42/marvin-toolkit).\r\n\r\nExecute the step0.sh, step1.sh and step2-alt.sh (you may want to comment out generation of ciphertexts for 1024 and 4096 bit keys in the step2-alt.sh file).\r\n\r\nAfter that, execute the reproducer capturing the timing of the ciphertexts:\r\n```php\r\n<?php\r\n\r\n$privateKeyPath = 'rsa2048/pkcs8.pem';\r\n$ciphertextPath = 'rsa2048_repeat/ciphers.bin';\r\n$ciphertextSize = 256;\r\n$timesPath = 'rsa2048_repeat/raw_times.csv';\r\n\r\n$privateKey = openssl_pkey_get_private(file_get_contents($privateKeyPath), '');\r\n\r\nif ($privateKey === false) {\r\n    die('Failed to load private key');\r\n\nAffected packages: php:php","url":"https://github.com/php/php-src/security/advisories/GHSA-hh26-4ppw-5864","published_at":"2024-06-06T21:17:06Z","updated_at":"2024-06-06T21:17:06Z","fetched_at":"2026-11-22T14:05:37.431201Z","severity":"medium","cvss_score":5.9,"epss":0.01158,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"php","product":"php","vuln_id":"CVE-2024-2408","vuln_ids":["CVE-2024-2408","GHSA-HH26-4PPW-5864"],"tags":["repo-advisory","php","CWE-208","CWE-327","CWE-385","security","repo:php/php-src","stack"],"cluster_id":11787,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/12674","html":"https://vulnwatch.ve1ve2.com/item/12674"}}]}