AgentStack
SKILL unreviewed MIT Self-run

Druid Javascript Security

skill-cxcscmu-skilllearnbench-druid-javascript-security · by cxcscmu

Securing Apache Druid's JavaScript execution engine against code injection and security bypass attacks.

No reviews yet
0 installs
9 views
0.0% view→install

Install

$ agentstack add skill-cxcscmu-skilllearnbench-druid-javascript-security

Open-source listing — not yet scanned by AgentStack. Follow the source repository for install instructions.

Security review

⚠ Flagged

1 finding(s); flagged for manual review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures
  • high Dangerous shell/eval execution.

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution Used
  • Environment & secrets No
  • Dynamic code execution Used

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Druid Javascript Security? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Apache Druid JavaScript Security

Vulnerability Context

Apache Druid versions up to 0.20.0 have a critical vulnerability in JavaScript expression handling where an empty key ("") can bypass security settings, allowing arbitrary code execution through the java.lang.Runtime API.

Key Components

1. JavaScript Transform Spec

  • Located in indexing service modules
  • Handles JavaScript expressions for data transformation
  • Uses GraalVM or Nashorn engine for JavaScript execution

2. Security Filter Structure

The vulnerable structure looks like:

{
  "filter": {
    "type": "javascript",
    "function": "function(){...}",
    "": {
      "enabled": true
    }
  }
}

The empty key "" is the bypass vector.

Patching Strategy

1. Input Validation

  • Reject filter/transform specs with empty string keys
  • Validate all keys in security configuration objects
  • Enforce strict schema validation before passing to JavaScript engine

2. Security Configuration Enforcement

  • Ensure enabled flag is only checked for known, valid keys
  • Implement whitelist of allowed configuration keys
  • Reject any configuration with unexpected keys

3. Code Changes Needed

  • Typically in classes handling JavaScript filter/transform deserialization
  • Common classes: JavaScriptFilter, JavaScriptExpressionValidator, JavaScript spec handlers
  • May need to add validation in both request parsing and execution phases

Testing the Fix

Exploit Request (should fail)

POST /druid/indexer/v1/sampler
{
  "type": "index",
  "spec": {
    "dataSchema": {
      "transformSpec": {
        "filter": {
          "type": "javascript",
          "function": "function(){java.lang.Runtime.getRuntime().exec('malicious_command');}",
          "": {
            "enabled": true
          }
        }
      }
    }
  }
}

Legitimate Request (should work)

POST /druid/indexer/v1/sampler
{
  "type": "index",
  "spec": {
    "dataSchema": {
      "transformSpec": {
        "filter": {
          "type": "javascript",
          "function": "function(row){return true;}"
        }
      }
    }
  }
}

Common Druid File Locations

  • JavaScript filter implementation: processing/src/main/java/org/apache/druid/query/filter/JavaScriptFilter.java
  • Indexing service: indexing-service/src/main/java/org/apache/druid/indexing/
  • Transform specs: Related to dataSchema handling

Jackson Deserialization Considerations

The vulnerability likely involves improper validation during Jackson deserialization. Use raw @JsonAnySetter or similar mechanisms to catch unexpected properties and validate them strictly before further processing.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.