# greptimedb-mcp-server: a comment inside a string slips writes past read-only

> A comment marker inside a SQL string literal made greptimedb-mcp-server's read-only gate approve write statements.

- **Severity:** Medium: Real and reproducible, but needs unusual setup, user help or a narrow audience. Plan a fix.
- **Category:** Vulnerability
- **Published by:** GreptimeDB
- **Disclosed:** 2026-12-02
- **CVSS:** 6.8
- **Affects:** greptimedb-mcp-server, greptimedb-mcp-server (PyPI), GreptimeDB
- **Research by:** Dilanka Kaushal Hewage
- **Primary source:** https://github.com/GreptimeTeam/greptimedb-mcp-server/security/advisories/GHSA-v2wh-92mj-qxq7
- **Page:** https://theinjection.dev/items/greptimedb-mcp-readonly-gate-bypass/

greptimedb-mcp-server 0.6.1 and earlier let stacked INSERT, DELETE and DROP statements pass the read-only gate by hiding a comment marker inside a SQL string. A prompt injection reaching the AI client was enough. Fixed in 0.6.2.

## What happened

Dilanka Kaushal Hewage, who reports as r3vpwnx, found that the read-only protection in greptimedb-mcp-server could be bypassed. GreptimeDB published the advisory and version 0.6.2 on 2026-12-02, and its proof of concept ran against GreptimeDB v1.3.1. GitHub rates the issue moderate with a CVSS 3.1 base score of 6.8, and the advisory records no CVE.

## How it works

The read-only gate strips comment markers from a query before scanning for forbidden keywords, without tracking string literals. A marker placed inside a string makes the gate discard the rest of the query, so it approves input that GreptimeDB then runs in full, including stacked write statements. The tools that expose this are execute_sql, execute_tql, query_range and explain_query. Version 0.6.2 tokenizes SQL with MySQL dialect rules and checks each statement against an allowlist of read statements.

## Who is affected

Versions 0.6.1 and earlier of greptimedb-mcp-server are affected, on GitHub and on PyPI. Exposure depends on the database account behind the server: an operator who pointed it at a read-write GreptimeDB user can have data inserted, deleted or dropped, while a genuinely read-only account limits the damage to what the gate was meant to prevent.

## What to do

Upgrade greptimedb-mcp-server to 0.6.2, and give the server a database user with read-only privileges, because the advisory stresses that the gate is not a security boundary on its own.

## Quick facts

- **Affected:** 0.6.1 and earlier
- **Fixed in:** 0.6.2, released 2026-12-02
- **CVSS:** 6.8 moderate, CVSS 3.1
- **CVE:** None assigned
- **Found by:** Dilanka Kaushal Hewage (r3vpwnx)
- **Attack type:** Read-only gate bypass through prompt injection

## Sources

1. [GitHub Advisory](https://github.com/GreptimeTeam/greptimedb-mcp-server/security/advisories/GHSA-v2wh-92mj-qxq7)
2. [Version 0.6.2 Notes](https://github.com/GreptimeTeam/greptimedb-mcp-server/releases/tag/v0.6.2)
