{"answers":{"affected":"It affects 1 product.","exploited":"There is no known exploitation of CVE-2023-40165 in the wild and no public exploit code.","fix":"No fix has been published for CVE-2023-40165 yet. Limit exposure of the affected software until one is available.","what":"CVE-2023-40165 is a high-severity vulnerability in rubygems.org, published on 17 Aug 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2023-40165 and fix it if it is affected.\n\nWhat it is: CVE-2023-40165 is a high-severity vulnerability in rubygems.org, published on 17 Aug 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2023-40165 in the wild and no public exploit code.\n\nAffected product: rubygems.org. No package-level version data is available, so check the vendor advisory linked from the reference page.\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-40165/ (Markdown: https://insights.sbomify.com/CVE-2023-40165/index.md)","id":"CVE-2023-40165","markdown":"https://insights.sbomify.com/CVE-2023-40165/index.md","name":"CVE-2023-40165","record":{"aliases":["GHSA-rxcq-2m4f-94wm"],"analysis":{"component_type":"cloud_service","fix_type":"patch","impacts":["code_execution","data_modify"],"network_reachable":"yes","non_default_config":false,"product_category":"Ruby gem hosting","requires_auth":"none","summary":"Attackers could replace legitimate Ruby gems with malicious versions due to insufficient input validation, potentially leading to code execution in dependent applications.","user_interaction":"required","vuln_class":"supply_chain"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"rubygems.org","vendor":"rubygems"}],"cvss":{"score":7.4,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:H/A:N","version":"3.1"},"cwes":[{"id":"CWE-20","name":"Improper Input Validation"}],"description":"rubygems.org is the Ruby community's primary gem (library) hosting service. Insufficient input validation allowed malicious actors to replace any uploaded gem version that had a platform, version number, or gem name matching `/-\\d/`, permanently replacing the legitimate upload in the canonical gem storage bucket, and triggering an immediate CDN purge so that the malicious gem would be served immediately. The maintainers have checked all gems matching the `/-\\d/` pattern and can confirm that no unexpected `.gem`s were found. As a result, we believe this vulnerability was _not_ exploited. The easiest way to ensure that a user's applications were not exploited by this vulnerability is to check that all of your downloaded .gems have a checksum that matches the checksum recorded in the RubyGems.org database. RubyGems contributor Maciej Mensfeld wrote a tool to automatically check that all downloaded .gem files match the checksums recorded in the RubyGems.org database. You can use it by running: `bundle add bundler-integrity` followed by `bundle exec bundler-integrity`. Neither this tool nor anything else can prove you were not exploited, but the can assist your investigation by quickly comparing RubyGems API-provided checksums with the checksums of files on your disk. The issue has been patched with improved input validation and the changes are live. No action is required on the part of the user. Users are advised to validate their local gems.","ecosystems":[],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":false,"headline":"Unauthorized gem replacement for full names ending in numbers on rubygems.org","id":"CVE-2023-40165","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":null,"product":null,"products":[],"type":"supply_chain","year":"2023"},"n_packages":0,"n_references":2,"next":{"headline":"Notepad++ heap buffer read overflow in FileManager::detectLanguageFromTextBegining","id":"CVE-2023-40166"},"packages":[],"prev":{"headline":"Notepad++ global buffer read overflow in nsCodingStateMachine::NextState","id":"CVE-2023-40164"},"products":["rubygems.org"],"published":"2023-08-17","related":[{"cvss_score":9.9,"headline":"Unauthorized gem takeover for some gems on rubygems.org","id":"CVE-2022-29176","kev_date_added":null,"published":"2022-05-05"},{"cvss_score":7.7,"headline":"Unauthorized takeover for new versions of some platform-specific gems","id":"CVE-2022-29218","kev_date_added":null,"published":"2022-05-12"},{"cvss_score":4.8,"headline":"rubygems.org MFA Bypass through password reset function could allow account takeover","id":"CVE-2024-21654","kev_date_added":null,"published":"2024-01-12"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"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":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2024-10-01","vendors":["rubygems"]},"summary":"Attackers could replace legitimate Ruby gems with malicious versions due to insufficient input validation, potentially leading to code execution in dependent applications.","url":"https://insights.sbomify.com/CVE-2023-40165/"}