{"id":"CVE-2022-24815","aliases":["CVE-2022-24815","GHSA-qjmq-8hjr-qcv6"],"related":[],"kind":"vulnerability","state":"published","title":"SQL Injection when creating an application with Reactive SQL backend","summary":"JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures. SQL Injection vulnerability in entities for applications generated with the option \"reactive with Spring WebFlux\" enabled and an SQL database using r2dbc. Applications created without \"reactive with Spring WebFlux\" and applications with NoSQL databases are not affected. Users who have generated a microservice Gateway using the affected version may be impacted as Gateways are reactive by default. Currently, SQL injection is possible in the findAllBy(Pageable pageable, Criteria criteria) method of an entity repository class generated in these applications as the where clause using Criteria for queries are not sanitized and user input is passed on as it is by the criteria. This issue has been patched in v7.8.1. Users unable to upgrade should be careful when combining criterias and conditions as the root of the issue lies in the `EntityManager.java` class when creating the where clause via `Conditions.just(criteria.toString())`. `just` accepts the literal string provided. Criteria's `toString` method returns a plain string and this combination is vulnerable to sql injection as the string is not sanitized and will contain whatever used passed as input using any plain SQL.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures. SQL Injection vulnerability in entities for applications generated with the option \"reactive with Spring WebFlux\" enabled and an SQL database using r2dbc. Applications created without \"reactive with Spring WebFlux\" and applications with NoSQL databases are not affected. Users who have generated a microservice Gateway using the affected version may be impacted as Gateways are reactive by default. Currently, SQL injection is possible in the findAllBy(Pageable pageable, Criteria criteria) method of an entity repository class generated in these applications as the where clause using Criteria for queries are not sanitized and user input is passed on as it is by the criteria. This issue has been patched in v7.8.1. Users unable to upgrade should be careful when combining criterias and conditions as the root of the issue lies in the `EntityManager.java` class when creating the where clause via `Conditions.just(criteria.toString())`. `just` accepts the literal string provided. Criteria's `toString` method returns a plain string and this combination is vulnerable to sql injection as the string is not sanitized and will contain whatever used passed as input using any plain SQL.","source":"cvelist"},{"lang":"en","text":"### Impact\nSQL Injection vulnerability in entities for applications generated with the option \"reactive with Spring WebFlux\" enabled and an SQL database using r2dbc. Applications created without \"reactive with Spring WebFlux\" and applications with NoSQL databases are not affected. \n\nIf you have generated a microservice Gateway using the affected version, you might be impacted as Gateways are reactive by default.\n\nCurrently, SQL injection is possible in the `findAllBy(Pageable pageable, Criteria criteria)` method of an entity repository class generated in these applications as the where clause using Criteria for queries are not sanitized and user input is passed on as it is by the criteria.\n\n## Impacted applications\n- Monolith and microservice applications with SQL database and reactive with Spring WebFlux combination (other combinations are not affected and the issue is only present when you generate entities)\n- Gateway applications with SQL database (issue will appear only when generating entities)\n\n### Patches\nPatched in v7.8.1\n\nThe `findAllBy(Pageable pageable, Criteria criteria)` method has been removed from the entity repositories and `org.springframework.data.relational.core.query.Criteria` support in the underlying methods has been replaced with `org.springframework.data.relational.core.sql.Condition`. This means you won't be able to do custom filtering in the generated applications.\n\nIf you have existing reactive applications generated by the impacted version, we advise you to audit for use of `Criteria` and take appropriate actions.\n\n### Workarounds\n\nThe problem lies in the `EntityManager.java` class when creating the where clause via `Conditions.just(criteria.toString())`.\n\n`just` accepts the literal string provided. Criteria's `toString` method returns a plain string and this combination is vulnerable to sql injection as the string is not sanitized and will contain whatever used passed as input using any plain SQL\n\nSo be careful when combining criterias and conditions. As a workaround we have removed the possibility to pass any user-provided criteria to the `createSelect` method of `EntityManager`.\n\n### Example \n\n```java\nCriteria criteria = Criteria.where(\"name\").is(\"foobar';DROP TABLE example;--\"); // parameter is user provided input\ncriteria.toString(); // --> \"'foobar';DROP TABLE example;--'\"\n```\n\n### References\n[More details in this Issue report](https://github.com/jhipster/generator-jhipster/issues/18269)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [JHipster issue tracker](https://github.com/jhipster/generator-jhipster/issues)","format":"markdown","source":"ghsa"},{"lang":"es","text":"JHipster es una plataforma de desarrollo para generar, desarrollar y desplegar rápidamente aplicaciones web modernas y arquitecturas de microservicios. Vulnerabilidad de inyección SQL en entidades para aplicaciones generadas con la opción \"reactiva con Spring WebFlux\" habilitada y una base de datos SQL usando r2dbc. Las aplicaciones creadas sin \"reactivo con Spring WebFlux\" y las aplicaciones con bases de datos NoSQL no están afectadas. Los usuarios que hayan generado un microservicio Gateway usando la versión afectada pueden verse afectados ya que los Gateways son reactivos por defecto. Actualmente, la inyección SQL es posible en el método findAllBy(Pageable pageable, Criteria criteria) de una clase de repositorio de entidades generada en estas aplicaciones, ya que la cláusula where que usa Criteria para las consultas no está saneada y la entrada del usuario es pasada tal cual por los criterios. Este problema ha sido parcheado en versión 7.8.1. Los usuarios que no puedan actualizar deberán tener cuidado cuando combinen criterios y condiciones, ya que la raíz del problema es encontrada en la clase \"EntityManager.java' cuando es creada la cláusula where por medio de \"Conditions.just(criteria.toString())\". La clase \"just\" acepta la cadena literal proporcionada. El método \"toString\" de Criteria devuelve una cadena simple y esta combinación es vulnerable a una inyección de sql, ya que la cadena no está saneada y contendrá lo que haya sido pasado como entrada usando cualquier SQL simple","source":"nvd"}],"published":"2022-04-07T15:18:05.000Z","modified":"2026-06-17T04:32:34.917Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","score":8.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:P/I:P/A:P","score":6.8,"rating":"MEDIUM"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":">= 7.0.0, < 7.8.1","status":"affected"}],"vendor":"jhipster","product":"generator-jhipster","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"7.0.0","status":"affected","fixed":"7.8.1"}],"ecosystem":"npm","package":"generator-jhipster","purl":"pkg:npm/generator-jhipster","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"7.0.0","fixed":"7.8.1"}],"vendor":"jhipster","product":"generator-jhipster","cpe":"cpe:2.3:a:jhipster:generator-jhipster:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/jhipster/generator-jhipster/security/advisories/GHSA-qjmq-8hjr-qcv6","tags":["third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/jhipster/generator-jhipster/issues/18269","tags":["exploit","issue-tracking","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/jhipster/generator-jhipster/commit/c220a210fd7742c53eea72bd5fadbb96220faa98","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24815","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/jhipster/generator-jhipster","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2025-04-22T15:43:58.432Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-24815","url":"https://www.cve.org/CVERecord?id=CVE-2022-24815","licence":"CVE Terms of Use","modified":"2025-04-22T18:16:34.648Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-qjmq-8hjr-qcv6","url":"https://github.com/advisories/GHSA-qjmq-8hjr-qcv6","licence":"CC-BY-4.0","modified":"2023-11-08T04:08:37.384Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-24815","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24815","licence":"Public domain","modified":"2026-06-17T04:32:34.917Z"}],"updatedAt":"2026-11-25T22:58:10.522Z","epss":{"score":0.01377,"percentile":0.72877,"date":"2026-12-01T12:00:22.000Z"}}