CVE-2025-13120: Use After Free in mruby
A vulnerability has been found in mruby up to 3.4.0. This vulnerability affects the function sort_cmp of the file src/array.c. Such manipulation leads to use after free. An attack has to be approached locally. The exploit has been disclosed to the public and may be used. The name of the patch is eb398971bfb43c38db3e04528b68ac9a7ce509bc. It is advisable to implement a patch to correct this issue.
AI Analysis
Technical Summary
CVE-2025-13120 is a use-after-free vulnerability discovered in the mruby interpreter, a lightweight Ruby implementation commonly embedded in applications and devices. The vulnerability resides in the sort_cmp function of the src/array.c file, where improper memory management leads to a use-after-free condition. This occurs when the function manipulates array elements during sorting, freeing memory that is still referenced afterward, causing undefined behavior. Exploitation requires local access with low privileges and no user interaction, indicating that an attacker must have some level of access to the target system to trigger the flaw. The vulnerability affects all mruby versions up to and including 3.4.0. The disclosed patch (commit eb398971bfb43c38db3e04528b68ac9a7ce509bc) corrects the issue by properly managing memory during the sort operation. While no public exploits are known to be actively used, the public disclosure increases the risk of exploitation attempts. The CVSS v4.0 base score is 4.8, reflecting medium severity due to the local attack vector, low complexity, and potential impact on confidentiality, integrity, and availability. This vulnerability could be leveraged to execute arbitrary code, cause application crashes, or escalate privileges within the local environment.
Potential Impact
The primary impact of CVE-2025-13120 is the potential for local attackers to exploit the use-after-free vulnerability to corrupt memory, leading to application crashes, denial of service, or possibly arbitrary code execution within the context of the mruby interpreter. This can compromise the confidentiality, integrity, and availability of applications embedding mruby, especially if they run with elevated privileges or handle sensitive data. Systems relying on mruby for scripting or automation could be destabilized or manipulated, affecting business operations and security. Although remote exploitation is not feasible, insider threats or attackers with local access could leverage this flaw to escalate privileges or disrupt services. The medium CVSS score reflects a moderate risk, but the real-world impact depends on the deployment context and the privileges of the mruby process. Organizations using mruby in critical infrastructure, embedded devices, or development environments may face increased risk of targeted attacks or system instability if unpatched.
Mitigation Recommendations
To mitigate CVE-2025-13120, organizations should promptly apply the official patch identified by commit eb398971bfb43c38db3e04528b68ac9a7ce509bc to all affected mruby versions up to 3.4.0. If immediate patching is not feasible, consider restricting local access to systems running mruby to trusted users only, minimizing the attack surface. Employ application whitelisting and monitoring to detect unusual behavior in processes using mruby. Conduct thorough code reviews and testing when embedding mruby in custom applications to identify potential misuse of the sort_cmp function or similar array operations. Additionally, implement least privilege principles for processes running mruby to limit the impact of potential exploitation. Regularly update and audit all dependencies, including mruby, to ensure timely application of security fixes. Finally, maintain robust logging and alerting mechanisms to detect exploitation attempts or crashes related to this vulnerability.
Affected Countries
United States, Japan, Germany, South Korea, China, United Kingdom, France, Canada, Australia, India
CVE-2025-13120: Use After Free in mruby
Description
A vulnerability has been found in mruby up to 3.4.0. This vulnerability affects the function sort_cmp of the file src/array.c. Such manipulation leads to use after free. An attack has to be approached locally. The exploit has been disclosed to the public and may be used. The name of the patch is eb398971bfb43c38db3e04528b68ac9a7ce509bc. It is advisable to implement a patch to correct this issue.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2025-13120 is a use-after-free vulnerability discovered in the mruby interpreter, a lightweight Ruby implementation commonly embedded in applications and devices. The vulnerability resides in the sort_cmp function of the src/array.c file, where improper memory management leads to a use-after-free condition. This occurs when the function manipulates array elements during sorting, freeing memory that is still referenced afterward, causing undefined behavior. Exploitation requires local access with low privileges and no user interaction, indicating that an attacker must have some level of access to the target system to trigger the flaw. The vulnerability affects all mruby versions up to and including 3.4.0. The disclosed patch (commit eb398971bfb43c38db3e04528b68ac9a7ce509bc) corrects the issue by properly managing memory during the sort operation. While no public exploits are known to be actively used, the public disclosure increases the risk of exploitation attempts. The CVSS v4.0 base score is 4.8, reflecting medium severity due to the local attack vector, low complexity, and potential impact on confidentiality, integrity, and availability. This vulnerability could be leveraged to execute arbitrary code, cause application crashes, or escalate privileges within the local environment.
Potential Impact
The primary impact of CVE-2025-13120 is the potential for local attackers to exploit the use-after-free vulnerability to corrupt memory, leading to application crashes, denial of service, or possibly arbitrary code execution within the context of the mruby interpreter. This can compromise the confidentiality, integrity, and availability of applications embedding mruby, especially if they run with elevated privileges or handle sensitive data. Systems relying on mruby for scripting or automation could be destabilized or manipulated, affecting business operations and security. Although remote exploitation is not feasible, insider threats or attackers with local access could leverage this flaw to escalate privileges or disrupt services. The medium CVSS score reflects a moderate risk, but the real-world impact depends on the deployment context and the privileges of the mruby process. Organizations using mruby in critical infrastructure, embedded devices, or development environments may face increased risk of targeted attacks or system instability if unpatched.
Mitigation Recommendations
To mitigate CVE-2025-13120, organizations should promptly apply the official patch identified by commit eb398971bfb43c38db3e04528b68ac9a7ce509bc to all affected mruby versions up to 3.4.0. If immediate patching is not feasible, consider restricting local access to systems running mruby to trusted users only, minimizing the attack surface. Employ application whitelisting and monitoring to detect unusual behavior in processes using mruby. Conduct thorough code reviews and testing when embedding mruby in custom applications to identify potential misuse of the sort_cmp function or similar array operations. Additionally, implement least privilege principles for processes running mruby to limit the impact of potential exploitation. Regularly update and audit all dependencies, including mruby, to ensure timely application of security fixes. Finally, maintain robust logging and alerting mechanisms to detect exploitation attempts or crashes related to this vulnerability.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- VulDB
- Date Reserved
- 2025-11-13T09:07:33.572Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6915fe5477eaf5a84960393e
Added to database: 11/13/2025, 3:50:44 PM
Last enriched: 3/4/2026, 6:25:19 PM
Last updated: 3/24/2026, 5:22:37 PM
Views: 277
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.