CVE-2025-65887
Executive Summary
CVE-2025-65887 is a denial-of-service (DoS) vulnerability in the OneFlow machine learning framework, version v0.9.0. The flaw resides in the flow.floor_divide() component, where a crafted input tensor containing a zero divisor triggers a division-by-zero error, causing the application to crash. This vulnerability is classified under CWE-369 (Divide By Zero) and can be exploited locally without authentication, leading to a high availability impact. No public proof-of-concept (PoC) code or patch is currently available, and the EPSS score is 0.0%, indicating low exploitation likelihood at this time.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
OneFlow is a Python-based deep learning framework distributed via PyPI. This vulnerability affects the core library and can be triggered by any user or process that passes a zero-valued tensor to the flow.floor_divide() function. Organizations using OneFlow in production or CI/CD pipelines should treat this as a high-severity availability risk, as a crafted input can crash the application, potentially disrupting model training or inference services.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Base Score: 6.2 (Medium)
- Attack Vector: Local (AV:L) – The attacker must be able to execute code on the same system or supply a crafted input to the OneFlow process.
- Attack Complexity: Low (AC:L) – No special conditions required; simply providing a zero divisor triggers the crash.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: None (UI:N) – No user action required beyond providing the input.
- Scope: Unchanged (S:U) – The vulnerability does not affect other components.
- Confidentiality Impact: None (C:N)
- Integrity Impact: None (I:N)
- Availability Impact: High (A:H) – The application crashes, causing a denial of service.
Threat Level: Medium. While the CVSS score is moderate, the ease of exploitation (no privileges, low complexity) and the potential for disrupting ML workflows make this a significant concern for availability.
Deep Dive & Mechanics
The flow.floor_divide() function in OneFlow performs element-wise floor division on tensors. The vulnerability occurs when the divisor tensor contains a zero value. In standard arithmetic, division by zero is undefined, and the OneFlow implementation fails to handle this edge case, leading to a division-by-zero exception that crashes the process.
Root Cause: The absence of input validation or exception handling for zero divisors in the floor_divide kernel. The function directly performs the division operation without checking if the divisor is zero, causing a floating-point exception (SIGFPE) on the underlying hardware.
Trigger Condition: An attacker provides a tensor with at least one zero element as the divisor to flow.floor_divide(). For example:
import oneflow as flow
a = flow.tensor([1.0, 2.0, 3.0])
b = flow.tensor([0.0, 1.0, 2.0]) # Zero divisor
result = flow.floor_divide(a, b) # Crashes
Impact: The process terminates immediately, leading to a denial of service. In a production environment, this could halt model serving, training jobs, or other critical operations.
Vulnerable vs. Patched Code
Vulnerable Code (OneFlow v0.9.0):
The floor_divide kernel likely performs the division without a zero check:
// Hypothetical vulnerable kernel
__global__ void floor_divide_kernel(float* a, float* b, float* out, int n) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < n) {
out[idx] = floorf(a[idx] / b[idx]); // No zero check
}
}
Patched Code (Hypothetical): A patched version would add a zero check and handle it gracefully:
__global__ void floor_divide_kernel(float* a, float* b, float* out, int n) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
if (idx < n) {
if (b[idx] == 0.0f) {
out[idx] = NAN; // Or raise an exception
} else {
out[idx] = floorf(a[idx] / b[idx]);
}
}
}
Note: No official patch has been released as of this report.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- OneFlow v0.9.0 installed (
pip install oneflow==0.9.0) - Ability to execute Python code on the target system
Exploit Script:
import oneflow as flow
# Craft a tensor with a zero divisor
a = flow.tensor([1.0, 2.0, 3.0])
b = flow.tensor([0.0, 1.0, 2.0]) # Zero in first element
# Trigger the vulnerability
try:
result = flow.floor_divide(a, b)
print("Result:", result)
except Exception as e:
print("Exception caught:", e)
Expected Outcome: The process crashes with a floating-point exception (SIGFPE) or a Python exception, depending on the environment. In a production system, this would cause the service to become unavailable.
Blue Team (Detection & Defense)
Detection:
- Monitor for crashes or abnormal terminations of OneFlow processes.
- Look for logs containing "Floating point exception" or "SIGFPE".
- Use the YARA and Sigma rules provided in the Detection Engineering section.
Defense:
- Input Validation: Implement a wrapper that checks for zero divisors before calling
flow.floor_divide(). - Sandboxing: Run OneFlow in a container with resource limits to prevent a crash from affecting other services.
- Update: Monitor the OneFlow repository for a patch and apply it as soon as available.
Indicators of Compromise (IOCs)
- Process Crash: OneFlow process terminates unexpectedly with SIGFPE.
- Log Entries:
Floating point exception (core dumped)SIGFPEsignal in system logs
- Network Traffic: None (local vulnerability)
- File Artifacts: Core dump files (if enabled) containing the crash state.
Detection Engineering
YARA Rule
rule CVE_2025_65887_OneFlow_DivByZero {
meta:
description = "Detects OneFlow v0.9.0 division-by-zero crash in floor_divide"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-65887"
strings:
$s1 = "floor_divide" ascii wide nocase
$s2 = "oneflow" ascii wide nocase
$s3 = "v0.9.0" ascii wide nocase
condition:
all of them
}
Sigma Rule
title: OneFlow Division-by-Zero Crash
id: cve-2025-65887
status: experimental
description: Detects crashes caused by CVE-2025-65887 in OneFlow v0.9.0
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: 'python3'
CommandLine|contains: 'oneflow'
CommandLine|contains: 'floor_divide'
condition: selection
falsepositives:
- Legitimate use of floor_divide with non-zero divisors
level: medium
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-65887 OneFlow Division-by-Zero Attempt"; flow:to_server; content:"floor_divide"; nocase; content:"0.0"; distance:0; within:100; classtype:attempted-dos; sid:1000001; rev:1;)
Note: The Suricata rule is a placeholder for network-based detection; however, this vulnerability is local and may not generate network traffic. Adjust based on your environment.
Remediation & Mitigation
Immediate Actions:
- Input Validation: Wrap
flow.floor_divide()calls with a check for zero divisors:def safe_floor_divide(a, b): if flow.any(b == 0): raise ValueError("Divisor contains zero") return flow.floor_divide(a, b) - Resource Limits: Run OneFlow in a container with
--memoryand--pids-limitto contain crashes. - Monitoring: Implement crash detection and automatic restart for OneFlow services.
Long-Term Fix:
- Monitor the OneFlow GitHub repository for a patch (expected in a future release).
- Upgrade to a patched version once available.
- Consider using an alternative framework (e.g., PyTorch, TensorFlow) if OneFlow is not critical.
Workaround: Replace flow.floor_divide() with a custom implementation that handles zero divisors gracefully.
Valters IT