Datadog Vector 0.54.0 can build a ClickHouse INSERT query from a database template rendered with event data. When that template uses an attacker-controlled event field, the rendered database identifier can break out of the quoted identifier context and redirect writes to another ClickHouse table reachable by Vector's credential.
The ClickHouse sink accepts both table and database as Template values in src/sinks/clickhouse/config.rs. At runtime, KeyPartitioner::partition in src/sinks/clickhouse/sink.rs renders those templates per event before the batch is sent.
The rendered values are passed into set_uri_query in src/sinks/clickhouse/service.rs. That function builds the HTTP query parameter with the SQL shape INSERT INTO "<database>"."<table>" FORMAT <format>.
The escaping is asymmetric. The table value is passed through table.replace('"', "\""), but the database value is inserted into the SQL string without the same quote escaping. URL encoding the HTTP