Skip to content

Commit 793b947

Browse files
author
HackTricks News Bot
committed
Add content from: CVE-2026-22730: SQL Injection in Spring AI’s MariaDB Vector ...
1 parent c246b86 commit 793b947

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,33 @@ 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+
672+
Impact:
673+
- **Authorization bypass**: always-true predicates return cross-tenant/department rows.
674+
- **Destructive writes**: if the same fragment is reused in `DELETE/UPDATE ... WHERE <predicate>`, it can wipe data.
675+
- **RAG-specific risk**: leaked rows may only surface indirectly inside LLM answers, making detection harder.
676+
677+
Hunting tips:
678+
- Look for classes that **serialize filter/AST nodes to SQL** and append them into queries via `String.format`, `+`, or templating.
679+
- Verify string emitters **escape single quotes and backslashes**; parameter binding only works for scalar values, not entire boolean expressions.
680+
- Prefer builders that keep **predicates parameterized** (values as bind params) and never inline user-controlled literals.
681+
655682
### WAF bypass suggester tools
656683
657684
@@ -674,5 +701,6 @@ https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/sqli.txt
674701
## References
675702
676703
- [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/)
704+
- [https://blog.securelayer7.net/cve-2026-22730-sql-injection-spring-ai-mariadb/](https://blog.securelayer7.net/cve-2026-22730-sql-injection-spring-ai-mariadb/)
677705
678706
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)