{"id":"GHSA-vmw2-qwm8-x84c","summary":"Marten has an injection vulnerability in its full-text search regConfig parameter","details":"## Summary\n\nMarten's full-text search APIs interpolated the user-supplied `regConfig` parameter directly into the generated SQL without parameterization or validation, making every code path that exposes `regConfig` to untrusted input a SQL injection sink.\n\n## Affected APIs\n\n- `IQuerySession.SearchAsync\u003cT\u003e(string searchTerm, string regConfig, ...)`\n- `IQuerySession.PlainTextSearchAsync\u003cT\u003e(...)`\n- `IQuerySession.PhraseSearchAsync\u003cT\u003e(...)`\n- `IQuerySession.WebStyleSearchAsync\u003cT\u003e(...)`\n- `IQuerySession.PrefixSearchAsync\u003cT\u003e(...)`\n- `IQueryable\u003cT\u003e.Where(x =\u003e x.Search(term, regConfig))` and the matching `PlainTextSearch` / `PhraseSearch` / `WebStyleSearch` / `PrefixSearch` extension methods\n\n## Details\n\nIn the affected versions, [`FullTextWhereFragment`](https://github.com/JasperFx/marten/blob/master/src/Marten/Linq/SqlGeneration/Filters/FullTextWhereFragment.cs) renders the WHERE-clause SQL by string interpolation:\n\n```csharp\nprivate string Sql =\u003e\n    $\"to_tsvector('{_regConfig}'::regconfig, {_dataConfig}) @@ {_searchFunction}('{_regConfig}'::regconfig, ?)\";\n```\n\n`_regConfig` arrives unchanged from the public API surface above. Any value containing a single quote terminates the SQL literal and lets an attacker append arbitrary PostgreSQL.\n\n### Confirmed exploit shapes (with `regConfig` set to attacker-controlled input)\n\n| Goal | Payload |\n| --- | --- |\n| Time-based blind | `english'::text); SELECT pg_sleep(5); --` |\n| Information disclosure | `english'; SELECT version(); --` |\n| DDL execution | `english'; DROP TABLE mt_doc_article; --` |\n\nAll five overloads listed above produced SQL containing the verbatim payload.\n\n## Impact\n\n- **Confidentiality**: an attacker can append arbitrary `SELECT` statements and exfiltrate database contents through error channels, response timing, or — if the application surfaces query results — directly.\n- **Integrity / Availability**: DDL, `UPDATE`, `DELETE`, and `pg_sleep`-style denial-of-service payloads succeed under the same vector. Concrete impact depends on the database role used by the Marten connection string.\n- **Precondition**: the calling application must forward attacker-controlled input into the `regConfig` parameter (e.g. a `?lang=` query string mapped to `regConfig`). Applications that hard-code `regConfig` to a compile-time constant are not exploitable.\n\n## Patches\n\nFixed in **Marten 8.36.1** (and forward) by [#4343](https://github.com/JasperFx/marten/pull/4343).\n\n`FullTextWhereFragment` now validates `regConfig` against `^[a-zA-Z_][a-zA-Z0-9_]*(\\.[a-zA-Z_][a-zA-Z0-9_]*)?$` (a simple PostgreSQL identifier, optionally schema-qualified, capped at `NAMEDATALEN-1` per side) and throws `ArgumentException` for anything else. The default value (`\"english\"`), schema-qualified configs (`\"pg_catalog.english\"`), and the standard PostgreSQL text-search configurations all continue to work.\n\n## Workarounds\n\nIf users cannot upgrade immediately, do **one** of the following at the application boundary:\n\n1. Hard-code `regConfig` to a compile-time constant (`\"english\"`, `\"simple\"`, …) and never accept it from request input.\n2. Validate any externally-sourced `regConfig` value before passing it to Marten — e.g. against the same regex as the patch (`^[a-zA-Z_][a-zA-Z0-9_]*(\\.[a-zA-Z_][a-zA-Z0-9_]*)?$`) or against an allowlist of PostgreSQL configurations the application actually uses.\n3. Drop the `regConfig` argument from the call site so Marten falls back to the safe default.\n\n## Resources\n\n- Patch PR: [JasperFx/marten#4343](https://github.com/JasperFx/marten/pull/4343)\n- Patched file: [`FullTextWhereFragment.cs`](https://github.com/JasperFx/marten/blob/master/src/Marten/Linq/SqlGeneration/Filters/FullTextWhereFragment.cs)\n- Regression tests: [`full_text_regconfig_sql_injection.cs`](https://github.com/JasperFx/marten/blob/master/src/LinqTests/Bugs/full_text_regconfig_sql_injection.cs)\n- CWE-89: \u003chttps://cwe.mitre.org/data/definitions/89.html\u003e\n\n## Credit\n\nReported privately to the JasperFx team with a working proof of concept covering all five affected overloads.","aliases":["CVE-2026-45288"],"modified":"2026-06-09T10:30:13.591566723Z","published":"2026-05-14T20:46:26Z","database_specific":{"cwe_ids":["CWE-74","CWE-89"],"severity":"CRITICAL","github_reviewed":true,"github_reviewed_at":"2026-05-14T20:46:26Z","nvd_published_at":"2026-05-28T21:16:31Z"},"references":[{"type":"WEB","url":"https://github.com/JasperFx/marten/security/advisories/GHSA-vmw2-qwm8-x84c"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45288"},{"type":"WEB","url":"https://github.com/JasperFx/marten/pull/4343"},{"type":"WEB","url":"https://github.com/JasperFx/marten/commit/626249656829860b9c55895b5b6046b61a2a695f"},{"type":"PACKAGE","url":"https://github.com/JasperFx/marten"}],"affected":[{"package":{"name":"Marten","ecosystem":"NuGet","purl":"pkg:nuget/Marten"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"8.37.0"}]}],"versions":["0.5.0.8","0.5.0.9","0.5.1.34","0.5.2.36","0.5.3.38","0.6.0.43","0.6.1.46","0.6.2.57","0.6.3.67","0.6.4.77","0.6.5.78","0.6.6.82","0.7.0.85","0.7.0.97","0.7.1.103","0.8.0.132","0.8.10.355","0.8.2.188","0.8.3.238","0.8.4.255","0.8.5.274","0.8.6.284","0.8.7.297","0.8.8.299","0.8.9.322","0.9.0.379","0.9.1.401","0.9.10.555","0.9.11.556","0.9.12.563","0.9.2.423","0.9.2.427","0.9.3.458","0.9.4.464","0.9.5.473","0.9.6.493","0.9.6.498","0.9.7.515","0.9.7.517","0.9.8.523","0.9.9.534","0.9.9.551","1.0.0","1.0.0-alpha-625","1.0.0-alpha-639","1.0.0-alpha-644","1.0.0-alpha-663","1.0.0-alpha-664","1.0.0-alpha-666","1.0.0-alpha-667","1.0.0-alpha-668","1.0.0-alpha-669","1.0.0-alpha-701","1.0.0-alpha-703","1.0.0-alpha-706","1.0.0-alpha-709","1.0.0-alpha-710","1.0.0-alpha-719","1.0.1","1.0.2","1.0.3","1.1.0","1.1.1","1.1.2","1.1.3","1.2.0","1.2.1","1.2.2","1.2.3","1.2.4","1.2.5","1.3.0","1.4.0","1.4.1","1.5.0","1.5.1","1.5.2","1.5.3","2.0.0","2.0.0-alpha-50651","2.0.0-alpha-51133","2.0.0-alpha-51614","2.0.0-rc-50930","2.0.0-rc-51247","2.1.0","2.10.0","2.10.1","2.10.2","2.10.3","2.2.0","2.3.0","2.3.1","2.3.2","2.4.0","2.5.0","2.6.0","2.7.0","2.7.1","2.8.0","2.8.1","2.8.2","2.9.0","3.0.0","3.0.0-alpha-1","3.0.0-alpha-2","3.0.1","3.1.0","3.10.0","3.11.0","3.12.0","3.12.1","3.12.2","3.12.3","3.12.4","3.13.0","3.13.1","3.13.2","3.13.3","3.13.4","3.13.5","3.14.0","3.14.1","3.14.2","3.14.3","3.14.4","3.2.0","3.3.0","3.4.0","3.5.0","3.6.0","3.6.1","3.6.2","3.7.0","3.7.1","3.8.0","3.8.1","3.9.0","4.0.0","4.0.0-alpha","4.0.1","4.0.2","4.0.3","4.0.4","4.1.0","4.2.0","4.3.0","4.3.1","5.0.0","5.1.0","5.10.0","5.10.1","5.11.0","5.2.0","5.3.0","5.3.1","5.4.0","5.5.0","5.5.1","5.5.2","5.6.0","5.7.0","5.8.0","5.9.0","6.0.3","6.0.4","6.0.5","6.1.0","6.2.0","6.3.0","6.4.0","6.4.1","6.4.2","7.0.0","7.1.0","7.1.1","7.10.0","7.10.1","7.11.0","7.12.0","7.13.0","7.13.1","7.14.0","7.15.0","7.16.0","7.17.0","7.17.1","7.18.0","7.19.0","7.19.1","7.2.0","7.20.0","7.20.1","7.20.2","7.21.0","7.21.1","7.22.0","7.23.0","7.23.1","7.24.0","7.25.0","7.25.1","7.25.2","7.26.0","7.26.1","7.26.2","7.26.3","7.26.4","7.26.5","7.26.6","7.27.0","7.28.0","7.28.1","7.28.2","7.29.0","7.3.0","7.3.1","7.30.0","7.30.1","7.30.2","7.30.3","7.31.0","7.31.1","7.31.2","7.31.3","7.32.0","7.33.0","7.33.1","7.33.2","7.33.3","7.34.0","7.34.1","7.35.0","7.35.1","7.35.2","7.35.3","7.36.0","7.37.0","7.37.1","7.37.2","7.37.3","7.38.0","7.38.1","7.39.0","7.39.1","7.39.2","7.39.3","7.39.5","7.39.6","7.4.0","7.40.0","7.40.1","7.40.2","7.40.3","7.40.4","7.40.5","7.5.0","7.6.0","7.7.0","7.8.0","7.9.0","8.0.0","8.0.0-alpha-2","8.0.0-alpha-3","8.0.0-alpha-5","8.0.0-alpha-6-","8.0.0-beta-1","8.0.0-beta-2","8.0.0-rc-1","8.0.0-rc-2","8.0.1","8.1.0","8.1.2","8.10.0","8.10.1","8.11.0","8.12.0","8.13.0","8.13.1","8.13.2","8.13.3","8.14.0","8.15.0","8.15.1","8.15.2","8.15.3","8.15.4","8.16.0","8.16.1","8.16.2","8.16.3","8.16.4","8.17.0","8.18.0","8.18.1","8.18.2","8.18.3","8.19.0","8.2.0","8.2.1","8.20.0","8.21.0","8.22.0","8.22.1","8.22.2","8.23.0","8.24.0","8.25.0","8.26.0","8.26.1","8.26.2","8.27.0","8.28.0","8.29.0","8.29.1","8.29.2","8.29.3","8.3.0","8.3.1","8.3.2","8.3.3","8.30.0","8.30.1","8.31.0","8.32.0","8.32.1","8.33.0","8.34.0","8.34.1","8.34.2","8.35.0","8.36.0","8.4.0","8.5.0","8.6.0","8.7.0","8.8.0","8.8.1","8.8.2","8.9.0","8.9.0-channels-alpha-1","8.9.0-channels-alpha-2"],"database_specific":{"last_known_affected_version_range":"\u003c= 8.36","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-vmw2-qwm8-x84c/GHSA-vmw2-qwm8-x84c.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"}]}