home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / library / hack / vms2.txt < prev    next >
Encoding:
Text File  |  1998-12-04  |  13.8 KB  |  323 lines

  1. Introduction to VMS - Part II.
  2. gr1p@b4b0.org
  3.  
  4. This is part 2 of my 3 part Introduction to VMS which will hopefully enable 
  5. you to gain a much more complete introductionary grasp of the Operating
  6. System and its Security Arrangements.
  7.  
  8. In the first text, found on the 9x webpage, I covered the basic background
  9. of VMS as well as showing some basics commands and talking a little bit about
  10. security with the list of some default logins.  This paper will see a slightly 
  11. more indepth look at security and gaining (superuser) access on a machine 
  12. running VMS, at the same time as keeping in mind that this is an *introduction* 
  13. and therefore not getting too technical (that will come in later files).
  14.  
  15. The information presented in this text file is for educational use only. 
  16. If you decide to use what you learn in this text and you get busted, don't
  17. blame me for showing you the information.
  18.  
  19. --> User Privileges
  20.  
  21. Before we actually look at ways to exploit VMS security I should give you a
  22. background of user privileges as they are different to UNIX user privileges
  23. etc.  Our aim on a VMS box is to gain the highest number of privileges that 
  24. we can in order to explore the box to the greatest potential.  Each account 
  25. has a different number of privileges.  To see what privileges your users 
  26. account has enter the following command at the prompt.
  27.  
  28. $ show proc/priv
  29.  
  30. This will then show you a list of your Authorised Privileges, Process
  31. Privileges, Process Rights and System Rights.
  32.  
  33. The Following is a list of Privileges that are commonly found on VMS
  34. systems.  This list is taken directly from the alt.2600/#hack FAQ. 
  35.  
  36.                 -- snip --
  37.  
  38. ACNT            Allows you to restrain accounting messages
  39.  
  40. ALLSPOOL        Allows you to allocate spooled devices
  41.  
  42. ALTPRI          Allot Priority.  This allows you to set any priority
  43.                 value
  44.  
  45. BUGCHK          Allows you make bug check error log entries
  46.  
  47. BYPASS          Enables you to disregard protections
  48.  
  49. CMEXEC/  
  50. CMKRNL          Change to executive or kernel mode.  These privileges
  51.                 allow a process to execute optional routines with KERNEL
  52.                 and EXECUTIVE access modes. CMKRNL is the most powerful
  53.                 privilege on VMS as anything protected can be accessed
  54.                 if you have this privilege.  You must have these
  55.                 privileges to gain access to the kernel data structures
  56.                 directly.
  57.  
  58. DETACH          This privilege allow you to create detached processes of
  59.                 arbitrary UICs
  60.  
  61. DIAGNOSE        With this privilege you can diagnose devices
  62.  
  63. EXQUOTA         Allows you to exceed your disk quota
  64.  
  65. GROUP           This privilege grants you permission to  affect other
  66.                 processes in the same rank
  67.  
  68. GRPNAM          Allows you to insert group logical names into the group
  69.                 logical names table.
  70.  
  71. GRPPRV          Enables you to access system group objects through
  72.                 system protection field
  73.  
  74. LOG_IO          Allows you to issue logical input output requests
  75.  
  76. MOUNT           May execute the mount function
  77.  
  78. NETMBX          Allows you to create network connections
  79.  
  80. OPER            Allows you to perform operator functions
  81.  
  82. PFNMAP          Allows you to map to specific physical pages
  83.  
  84. PHY_IO          Allows you to perform physical input output requests
  85.  
  86. PRMCEB          Can create permanent common event clusters
  87.  
  88. PRMGBL          Allows you to create permanent global sections
  89.  
  90. PRMMBX          Allows you to create permanent mailboxes
  91.  
  92. PSWAPM          Allows you to change a processes swap mode
  93.  
  94. READALL         Allows you read access to everything
  95.  
  96. SECURITY        Enables you to perform security related functions
  97.  
  98. SETPRV          Enable all privileges
  99.  
  100. SHARE           Allows you to access devices allocated to other users.
  101.                 This is used to assign system mailboxes.
  102.  
  103. SHMEM           Enables you to modify objects in shared memory
  104.  
  105. SYSGBL          Allows you to create system wide permanent global
  106.                 sections
  107.  
  108. SYSLCK          Allows you to lock system wide resources
  109.  
  110. SYSNAM          Allows you to insert in system logical names in the
  111.                 names table.
  112.  
  113. SYSPRV          If a process holds this privilege then it is the same as
  114.                 a process holding the system user identification code.
  115.  
  116. TMPMBX          Allows you create temporary mailboxes
  117.  
  118. VOLPRO          Enables you to override volume protection
  119.  
  120. WORLD           When this is set you can affect other processes in the
  121.                 world
  122.  
  123.                 -- snip --
  124.  
  125. You will be able to see which privileges your user account has when you run
  126. the command shown above on your target host's box.  A typical normal-user
  127. with no superuser rights will have the Process Privileges NETMBX and TMPMBX 
  128. which will allow the user to make network connections and to make a mailbox.  
  129. This is very basic privileges on a system, but these are the most common 
  130. Process Privileges that you will find of normal "bottom-range" users.  
  131. However, more privileges are needed in order to explore the box further.  
  132. A thing I have done a number of times, without actually realising before 
  133. hand, is gained a SYSTEM account from what I just presumed was a normal user.
  134. The best way to check to see if you have full privileges on the system is 
  135. to type the following command.
  136.  
  137. $ set proc/priv=all
  138.  
  139. If there is no error message you have found yourself a SYSTEM account, which
  140. is basically a SuperUser account which will let you add users, read files,
  141. change necessary data etc.
  142.  
  143. --> Expired User Exploit
  144.  
  145. The following exploit is basically an expired user exploit which was
  146. documented as being found by a guy called Hellmaster.  I did a little 
  147. experimentation with this bug and I found that it had a high success rate 
  148. on expired accounts on VMS 6.2 and under platforms.  This bug is very useful 
  149. if you have a lot of information about your target system.  For example, if 
  150. your target is running the finger daemon you could easily guess login names 
  151. of users etc. if you knew the generic breakdown of the usernames.  To 
  152. demonstrate this I will show you a simple way to gain information about the 
  153. structures of usernames by using a username structure I found at a big .edu 
  154. a while ago.
  155.  
  156. The .edu used a system of both letters and numbers for usernames, depending
  157. on what grade you were in college and what your name was.  For example, if 
  158. you were a college freshman and your name was Mike Fisher than your login 
  159. would be something like..
  160.  
  161. mkr121
  162.  
  163. mk  == The first letters of your names.
  164. r   == The Year eg. 1998 (previous letters indicate previous years)
  165. 121 == Some numeric catergorisation
  166.  
  167. Now, in order to exploit the expired user exploit you must find old users to
  168. the system whose accounts have expired but have not been deleted.  College's 
  169. are great for helping you exploit this bug.  All you need to do is go through 
  170. a student directory of email addresses/homepages and look for old accounts.  
  171. This is simple and can soon result in you having 2-3 hacked expired accounts 
  172. for further exploration.  The simple alternative to searching directories etc. 
  173. is to use the finger daemon as I suggested above, this is simple once you have 
  174. the structures of the usernames broken down you can easily finger users and
  175. look for old Last Login dates.
  176.  
  177. Once you have a list of usernames with old last login dates, or usernames
  178. that you feel are expired then telnet to the target host entering the username
  179. and the password "temp".
  180.  
  181. For example..
  182.  
  183. Username: mkr121
  184. Password: temp
  185.  
  186. You will now gain access to the system, however, the system will prompt you
  187. to enter a new valid password as your old password has expired.  So, with a 
  188. little background research you can easily gain an account on a system which 
  189. contains expired accounts.
  190.  
  191. On the subject of colleges/universities, it may be handy to remember that
  192. the faculty have accounts on these machines too, and the faculty will
  193. usually be given more user-privileges than student users, so perhaps faculty 
  194. users are the users to target.
  195.  
  196. --> Bypassing Login Sequence
  197.  
  198. There is an exploit that exists which bypasses the login sequence and drop's
  199. you straight into a DCL prompt.  However, I have personally only found this to
  200. work on VMS 4.2 and below.
  201.  
  202. The exploit works by bypassing the login.com sequence.  The normal login
  203. sequence on a VMS box is as follows. After you enter your username and password 
  204. the sylogin.com file is executed, sylogin.com is a default login file that
  205. activates when every user logs onto the system, sylogin.com then searches the 
  206. users home directory that logged on for his individual login.com file.  The 
  207. login.com file is basically the file that sets all your shell parameters, such 
  208. as terminal settings, executing programs etc.
  209.  
  210. To execute the exploit you need to know a valid username on the system 
  211. (I discussed a few easy ways to gain usernames earlier in this txt).
  212. Once you have your valid username you simply type the following at the login
  213. prompt.
  214.  
  215. Username: mkr121/nocommand
  216.  
  217. This will then drop you straight into the DCL command prompt.  As you can
  218. see from above, all we did was add the text /nocommand after the login name. 
  219. This /nocommand switch is known as a login qualifier.  Login qualifiers exist 
  220. to enable the user to change certain things about the login sequence.  For 
  221. example..
  222.  
  223. Username: mkr121/command=l0g1n.com
  224.  
  225. The above command would log us into the system using the l0g1n.com file in
  226. your home directory.  Please note, this cannot be used to gain access to the
  227. system, this command line is just for use after you have an account on your 
  228. system.  For example, you could code a little l0g1n.com batch file that when 
  229. executed at login will set all the login parameters to your defined preference, 
  230. as well as execute all the programs you want executing at login etc.
  231.  
  232. Other login qualifiers you can use at the login prompt are as follows..
  233.  
  234. /disk                   - Changes the default system disk.
  235. /new_password           - Asks you to set a new password.
  236.  
  237. This technique will not however work if the admin set captive flags on.  
  238. If captive flags are on then you cannot break out of the preset login batch 
  239. file into a DCL prompt.  Any sensible admin would set captive flags on, but
  240. often, this parameter is not set to on in a user profile, therefore allowing
  241. people to use the login qualifiers, as shown above.
  242.  
  243. --> Restricted Accounts
  244.  
  245. During your time hacking machines running VMS you may find that some
  246. accounts, especially those on .edu subnet's are running a sort of 
  247. restricted-shell atmosphere.  This is bad for you as you need access 
  248. to the DCL system prompt.
  249.  
  250. However, there is an vulnerability that you can exploit within restricted 
  251. shells.  When logged into a restricted shell account on a VMS box try
  252. hitting Ctrl-Y to break out of the shell into a prompt such as MAIL> or TELNET>.
  253. Once at one of these prompts, type SPAWN which should then create a DCL
  254. command prompt from which you have gained greater system access and broken 
  255. the old restricted login.com.  
  256.  
  257. --> Gaining More Accounts
  258.  
  259. Once you have SYSTEM access on a box you will want to gain as many accounts
  260. on the box as you can, incase some die, or you lose access.  This way you will 
  261. have other accounts to fall back on.
  262.  
  263. The best way to gain other accounts is to first pull off a list of users on
  264. a system.  There are literally a lot of ways to do this at the command prompt.  
  265. I'll highlight a few ways, take your pick.  I would recommend using some kind 
  266. of terminal logger while pipeing the information in the user files onto your 
  267. terminal.  If you are in Linux, use the script command to save the terminal 
  268. session to a file (defaulting as typescript), and if you are in windows, use 
  269. the telnet.exe logging feature.
  270.  
  271. $ type sys$system:rightslist.dat
  272.  
  273. This will pipe the information from sys$system:rightslist.dat onto the
  274. terminal from where you can view and pick out user names etc.  The only 
  275. problem with using the type command to pipe the user data is that it leaves 
  276. garbage characters on your terminal.  These garbage characters are however 
  277. quite easy to distinguise from the login usernames.  When looking at your 
  278. screen when displaying rightslist.dat try to ignore the first character of 
  279. each username as that is simply garbage.  Using your judgement here can 
  280. help a lot.  This is the quickest method for gaining a copy of
  281. sys$system:rightslist.dat but if you are willing to wait a bit longer there 
  282. is a much better way of pipeing the data contained in sys$system:rightslist.dat 
  283. onto your terminal.
  284.  
  285. $ dump sys$system:rightslist.dat
  286.  
  287. This uses the dump command to dump the contents of sys$system:rightslist.dat
  288. straight onto your terminal without any garbage characters or unneccesary changes
  289. in the content of the file.
  290.  
  291. Another way of gaining the list of users on a system is to abuse the file
  292. permission of a file that might have been created by the admin.  Sometimes, an 
  293. admin might use the LIST command to produce a list of users on the system from 
  294. the data contained in the sys$system directory.  If he has done this the 
  295. userlist is then saved to the file SYSUAF.LIS which unless changed by the 
  296. admin (and usually not) is set as WORLD readable, in other words, ready for 
  297. you to grab.  To grab this file to your terminal try the following command 
  298. line..
  299.  
  300. $ type sys$system:sysuaf.lis
  301.  
  302. If this worked you will now have a list of usernames for that system
  303. flashing by your terminal.
  304.  
  305. All these techniques result in the same thing, gaining a list of usernames
  306. for users on the system, so once you have your username list its time to go 
  307. back to basics and brute force the list to gain more accounts.  If you know what 
  308. the default account password is then keep trying that against every username.  
  309. For example, the default password could be the same as the username, or the 
  310. users date of birth, or even a word such as temp or password, its up to you to 
  311. do some research.  
  312.   
  313. Look out for Part-III of my Introduction to VMS soon, until then check out
  314. the links below for more fun stuph.
  315.  
  316. 9x   -> http://www2.dope.org/9x
  317. b4b0 -> http://www.b4b0.org 
  318.  
  319. gr1p
  320. gr1p@b4b0.org
  321. http://www.b4b0.org/gr1p
  322.  
  323.