Skip to content

Commit 23cf2e8

Browse files
authored
Merge pull request #2029 from HackTricks-wiki/update_CVE-2026-22730__SQL_Injection_in_Spring_AI_s_Maria_20260319_131806
CVE-2026-22730 SQL Injection in Spring AI’s MariaDB Vector S...
2 parents d076b8c + be31b7e commit 23cf2e8

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

src/pentesting-web/sql-injection/README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,23 @@ Mitigations:
652652
- Never concatenate identifiers from user input. Map allowed column names to a fixed allow-list and quote identifiers properly.
653653
- If dynamic table access is required, restrict to a finite set and resolve server-side from a safe mapping.
654654
655+
656+
### SQLi via AST/filter-to-SQL converters (JSON_VALUE predicates)
657+
658+
Some frameworks **convert structured filter ASTs into raw SQL boolean fragments** (e.g., metadata filters or JSON predicates) and then **string-concatenate** those fragments into larger queries. If the converter **wraps string values as `'%s'` without escaping**, a single quote in user input terminates the literal and the rest is parsed as SQL.
659+
660+
Example pattern (conceptual):
661+
662+
```sql
663+
JSON_VALUE(metadata, '$.department') = '<user_value>'
664+
```
665+
666+
Payload (URL-encoded): `%27%20OR%20%271%27%3D%271` → decoded: `' OR '1'='1` → predicate becomes:
667+
668+
```sql
669+
JSON_VALUE(metadata, '$.department') = '' OR '1'='1'
670+
```
671+
655672
### ORDER BY / identifier-based SQLi (PDO limitation)
656673
657674
Prepared statements **cannot bind identifiers** (column or table names). A common unsafe pattern is to take a user-controlled `sort` parameter and build `ORDER BY` using string concatenation, sometimes wrapping the input in backticks to “sanitize” it. This still enables SQLi because the identifier context is attacker-controlled.
@@ -670,10 +687,6 @@ Signals in traffic:
670687
- Sort parameter in **POST** (often `sort=column`), not a fixed allow-list.
671688
- Changing `sort` breaks the query or alters output ordering.
672689
673-
Mitigation:
674-
675-
- Map user input to a **fixed allow-list** of column names and only interpolate mapped identifiers.
676-
- Never rely on backticks as “sanitization” for identifiers.
677690
678691
### WAF bypass suggester tools
679692
@@ -697,6 +710,7 @@ https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/sqli.txt
697710
## References
698711
699712
- [https://blog.sicuranext.com/vtenext-25-02-a-three-way-path-to-rce/](https://blog.sicuranext.com/vtenext-25-02-a-three-way-path-to-rce/)
713+
- [https://blog.securelayer7.net/cve-2026-22730-sql-injection-spring-ai-mariadb/](https://blog.securelayer7.net/cve-2026-22730-sql-injection-spring-ai-mariadb/)
700714
- [HTB: Gavel](https://0xdf.gitlab.io/2026/03/14/htb-gavel.html)
701715
702716
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)