The `kv-mem`, `kv-surrealkv` and `kv-rocksdb` backends move non-`'static` borrowed state into affinity-pool closures through `affinitypool::spawn_local`: a `tokio::sync::MutexGuard<Option<TransactionInner>>`, `&Transaction`, `&mut ScanStateKeys/Vals`, `&mut dyn KeyVisitor/ValV...
Vulnerable Range:
0.0.0-0 -> 3.3.0
An authenticated user scoped to one namespace/database could invoke a custom API (`DEFINE API`) belonging to a different namespace/database, reaching another tenant's endpoint.
The route `/api/{namespace}/{database}/{endpoint}` took the namespace and database from the URL and...
Vulnerable Range:
0 -> 3.2.0
SurrealDB offers http functions that can access external network endpoints. A typical, albeit [not recommended ](https://surrealdb.com/docs/surrealdb/reference-guide/security-best-practices#example-deny-all-capabilities-with-some-exceptions)configuration would be to start Surr...
Vulnerable Range:
2.1.0 -> 2.1.8, 2.2.0 -> 2.2.6, 3.0.0-alpha.1 -> 3.0.0-alpha.7
A `SELECT` permission defined on an array element (`DEFINE FIELD field.* … PERMISSIONS FOR select …`) is not enforced correctly for `RECORD` users. Instead of hiding the denied elements, the query leaks a subset of them: a deny-all returns the odd-indexed elements, and a per-e...
Vulnerable Range:
0 -> 3.1.4
In SurrealDB, records can be connected as a graph: a `RELATE` statement creates an edge record between two node records. If either endpoint node is deleted, SurrealDB automatically removes the edge row to keep the graph consistent.
A user with permission to delete a node coul...
Vulnerable Range:
0 -> 3.1.0
When a user configures `ALGORITHM ES512` for any JWT access method (`DEFINE ACCESS ... TYPE JWT ALGORITHM ES512`), SurrealDB silently substitutes ES384 at all four internal algorithm conversion points. This occurs because the underlying `jsonwebtoken` crate (v10.x) does not in...
Vulnerable Range:
0 -> 3.1.0
A record user could learn the value of a hidden field by counting how many records match a guess.
When `DEFINE FIELD ... PERMISSIONS FOR select WHERE ...` hides a field's contents from a caller, and that field is indexed, running `SELECT count() FROM t WHERE hidden_field = "g...
Vulnerable Range:
0 -> 3.1.0
An anonymous caller could create new namespaces and databases on a running SurrealDB instance without holding `DEFINE NAMESPACE` or `DEFINE DATABASE` permission.
`USE NS <name>` and `USE DB <name>` automatically create the target when it does not exist. The three places `USE`...
Vulnerable Range:
0 -> 3.1.0
SurrealDB offers `http::*` functions that can access external network endpoints, with the `--allow-net` and `--deny-net` capabilities used to restrict the set of network targets that can be reached. An authenticated user of SurrealDB can bypass a port-scoped `--deny-net <host>...
Vulnerable Range:
0 -> 3.1.0
A record user could read records the table's SELECT permission expression should have hidden, when that expression referenced `$value`, `$before`, `$after`, or `$event`. Binding a chosen value to that name before registering a `LIVE SELECT` caused notifications to evaluate the...
Vulnerable Range:
0 -> 3.1.0
`RELATE` creates an edge record between two existing records, and SurrealDB enforces the `CREATE` permission on the edge table for this operation. When the statement included a `SET id = edge:existing` clause, however, the new edge's id ended up pointing at an record that was ...
Vulnerable Range:
0 -> 3.1.0
SurrealDB lets callers modify records using JSON Patch operations via the `UPDATE … PATCH` statement (and SDK equivalents such as `db.patch()`). One of those operations is `copy`, which duplicates one field's value into another field of the same record. A `PATCH` with an empty...
Vulnerable Range:
0 -> 3.1.0
A record user with UPDATE access could read field values that field-level SELECT permissions hid from them. Arithmetic operators and `extend` embedded the raw operand into their error messages, and UPDATE permission checks evaluate against the unreduced document - so triggerin...
Vulnerable Range:
0 -> 3.1.0
A `LIVE SELECT` subscription records the user's auth state (`$auth`, `$token`, `$session`, `$access`) when it is registered, and the server uses that recorded state to evaluate the table- and row-level `PERMISSIONS` clauses for every subsequent notification. The recorded state...
Vulnerable Range:
0 -> 3.1.0
An anonymous caller could degrade `/sql` availability by streaming WebSocket frames many times larger than the operator-configured per-connection limit. The `/sql` upgrade handler accepted anonymous connections and did not propagate `SURREAL_WEBSOCKET_MAX_MESSAGE_SIZE` to the ...
Vulnerable Range:
0 -> 3.1.0
The `KILL` statement is used to terminate `LIVE SELECT` subscriptions that capture real-time changes to data within a table. The `KILL` statement implementation in `core/src/expr/statements/kill.rs` verifies that the requesting user has database-level access, but does not veri...
Vulnerable Range:
0 -> 3.1.0
A `LIVE` query whose `WHERE` clause evaluates to an error caused the source data modifier (the user creating, updating, or deleting a record on the watched table) to fail instead. Calling any arbitrary SurrealQL function with a typed parameter and passing a value of the wrong ...
Vulnerable Range:
0 -> 3.1.0
An authenticated user could bypass permission rules that gated access on parts of a record's id - most commonly tenant-isolation rules of the form `PERMISSIONS FOR select WHERE id.tenant = $auth.id.tenant`. The same defect also let UNIQUE constraints defined on parts of an id ...
Vulnerable Range:
0 -> 3.1.0
An authenticated record or scope user could read records on any table reachable through a graph edge or `REFERENCES TO` back-reference, regardless of that table's `PERMISSIONS FOR select` clause.
Traversing `SELECT * FROM source->edge->target` returned full documents from `ta...
Vulnerable Range:
0 -> 3.1.0
A vulnerability was discovered where the user-supplied `WHERE` clause in a `SELECT` statement is evaluated against the full record data before `PERMISSIONS FOR SELECT WHERE` determines whether the principal is authorised to access that record. A side-effecting expression in th...
Vulnerable Range:
0 -> 3.1.0
The SurrealDB type/kind parser did not enforce the configured recursion depth limit when parsing nested type annotations. The expression parser already enforced the limit for analogous constructs; the kind parser omitted it. An authenticated attacker could send a query with de...
Vulnerable Range:
0 -> 3.1.0
A single unauthenticated WebSocket message to `/rpc` crashed the SurrealDB server. Sending `use { db: "x" }` without first selecting a namespace hit `.expect("namespace should be set")` in the `use` handler; because `surrealdb-core` is built with `panic = 'abort'`, the panic t...
Vulnerable Range:
0 -> 3.1.0
The SurrealDB value and JSON parser did not enforce the configured recursion depth limit when parsing nested `{`, `[`, or `(` tokens. The expression parser already enforced the limit for these tokens; the value/JSON parser omitted it. An unauthenticated attacker could send a d...
Vulnerable Range:
0 -> 3.1.0
The HTTP `/rpc` endpoint has a time-of-check/time-of-use (TOCTOU) race condition on internal session state. When authenticated and unauthenticated requests are processed concurrently, the unauthenticated request can inherit the authenticated user's session and privileges. The ...
Vulnerable Range:
0 -> 3.1.0
The HTTP `/rpc` `sessions` method returned every attached session UUID without authentication, and the `/rpc` handler accepted an arbitrary `session` field with no ownership check. An anonymous caller could enumerate UUIDs and impersonate any authenticated session.
"Attached"...
Vulnerable Range:
0 -> 3.1.0
An authenticated user could crash a SurrealDB server with a single query containing a long chain of operators.
Such a query - for example `RETURN 1 + 1 + 1 + ...` with tens of thousands of terms - is parsed into an expression tree one level deep per operator. Because the chai...
Vulnerable Range:
3.0.0 -> 3.1.5
A record user could read field values hidden from them by field-level SELECT permissions by reaching the records through a graph-edge (`->`) or back-reference (`<~`) traversal instead of a direct `SELECT`.
When a table was readable at the table level but carried a field hidde...
Vulnerable Range:
3.1.0 -> 3.1.5
A field can be hidden from a user with a field-level SELECT permission (`DEFINE FIELD code ON secret PERMISSIONS FOR select WHERE owner = $auth.id`). When that field is indexed, a record user who cannot read it could still recover the relative ordering of its values across eve...
Vulnerable Range:
3.0.0 -> 3.1.5
SurrealDB's full-text search lets you define a text analyzer whose `mapper` filter loads a term-mapping file from disk (`DEFINE ANALYZER ... FILTERS mapper('<path>')`). A database user with the `EDITOR` or `OWNER` role could point that filter at any file the SurrealDB process ...
Vulnerable Range:
0 -> 3.1.5
SurrealDB fetches the JWKS document for a JWT or record access method using a bare `reqwest` client that follows HTTP redirects by default. The network capability check in `core/src/iam/jwks.rs` (`check_capabilities_url`) is applied only to the originally configured URL; redir...
Vulnerable Range:
0 -> 3.1.5
In SurrealDB instances with the scripting capability enabled (`--allow-scripting`), users with the ability to run arbitrary queries can trigger a server crash due to a memory-safety bug in the underlying JS engine. The SurrealDB instance terminates instantly, requiring a manu...
Vulnerable Range:
0 -> 2.6.1, 3.0.0-alpha.8 -> 3.0.0-beta.3
Unprivileged users (for example, those with the database editor role) can create or modify fields in records that contain functions or `futures`. `Futures` are values which are only computed when the value is queried. The query executes in the context of the querying user, rat...
Vulnerable Range:
0 -> 2.5.0, 3.0.0-alpha.1 -> 3.0.0-beta.3
`LIVE SELECT` statements are used to capture changes to data within a table in real time. Documents included in `WHERE` conditions and `DELETE` notifications were not properly reduced to respect the querying user's security context. Instead the leaked documents reflect the con...
Vulnerable Range:
2.3.0 -> 2.3.8, 2.2.0 -> 2.2.8, 0 -> 2.1.9
SurrealDB offers http functions that can access external network endpoints. A typical, albeit [not recommended ](https://surrealdb.com/docs/surrealdb/reference-guide/security-best-practices#example-deny-all-capabilities-with-some-exceptions) configuration would be to start Sur...
Vulnerable Range:
2.2.0 -> 2.2.2, 2.1.0 -> 2.1.5, 0 -> 2.0.5
SurrealDB allows authenticated users with `OWNER` or `EDITOR` permissions at the root, database or namespace levels to define their own database functions using the `DEFINE FUNCTION` statement
A custom database function comprises a name together with a function body. In the f...
Vulnerable Range:
2.2.0 -> 2.2.2, 2.1.0 -> 2.1.5, 0 -> 2.0.5
Through enabling the scripting capability. SurrealDB allows for advanced functions with complicated logic, by allowing embedded functions to be written in JavaScript.
These functions are bounded for memory and stack size, but not in time. An attacker could launch a number of ...
Vulnerable Range:
2.2.0 -> 2.2.2, 0 -> 2.0.5, 2.1.0 -> 2.1.5
An authenticated user can craft a query using the `string::replace` function that uses a Regex to perform a string replacement. As there is a failure to restrict the resulting string length, this enables an attacker to send a `string::replace` function to the SurrealDB server ...
Vulnerable Range:
2.2.0 -> 2.2.2, 2.1.0 -> 2.1.5, 0 -> 2.0.5
The SurrealDB command-line tool allows exporting databases through the `export` command. It was discovered that table or field names are not properly sanitized in exports, leading to a SurrealQL injection when the backup is reimported.
For the injection to occur, an authentic...
Vulnerable Range:
2.2.0 -> 2.2.2, 2.1.0 -> 2.1.5, 0 -> 2.0.5
An authenticated system user at the root, namespace, or database levels can use the `DEFINE ANALYZER` statement to point to arbitrary file locations on the file system, and should the file be tab separated with two columns, the analyzer can be leveraged to exfiltrate the conte...
Vulnerable Range:
2.2.0 -> 2.2.2, 0 -> 2.1.5
In order to prevent DoS situations due to infinite recursions, SurrealDB implements a limit of nested calls for both native functions and embedded JavaScript functions.
However, in SurrealDB instances with embedded scripting functions enabled, it was found that this limit can...
Vulnerable Range:
2.2.0 -> 2.2.2, 2.1.0 -> 2.1.5, 0 -> 2.0.5
A vulnerability was found where an attacker can crash the database via crafting a HTTP query that returns a null byte. The problem relies on an uncaught exception in the `net` module, where the result of the query will be converted to JSON before showing as the HTTP response t...
Vulnerable Range:
2.2.0 -> 2.2.2, 2.1.0 -> 2.1.5, 0 -> 2.0.5
The `OVERWRITE` clause of the `DEFINE TABLE` statement would fail to overwrite data for tables that were defined with `TYPE RELATION`. Since table definitions include the `PERMISSIONS` clause, this failure would result in permissions not being overwritten as a result, which ma...
Vulnerable Range:
2.0.0 -> 2.1.4, 2.0.0 -> 2.1.4
Sorting table records using an `ORDER BY` clause with the `rand()` function as sorting mechanism could cause a panic due to relying on a comparison function that did not implement total order. This event resulted in a panic due to a recent [change in Rust 1.81](https://blog.ru...
Vulnerable Range:
0 -> 2.1.0, 0 -> 2.1.0
Roles for system users are stored as generic `Ident` values and converted as strings and into the `Role` enum whenever IAM operations are to be performed that require processing the user roles. This conversion expects those identifiers to only contain the values `owner`, `edit...
Vulnerable Range:
0 -> 2.1.0, 0 -> 2.1.0
The `rand::time()` function in SurrealQL generates a random time from an optional range of two Unix timestamps. Due to the underlying use of `timestamp_opt` from the `chrono` crate, this function could potentially return `None` in some instances, leading to a panic when `unwra...
Vulnerable Range:
0 -> 2.1.0, 0 -> 2.1.0
Due to the order in which permissions were processed, some statements, filters and computations could lead to leaking field values or record contents to users without the required permissions. This behavior could be triggered in different scenarios:
- When performing a `SELEC...
Vulnerable Range:
0 -> 2.0.4, 0 -> 2.0.4
The error rendering code from the parser would panic when handling failed parsing of queries where the error occurred when converting an empty string to a SurrealDB value. This would be the case when casting an empty string to a `record`, `duration` or `datetime`, as well as p...
Vulnerable Range:
2.0.0 -> 2.0.4, 2.0.0 -> 2.0.4
During the sign in and sign up operations through the SurrealDB RPC API, an arbitrary object would be accepted in order to support a wide array of types and structures that could contain user credentials. This arbitrary object could potentially contain any SurrealDB value, inc...
Vulnerable Range:
0 -> 1.5.5, 0 -> 1.5.2, 2.0.0-beta.1 -> 2.0.0-beta.3
Authentication would not be properly validated when an already authenticated scope user would use the `use` method or `USE` clause to switch working databases in a session. If there was a user record in the new database with identical record identifier as the original record t...
Vulnerable Range:
0 -> 1.5.4, 2.0.0-alpha.1 -> 2.0.0-alpha.6, 0 -> 1.5.1
The `rquickjs` crate used by SurrealDB implements Rust bindings to the QuickJS C library and is used to execute SurrealDB scripting functions. The `rquickjs` function `Exception::throw_type` takes a string and returns an error object. Prior to version `0.4.2` of the crate, thi...
Vulnerable Range:
0 -> 1.1.1
The query executor would panic when executing a query containing a call to a built-in SurrealDB function that did not exist. This could occur accidentally in situations where the version of the SurrealDB client was newer than the SurrealDB server or when a pre-parsed query was...
Vulnerable Range:
0 -> 1.2.0
The span rendering would panic when handling failed parsing of queries where the error occurred on a line terminator character.
### Impact
A client that is authorized to run queries in a SurrealDB server is able to execute a malformed query which will fail to parse on a line...
Vulnerable Range:
0 -> 1.2.1
SurrealDB depends on the `tungstenite` and `tokio-tungstenite` crates used by the `axum` crate, which handles connections to the SurrealDB WebSocket interface. On versions before `0.20.1`, the `tungstenite` crate presented an issue which allowed the parsing of HTTP headers dur...
Vulnerable Range:
0 -> 1.1.0
In some specific instances, the SurrealQL parser will attempt to recursively parse nested statements or idioms (i.e. nested `IF` and `RELATE` statements, nested basic idioms and nested access to attributes) without checking if the depth limit established by default or in the `...
Vulnerable Range:
0 -> 1.1.0
The `ID`, `DB` and `NS` headers accepted by the SurrealDB HTTP REST API would fail to parse when containing some special characters. This would cause a panic which would crash the SurrealDB server, leading to denial of service.
This issue only affects the SurrealDB binary; it...
Vulnerable Range:
0 -> 1.1.0
Although custom parameters and functions are only supported at the database level, it was allowed to invoke those entities at the root or namespace level. This would cause a panic which would crash the SurrealDB server, leading to denial of service.
### Impact
A client that ...
Vulnerable Range:
0 -> 1.1.1
Default table permissions in SurrealDB were `FULL` instead of `NONE`. This would lead to tables having `FULL` permissions for `SELECT`, `CREATE`, `UPDATE` and `DELETE` unless some other permissions were specified via the `PERMISSIONS` clause.
We have decided to treat this beh...
Vulnerable Range:
0 -> 1.0.1