{"id":"CVE-2026-40887","aliases":["EUVD-2026-24274","GHSA-9pp3-53p2-ww9v"],"status":"published","title":"@vendure/core has a SQL Injection vulnerability","description":"Vendure is an open-source headless commerce platform. Starting in version 1.7.4 and prior to versions 2.3.4, 3.5.7, and 3.6.2, an unauthenticated SQL injection vulnerability exists in the Vendure Shop API. A user-controlled query string parameter is interpolated directly into a raw SQL expression without parameterization or validation, allowing an attacker to execute arbitrary SQL against the database. This affects all supported database backends (PostgreSQL, MySQL/MariaDB, SQLite). The Admin API is also affected, though exploitation there requires authentication. Versions 2.3.4, 3.5.7, and 3.6.2 contain a patch. For those who are unable to upgrade immediately, Vendure has made a hotfix available that uses `RequestContextService.getLanguageCode` to validate the `languageCode` input at the boundary. This blocks injection payloads before they can reach any query. The hotfix replaces the existing `getLanguageCode` method in `packages/core/src/service/helpers/request-context/request-context.service.ts`. Invalid values are silently dropped and the channel's default language is used instead. The patched versions additionally convert the vulnerable SQL interpolation to a parameterized query as defense in depth.","severity":{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-04","score":0.01762,"percentile":0.78092,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-89"],"published":"2026-04-14T22:38:01Z","modified":"2026-10-28T02:31:09.135905516Z","exploits":[{"source":"nuclei","id":"CVE-2026-40887","title":"Vendure Core - SQL Injection","type":"detection template","url":"https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2026/CVE-2026-40887.yaml"}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"@vendure/core","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.0.0"},{"fixed":"3.5.7"}]}]},{"source":"ghsa","ecosystem":"npm","package":"@vendure/core","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.6.0"},{"fixed":"3.6.2"}]}]},{"source":"ghsa","ecosystem":"npm","package":"@vendure/core","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"1.7.4"},{"fixed":"2.3.4"}]}]},{"source":"osv","ecosystem":"npm","package":"@vendure/core","ranges":[{"type":"SEMVER","events":[{"introduced":"3.0.0"},{"fixed":"3.5.7"}]}]},{"source":"osv","ecosystem":"npm","package":"@vendure/core","ranges":[{"type":"SEMVER","events":[{"introduced":"3.6.0"},{"fixed":"3.6.2"}]}]},{"source":"osv","ecosystem":"npm","package":"@vendure/core","ranges":[{"type":"SEMVER","events":[{"introduced":"1.7.4"},{"fixed":"2.3.4"}]}]}],"products":[{"vendor":"vendurehq","product":"vendure"}],"references":[{"url":"https://github.com/vendurehq/vendure/security/advisories/GHSA-9pp3-53p2-ww9v","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40887","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-9pp3-53p2-ww9v"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40887.json","tags":["advisory"]},{"url":"https://github.com/vendurehq/vendure","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-40887","title":"@vendure/core has a SQL Injection vulnerability","description":"Vendure is an open-source headless commerce platform. Starting in version 1.7.4 and prior to versions 2.3.4, 3.5.7, and 3.6.2, an unauthenticated SQL injection vulnerability exists in the Vendure Shop API. A user-controlled query string parameter is interpolated directly into a raw SQL expression without parameterization or validation, allowing an attacker to execute arbitrary SQL against the database. This affects all supported database backends (PostgreSQL, MySQL/MariaDB, SQLite). The Admin API is also affected, though exploitation there requires authentication. Versions 2.3.4, 3.5.7, and 3.6.2 contain a patch. For those who are unable to upgrade immediately, Vendure has made a hotfix available that uses `RequestContextService.getLanguageCode` to validate the `languageCode` input at the boundary. This blocks injection payloads before they can reach any query. The hotfix replaces the existing `getLanguageCode` method in `packages/core/src/service/helpers/request-context/request-context.service.ts`. Invalid values are silently dropped and the channel's default language is used instead. The patched versions additionally convert the vulnerable SQL interpolation to a parameterized query as defense in depth.","status":"published","published":"2026-04-21T19:24:59.525Z","modified":"2026-04-22T13:41:11.124Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"cna"}],"cwes":["CWE-89"],"references":[{"url":"https://github.com/vendurehq/vendure/security/advisories/GHSA-9pp3-53p2-ww9v","tags":["x_refsource_CONFIRM"]}],"products":[{"vendor":"vendurehq","product":"vendure"}],"updated_at":"2026-11-02T13:43:11.445168Z"}],"euvd":[{"id":"EUVD-2026-24274","description":"Vendure is an open-source headless commerce platform. Starting in version 1.7.4 and prior to versions 2.3.4, 3.5.7, and 3.6.2, an unauthenticated SQL injection vulnerability exists in the Vendure Shop API. A user-controlled query string parameter is interpolated directly into a raw SQL expression without parameterization or validation, allowing an attacker to execute arbitrary SQL against the database. This affects all supported database backends (PostgreSQL, MySQL/MariaDB, SQLite). The Admin API is also affected, though exploitation there requires authentication. Versions 2.3.4, 3.5.7, and 3.6.2 contain a patch. For those who are unable to upgrade immediately, Vendure has made a hotfix available that uses `RequestContextService.getLanguageCode` to validate the `languageCode` input at the boundary. This blocks injection payloads before they can reach any query. The hotfix replaces the existing `getLanguageCode` method in `packages/core/src/service/helpers/request-context/request-context.service.ts`. Invalid values are silently dropped and the channel's default language is used instead. The patched versions additionally convert the vulnerable SQL interpolation to a parameterized query as defense in depth.","status":"published","published":"2026-04-21T19:24:59Z","modified":"2026-04-22T13:41:11Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"references":[{"url":"https://github.com/vendurehq/vendure/security/advisories/GHSA-9pp3-53p2-ww9v"}],"products":[{"vendor":"vendurehq","product":"vendure"},{"vendor":"vendurehq","product":"vendure"},{"vendor":"vendurehq","product":"vendure"}],"updated_at":"2026-11-02T19:24:20.71791Z"}],"ghsa":[{"id":"GHSA-9pp3-53p2-ww9v","title":"@vendure/core has a SQL Injection vulnerability","description":"## Summary\n\nAn unauthenticated SQL injection vulnerability exists in the Vendure Shop API. A user-controlled query string parameter is interpolated directly into a raw SQL expression without parameterization or validation, allowing an attacker to execute arbitrary SQL against the database. This affects all supported database backends (PostgreSQL, MySQL/MariaDB, SQLite).\n\nThe Admin API is also affected, though exploitation there requires authentication.\n\n## Affected versions\n\n- `@vendure/core` \u003c 2.3.4\n- `@vendure/core` \u003e= 3.0.0, \u003c 3.5.7\n- `@vendure/core` \u003e= 3.6.0, \u003c 3.6.2\n\nNote: versions 2.3.4 and above in the 2.x line are patched. There were no 2.4.x or 2.x releases between 2.3.x and 3.0.0.\n\n## Patched versions\n\n- `@vendure/core` 2.3.4\n- `@vendure/core` 3.5.7\n- `@vendure/core` 3.6.2\n\n## Details\n\nIn `ProductService.findOneBySlug`, the request context's `languageCode` value is interpolated into a SQL `CASE` expression via a JavaScript template literal:\n\n```ts\n.addSelect(\n    `CASE translation.languageCode WHEN '${ctx.languageCode}' THEN 2 WHEN '${ctx.channel.defaultLanguageCode}' THEN 1 ELSE 0 END`,\n    'sort_order',\n)\n```\n\nTypeORM has no opportunity to parameterize this value because it is embedded directly into the SQL string before being passed to the query builder.\n\nThe `languageCode` value can originate from the HTTP query string and is set on the request context for every incoming API request. The value is cast to the `LanguageCode` TypeScript type at compile time, but no runtime validation is performed -- the raw query string value is used as-is.\n\n## Attack vector\n\nAn unauthenticated attacker can append a crafted `languageCode` query parameter to any Shop API request to inject arbitrary SQL into the query. No user interaction is required. The vulnerable endpoint is exposed on every default Vendure installation.\n\n## Mitigation\n\n**Upgrade to a patched version immediately.**\n\nIf you cannot upgrade right away, apply the following hotfix to `RequestContextService.getLanguageCode` to validate the `languageCode` input at the boundary. This blocks injection payloads before they can reach any query:\n\n```ts\nprivate getLanguageCode(req: Request, channel: Channel): LanguageCode | undefined {\n    const queryLanguageCode = req.query?.languageCode as string | undefined;\n    const isValidFormat = queryLanguageCode \u0026\u0026 /^[a-zA-Z0-9_-]+$/.test(queryLanguageCode);\n    return (\n        (isValidFormat ? (queryLanguageCode as LanguageCode) : undefined) ??\n        channel.defaultLanguageCode ??\n        this.configService.defaultLanguageCode\n    );\n}\n```\n\nThis replaces the existing `getLanguageCode` method in `packages/core/src/service/helpers/request-context/request-context.service.ts`. Invalid values are silently dropped and the channel's default language is used instead.\n\nThe patched versions additionally convert the vulnerable SQL interpolation to a parameterized query as defense in depth.","status":"published","published":"2026-04-14T22:38:01Z","modified":"2026-04-24T21:10:19Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"cwes":["CWE-89"],"references":[{"url":"https://github.com/vendurehq/vendure/security/advisories/GHSA-9pp3-53p2-ww9v"},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40887"},{"url":"https://github.com/advisories/GHSA-9pp3-53p2-ww9v"}],"updated_at":"2026-11-02T14:39:58.897998Z"}],"nuclei":[{"id":"CVE-2026-40887","exploits":[{"source":"nuclei","id":"CVE-2026-40887","title":"Vendure Core - SQL Injection","type":"detection template","url":"https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2026/CVE-2026-40887.yaml"}],"updated_at":"2026-11-02T17:01:32.285681Z"}],"nvd":[{"id":"CVE-2026-40887","description":"Vendure is an open-source headless commerce platform. Starting in version 1.7.4 and prior to versions 2.3.4, 3.5.7, and 3.6.2, an unauthenticated SQL injection vulnerability exists in the Vendure Shop API. A user-controlled query string parameter is interpolated directly into a raw SQL expression without parameterization or validation, allowing an attacker to execute arbitrary SQL against the database. This affects all supported database backends (PostgreSQL, MySQL/MariaDB, SQLite). The Admin API is also affected, though exploitation there requires authentication. Versions 2.3.4, 3.5.7, and 3.6.2 contain a patch. For those who are unable to upgrade immediately, Vendure has made a hotfix available that uses `RequestContextService.getLanguageCode` to validate the `languageCode` input at the boundary. This blocks injection payloads before they can reach any query. The hotfix replaces the existing `getLanguageCode` method in `packages/core/src/service/helpers/request-context/request-context.service.ts`. Invalid values are silently dropped and the channel's default language is used instead. The patched versions additionally convert the vulnerable SQL interpolation to a parameterized query as defense in depth.","status":"published","published":"2026-04-21T20:17:02.397Z","modified":"2026-10-26T22:10:00.163Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"secondary"}],"cwes":["CWE-89"],"references":[{"url":"https://github.com/vendurehq/vendure/security/advisories/GHSA-9pp3-53p2-ww9v"}],"updated_at":"2026-11-02T14:12:15.493943Z"}],"osv":[{"id":"CVE-2026-40887","title":"@vendure/core has a SQL Injection vulnerability","description":"Vendure is an open-source headless commerce platform. Starting in version 1.7.4 and prior to versions 2.3.4, 3.5.7, and 3.6.2, an unauthenticated SQL injection vulnerability exists in the Vendure Shop API. A user-controlled query string parameter is interpolated directly into a raw SQL expression without parameterization or validation, allowing an attacker to execute arbitrary SQL against the database. This affects all supported database backends (PostgreSQL, MySQL/MariaDB, SQLite). The Admin API is also affected, though exploitation there requires authentication. Versions 2.3.4, 3.5.7, and 3.6.2 contain a patch. For those who are unable to upgrade immediately, Vendure has made a hotfix available that uses `RequestContextService.getLanguageCode` to validate the `languageCode` input at the boundary. This blocks injection payloads before they can reach any query. The hotfix replaces the existing `getLanguageCode` method in `packages/core/src/service/helpers/request-context/request-context.service.ts`. Invalid values are silently dropped and the channel's default language is used instead. The patched versions additionally convert the vulnerable SQL interpolation to a parameterized query as defense in depth.","status":"published","published":"2026-04-21T19:24:59.525Z","modified":"2026-10-28T02:31:09.135905516Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"cwes":["CWE-89"],"references":[{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40887.json","tags":["advisory"]},{"url":"https://github.com/vendurehq/vendure/security/advisories/GHSA-9pp3-53p2-ww9v","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40887","tags":["advisory"]}],"updated_at":"2026-11-02T15:45:03.424067Z"},{"id":"GHSA-9pp3-53p2-ww9v","title":"@vendure/core has a SQL Injection vulnerability","description":"## Summary\n\nAn unauthenticated SQL injection vulnerability exists in the Vendure Shop API. A user-controlled query string parameter is interpolated directly into a raw SQL expression without parameterization or validation, allowing an attacker to execute arbitrary SQL against the database. This affects all supported database backends (PostgreSQL, MySQL/MariaDB, SQLite).\n\nThe Admin API is also affected, though exploitation there requires authentication.\n\n## Affected versions\n\n- `@vendure/core` \u003c 2.3.4\n- `@vendure/core` \u003e= 3.0.0, \u003c 3.5.7\n- `@vendure/core` \u003e= 3.6.0, \u003c 3.6.2\n\nNote: versions 2.3.4 and above in the 2.x line are patched. There were no 2.4.x or 2.x releases between 2.3.x and 3.0.0.\n\n## Patched versions\n\n- `@vendure/core` 2.3.4\n- `@vendure/core` 3.5.7\n- `@vendure/core` 3.6.2\n\n## Details\n\nIn `ProductService.findOneBySlug`, the request context's `languageCode` value is interpolated into a SQL `CASE` expression via a JavaScript template literal:\n\n```ts\n.addSelect(\n    `CASE translation.languageCode WHEN '${ctx.languageCode}' THEN 2 WHEN '${ctx.channel.defaultLanguageCode}' THEN 1 ELSE 0 END`,\n    'sort_order',\n)\n```\n\nTypeORM has no opportunity to parameterize this value because it is embedded directly into the SQL string before being passed to the query builder.\n\nThe `languageCode` value can originate from the HTTP query string and is set on the request context for every incoming API request. The value is cast to the `LanguageCode` TypeScript type at compile time, but no runtime validation is performed -- the raw query string value is used as-is.\n\n## Attack vector\n\nAn unauthenticated attacker can append a crafted `languageCode` query parameter to any Shop API request to inject arbitrary SQL into the query. No user interaction is required. The vulnerable endpoint is exposed on every default Vendure installation.\n\n## Mitigation\n\n**Upgrade to a patched version immediately.**\n\nIf you cannot upgrade right away, apply the following hotfix to `RequestContextService.getLanguageCode` to validate the `languageCode` input at the boundary. This blocks injection payloads before they can reach any query:\n\n```ts\nprivate getLanguageCode(req: Request, channel: Channel): LanguageCode | undefined {\n    const queryLanguageCode = req.query?.languageCode as string | undefined;\n    const isValidFormat = queryLanguageCode \u0026\u0026 /^[a-zA-Z0-9_-]+$/.test(queryLanguageCode);\n    return (\n        (isValidFormat ? (queryLanguageCode as LanguageCode) : undefined) ??\n        channel.defaultLanguageCode ??\n        this.configService.defaultLanguageCode\n    );\n}\n```\n\nThis replaces the existing `getLanguageCode` method in `packages/core/src/service/helpers/request-context/request-context.service.ts`. Invalid values are silently dropped and the channel's default language is used instead.\n\nThe patched versions additionally convert the vulnerable SQL interpolation to a parameterized query as defense in depth.","status":"published","published":"2026-04-14T22:38:01Z","modified":"2026-05-05T16:05:31.51036Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"cwes":["CWE-89"],"references":[{"url":"https://github.com/vendurehq/vendure/security/advisories/GHSA-9pp3-53p2-ww9v","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40887","tags":["advisory"]},{"url":"https://github.com/vendurehq/vendure","tags":["package"]}],"updated_at":"2026-11-02T15:46:43.875515Z"}]}}
