Brute is a project for monitoring authentication attempts on servers using OpenSSH. It tracks and records each attempt and provides detailed information about the person who made the attempt.
Currently, this project must use a specific version of OpenSSH. Unfortunately, the changes made to this may compromise the security of your server, so use with caution.
Straightforward — Simply call the endpoint /brute/attack/add
, and Brute will log, analyze, and store the credentials for you.
Extendable Metrics — Brute allows developers to easily add or remove metrics as needed. You can easily integrate additional metrics or connect an API with minimal effort to Brute.
Location Information — Information can be easily accessed through the Ipinfo API, which is integrated into Brute. This integration allows for retrieval of detailed data from the individual's IP address.
WebSocket Support — Brute supports WebSocket connections for both TLS and non-TLS websites, providing an easy way for you to stream your results in real-time.
This installation is for brute-http
this is the http server that needs to run in order
to collect the traffic from the dummy servers.
# Download rustup
curl https://sh.rustup.rs -sSf | sh
# Type 1 to proceed with the default installation.
# You might need to restart the shell
# Add Rust to PATH
source "$HOME/.cargo/env"
# Verify the installation
rustc -V
Non-docker installation
Docker installation
Before installing, please identify where you want to source your traffic. There are, of course, multiple ways to do this, but we'll only be discussing two of them.
# Update package lists
sudo apt update
sudo apt upgrade
sudo apt install build-essential zlib1g-dev libssl-dev libpq-dev pkg-config
sudo apt install libcurl4-openssl-dev libpam0g-dev
sudo apt install autoconf
### Daemon
Supports SSH and FTP. You can easily integrate your own protocols just call /brute/attack/add then specify the protocol in the payload. This is a great alternative if you don't want to go through the openssh route. But ensure that you use this on a dummy server not a production server.
https://github.com/chomnr/brute-daemon
Please ensure you have OpenSSH and any FTP server uninstalled before proceeding.
<details><summary><b>Show instructions</b></summary>
1. Clone the repository:
```sh
git clone https://github.com/chomnr/brute-daemon
cd brute-daemon
cargo build --release
/usr/local/bin/
:
mv ~/brute-daemon/target/release/brute-daemon /usr/local/bin/brute-daemon
Create a daemon file and paste and edit the following contents:
nano /etc/systemd/system/brute-daemon.service
+ [Unit]
+ Description=Brute Daemon
+ After=network.target
+ [Service]
+ ExecStart=/usr/local/bin/brute-daemon
+ Restart=always
+ User=root
+ WorkingDirectory=/usr/local/bin
+ StandardOutput=append:/var/log/brute-daemon.log
+ StandardError=append:/var/log/brute-daemon_error.log
+ # Environment Variables
+ Environment="ADD_ATTACK_ENDPOINT=https://example.com/brute/attack/add"
+ Environment="BEARER_TOKEN=my-secret-token"
+ [Install]
+ WantedBy=multi-user.target
systemd
:
systemctl daemon-reload
systemctl enable brute-daemon
systemctl start brute-daemon
systemctl status brute-daemon
Active: active (running)
```s
</details>
ssh.service
```ssh
nano /lib/systemd/system/ssh.service
```
6. Replace the existing SSH server with the one you just compiled:
```diff
- ExecStartPre=/usr/sbin/sshd -t
- ExecStart=/usr/sbin/sshd -D $SSHD_OPTS
- ExecReload=/usr/sbin/sshd -t
+ ExecStartPre=/usr/local/sbin/sshd -t
+ ExecStart=/usr/local/sbin/sshd -D $SSHD_OPTS
+ ExecReload=/usr/local/sbin/sshd -t
```
7. Now run ssh -V
and it should say the following:
```
(Brute) OpenSSH_9.8...
```
8. Ok, now we need to setup the PAM module first clone it:
```sh
git clone https://github.com/chomnr/brute_pam
```
8. Make and install the PAM module:
```sh
cmake .
make # go into lib and rename it to brute_pam.so
```
9. Now copy the PAM module into /lib/x86_64-linux-gnu/security/
```
cp brute_pam.so /lib/x86_64-linux-gnu/security/
```
10. Now go into /etc/pam.d/common-auth
```
sudo nano /etc/pam.d/common-auth
```
11. Now add PAM to the common-auth
```diff
original /etc/pam.d/common-auth
# here are the per-package modules (the "Primary" block)
- auth [success=1 default=ignore] pam_unix.so nullok
# here's the fallback if no module succeeds
auth requisite
# here are the per-package modules (the "Primary" block)
+ auth [success=2 default=ignore] pam_unix.so nullok
+ # enable Brute.
+ auth optional pam_brute.so
# here's the fallback if no module succeeds
auth requisite pam_deny.so
```
The MIT License (MIT) 2024 - Zeljko Vranjes. Please have a look at the LICENSE.md for more details.