summaryrefslogtreecommitdiff
path: root/informationals/teso-i0031.txt
diff options
context:
space:
mode:
Diffstat (limited to 'informationals/teso-i0031.txt')
-rw-r--r--informationals/teso-i0031.txt68
1 files changed, 68 insertions, 0 deletions
diff --git a/informationals/teso-i0031.txt b/informationals/teso-i0031.txt
new file mode 100644
index 0000000..84418ba
--- /dev/null
+++ b/informationals/teso-i0031.txt
@@ -0,0 +1,68 @@
10031 2000/12/20 exploitable one-byte overflow in openftpd 1.0 beta28
2
3==== TESO Informational =======================================================
4This piece of information is to be kept confidential.
5===============================================================================
6
7Description ..........: exploitable one-byte overflow in openftpd 1.0 beta28
8Date .................: 2000/12/20 23:00
9Author ...............: scut
10Publicity level ......: unknown before, told to openftpd authors
11Affected .............: openftpd 1.0 beta28 and below
12Type of entity .......: exploitable buffer overflow
13Type of discovery ....: vulnerabilitiy
14Severity/Importance ..: high
15Found by .............: scut
16
17===============================================================================
18
19The OpenFTPd project develops a FTP daemon optimized for warez and mp3 sites,
20with extensive script and maintenance support, far over the FTP RFC standards.
21It introduces a command 'SITE INFO' to let each user set his own 'infoline',
22a describing line, which may not be longer then 50 chars. Often it is used to
23set affiliations to certain warez groups or short mottos or slogans.
24
25However, this 'SITE INFO' is flawed:
26
27int cmd_site_info(char** p, int n)
28{
29 char str[128];
30 char infoline[50];
31 int i;
32
33 if (!n) printf("UIN %s\n", usr.name);
34 else {
35 snprintf(str, sizeof(str), "%s ", p[0]);
36 for(i = 1; i < n; i++) {
37 strncat(str, p[i], sizeof(str) - strlen(str));
38 strncat(str, " ", sizeof(str) - strlen(str));
39 }
40 str[strlen(str) - 1] = '\0';
41 printf("UIN %s %s\n", usr.name, str);
42 }
43 if (!fgets(str, sizeof(str), stdin))
44 strncpy(str, "-!Bpipe error!0", sizeof(str) - 1);
45 return send_reply(*str == '+' ? 200 : 550, str+1);
46}
47
48The two strncat's store a NUL byte right behind the str buffer, if the content
49of str is already long enough. On x86 platforms the least significant byte of
50the framepointer is overwritten and the stack frame of the calling function
51slides down. This is very much similar to the exploitable one-byte overflow
52in the OpenBSD ftpd recently discovered. Here a reasonable target to store the
53real retaddr in is the buffer str[256] in the calling function, which may be
54easily written into by issuing something like:
55
56AAAAAAAAAAAAAAAAAAAA<up to 256 bytes>\n
57SITE INFO a aaaaaaaa<more then 128 bytes>\n
58
59A substantial portion of the str[256] buffer contains 'A' characters and you
60may have luck that your stored retaddr is at the right place. The ftpd is
61respawning, since only a child process segfaults on wrong attempts, so you
62have enough space and time to try all possible combinations (~ 1000 * 4 * 64
63= 256,000).
64
65The authors have been notified, let's see whether it gets fixed.
66
67===============================================================================
68