CVE-2023-22665
Medium · 5.4CVSS
5.4
EPSS
1.3%
Published
Apr 25, 2023
CISA due date
—
Cloudanix analysis
A problem in Apache Jena lets attackers run their own code on the server by sending specially crafted database queries, which could lead to unauthorized access or data leaks.
- Exploitation
- Requires User Interaction
- Attacker needs
- Low Privilege
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- RCE
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Insufficient validation of SPARQL queries allows remote authenticated users to inject and execute arbitrary JavaScript when custom scripts are invoked in Apache Jena 4.7.0 and earlier.
Why it matters to the business
Compromised data-processing servers could expose sensitive information or allow unauthorized code execution, disrupting analytics workloads and requiring emergency patching across dependent systems.
How an attack unfolds
An attacker with SPARQL access submits a crafted query containing JavaScript that bypasses the missing checks and executes within the server context when custom script invocation is enabled.
How to fix it
Upgrade Apache Jena to a version newer than 4.7.0 that contains the input-validation fix. Disable custom script invocation if immediate upgrade is not feasible and restrict SPARQL endpoint access to trusted clients only.
How to confirm the fix worked
Confirm the running Jena version is newer than 4.7.0, review query-handling configuration to ensure script invocation is properly gated, and test with benign and malicious SPARQL payloads in a non-production environment.
Typical attack path
- Identify an exposed Apache Jena SPARQL endpoint
- Authenticate with low-privileged credentials if required
- Craft a SPARQL query embedding arbitrary JavaScript
- Submit the query to trigger script execution
- Leverage resulting code execution for further actions such as data exfiltration or persistence
How to detect it
Inspect SPARQL query logs for submissions containing JavaScript keywords, eval calls, or script tags; correlate with authentication events and unexpected process spawns on the Jena host.
What your security team should do
- Prioritize upgrade of all Apache Jena instances to a patched release
- Inventory and restrict network exposure of SPARQL endpoints
- Monitor for unusual query patterns containing script constructs
- Review and minimize use of custom script features
The record
There is insufficient checking of user queries in Apache Jena versions 4.7.0 and earlier, when invoking custom scripts. It allows a remote user to execute arbitrary javascript via a SPARQL query.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Maven | org.apache.jena:jena | 0 | 4.8.0 |
| Debian:12 | apache-jena | 0 | No fix |
| Debian:13 | apache-jena | 0 | 4.9.0-1 |
| Ubuntu:22.04:LTS | apache-jena | 0 | No fix |
| Ubuntu:24.04:LTS | apache-jena | 0 | No fix |
| Ubuntu:24.10 | apache-jena | 0 | No fix |
| Ubuntu:25.04 | apache-jena | 0 | No fix |
| Ubuntu:25.10 | apache-jena | 0 | No fix |
| maven | org.apache.jena/jena | 3.7.0 | No fix |
Related vulnerabilities
- CVE-2023-32200 There is insufficient restrictions of called script functions in Apache Jena versions… Also affects org.apache.jena:jena
- CVE-2022-28890 A vulnerability in the RDF/XML parser of Apache Jena allows an attacker to cause an… Also affects org.apache.jena:jena
- CVE-2022-45136 Apache Jena SDB 3.17.0 and earlier is vulnerable to a JDBC Deserialisation attack if the… Also affects apache-jena
- CVE-2026-65591 n8n contains a sanitizer bypass vulnerability in the legacy expression evaluator's… CWE-917
- CVE-2026-57281 Jenkins Script Security Plugin 1402.v94c9ce464861 and earlier does not reject Groovy AST… CWE-917
- CVE-2026-11561 Improper neutralization of special elements used in an expression language statement… CWE-917
- CVE-2026-40985 Applications that configure the WebFlowELExpressionParser are vulnerable to the use of… CWE-917
- CVE-2026-41729 Spring Data REST is vulnerable to SpEL expression injection through map-typed properties… CWE-917