{"answers":{"affected":"4 open source packages ship an affected version, including webklex/php-imap and webklex/laravel-imap. It affects 1 product.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-35169 exists.","fix":"Upgrade webklex/php-imap to 5.3.0 or later.","what":"CVE-2023-35169 is a critical path traversal vulnerability in Webklex php-imap, published on 23 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for CVE-2023-35169 and fix it if it is affected.\n\nWhat it is: CVE-2023-35169 is a critical path traversal vulnerability in Webklex php-imap, published on 23 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-35169 exists.\n\nAffected packages and fixed versions:\n- webklex/php-imap (Packagist): affected all versions; fixed in 5.3.0\n- webklex/php-imap (Packagist): affected all versions; fixed in 5.3.0\n- webklex/laravel-imap (Packagist): affected all versions; fixed in 5.3.0\n- webklex/laravel-imap (Packagist): affected all versions; fixed in 5.3.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2023-35169/ (Markdown: https://insights.sbomify.com/CVE-2023-35169/index.md)","id":"CVE-2023-35169","markdown":"https://insights.sbomify.com/CVE-2023-35169/index.md","name":"CVE-2023-35169","record":{"aliases":["GHSA-47p7-xfcc-4pv9","UBUNTU-CVE-2023-35169"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution"],"network_reachable":"yes","non_default_config":true,"product_category":"PHP IMAP library","requires_auth":"none","summary":"Unsanitized attachment filenames in php-imap allow attackers to achieve remote code execution via directory traversal when saving emails.","user_interaction":"not_required","vuln_class":"path_traversal"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"php-imap","vendor":"webklex"}],"cvss":{"score":9.1,"severity":"critical","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-22","name":"Improper Limitation of a Pathname to a Restricted Directory"}],"description":"PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. Prior to version 5.3.0, an unsanitized attachment filename allows any unauthenticated user to leverage a directory traversal vulnerability, which results in a remote code execution vulnerability. Every application that stores attachments with `Attachment::save()` without providing a `$filename` or passing unsanitized user input is affected by this attack.\n\nAn attacker can send an email with a malicious attachment to the inbox, which gets crawled with `webklex/php-imap` or `webklex/laravel-imap`. Prerequisite for the vulnerability is that the script stores the attachments without providing a `$filename`, or providing an unsanitized `$filename`, in `src/Attachment::save(string $path, string $filename = null)`. In this case, where no `$filename` gets passed into the `Attachment::save()` method, the package would use a series of unsanitized and insecure input values from the mail as fallback. Even if a developer passes a `$filename` into the `Attachment::save()` method, e.g. by passing the name or filename of the mail attachment itself (from email headers), the input values never get sanitized by the package. There is also no restriction about the file extension (e.g. \".php\") or the contents of a file. This allows an attacker to upload malicious code of any type and content at any location where the underlying user has write permissions. The attacker can also overwrite existing files and inject malicious code into files that, e.g. get executed by the system via cron or requests.\n\nVersion 5.3.0 contains a patch for this issue.","ecosystems":["Packagist"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"weaponised"},"has_fix":true,"headline":"php-imap vulnerable to RCE through a directory traversal vulnerability","id":"CVE-2023-35169","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Packagist","product":null,"products":[],"type":"path_traversal","year":"2023"},"n_packages":4,"n_references":5,"next":{"headline":"This CVE is a duplicate of another CVE.","id":"CVE-2023-35170"},"packages":[{"ecosystem":"Packagist","fixed":["5.3.0"],"introduced":["0"],"last_affected":[],"package":"webklex/laravel-imap","purl":null,"source":"GHSA-47p7-xfcc-4pv9"},{"ecosystem":"Packagist","fixed":["5.3.0"],"introduced":["0"],"last_affected":[],"package":"webklex/laravel-imap","purl":"pkg:composer/webklex/laravel-imap","source":"GHSA-47p7-xfcc-4pv9"},{"ecosystem":"Packagist","fixed":["5.3.0"],"introduced":["0"],"last_affected":[],"package":"webklex/php-imap","purl":null,"source":"GHSA-47p7-xfcc-4pv9"},{"ecosystem":"Packagist","fixed":["5.3.0"],"introduced":["0"],"last_affected":[],"package":"webklex/php-imap","purl":"pkg:composer/webklex/php-imap","source":"GHSA-47p7-xfcc-4pv9"}],"prev":{"headline":"DataEase has a privilege bypass vulnerability","id":"CVE-2023-35168"},"products":["php-imap"],"published":"2023-06-23","related":[],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"total"},"state":"PUBLISHED","updated":"2024-11-27","vendors":["Webklex"]},"summary":"Unsanitized attachment filenames in php-imap allow attackers to achieve remote code execution via directory traversal when saving emails.","url":"https://insights.sbomify.com/CVE-2023-35169/"}