home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / computer-security / most-common-qs < prev    next >
Text File  |  2003-04-23  |  43KB  |  847 lines

  1. Newsgroups: comp.security.unix,comp.security.misc,alt.security,alt.answers,comp.answers,news.answers
  2. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!newsfeed.stanford.edu!nntp.cs.ubc.ca!torn!utnut!cdf.toronto.edu!ajr
  3. From: flaps@dgp.toronto.edu (Alan J Rosenthal)
  4. Subject: comp.security.unix and comp.security.misc frequently asked questions
  5. X-Nntp-Posting-Host: ajr@eddie.cdf.toronto.edu
  6. Message-ID: <HDr0t5.4z4.0.water@cdf.toronto.edu>
  7. Followup-To: comp.security.unix,comp.security.misc
  8. Summary: VERY frequently asked questions which have straightforward answers
  9. Originator: ajr@cdf.toronto.edu
  10. Sender: news@cdf.toronto.edu (Usenet News)
  11. Organization: Dynamic Graphics Project, University of Toronto
  12. Date: Tue, 22 Apr 2003 14:12:41 GMT
  13. Approved: news-answers-request@mit.edu
  14. Lines: 830
  15. Xref: senator-bedfellow.mit.edu comp.security.unix:76041 comp.security.misc:87507 alt.security:64110 alt.answers:67131 comp.answers:53396 news.answers:249765
  16.  
  17. Archive-name: computer-security/most-common-qs
  18. Posting-frequency: monthly
  19. Last-modified: October 2002
  20. Last-seriously-modified: January 2001
  21. URL: ftp://rtfm.mit.edu/pub/faqs/computer-security/most-common-qs
  22.  
  23. This is a faq file for comp.security.misc and comp.security.unix.  It is
  24. cross-posted to alt.security because I think it will also be useful there.
  25.  
  26. Please check whether your question is in this file before posting.
  27. Also, unix-specific questions should be posted to comp.security.unix, not
  28. comp.security.misc; so if they're in here, there are now TWO reasons not to
  29. post them to comp.security.misc.
  30.  
  31. ------------------------------
  32.  
  33. Subject: Table of contents
  34.  
  35. - This faq
  36.  
  37. - Can anyone here tell me how to exploit the [whatever] bug?
  38.   or Can anyone here tell me how to break in to my ISP?
  39.  
  40. - What do the "identd" lines in my syslog mean?  Is this a security
  41.   exposure?  Can I turn off identd?
  42.  
  43. - I just noticed that [something].  Has my machine been compromised?
  44.  
  45. - What does port number [whatever] mean?
  46.  
  47. - Here's new, unbreakable encryption software.
  48.  
  49. - What should I read to learn how to secure my computers?  What should I read
  50.   to learn about computer security?
  51.  
  52. - Is there a newer version of cops?
  53.  
  54. - Tripwire fails the self-test, dumps core when building the database, and
  55.   dumps core when verifying.
  56.  
  57. - Cops won't "make" in some versions of linux (GNU).
  58.  
  59. - Various problems with building anything under Solaris, especially
  60.   "/usr/ucb/cc:  language optional software package not installed".
  61.  
  62. - What's that weird URL with SATAN/SAINT?  I'm not running a web server!
  63.   or SATAN says "Can't find my own hostname".
  64.  
  65. - SATAN doesn't display right in my web browser; it asks me to save the file.
  66.  
  67. - How do I find all setuid and setgid files?
  68.  
  69. - Tcp wrappers (tcpd) thinks all hosts are 0.0.0.0 in Solaris 8 or in some
  70.   versions of AIX.
  71.  
  72. - I can't get .rhosts/.shosts to work with ssh.
  73. (Note: there is a newsgroup comp.security.ssh)
  74.  
  75. - Should I block all ICMP at my firewall/router?
  76.  
  77. - How do I prevent my machine from announcing OS version, daemon version,
  78.   etc in the banner message?
  79.  
  80. - How do I recover from forgetting my root password?  (Similarly: I messed up
  81.   the root line in /etc/passwd and can't su or login as root; what do I do?)
  82.  
  83. - Is a portscan of a machine malicious/illegal/unfriendly?
  84.  
  85. - Can my ISP/employer monitor [various things I'm doing]?
  86.  
  87. - Why do some people get so upset when system penetration is called "hacking"?
  88.  
  89. ------------------------------
  90.  
  91. Subject: This faq
  92.  
  93. This is not supposed to be a statement of group consensus.  This is simply
  94. supposed to be a few VERY frequently asked questions and their answers, so
  95. that we can snidely say "see the faq" when people ask them.  The answers
  96. supplied are supposed to be completely uncontroversial amongst people who
  97. know what they're talking about.  (My first answer might be a bit borderline
  98. in this respect but I don't recall ever having seen a contrary opinion here.)
  99. Except for the portscan question, in which I've attempted to present ALL of
  100. the major views.
  101.  
  102. Contributions of questions are welcome (with or without answers); however,
  103. the idea is that they are supposed to be things which have straightforward
  104. answers and which we see very frequently (at least prior to their inclusion
  105. in this document).  If your answer is long, it might not belong in this
  106. document, at least as I see the purpose of this document.  For example, it is
  107. intentional that this document doesn't contain firewall recommendations, even
  108. though that's a frequently-asked question here.  (But see the firewall faq at
  109. http://www.interhack.net/pubs/fwfaq/)
  110.  
  111. Thanks to Juan Gallego, Lamont Granquist, and Martin Ouwehand for additional
  112. suggestions re finding setuid files on different versions of unix.  Thanks
  113. to Dan Farmer for making me aware of cops 1.04+ (cf 1.04).  Thanks to Dan
  114. Niles and Jyrki Havia for tripwire bug details as posted to the newsgroup.
  115. Thanks to Scott Barman for a Windows NT security book reference.  Thanks to
  116. Robert Graham for suggesting I cite his good firewall-seen.html file.
  117. Thanks to Denis McKeon and Olaf Schreck for improvements to my bit about
  118. editing the SATAN perl file (to avoid newbie errors).
  119.  
  120. Disclaimer: The posting of this file is not to be construed as a commitment
  121. to provide free consulting to people I don't know.  Post your questions to
  122. the newsgroup and I might answer them there, or someone else might do it
  123. better.  (Although if you say "please send e-mail copies", I'm going to
  124. ignore your message.)
  125.  
  126. Disclaimer 2: There ARE errors in this file, but at the time of writing, I
  127. didn't know what they were.  (If I knew, I would have fixed them.)  This
  128. document is offered on an "as-is" basis, no warranty is implied, blah blah blah.
  129.  
  130. The metafaqs say you should choose a random day of the month to post monthly
  131. faqs on, so I just used random() and got the number 22 (I don't think it's
  132. necessary for it to be a cryptographic random number).
  133.  
  134. Yes, I know that syntactically, these are not all "questions".
  135.  
  136. ------------------------------
  137.  
  138. Subject: Can anyone here tell me how to exploit the [whatever] bug?
  139.     or Can anyone here tell me how to break in to my ISP?
  140.  
  141. No.  We're security professionals.  We try to secure systems.  We think that
  142. securing systems and fixing bugs are more intellectual activities than running
  143. a program which someone else wrote which you don't understand.
  144.  
  145. You should only attempt "penetration testing" of a system with the consent
  146. of its administrators and/or owners.  They will only be interested in your
  147. services if you know something.  You can start your education by learning
  148. some general computer science and computer programming, and by reading
  149. computer security textbooks and/or newsgroups.
  150.  
  151. ------------------------------
  152.  
  153. Subject: What do the "identd" lines in my syslog mean?  Is this a security
  154.     exposure?  Can I turn off identd?
  155.  
  156. Discarding the timestamp and hostname, the lines look something like this:
  157.  
  158.     identd[10362]: from: 205.238.143.33 ( mail.dejanews.com ) for: 20546, 25
  159.     identd[10362]: Successful lookup: 20546 , 25 : flaps.users
  160.  
  161. This states that the machine 205.238.143.33 asked your machine who was
  162. connecting from port 20546 on your machine to port 25 on 205.238.143.33.
  163. And your machine responded that the user was "flaps", and that flaps's group
  164. is "users".  (10362 is the process id number of this particular invocation of
  165. identd; for example, if two identd requests happened at about the same time
  166. and the two lines were interleaved, it would help you sort them out.)
  167.  
  168. Theoretically, this is a security-sensitive data exposure, although the
  169. practical effect of this is arguably nil.  And it can be very helpful to the
  170. admin of a machine which often has more than a few simultaneous users.  When
  171. one of your users does something untoward, this allows the remote machine to
  172. log the username, and then the remote sysadmin's complaint to you will
  173. contain information useful to you.  A linux machine at home connected to the
  174. internet via ppp and with only one user should not be running identd because
  175. it does not contribute to this process.  Very few things on the net REQUIRE
  176. the sender to be running identd, because many machines don't have it and
  177. because many people turn it off.
  178.  
  179. Your identd program probably has various options to configure what
  180. information it discloses; see the man page.  You might want to run it with
  181. options to minimize data OTHER than the above (-o and -e in the common
  182. implementation), and/or perhaps run it with the option to report numeric uids
  183. rather than lognames (-n), which is just as useful for tracking down
  184. offenders from your point of view.  On the other hand, if you report numeric
  185. uids, then in some cases the remote people will be able to gain logname<->uid
  186. translation info (e.g. the outgoing connection is a mail message bearing
  187. 'from' information), so it's hard to say which discloses less data.
  188.  
  189. If you feel that this data is sensitive but still want to run identd, there
  190. are some identd servers out there which report the data encrypted, so that
  191. all the target sysadmins can do with the information they get is to send the
  192. token back to you for your own use.  This facility might be available as -C.
  193.  
  194. You specify these options on the identd command-line, wherever it appears,
  195. which is usually in /etc/inetd.conf.
  196.  
  197. The identd protocol is documented in RFC 1413.  It is the same as "auth".
  198. The query specifies the port numbers only; the two IP addresses implied
  199. are the sender and target of the identd query.  Thus you cannot query about
  200. IP connections to other machines, although you can query about connections
  201. which don't concern you but are to a machine you have an account on.
  202.  
  203. RFC 1413 states, "If you wouldn't run a 'finger' server due to privacy
  204. considerations you may not want to run this protocol."  I agree with this but
  205. suggest that it might not apply to a cryptographic identd (e.g. -C).
  206.  
  207. ------------------------------
  208.  
  209. Subject: I just noticed that [something].  Has my machine been compromised?
  210.  
  211. Maybe.  You probably don't know whether it always was like this.  You should
  212. look around your system enough of the time that you get used to how things
  213. look BEFORE you get broken into.  And you should make a practice of following
  214. up oddities you find, so that your judgement as to what is and is not weird
  215. improves with experience.
  216.  
  217. If it's too late for that, before posting to comp.security.* ask at least
  218. one local expert in the OS you're running, or in the case of unix/linux/gnu,
  219. one local unix expert.  There may be a straightforward, happy explanation
  220. for the behaviour you observe.  Or there may not.  Not all anomalies are the
  221. result of an intrusion; to some extent "My machine has been broken into!" has
  222. replaced the "I have a virus!" default explanation of a few years ago.
  223. On the other hand, machine breakins are very common these days, too.
  224.  
  225. ------------------------------
  226.  
  227. Subject: What does port number [whatever] mean?
  228.  
  229. RFC 1700 is obsolete.  The standard current reference is
  230. http://www.iana.org/assignments/port-numbers
  231.  
  232. However, you can write a program which uses any port number, whether it has a
  233. standard meaning or not; and similarly you can write a program which uses a
  234. port number in a way contrary to its standard meaning.
  235.  
  236. If you notice an attempted connection to a weird port number on your machine,
  237. the connection might have been meant for some other machine running an
  238. idiosyncratic service (perhaps someone typoed the IP address or hostname),
  239. it might be a probe for a widely-spread trojan horse program, it might be
  240. part of some kind of portscan, or plenty of other possibilities.  Some notes
  241. about what a particular port access might mean in practical terms (as opposed
  242. to the intended purpose of that port number assignment) can be found at
  243. http://www.robertgraham.com/pubs/firewall-seen.html
  244. And a list of some non-standard ports used by various strange programs is at
  245. http://www.chebucto.ns.ca/~rakerman/port-table.html
  246.  
  247. If you notice your machine listening on an unexpected port, you may have
  248. been broken into, or it may be a "feature" of your OS distribution or some
  249. third-party software you're running.  In unix, most ports your OS distribution
  250. will use will be listed in /etc/services, along with MANY you don't use.
  251. /etc/inetd.conf lists services whose daemons are started on demand by inetd,
  252. the internet "super-server" (see the man page).  (/etc/inetd.conf entries
  253. cause services to be offered; /etc/services entries basically just map names
  254. to and from numbers.)  In different ways depending on OS version, /etc/rc*
  255. specifies some standalone daemons to be started up on boot (or initlevel
  256. change); see man pages (including man init).  These are conventional ways to
  257. start services but any program can listen on a port (unprivileged processes
  258. can only listen on port numbers >=1024 in most multiuser OSes).
  259.  
  260. Some port numbers are not fixed.  There are several possibilities here, but
  261. in unix these most notably include port numbers bearing services registered
  262. under the "portmapper", which listens on port 111.  Type "rpcinfo -p hostname"
  263. for a list of services for which the portmapper is serving as a directory.
  264. (Some of these port numbers may in fact be fixed, in which case client
  265. programs have two different ways to find the port number (hardcode the port
  266. number or use the portmapper).)
  267.  
  268. To see what listeners you have running (open ports), the canonical incantation
  269. is "netstat -an".  But doing a portscan from a remote machine might be more
  270. reliable if you suspect your machine has been compromised, because the netstat
  271. program could have been replaced.  (But do keep in mind the tricky "malware"
  272. technique of only accepting connections with certain *source* port numbers.)
  273. To find out what process is doing the listening, try something like lsof.
  274. Again, once your machine has been compromised, this might report the
  275. wrong answer; the purpose of using lsof would be to investigate the normal
  276. behaviour of your machine, not to check whether it's been compromised.
  277.  
  278. ------------------------------
  279.  
  280. Subject: Here's new, unbreakable encryption software.
  281.  
  282. It's probably not substantially new, and I'm sure it's not unbreakable.
  283. Read the snake oil FAQ at
  284. http://www.interhack.net/people/cmcurtin/snake-oil-faq.html
  285.  
  286. ------------------------------
  287.  
  288. Subject: What should I read to learn how to secure my computers?  What should
  289.     I read to learn about computer security?
  290.  
  291. The number one thing to do is to install all of your vendor's security
  292. patches and to disable unused services (in unix, comment things out of
  293. /etc/inetd.conf, and remove daemon invocations from /etc/rc* (details
  294. depend on OS version)).  See some other basic information in
  295. http://www.cert.org/tech_tips/unix_configuration_guidelines.html
  296. Subscribe to the CERT advisory list and to your vendor's security alert list
  297. to keep current in future.
  298.  
  299. If you're trying to learn your way around unix and internet security in
  300. general, I suggest you want to start with a good grasp of unix basics, e.g.
  301. from the Kernighan & Pike book.  You'll also want to be strong in C, which
  302. education you can begin with the Kernighan & Ritchie book.  (Of course
  303. there are alternatives to both.)
  304.  
  305. If you're feeling strong after that and want to go for the details, read
  306. Farmer & Venema's "Improving the Security of Your Site by Breaking Into
  307. it" at http://www.fish.com/security/admin-guide-to-cracking.html , and
  308. the Cheswick & Bellovin firewalls book.  For a gentler approach covering
  309. a broader range of security issues, read Spafford & Garfinkel's "Practical
  310. Unix and Internet Security".  A more hands-on-oriented book about firewalls
  311. is Chapman & Zwicky.
  312.  
  313. If you're interested in cryptography, the canonical book is Schneier's
  314. "Applied Cryptography", and you might be interested in RFC 1750.
  315.  
  316. I've received a recommendation for "Windows NT Security" by Rutstein.
  317.  
  318. Some URLs with security notes for particular systems (in addition to those
  319. above, and don't forget your vendor's security patch list):
  320.  
  321. Linux security:
  322.     http://metalab.unc.edu/LDP/HOWTO/Security-HOWTO.html
  323.  
  324. Irix (out of date but contains notes which are still important):
  325.     ftp://rtfm.mit.edu/pub/faqs/sgi/faq/security
  326.  
  327. Improve assorted file permissions for solaris 2.2 through 2.6, changing
  328. the pkg database to match:
  329.     ftp://ftp.fwi.uva.nl/pub/solaris/fix-modes.tar.gz
  330.  
  331. Solaris security:
  332.     http://www.sunworld.com/common/security-faq.html
  333.  
  334. Unix versus Windows NT:
  335.     [http://www.unix-vs-nt.org is now a domain squatter; does this page
  336.      have a new home, anyone?]
  337.  
  338. (Canonical URLs for additional platforms solicited!  Non-vendor URLs preferred.)
  339.  
  340. ------------------------------
  341.  
  342. Subject: Is there a newer version of cops?
  343.  
  344. No.  Version 1.04+ is a bit old but performs some functions which are still as
  345. useful as they ever were.  (And the message "/usr/lib/sendmail could have a
  346. hole/bug!" is still right although the cert advisory quoted could be changed.)
  347.  
  348. (1.04+ contains an assortment of minor fixes and enhancements to 1.04,
  349. and was released in 1993 by the original author (Dan Farmer).)
  350.  
  351. ------------------------------
  352.  
  353. Subject: Tripwire fails the self-test, dumps core when building the database,
  354.     and dumps core when verifying.
  355.  
  356. Fails the self-test (on fast machines):
  357.  
  358. You have to slow it down (just the self-test scripts, not the tripwire binary
  359. itself).  The test scripts create and then update a file, and then fail to
  360. detect that the timestamp has changed.  But this is ok, because the timestamp
  361. has indeed not changed, because this all happens within a second on some
  362. modern machines.  This occurs in a few places in the test scripts.  If a
  363. second-boundary happens to be crossed during this brief interval, then that
  364. particular test will succeed, but another one might fail soon.
  365.  
  366. In the tests directory, edit 3 of the 4 files named test.*.sh:
  367. in test.escape.sh, add "sleep 1" on line 46 (in the cert version), just before
  368. running tripwire; in inter and update, un-comment-out the "sleep 1".
  369. If this isn't good enough (obscure but can happen), use "sleep 2".  See
  370. ftp://coast.cs.purdue.edu/pub/COAST/Tripwire/README-third
  371.  
  372.  
  373. Dumps core when building the database (if you have 8-bit chars in filenames):
  374.  
  375. Tripwire 1.2 contains a bug relating to octal printing of 8-bit chars in file
  376. names.  The bug occurs in filename_escape() in src/utils.c.  Double the size
  377. of the "octal_array" to contain all 256 possible entries, and change
  378. octal_array[(int)(*pcin)] to octal_array[*pcin & 255] farther down.
  379. (This only works if you have eight-bit bytes, of course, but most of us do.)
  380.  
  381.  
  382. Dumps core when verifying (this bug surfaces on some systems only):
  383.  
  384. In config.parse.c just before the end of configfile_read(), on line 356 in
  385. the tripwire 1.2 distribution, there is a "rewind(fpout);".  It should be
  386. conditional on "specified_configmode" as in the previous 'if' statement:
  387. at this point the values "fpin" and "fpout" are the same (see line 184), so
  388. it is actually rewinding the fp it might have closed in the previous line.
  389. So simply add the word "else" before the "rewind".  (Perhaps change "fpout"
  390. to "fpin" for clarity, although this won't affect its behaviour.)
  391.  
  392. ------------------------------
  393.  
  394. Subject: Cops won't "make" in some versions of linux (GNU).
  395.  
  396. Remove the '#' from "BRAINDEADFLAGS" in the makefile.
  397. (This adds a "-lcrypt" to the compilation of pass.c.)
  398.  
  399. ------------------------------
  400.  
  401. Subject: Various problems with building anything under Solaris, especially
  402.     "/usr/ucb/cc:  language optional software package not installed".
  403.  
  404. This is not a security question.  Please ask in a solaris newsgroup instead,
  405. or ask someone near you because it's a detail, and easy to diagnose in
  406. person but sometimes hard to diagnose over the net (depending on the problem).
  407.  
  408. If you get the message "language optional software package not installed",
  409. this means that the compiler is not installed.  (Like, duh.)  Sun doesn't
  410. include a C compiler with Solaris.  Get gcc.  Put it in your path and/or in
  411. the makefile (e.g. CC=gcc).  Perhaps do "ln -s gcc /usr/local/bin/cc" so that
  412. /usr/local/bin/cc points to /usr/local/bin/gcc, and make sure /usr/local/bin
  413. is near the front of your path.  This is still not a security question.
  414.  
  415. If you are using the Sun compiler tools, or having problems with other missing
  416. commands such as "make" or "ar", perhaps you need to add /usr/ccs/bin to
  417. your path.  This is not a security question either.
  418.  
  419. ------------------------------
  420.  
  421. Subject: What's that weird URL with SATAN/SAINT?  I'm not running a web server!
  422.     or SATAN says "Can't find my own hostname".
  423.  
  424. SATAN acts as a web server so that it can use HTML conveniently.  The main
  425. thing it gets out of HTML is its hypertext capabilities (you can click on
  426. stuff).
  427.  
  428. The web browser communicates with it using the HTTP protocol.  This allows
  429. it to generate responses to queries dynamically, rather than having to
  430. generate a huge number of static files (to be accessed via file://).  It
  431. includes a cryptographic random number at the beginning of the URL so that
  432. others can't contact your copy of SATAN and retrieve the information it's
  433. supplying.
  434.  
  435. If SATAN claims it "can't find my own hostname" or if the web browser can't
  436. resolve your hostname in the URL, try adding your hostname to /etc/hosts.
  437. You can list multiple hostnames for a given IP address in /etc/hosts; among
  438. them should be the output from the "hostname" command and also your
  439. fully-qualified domain name ("myname.dept.organization.org" rather than
  440. "myname" or "myname.dept").
  441.  
  442. ------------------------------
  443.  
  444. Subject: SATAN doesn't display right in my web browser; it asks me to save
  445.     the file.
  446.  
  447. Newer web browsers seem to use different algorithms in guessing mime types
  448. when the web server doesn't supply them.  Anyway, web servers are supposed to
  449. supply the correct mime type and it's easy to fix SATAN to do so.
  450.  
  451. Add, in perl/html.pl, in process_html_request before it sends anything
  452. (actually I see I put it just before the "Make sure they gave us the right
  453. magic number"):
  454.  
  455.     # local bug fix: must send http response code and content type header
  456.     print CLIENT "HTTP/1.0 200 Ok\nContent-Type: text/html\n\n";
  457.  
  458. There's some bad advice out there about adding a handler with the ".pl"
  459. suffix in your netscape preferences.
  460. 1) This is wrong.  What's relevant about the satan response is that it is
  461. indeed html code, not the fact that the requesting URL ends in .pl.  A web cgi
  462. URL might end in .pl but the program might return a gif.  Unlike with e-mail,
  463. mime types are an integral part of the http protocol.
  464. 2) This is dangerous (the version of the advice which says to set it to
  465. invoke the perl interpreter).  You don't want to execute arbitrary perl code
  466. off the net.  It also won't work, because the satan response is html code, not
  467. a perl program.
  468.  
  469. The recommendation to deactivate an existing ".pl" handler is ok, but the
  470. above is better imho; it fixes the real problem, and the fix won't go away
  471. when you switch web browsers or use a different account.
  472.  
  473. ------------------------------
  474.  
  475. Subject: How do I find all setuid and setgid files?
  476.  
  477. find / -local -type f \( -perm -4000 -o -perm -2000 \) -print
  478.  
  479. or to do an "ls -l" of them:
  480.  
  481. find / -local -type f \( -perm -4000 -o -perm -2000 \) -exec ls -ld '{}' \;
  482.  
  483. You may want to add the "-u" option to ls to see last-accessed times rather
  484. than last-modified times (esp to help gauge how harmful it would be to
  485. unsetuid the file).
  486.  
  487. Some versions of "find" don't have the "-local" option.  Its purpose is to
  488. avoid searching nfs volumes.  If you don't have any nfs mounts, you can omit
  489. the "-local".  If you do, here are some other possibilities:
  490.     * On some systems you can do something like
  491.         find / -fstype nfs -prune -o -type f \( -perm -4000 ...
  492.     * Some systems have "-xdev" or "-mount", which prevent find from
  493.       traversing mounts.  But then you have to run it for each local
  494.       filesystem separately.
  495.     * Do the check with nfs filesystems unmounted (e.g. single-user mode).
  496.     * As an alternative to find, "ncheck -s" will tell you all setuid and
  497.       setgid files, plus all device files (which is something of equal
  498.       interest, although usually much less problematic in OS distributions).
  499.       It too must be run separately for each filesystem.
  500.  
  501. Please note that this is insufficient if you suspect backdoors have been
  502. installed on your system.  The backdoor installation activity could have
  503. included modifying the "find" command.  The purpose of the above is to find
  504. locally-installed or vendor-supplied security bugs waiting to happen, not to
  505. find backdoors.
  506.  
  507. Also note that on some systems, "-local" doesn't do what you'd think, because
  508. it still traverses the entire remote filesystem, and rejects all nodes in it
  509. as non-local.  In this case you want "! -local -prune -o", i.e. if not local
  510. prune the search, else ... .
  511.  
  512. ------------------------------
  513.  
  514. Subject: Tcp wrappers (tcpd) thinks all hosts are 0.0.0.0 in Solaris 8 or in
  515.     some versions of AIX.
  516.  
  517. This is because the line for that service in inetd.conf still says "tcp6".
  518. The vendor-supplied application you are wrapping can handle IPv6 (aka
  519. "IP-NG") connections, but the version of tcp wrappers you are using cannot.
  520. Change "tcp6" to "tcp" on inetd.conf lines which you edit to invoke the
  521. standard version of tcp wrappers.
  522.  
  523. For ftpd for AIX, I've heard that you then need to add the '-f' option to
  524. the ftpd invocation.  (Confirmation requested.)
  525.  
  526. Alternatively, use a "IPv6-aware" version of tcp wrappers from
  527. ftp://ftp.porcupine.org/pub/ipv6/
  528.  
  529. ------------------------------
  530.  
  531. Subject: I can't get .rhosts/.shosts to work with ssh.
  532.  
  533. If ssh doesn't do what you want, the output of "ssh -v" may be helpful.
  534.  
  535. For .rhosts or .shosts (or hosts.equiv or shosts.equiv) to take effect with
  536. ssh with the default configuration, a few somewhat unobvious things must be
  537. the case.  These are all good restrictions and the rationale is included here.
  538.  
  539.     * The request must be coming in from a "privileged port"; thus, the ssh
  540.       client must be setuid.  Without this restriction, any user could
  541.       masquerade (for the purposes of passwordless login) as any other on the
  542.       same source machine.  (Even with it, root can; but there's no way to
  543.       restrict THAT without the user typing something or involving a third
  544.       machine (i.e. some hardware which root doesn't have access to).)  Also,
  545.       the ssh client must be able to read /etc/ssh_host_key (the private one)
  546.       to be able to do the public key authentication thing to prove you're on
  547.       the host whose IP address you're using.  N.B. that the 1.2.25 makefile
  548.       sometimes turns off the setuid bit on ssh when doing a "make install"
  549.       (it's a bug in the makefile, fixed in 1.2.26).
  550.  
  551.     * .rhosts or .shosts must be owned by the appropriate user and not be
  552.       writable by group or others.  Sshd does not check for the situation of
  553.       single-user groups common on some versions of unix these days (esp some
  554.       versions of GNU/linux); you have to chmod g-w .rhosts/.shosts if your
  555.       umask is 2.  (There is no way for sshd to detect the single-user group
  556.       situation; current membership of size one doesn't tell you its history.)
  557.       Similarly, your home directory should not be writable by group or others.
  558.  
  559.     * The source host must be in /etc/ssh_known_hosts or
  560.       ~user/.ssh/known_hosts on the target machine.
  561.       This is the difference between "RhostsRSAAuthentication" (allowed by
  562.       default) and "RhostsAuthentication" (disallowed by default).  Without
  563.       this, ssh is not gaining you any login security, although it is still
  564.       gaining you anti-sniffing security.
  565.  
  566. When all else fails, try "ssh -v".
  567. Take further questions to comp.security.ssh.
  568.  
  569. ------------------------------
  570.  
  571. Subject: Should I block all ICMP at my firewall/router?
  572.  
  573. No.  You need to allow the "can't fragment" message through or you will lose
  574. connectivity to some number of sites with wacky packet sizes on their local
  575. nets (notably token ring).  See http://www.worldgate.com/~marcs/mtu/
  576.  
  577. Less crucially but still somewhat important, if you block the "destination
  578. unreachable" message then you'll get timeouts, after a long wait, in some
  579. cases when you could have received immediate "no route to host" messages.
  580.  
  581. But blocking some of the rest might not be a bad idea, especially "redirect".
  582.  
  583. ------------------------------
  584.  
  585. Subject: How do I prevent my machine from announcing OS version, daemon
  586.     version, etc in the banner message?
  587.  
  588. In unix, find the daemon in question, possibly by finding its line
  589. in /etc/inetd.conf, and read its man page.  For complex config files
  590. (e.g. sendmail), search in the config file for the constant portions of the
  591. string it's outputting (e.g. in sendmail.cf find the string "Sendmail" with
  592. a capital 'S').  For telnetd, some systems have "-h" to suppress the greeting
  593. and other systems' banners come from a file called something like /etc/issue.
  594. (Note that in redhat linux, you really want to modify /etc/rc.d/rc.local
  595. rather than (or in addition to) /etc/issue*, because it regenerates
  596. /etc/issue* upon boot.)  For Solaris 2.6 and greater, put "BANNER=" (without
  597. the quotes) in /etc/default/telnetd and/or /etc/default/ftpd.  The telnetd
  598. included with Solaris <2.6 and SunOS can't suppress the banner, but there's
  599. no need to use that particular software; you could use GNU telnetd or wu-ftpd,
  600. for example; or you might edit the binary, as the strings appear in it.
  601.  
  602. But this might not really be a security issue and it might not be worth
  603. your effort.  Suppressing banners probably doesn't restrict any information
  604. which is genuinely useful to an attacker.  If an attacker has some "exploit"
  605. program for sendmail 1.2.3 only, then rather than checking the banner to see
  606. if your machine is in fact running sendmail 1.2.3, they might as well just run
  607. the exploit program, which is a direct check of whether you're vulnerable.
  608. Whereas the banner suppression *will* interfere with some kinds of checking
  609. of daemon versions which you yourself may want to do occasionally.
  610.  
  611. ------------------------------
  612.  
  613. Subject: How do I recover from forgetting my root password?  (Similarly:
  614.     I messed up the root line in /etc/passwd and can't su or login as
  615.     root; what do I do?)
  616.  
  617. Basically, you want to boot from CD/floppy or in single-user mode.
  618. Single-user mode in some versions of unix still prompts for the root
  619. password, but can nevertheless be used to recover from messing up the root
  620. line in /etc/passwd farther along, e.g. changing the shell to something
  621. inappropriate.  And in some versions of unix it doesn't ask for the password.
  622.  
  623. To boot in single-user mode, in a prom monitor (e.g. L1-A on a Sun, or press
  624. ESC while booting an SGI), you want a command like "single" or "boot -s"
  625. or "b -s".  At the linux LILO prompt, you want something like "linux s".
  626. If "linux s" gives you problems, "linux init=/bin/sh" might bypass the
  627. normal boot sequence and just give you a shell, but you'll have to remount
  628. the root filesystem (see below).
  629.  
  630. After single-user mode, it's cleaner to reboot rather than to press ^D to
  631. do the multiuser boot, because the init "runlevel" mechanism is hacky.
  632.  
  633. It might be more rewarding to boot from OS installation media.  They usually
  634. give you the opportunity to run a shell (e.g. in irix inst, type "sh"; in
  635. redhat linux, press ctrl-alt-F2; in solaris, get a menu with the right button
  636. in the background and select "command tool" in the "utilities" submenu).
  637. In this case, do a "df" to find your root partition on something like /root
  638. or /mnt (or, in solaris, /a).
  639.  
  640. Sometimes it's easier to make like a "cracker" and break in to it.
  641. I imagine that most people who forget their root password have machines
  642. which can easily be broken into...
  643.  
  644. Once you're in, you can edit the password file (or /etc/shadow as
  645. appropriate), or you can change the password without supplying the old one
  646. as root by typing "passwd root".  (Depending on how you got there, a plain
  647. "passwd" might not know it's root's password you're trying to change.)
  648.  
  649. If you clear the password entry, be disconnected from the internet until
  650. you've set a new root password (probably after a normal reboot).
  651.  
  652. If the above doesn't answer your question, please look for a faq specific
  653. to your version of unix; if you end up posting here, please state precise
  654. version of unix including version number (e.g. "irix 5.3", not just "5.3").
  655.  
  656. Problems editing the password file or running "passwd root" include:
  657.  
  658. /usr might not be mounted in single-user mode (and /bin might be a symlink to
  659. /usr/bin, so most things might be on /usr).  You can probably just type "mount
  660. /usr" or "/sbin/mount /usr".  Other filesystems might also be unavailable
  661. but probably aren't needed just to change the password (and you're about
  662. to reboot to get things back to normal after you change root's password).
  663.  
  664. The root filesystem might be mounted read-only, depending on how you
  665. got there.  "mount / -o remount,rw" might fix this.
  666.  
  667. ------------------------------
  668.  
  669. Subject: Is a portscan of a machine malicious/illegal/unfriendly?
  670.  
  671. This is included here because it's a recurring flamefest.  Please avoid
  672. simply repeating the same old basic statements, because we've heard 'em all.
  673.  
  674. First of all, what a portscan is:  Basically (there are myriad variants),
  675. it's an attempted connection to every single port number on a given machine
  676. or range of machines.  Suppose you want to break in to a particular machine.
  677. First thing you might do is to run a port-scanner to find out what all the
  678. "open ports" are (ports with a listener).  Then you see, aha there's an
  679. imapd, let's try the imapd exploit program.  Rather than just trying all
  680. sorts of programs which wouldn't even connect let alone break in.
  681.  
  682. Portscanning your own machine is valuable; you may find listeners you didn't
  683. know were there, and then you can close them off and/or check their security.
  684.  
  685. Since you have to secure each service on its own anyway, some people argue
  686. that there's no need to defend against portscanning itself.  On the other
  687. hand, you might configure your system to page you, or delete all your files,
  688. or perform some such useful action when it detects a port-scanning in
  689. progress.  Some defense systems cease accepting connections of any kind from
  690. that IP address when they detect a portscan, and some sysadmins write to your
  691. ISP and try to get you kicked off.  This leads to "stealth port-scanners"
  692. which try to avoid triggering the alarms by various means.
  693.  
  694. Some people argue that there's not too much in the way of useful action you
  695. can take automatically when you detect a port-scanning in progress, and
  696. "counterattack" software is unwise and can be used via forgery to launch
  697. attacks from your machine.
  698.  
  699.  
  700. Now, the basic portscanning arguments.  (The discussion is only about machines
  701. you don't admin, obviously; there is an additional, finer dispute about the
  702. situation with machines you have some legitimate association with but not as
  703. sysadmin, but I don't propose to address that intermediate situation here.)
  704. I might be willing to add other statements to this list if they're similarly
  705. terse, and certainly do let me know if you feel I've inadequately represented
  706. a viewpoint, except that I reserve the right to apply a sense of humour.
  707.  
  708. Portscanning has been argued to be malicious/illegal/satanic because (see
  709. rebuttals in subsequent section):
  710. - a portscan is always/usually a prelude to or part of an attack, like testing
  711. doorknobs to see if they're unlocked
  712. - my pager beeps when I get portscanned, which takes my time unfairly (aka my
  713. machine crashes, sends lots of e-mail, changes the root password to "soup")
  714. - if everyone portscans a few machines for fun, in total there will be a
  715. constant barrage of portscans to all/many/some machines, overloading them
  716. - an attempt to commit a criminal offence is itself a criminal offence
  717. - portscanning someone ELSE's machine is a completely different matter than
  718. portscanning one's own
  719. - a stealth portscan shows criminal intent even if you argue that a
  720. traditional portscan does not
  721. - any connection to a machine you're not explicitly authorized to use
  722. constitutes the criminal offence of unauthorized access to a computer (i.e.
  723. it's already a breakin)
  724. - various lame analogies
  725.  
  726. Portscanning has been argued to be innocent/salutory/pure because (see
  727. rebuttals in previous section):
  728. - the "hands-on imperative": people should be curious, people should explore,
  729. people should think
  730. - a portscan uses a negligible amount of resources on the target machine
  731. - if a portscan is a prelude to an attack, the ATTACK is what's wrong; the
  732. portscan is not wrong, and is not usually a prelude to an attack anyway
  733. - legally, "mere preparation" does not constitute an attempt
  734. - having a listener on a port solicits connections; you can't complain that
  735. someone makes the connection to the advertised port; port numbers are
  736. "well-known" for a reason
  737. - if a portscan crashes your system, it's crappy anyway; if your pager beeps
  738. when you get portscanned, that's a stupid configuration
  739. - if your machine is connected to the internet, it's your job as sysadmin to
  740. deal with network activity and you shouldn't complain if you don't like it
  741. - various lame analogies
  742.  
  743. NOTE!  The above two sections are a pair.  Don't cite a point from one
  744. section in your favour without examining its rebuttal in the other section!
  745. I am not attempting to resolve this issue here, just to decrease repetition.
  746.  
  747. Note re analogies:  Analogies are a good way to express a point of view but
  748. usually the attempt to draw conclusions from them is essentially circular.
  749. I recommend using an analogy to express views but not to argue.  Example of a
  750. useful analogy:  "Looking through someone's protected files without their
  751. permission is like looking through their desk drawers."  Very connotative;
  752. conveys concepts of reasonable expectations of privacy despite organizational
  753. ownership of the infrastructure; shows what the speaker thinks some of the
  754. fundamental issues are; but note it's still not a proof of anything.  Example
  755. of a useless analogy:  "Portscanning isn't like trying to turn the doorknob,
  756. it's like looking at the doorknob while passing by on the street." Conveys no
  757. information other than "I think portscanning is ok".  Neither is an argument,
  758. but one of them gives a wealth of information as to the basic perspective of
  759. the speaker and the other is useless.
  760.  
  761. ------------------------------
  762.  
  763. Subject: Can my ISP/employer monitor [various things I'm doing]?
  764.  
  765. Do they have the technical ability?  Yes.  Your packets go through their
  766. equipment.  Your packets are identified with your IP address, and they
  767. contain the IP address of the destination; your ISP's routers need to know
  768. the destination IP addresses to be able to route your packets.
  769.  
  770. The data you send (e.g. passwords, mail message contents, URLs) is all also
  771. easily available, in the body of the packets.  If you use www.anonymizer.com
  772. (in its non-cryptographic mode), the URL you request is still just as
  773. available in the outgoing packets.
  774.  
  775. If you use some form of encryption, e.g. ssh, they could still at least tell
  776. the destination, even if the contents are unreadable.  In general, encryption
  777. is the only way to render at least the contents unsnoopable, and only then if
  778. the encryption and decryption are both done on machines which the overseers
  779. DON'T control, and plain text not transmitted on any networks on which the
  780. overseers have machines or are able to attach machines.  If you use their
  781. computers (including if you run the encryption program on a unix machine
  782. operated by them), then everything you do is available to them, theoretically.
  783.  
  784. But perhaps you were asking "*May* my ISP monitor X": is it allowed, is it
  785. ethical.
  786.  
  787. I think most sysadmins would feel that once there is reasonable suspicion that
  788. you are acting improperly (breaking into computers, violating the acceptable
  789. use policy, etc), that it is ethical for the admins to take a closer look.
  790.  
  791. It's unlikely that it's *illegal* for them to look at your stuff or what
  792. you're doing, although there are some exceptions.  Under certain court orders
  793. or subpoenas, it may be illegal for them *not* to look at your files or what
  794. you're doing.
  795.  
  796. Many believe inquiry not in a case of suspicion and not under a court order is
  797. unethical.  This is a potential topic for discussion in comp.security.misc and
  798. comp.security.unix, but posters should refrain from the argument that "they
  799. paid for it, they can do what they like with it" (which is sometimes advanced
  800. in the case of employers or educational institutions).  This is surely false
  801. in general and thus not the basis for a convincing argument.  For example,
  802. if they do something criminal with their equipment, it's a criminal act,
  803. they can be charged criminally, it doesn't matter that they paid for it.
  804. Similarly, if they do something unethical, it's unethical even though they
  805. paid for it.  The whole concept of professional ethics is based on the
  806. idea that ethics transcends legality: the idea that an action can be legal
  807. but unethical.  If "they paid for it" means that all legal acts are ethical,
  808. then you've pretty much defined away the whole idea of professional ethics.
  809. *That* is probably best not attempted on comp.security.misc/unix.
  810.  
  811. ------------------------------
  812.  
  813. Subject: Why do some people get so upset when system penetration is called
  814.     "hacking"?
  815.  
  816. The word "hacker" has a long and honourable tradition of referring to a
  817. certain category of skilled computer programmer.  For example, see Eric
  818. Raymond's "How To Become A Hacker" at
  819. http://www.tuxedo.org/~esr/faqs/hacker-howto.html
  820.  
  821. Some people who break into computers definitely *are* hackers: they discover
  822. interesting security flaws through enthusiastic exploration of technical
  823. information and artifacts, combined with skilled computer programming.
  824. Many people here would quite reasonably call them hackers, while lamenting
  825. their choice of focus.
  826.  
  827. However, most people who compromise computer systems are not "hackers" in
  828. this sense.  Numerically speaking, these days most people who break into
  829. computers use canned "exploit" programs or otherwise follow procedures
  830. formulated by others.  So many people, on this newsgroup and elsewhere,
  831. try to observe a distinction between the terms "cracking" and "hacking".
  832. "Hacking" is not typically destructive, and its basic outlook is responsible
  833. for the creation of a lot of the computer software we all use, whereas
  834. "cracking" involves breaking or compromising something.  Also see
  835. http://www.interhack.net/hacker.html
  836.  
  837. Other people say they're just words, and for better or for worse, the
  838. media has conflated them in almost all people's minds, so let's give up.
  839. I personally disagree with that view; and in particular I think that for
  840. people who stray across the borderline between acceptable and unacceptable
  841. system "exploration", it is helpful and can turn them into productive
  842. citizens and maybe even keep them out of jail to discuss the difference
  843. between hacking and cracking.
  844.  
  845. All these are the reasons that some people get upset when system penetration
  846. is called "hacking".  And some people don't.
  847.