/

CVE-2026-134372

Severity:

HIGH RISK

(7.7)

SQL Injection (CWE-89) in Frappe ERPNext Selling/Buying

CVE-2026-134372

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Sensitive data disclosure and potential account takeover

Severity:

HIGH RISK

(7.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Frappe ERPNext has an SQL injection vulnerability in an endpoint used by the Selling and Buying modules: caller-supplied data can override a value that was validated earlier and reach a database query without adequate validation. An authenticated user, including a portal user with no roles, could exploit this behavior to access sensitive data such as active session information and potentially take over other accounts.

Affected context

The issue is described in Frappe ERPNext 4.3.0 before 15.121.6 and 16.x before 16.37.0. It occurs in an endpoint associated with the Selling and Buying modules when caller-supplied request data can replace an earlier validated value and is used in a database query without adequate safeguards. The vulnerability is risky when an authenticated user can reach that endpoint.

Exploit preconditions

  • Attack surface: An endpoint in the Selling or Buying modules
  • Required access: Authentication; the description notes that portal users with no roles may be able to access it
  • Trigger point: A request handled by the affected endpoint
  • Why exploitation is possible: Caller-supplied data can override a value validated earlier and reach a database query without adequate validation or safe query handling

Why this happens

This is an SQL injection flaw, mapped to CWE-89: Improper Neutralization of Special Elements used in an SQL Command. The underlying pattern is that request data reaches a database query after a prior validation step can be bypassed or overridden. When query inputs are not safely bound or otherwise constrained, data may be interpreted as part of the SQL command rather than only as a value.

Potential impact

  • An attacker may retrieve sensitive database records, including active session data.
  • An attacker could use exposed information to take over other user accounts, potentially including administrator accounts.
  • Data confidentiality and the integrity of affected accounts may be compromised.

General mitigation guidance

Defensive approaches focus on keeping request data separate from SQL command structure and ensuring that validation applies to the final value used by the query.

  • Use parameterized queries or equivalent safe database APIs.
  • Avoid allowing caller-controlled fields to shape SQL statements.
  • Apply strict allowlists and type checks after request data has been normalized and resolved.
  • Limit database and application permissions to the minimum needed.
  • Reduce the privileges and reach of portal accounts, and restrict access to sensitive endpoints where appropriate.

How teams detect issues like this

  • Use static analysis rules to flag query construction that combines SQL with request-derived values.
  • Review endpoint code for fields that are validated and later overwritten, transformed, or sourced again before database use.
  • Check that database access consistently uses parameter binding and that validation occurs at the final query boundary.
  • Apply policy checks in code review or CI to prevent unsafe query-building patterns.
  • Monitor for unusual query errors, data-access patterns, or session activity that may indicate attempted or successful abuse.

Sources

SourceLink
github.comgithub.com/frappe/erpnext/security/advisories/GHSA-cc74-rc2g-p7hw
vulncheck.comvulncheck.com/advisories/frappe-erpnext-4.3.0-before-15.121.6-sql-injection-in-selling-and-buying-modules

Frequently asked

questions

An authenticated user who can reach the affected endpoint may be able to exploit it. The description includes portal users with no roles among the potentially affected users.

No. The described access requirement is authentication, and the issue may be reachable by users without roles. Actual exposure depends on endpoint access controls and deployment configuration.

Keep untrusted values out of SQL command structure by using parameterized queries or equivalent safe database APIs, and validate the final values used by the query.

Use consistent safe-query patterns, review how request values flow into database calls, enforce least privilege, and add automated checks for unsafe query construction.

Find out what's already
exploitable in your codebase.