Cloudanix VulnDB

CVE-2023-22665

Medium · 5.4

CVSS

5.4

EPSS

1.3%

Published

Apr 25, 2023

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

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

  1. Identify an exposed Apache Jena SPARQL endpoint
  2. Authenticate with low-privileged credentials if required
  3. Craft a SPARQL query embedding arbitrary JavaScript
  4. Submit the query to trigger script execution
  5. 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