Rexec - Port 512

It is a service that allows you to execute a command inside a host if you know valid credentials (username and password).

Become VeryLazyTech memberarrow-up-right! 🎁

Basic Info

It is a service that allows you to execute a command inside a host if you know valid credentials (username and password).

Default Port: 512

PORT    STATE SERVICE
512/tcp open  exec

Scanning for Hosts

Start by using Nmap to scan for hosts with port 512 open, which is the default port for Rexec:

This will help identify potential targets with the Rexec service running.

Brute-Forcing Credentials

Use Metasploit's auxiliary/scanner/rservices/rexec_login module to brute-force username and password combinations:

Load the module:

Set the target and options, such as username and password files:

This will attempt to find valid credentials, exploiting Rexec's clear-text password vulnerability.

Exploiting with Command Execution

Once credentials are obtained, use the rexec command to execute a backdoor command. For example, start a netcat listener:

Then, connect to the backdoor:

Alternatively, set up a reverse shell:


circle-check

Last updated