The vulnerability is a SQL injection flaw within Marten's full-text search functionality. The root cause lies in the Marten.Linq.SqlGeneration.Filters.FullTextWhereFragment class, specifically its constructor and the Sql property. The regConfig parameter, which specifies the text-search configuration, was taken from user input and directly concatenated into the generated SQL query without any validation or parameterization. This allows an attacker to break out of the string literal and execute arbitrary SQL commands, leading to potential data exfiltration, modification, or denial of service.
The patch, identified in commit 626249656829860b9c55895b5b6046b61a2a695f, addresses this by adding a strict validation mechanism. A new private method, ValidateRegConfig, was introduced, which uses a regular expression to ensure that the regConfig value is a simple, valid PostgreSQL identifier. This validation is now the first step in the FullTextWhereFragment constructor, effectively closing the injection vector. Any of the public-facing full-text search APIs (like SearchAsync, PlainTextSearchAsync, etc.) that accept a regConfig parameter were entry points to this vulnerability, as they all lead to the instantiation of the vulnerable FullTextWhereFragment class.