GHSA-CR79-9P8R-P5WX
MCP Tool Identifier Validation Permits Statement Injection via Escaped Backticks
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CR79-9P8R-P5WX divulgada | |
| Remediación | Parche 4.0.0 | surrealdb · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
A SQL statement injection vulnerability exists in SurrealDB's Model Context Protocol (MCP) server integration (`surrealdb/surrealdb`). In `surrealdb/mcp/src/tools/mod.rs`, discrepancy between identifier validation and SQL lexing permits delimiter escape.
### Vulnerability Details
- Affected Files: `surrealdb/mcp/src/tools/mod.rs` (`consume_backtick_ident`, `validate_identifier`), `surrealdb/mcp/src/tools/crud.rs`
- Mechanism: The MCP identifier validator treats the first backtick as the closing identifier delimiter regardless of preceding escape characters (`\`). However, SurrealQL's SQL parser recognizes `\`` as an escaped literal backtick within an identifier. Passing an identifier containing an escaped backtick allows an attacker to break out of the quoted identifier into raw SurrealQL statement execution.
- Impact: Arbitrary SQL query execution through MCP tool invocation, bypassing tool argument constraints.
### Recommended Remediation
Synchronize MCP identifier parsing with the core SurrealQL lexer to handle escape characters correctly, or construct queries using parameterized AST nodes instead of string interpolation.
---
Reported by: ARSB
Patches
A patch has been created that validates MCP tool identifiers so an escaped backtick can no longer break out of the identifier and inject a statement.
- Version 4.0.0 and later are not affected by this issue.
References
- `fix(mcp): MCP tool identifier validation permits statement injection via escaped backticks` (commit `ec41ae8f15`)
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
crates.iosurrealdb |
Corregida | 4.0.0 | 0 d | 4.0.1 no afectada |
4.0.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/surrealdb/surrealdb/security/advisories/GHSA-cr79-9p8r-p5wxLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
