Summary
ArcadeDB does not consistently enforce the UPDATE_SCHEMA permission when a DEFINE FUNCTION statement targets an existing function library. A database user with limited access may therefore add or overwrite SQL or Cypher functions and persist changes, potentially altering administrator-defined logic.
Affected context
The issue affects ArcadeDB deployments where a user can access a database and issue DEFINE FUNCTION statements against an already-existing function library. The permission gap applies to SQL and Cypher functions in this context; JavaScript functions continue to trigger the UPDATE_SECURITY check. Risk depends on which users can access the database and how altered functions are invoked by applications or administrative workflows.
Exploit preconditions
- Attack surface: ArcadeDB database function-definition interface
- Required access: Valid database access sufficient to submit DEFINE FUNCTION statements
- Trigger point: Creating or overwriting a SQL or Cypher function in an existing library
- Why exploitation is possible: The UPDATE_SCHEMA authorization check is not enforced for this target condition, allowing a user without the intended schema-management permission to persist changes
Why this happens
The underlying flaw is an authorization decision that depends incorrectly on whether a function library already exists. The implementation fails to apply the required UPDATE_SCHEMA permission check when modifying an existing library, allowing a lower-privileged database user to perform a schema-related operation. This maps to CWE-862: Missing Authorization, where access control is absent or incomplete for a protected action.
Potential impact
- Administrator-defined SQL or Cypher logic may be altered or replaced
- Application workflows that invoke affected functions could produce unexpected results
- Data integrity or business-rule enforcement may be weakened
- A modified function could potentially influence operations performed with greater privileges
- Security monitoring and audit assumptions about trusted function definitions may be undermined
General mitigation guidance
Mitigation generally focuses on enforcing authorization consistently across all function-definition paths and reducing the trust placed in mutable database logic.
Common defensive patterns include:
- Require the appropriate schema-management permission for creating, replacing, or modifying functions
- Apply authorization checks based on the effective operation rather than only the existence of the target library
- Separate routine creation, routine replacement, and routine execution privileges where supported
- Limit database access to trusted identities and use least-privilege roles
- Treat administrator-defined functions as controlled artifacts with integrity protection and review
- Monitor and restrict changes to SQL and Cypher function libraries
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis of authorization guards around DEFINE FUNCTION and function-library mutation paths
- Code review checks confirming that create and overwrite operations enforce equivalent permission requirements
- Authorization tests using accounts with database access but without UPDATE_SCHEMA permission
- Integration tests covering existing and newly created libraries, including SQL, Cypher, and JavaScript function behavior
- Audit policies that alert on unexpected function creation, replacement, or persistence
- Automated security review tools that identify missing or inconsistent access-control checks

