ninenines / cowboy

Small, fast, modern HTTP server for Erlang/OTP.

Home Page:https://ninenines.eu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unauth RCE in Cowboy

ssd-disclosure opened this issue · comments

Hi,

We would like to report an RCE in Cowboy, the vulnerability allows unauthenticated attackers to execute commands on the remote server via an authentication bypass

Is this the right place to report such a vulnerability?

Can you be a little more specific? Cowboy does not provide authentication as a feature, it is a library, and authentication is provided and implemented by the users of the library.

I don't think you can attach files via replies to Github tickets. You can send me an email at contact@ninenines.eu if you want.

OK I see. There's a few misunderstandings I think.

First the issue is not related to Cowboy. The default value is set by Erlang.mk so I guess that would have been more appropriate, but I don't think it matters overall because...

The distribution cookie is not a security mechanism as is explained in the Note here: https://www.erlang.org/doc/reference_manual/distributed.html#security

And which I will quote:

"Security" here does not mean cryptographically secure, but rather security against accidental misuse, such as preventing a node from connecting to a cluster with which it is not intended to communicate.

Furthermore, the communication between nodes is per default in clear text. If you need strong security, please see Using TLS for Erlang Distribution in the SSL application's User's Guide.

Also, the default random cookie mentioned in the following text is not very unpredictable. A better one can be generated using primitives in the crypto module, though this still does not make the initial handshake cryptographically secure. And inter-node communication is still in clear text.

So I believe Erlang.mk is using the cookie in the correct way which is to identify the cluster the nodes will be a part of.

Now the defaults definitely are not secure but it is not the changing of the cookie that will help. Instead users that need it should use TLS for Erlang Distribution and verify certificates of connected nodes. But that's also not something we can really do by default as a library.