Skip to content

Disable CORS by default #7151

@konklone

Description

@konklone

Elasticsearch currently defaults CORS to being enabled for all domains.

cors-true

This is a security issue for any developer running Elasticsearch locally at localhost:9200 -- any website they visit can fire off arbitrary HTTP requests to their local machine. This should be disabled by default.

I became aware of this issue during the hubbub over the dynamic scripting vulnerability in 1.1's defaults (now changed in 1.2, and scripting sandboxed in 1.3). CORS magnified the effect of that bug for developers browsing the web, but even with dynamic scripting disabled, websites can still perform arbitrary Elasticsearch actions to a local instance of ES.

When I mention to developers that localhost:9200 is accessible via any website they visit, they are very surprised, as was I. Yes, maybe it's something I and everyone should have understood going in, but that's not happening. And while it may not be unique to Elasticsearch, this isn't a problem with most databases and database-like systems developers are used to running locally.

I've seen people recommend using Elasticsearch in a VM during development, but this is overhead caused by a choice Elasticsearch makes. Elasticsearch's current default CORS setting adds convenience for some, at the expense of security for many developers.

Any plugins or support systems that depend on enabling CORS for Elasticsearch can provide instruction to enable CORS (along with a warning of serious side effects) as part of their installation.

Elasticsearch should provide a safe experience by default. The dynamic scripting issue, which took some time to be seen as a security issue, is now CVE-2014-3120. Elasticsearch should get in front of this one.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions