Skip to main content

CVE-2025-47907: CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') in Go standard library database/sql

High
VulnerabilityCVE-2025-47907cvecve-2025-47907cwe-362
Published: Thu Aug 07 2025 (08/07/2025, 15:25:30 UTC)
Source: CVE Database V5
Vendor/Project: Go standard library
Product: database/sql

Description

Cancelling a query (e.g. by cancelling the context passed to one of the query methods) during a call to the Scan method of the returned Rows can result in unexpected results if other queries are being made in parallel. This can result in a race condition that may overwrite the expected results with those of another query, causing the call to Scan to return either unexpected results from the other query or an error.

AI-Powered Analysis

AILast updated: 08/07/2025, 16:17:43 UTC

Technical Analysis

CVE-2025-47907 is a high-severity race condition vulnerability (CWE-362) found in the Go standard library's database/sql package, affecting versions up to 1.24.0. The flaw arises when a query is cancelled—typically by cancelling the context passed to query methods—while concurrently calling the Scan method on the returned Rows object. This improper synchronization leads to a race condition where the results of one query can be overwritten by those of another query executing in parallel. Consequently, the Scan method may return unexpected data from a different query or an error, compromising data integrity and potentially causing application logic errors. The vulnerability is exploitable remotely (AV:N) without authentication or user interaction but requires high attack complexity (AC:H), indicating that exploitation demands specific conditions or timing. The impact primarily affects confidentiality (high), with some integrity and availability impacts (low). No known exploits are currently reported in the wild, and no patches have been linked yet. This vulnerability is significant because the Go database/sql package is widely used in backend services and applications for database interactions, and improper handling of query cancellations can lead to data leakage or corruption in concurrent environments.

Potential Impact

For European organizations, this vulnerability poses a considerable risk, especially for those relying on Go-based backend systems handling concurrent database queries. The race condition can lead to leakage of sensitive data across queries, undermining confidentiality obligations under regulations like GDPR. Data integrity issues may cause erroneous business decisions or corrupt records, affecting operational reliability. Availability impacts, though low, could disrupt services if errors propagate. Sectors such as finance, healthcare, and government, which often use Go for scalable backend services, are particularly vulnerable. The complexity of exploitation reduces immediate risk, but the potential for silent data leakage or corruption necessitates urgent attention. Organizations with multi-tenant or high-concurrency database applications are at higher risk, as the flaw manifests under parallel query execution and cancellation scenarios.

Mitigation Recommendations

To mitigate this vulnerability, European organizations should: 1) Upgrade to a fixed version of the Go standard library once patches are released, as no official patch links are currently available. 2) Until patched, avoid cancelling queries during concurrent Scan operations or serialize query execution to prevent overlapping Scan calls. 3) Implement additional application-level synchronization to ensure that query cancellations and Scans do not overlap on shared Rows objects. 4) Conduct thorough code reviews and testing focusing on concurrent database access patterns to detect and remediate unsafe usage. 5) Monitor application logs for unexpected Scan errors or anomalous query results that may indicate exploitation attempts. 6) Employ runtime application self-protection (RASP) or database activity monitoring tools to detect unusual query cancellation patterns. 7) Educate developers on safe concurrency practices with database/sql to prevent misuse that could trigger this race condition.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Go
Date Reserved
2025-05-13T23:31:29.597Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 6894ce25ad5a09ad00fae4bd

Added to database: 8/7/2025, 4:02:45 PM

Last enriched: 8/7/2025, 4:17:43 PM

Last updated: 8/8/2025, 1:30:54 PM

Views: 12

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats