· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Honeypot-HOWTO

¹ø¿ª : ÀÌ»óÀÎ, delpai at hotmail dot com

ÃÖ±Ù¿¡ Çã´ÏÆÌ¿¡ ´ëÇØ °øºÎÇϸ鼭 ¹ø¿ªÇغ¸¾Ò½À´Ï´Ù. ¹ø¿ªÀÌ ¸Å²ô·´Áö ¸øÇÑ ºÎºÐµµ ¸¹ÀÌÀÖÀ¸´Ï °íÄ¥ºÎºÐÀÖÀ¸¸é °íÃÄÁÖ¼¼¿ä ^^;

-- delpai 2004-07-09 16:43:58

1. ¸Ó¸®¸»

How To Build A Honeypot by Lance Spitzner on 06/09/02

This article is a follow up to the "Know Your Enemy" series. Many people from the Internet community asked me how I was able to track black-hats in the act of probing for and compromising a system. This paper discusses just that. Here I describe how I built, implemented, and monitored a honeypot network designed specifically to learn how black-hats work.

2. What is a Honeypot?


For me, a honeypot is a system designed to teach how black-hats probe for and exploit a system. By learning their tools and methods, you can then better protect your network and systems. I do not use honeypots to capture the bad guy. I want to learn how they work without them knowing they are being watched. For me, a well designed honeypot means the black-hat never knew he was being tracked. There are a variety of different approaches on how you can do this. Mine is only one of many.

Before I continue, I would like to post a disclaimer. First, no honeypot can catch/capture all the bad guys out there. There are too many ways to spoof/hide your actions. Instead of going into detail on how this is possible, I highly recommend you check out Insertion, Evasion, and Denial of Service: Eluding Network Intrusion Detection or fragrouter. Second, keep in mind that you are playing with fire. Someone far more advanced then you may compromise your honeypot, leaving you open to attack. Third, throughout this paper I use the term black-hat. I define a black-hat as anyone who is attempting un-authorized access to a system. This could be an 15 year old kid from Seattle, or a 45 year old company employee in accounting. Also, I refer to our black-hat as a he, however we have no idea what the true gender of the black-hat is.

3. Where to Begin?


There are a variety of different approaches to building a honeypot. Mine was based on simplicity. Build a standard box that I wanted to learn how the black-hat community was compromising. In this case it was Linux, but you can just as easily use Solaris, NT, or any other operating system. Don"t do anything special to this system, build it as you would any other. Then put the system on the Internet and wait. Sooner or later someone will find the system and attack it. The system is built to be attacked and compromised, someone will gain root on that system, that is the goal. However, while they are gaining root (or Admin), you are tracking their every move.

This approach is different from other concepts. Network Associates has built a commercial product called CyberCop Sting, Designed to run on NT, this product can emulate variety of different systems at the same time, including Linux, Solaris, Cisco IOS, and NT. Fred Cohen has developed the deception toolkit, which are a variety of tools intended to make it appear to attackers as if a system has a large number of widely known vulnerabilities. One of my favorites is NFR"s BackOfficer Friendly, which emulates a Back Orifice server. All of these have their advantages. However, my goal was to build a honeypot that mirrored my production systems, so I could better understand what vulnerabilities and threats existed for my production network. Also, the fewer modifications I make to the honeypot, the less chance the black-hat will find something "fishy" on the box. I do not want the black-hat to ever learn that he was on a honeypot.

4. The Plan


My plan was simple. Build a box I wanted to learn about, put it on the network, and then wait. However, there were several problems to this. First, how do I track the black-hats moves? Second, how do I alert myself when the system is probed or compromised? Last, how do I stop the black-hat from compromising other systems? The solution to this was simple, put the honeypot on its own network behind a firewall. This solves a variety of problems.

³ªÀÇ °èȹÀº °£´ÜÇÏ´Ù. ³»°¡ ¿øÇÏ´Â ½Ã½ºÅÛÀ» ±¸ÃàÇÏ°í, ³×Æ®¿öÅ©¿¡ ¿¬°áÇÏ°í ±â´Ù¸°´Ù. ±×·¯³ª ÀÌ°Í¿¡ ´ëÇؼ­´Â ¸î°¡Áö ¹®Á¦°¡ ÀÖ´Ù. ù¹ø°, ¾î¶»°Ô ÇØÄ¿°¡ ¿À°Ô ÇÒ°ÍÀΰ¡? µÎ¹ø°, ¾î¶»°Ô ½Ã½ºÅÛÀÌ Ä§ÀÔ´çÇϰųª ħÇصǾúÀ»¶§ °æ°íÇÒ °ÍÀΰ¡? ¸¶Áö¸·À¸·Î, ¾î¶»°Ô ´Ù¸¥ ½Ã½ºÅÛÀ» ħÇØÇÒ·Á´Â ÇØÄ¿¸¦ ¸ØÃâ°ÍÀΰ¡? ÇØ°á¹ý ¿ª½Ã °£´ÜÇÏ´Ù. ¹æÈ­º® µÚÀÇ ³×Æ®¿öÅ©¿¡ Çã´ÏÆÌÀ» ¼³Ä¡ÇÏ¸é µÈ´Ù. ÀÌ°ÍÀº ´Ù¾çÇÑ ¹®Á¦¸¦ ÇØ°áÇÑ´Ù.

(Black Hats: ¾ÇÀÇÀûÀÌ°í Æı«ÀûÀÎ Å©·¡Ä¿ÀÏ ¼ö·Ï black hat¿¡ °¡±õ°í, Å©·¡Ä¿¿Í °Å¸®°¡ ¸Ö ¼ö·Ï white hat¿¡ °¡±õ½À´Ï´Ù.)

First, most firewalls log all traffic going through it. This becomes the first layer of tracking the black-hat"s moves. By reviewing the firewall logs, we can begin to determine how black-hats probe our honeypot and what they are looking for.

ù¹ø°, ´ë°³ ¹æÈ­º® ·Î±×´Â µé¾î¿À°í ³ª°¡´Â ¸ðµç Æ®·¡ÇÈÀÌ´Ù. ÇØÄ¿°¡ Áö³ª°£ ÀÚ¸®ÀÇ Ã¹¹ø° ·¹À̾ µÈ´Ù. ¹æÈ­º® ·Î±×¸¦ Á¶»çÇÏ¿© ÇØÄ¿°¡ ¿ì¸®ÀÇ Çã´ÏÆÌÀ» Á¶»çÇÏ°í ¹«¾ùÀ» º¸°í °¬´ÂÁö ¾Ë ¼ö ÀÖÀ» °ÍÀÌ´Ù.

Second, most firewalls have some alerting capability. You can build simple alerts whenever someone probes your network. Since no one should be connecting to your honeypot, any packets sent to it are most likely black-hats probing the system. If there is any traffic coming FROM the honeypot out to the Internet, then the honeypot was most likely compromised. For an example on how set up alerting with Check Point FireWall-1, click here.

µÎ¹ø°, ´ë°³ ¹æÈ­º®Àº °æ°í ±â´ÉÀ» °¡Áö°í ÀÖ´Ù. ´ç½ÅÀº ´©±º°¡°¡ ³×Æ®¿öÅ©¸¦ Á¶»çÇÒ ¶§¸¶´Ù °£´ÜÇÑ °æ°í¸¦ ¸¸µé ¼ö ÀÖ´Ù. ±× ÈÄ ´ç½ÅÀÇ Çã´ÏÆÌ¿¡ ´©±º°¡°¡ Á¢¼ÓÇÒ °ÍÀÌ°í, ¾î¶² ÆÐŶÀÌ ½Ã½ºÅÛÀ» Á¶»çÇÑ ÇØÄ¿¿¡°Ô º¸³»Áú °ÍÀÌ´Ù. ¸¸¾à ÀÎÅͳÝÀ» ÅëÇØ Çã´ÏÆÌÀ¸·ÎºÎÅÍ ¾î¶² Æ®·¡ÇÈÀÌ »ý±ä´Ù¸é, Çã´ÏÆÌÀº ´ë°³ ħÇظ¦ ´çÇÒ °ÍÀÌ´Ù. üũ Æ÷ÀÎÆ® ¹æÈ­º®-1¿¡ °æ°íÇÒ ¼ö ÀÖ´Â ±â´ÉÀ» ¼³Á¤ÇÑ ¿¹Á¦´Â ´ÙÀ½À» Ŭ¸¯Çضó.([http]http://www.infosecwriters.com/intrusion.html)

Third, the firewall can control what traffic comes in and what traffic goes out. In this case, the firewall lets everything from the Internet in, but only limited traffic out. This way the black-hats can find, probe, and exploit our honeypot, but they cannot compromise other systems. The goal is to have our honeypot behind a controlled system. Most firewalls will do, as long as it can both control and log traffic going through it.

¼¼¹ø°, ¹æÈ­º®Àº ¾î¶² Æ®·¡ÇÈÀÌ µé¾î¿À°í ¾î¶² Æ®·¡ÇÈÀÌ ³ª°¡´Â °ÍÀ» Á¶ÀýÇÒ¼ö ÀÖ´Ù. ÀÌ °æ¿ì, ¹æÈ­º®Àº ÀÎÅͳÝÀ¸·ÎºÎÅÍ ¸ðµç°ÍÀÌ µé¾î¿À°Ô ÇÏ°í, ´ÜÁö ³ª°¡´Â Æ®·¡ÇÈÀ» Á¦ÇÑÇÑ´Ù. ÀÌ¿Í°°Àº ¹æ¹ýÀ¸·Î ÇØÄ¿´Â ã°í, Á¶»çÇÏ°í, Çã´ÏÆÌÀ» ħÇØÇÒ ¼ö ÀÖÀ¸³ª ´Ù¸¥ ½Ã½ºÅÛÀ» ħÇØÇÏÁö´Â ¸øÇÑ´Ù. °á·ÐÀº Á¦¾î ½Ã½ºÅÛ µÚ¿¡ Çã´ÏÆÌÀ» ¸¸µå´Â °ÍÀÌ´Ù. ´ë°³ ¹æÈ­º®À¸·Î ÀÌ°ÍÀ» ÅëÇØ ³ª°¡´Â Æ®·¡ÇÈ ·Î±×¿Í Á¦¾î¸¦ µ¿½Ã¿¡ ÇÒ¼ö ÀÖÀ» °ÍÀÌ´Ù.

5. Tracking Their Moves


±×µéÀÇ ¿òÁ÷ÀÓÀ» ÃßÀûÇغ¸ÀÚ.

Now, the real trick becomes how to track their moves without them knowing it. First, you do not want to depend on a single source of information. Something can go wrong, things can be erased, etc. I prefer to track in layers. That way, if something does go wrong, you have additional sources of information. Also, you can compare different sources to paint a better picture.

ÀÌÁ¦ ¾î¶»°Ô ÇØÄ¿°¡ ¾ËÁö ¸øÇÏ°Ô ÇØÄ¿ÀÇ ¿òÁ÷ÀÓÀ» ÃßÀûÇÒ¼ö ÀÖ´ÂÁö º¸ÀÚ. ù¹ø°, ´ç½ÅÀº ´ÜÀÏ ÀÚ·áÀÇ Á¤º¸¿¡ ÀÇÁ¸Çϱ⸦ ¿øÄ¡ ¾Ê´Â´Ù. ¾î¶² °ÍÀº Ʋ¸± ¼öµµ ÀÖ°í ¾î¶² °ÍÀº Áö¿öÁú¼öµµ Àֱ⠶§¹®ÀÌ´Ù. ³ª´Â °èÃþÀûÀ¸·Î ÃßÀûÇÏ´Â°É ¼±È£ÇÑ´Ù. ±×¿Í °°Àº ¹æ¹ýÀ¸·Î ¸¸¾à ¾î¶² °ÍÀÌ Æ²¸®´õ¶óµµ ³ª´Â Ãß°¡ ÀÚ·áÀÇ Á¤º¸¸¦ °¡Áø´Ù. ¶ÇÇÑ ´ç½ÅÀÌ ´õ ÁÁÀº »óȲÀ» ±×¸®°í ´Ù¸¥ ÀÚ·á¿Í ºñ±³ÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù.

Personally, I do not like to log information on the honeypot itself. There are two reasons for this. First, the fewer modification you make to the honeypot, the better. The more changes you make, the better the chance a black-hat will discover something is up. The second reason is you can easily lose the information. Don"t forget, sooner or later the black-hat will have root on the honeypot. Several times I have had data altered, or in one case, the entire hard drive wiped clean. Our goal is to track the enemies moves, but log all the data on a system they cannot access. As we discussed above, our first layer of tracking is the firewall logs. Besides this, I track the black-hat"s moves several other ways.

°³ÀÎÀûÀ¸·Î Çã´ÏÆÌ ÀÚ½ÅÀÇ ·Î±× Á¤º¸´Â ÁÁ¾ÆÇÏÁö ¾Ê´Â´Ù. ÀÌ°ÍÀº µÎ°¡Áö ÀÌÀ¯°¡ ÀÖ´Ù. First, the fewer modification you make to the honeyopot, the better. The more changes you make, the better the chance a black-hat will discover something is up. µÎ¹ø° ÀÌÀ¯´Â Á¤º¸¸¦ ½±°Ô ÀÒÀ» ¼ö ÀÖ´Ù. ÀØÁö ¸¶¶ó. ¾ðÁ¦µçÁö ÇØÄ¿´Â Çã´ÏÆÌÀÇ ·çÆ®¸¦ ȹµæÇÒ °ÍÀÌ´Ù. ¸îºÐ¸¸¿¡ µ¥ÀÌÅÍ°¡ º¯°æµÇ°Å³ª ÇÏµå µå¶óÀ̺긦 ±ú²ýÈ÷ Áö¿öÁú ¼öµµ ÀÖ´Ù. ¿ì¸®ÀÇ ¸ñÀûÀº ÀûÀÇ ¿òÁ÷ÀÓÀ» ÃßÀûÇÏ´Â °ÍÀ̳ª ½Ã½ºÅÛ¾ÈÀÇ ·Î±×´Â ¸ðµç µ¥ÀÌÅÍ¿¡°Ô Á¢±ÙÇÒ¼ö ¾ø´Ù. ¿ì¸®°¡ ¾Õ¿¡¼­ Åä·ÐÇßµíÀÌ ¿ì¸®ÀÇ ÃßÀûÀÇ Ã¹¹ø° °èÃþÀº ¹æÈ­º® ·Î±×´Ù. ÀÌ°Í°ú ºñ±³ÇÏ¿© ¸î°¡Áö ´Ù¸¥ ¹æ¹ýÀ¸·Î ÇØÄ¿ÀÇ ¿òÁ÷ÀÓÀ» ÃßÀûÇÒ °ÍÀÌ´Ù.

A second layer I use is the system logs on the honeypot. System logs provide valuable data, as they tell us what the kernel and user processes are doing. However, the first thing a black-hat normally does is wipe the system logs and replace syslogd. So, the challenge becomes logging syslog activity to another server, but without the black-hat knowing it. I do this by first building a dedicated syslog server, normally on a different network separated by the firewall. Then I recompile syslogd on the honeypot to read a different configuration file, such as /var/tmp/.conf. This way the black-hat does not realize where the real configuration file is. This is simply done by changing the entry "/etc/syslog.conf" in the source code to whatever file you want. We then setup our new configuration file to log both locally and to the remote log server (example). Make sure you maintain a standard copy of the configuration file, /etc/syslog.conf, which points to all local logging. Even though this configuration file is now useless, this will throw off the black-hat from realizing the true destination of our remote logging. Now, you will capture all system logs up to and including when the system is compromised. This will help tell us how the system was probed and compromised. It is also very interesting comparing these true system logs to the logs a black-hat has "cleaned" on a compromised system. This is the only time where I make a modification on the honeypot. Be advised, more advance users can detect these modifications using the command strings(1) on the syslogd binary. Then again, there are more advance ways to hide the modifications also. This is merely a suggestion you may want to consider.

µÎ¹ø° °èÃþÀº Çã´ÏÆÌÀÇ ½Ã½ºÅ۷α׸¦ »ç¿ëÇÒ °ÍÀÌ´Ù. ½Ã½ºÅÛ ·Î±×´Â Ä¿³Î°ú »ç¿ëÀÚÀÇ ÇÁ·Î¼¼½º°¡ ¹«¾ùÀ» ÇÏ´ÂÁö ¿ì¸®¿¡°Ô ¸»ÇØÁÖ´Â ±ÍÇÑ µ¥ÀÌÅ͸¦ ÁØ´Ù. ±×·¯³ª ÇØÄ¿´Â óÀ½¿¡ ÇÏ´Â ÀÏÀÌ ½Ã½ºÅ۷α׸¦ Áö¿ì°í syslogd¸¦ ¹Ù²Ù´Â °ÍÀÌ´Ù. ±×·¡¼­ ·Î±ëÇÏ´Â syslog´Â ´Ù¸¥¼­¹ö¿¡¼­ È°µ¿ ÇÏ°Ô ÇÏÁö¸¸ ÇØÄ¿´Â ±×°ÍÀ» ¾ËÁö ¸øÇÑ´Ù. ³ª´Â ù¹ø°·Î Àü¿ë syslog ¼­¹ö¸¦ ¸¸µé°í, Æò¼Ò´ë·Î ¹æÈ­º®¿¡ ÀÇÇØ ´Ù¸¥ ³×Æ®¿öÅ©¿Í ºÐ¸®ÇÑ´Ù. ±× ´ÙÀ½¿¡ ³ª´Â Çã´ÏÆÌÀÌ /var/tmp/.conf°°Àº ´Ù¸¥ ȯ°æ¼³Á¤ ÆÄÀÏÀ» Àеµ·Ï syslogd¸¦ ´Ù½Ã ÄÄÆÄÀÏÇÑ´Ù. ÀÌ·¸°Ô Çϸé ÇØÄ¿´Â ½ÇÁ¦ ȯ°æ¼³Á¤ÆÄÀÏÀÌ ¾îµð¿¡ ÀÖ´ÂÁö ¾ËÁö ¸øÇÑ´Ù. ¼Ò½ºÄÚµå ¾È¿¡ /etc/syslog.conf¶ó°í ÀûÇô ÀÖ´Â °ÍÀ» ´ç½ÅÀÌ ¿øÇÏ´Â ¾î¶² ÆÄÀÏ·Î ¹Ù²ÞÀ¸·Î½á °£´ÜÈ÷ ³¡³­´Ù. ¿ì¸®´Â ·ÎÄðú ¿ø°Ý ·Î±×¼­¹ö¿¡ µ¿½Ã¿¡ ·Î±×°¡ ±â·ÏµÇµµ·Ï ÇÑ »õ·Î¿î ȯ°æ¼³Á¤ÆÄÀÏ·Î ¼³Ä¡ÇÑ´Ù.(¿¹Á¦:[http]http://www.infosecwriters.com/syslog.txt) ´ç½ÅÀº /etc/syslog.conf, ȯ°æ ¼³Á¤ ÀÇ º¹»ç ÆÄÀÏÀ» À¯ÁöÇÔÀ¸·Î ¸ðµç ·ÎÄà ·Î±ëÀ» È®ÀÎÇÑ´Ù. ÀÌ È¯°æ¼³Á¤ ÆÄÀÏÀº ÀÌÁ¦ ¾µµ¥¾ø´õ¶óµµ ¿ø°Ý ·Î±ëÀÇ ¿ëµµ´Â ÇØÄ¿¸¦ ÃßÀûÇϴµ¥ À¯¿ëÇÏ´Ù´Â °ÍÀ» ½Ç°¨ÇÒ °ÍÀÌ´Ù. ÀÌÁ¦ ´ç½ÅÀº ½Ã½ºÅÛÀÌ À§Å·οﶧ ¸ðµç ½Ã½ºÅÛ ·Î±×¸¦ °¥¹«¸®ÇÏ°í Æ÷ÇÔÇÒ¼ö ÀÖÀ» °ÍÀÌ´Ù. ÀÌ°ÍÀº ¾î¶»°Ô ½Ã½ºÅÛÀÌ Á¶»çÇÏ°í ħÇØ´çÇÏ´ÂÁö ¿ì¸®¿¡°Ô ¸»ÇØÁÙ °ÍÀÌ´Ù. ¶ÇÇÑ ÇØÄ¿°¡ ħÇØ ½Ã½ºÅÛÀÌ ±ú²ýÇÏ°Ô Áö¿ü´Ù°í »ý°¢ÇÏ´Â ·Î±×¿Í ½ÇÁ¦ ½Ã½ºÅÛ ·Î±×¿Í ºñ±³ÇÒ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ³ª´Â Çã´ÏÆÌÀ» º¯ÇüÇÏ¿© ¸¸µé¾ú´Ù. Ãæ°í¸¦ ÇÏÀÚ¸é °í±Þ»ç¿ëÀÚ´Â syslogd ¹ÙÀ̳ʸ®¾È¿¡ ¸í·É ¹®ÀÚ¿­(1)À» »ç¿ëÇÏ¿© º¯ÇüµÈ°É ¹ß°ßÇÒ ¼ö ÀÖ´Ù. ¹Ý¸é¿¡ ¸¹Àº ÀÌ º¯Çü¶ÇÇÑ ¼û±æ¼ö ÀÖ´Â °í±Þ±â¼úÀÌ ÀÖ´Ù. ÀÌ°ÍÀº ´ÜÁö ´ç½ÅÀÌ °í·ÁÇϱ⸦ ¿øÇÏ¿©µµ ÁÁÀº Á¦¾ÈÀÌ´Ù.

The only problem with using a remote syslog server is it can be detected with a sniffer. Normally, black-hats either kill or replace syslogd when they gain root. If so, they can no longer sniff the syslog packets, since there are no longer any packets sent. However, if the black-hat does not modify nor kill the syslogd dameon, then they could sniff the packets sent. For the truly devious, you could send your syslogd traffic using a different protocol, such as IPX, which are normally not sniffed. Your level of paranoia may vary. There are also several alternatives you can use to standard syslogd. CORE-SDI has ssyslog, which implements a cryptographic protocol called PEO-1 that allows the remote auditing of system logs. For you NT users, they also have a Windows version, called slogger. There is also syslog-ng, developed by BalaBit Software, which is similiar in use to ssyslog, but uses SHA1 instead. All versions are free and open source.

´ÜÁö ¹®Á¦Á¡Àº ¿ø°Ý syslog ¼­¹ö¸¦ »ç¿ëÇÏ¸é ½º´ÏÆÛ¸¦ ÅëÇØ ¹ß°ßÇÒ ¼ö ÀÖ´Ù. º¸Åë ÇØÄ¿´Â ·çÆ®¸¦ ȹµæÇßÀ» ¶§ syslogd¸¦ Á×À̰ųª ´ëüÇÑ´Ù. If so, they can no longer sniff the syslog packets, since there are no longer any packets sent. ±×·¯³ª ¸¸¾à ÇØÄ¿°¡ syslogd µ¥¸óÀ» Á×À̰ųª ´ëü ÇÏÁö ¾Ê´Â ´Ù¸é ±×µéÀº packetÀÌ º¸³»Áö´Â °ÍÀ» ´«Ä¡ ç¼ö ÀÖ´Ù. Á¤È®È÷ ¼û±â±â À§ÇØ ´ç½ÅÀº º¸Åë ½º´ÏÇÎ ´çÇÏÁö ¾Ê´Â IPX°°Àº ´Ù¸¥ ÇÁ·ÎÅäÄÝÀ» »ç¿ëÇÏ¿© syslogd Æ®·¡ÇÈÀ» º¸³¾ ¼ö ÀÖ´Ù. Your level of paranoia my vary. ¶ÇÇÑ Ç¥ÁØ syslogd°¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ¸î°¡Áö ´ë¾ÈÀÌ ÀÖ´Ù. CORE-SDI´Â ½Ã½ºÅ۷α×ÀÇ ¿ø°Ý °¨»ç¸¦ Çã¶ôÇÏ´Â PEO-1À» È£ÃâÇÏ´Â ¾ÏȣȭµÈ ÇÁ·ÎÅäÄÝ µµ±¸ÀÎ ssyslogÀÌ´Ù. NT À¯Àú¸¦ À§ÇÏ¿© slogger¸¦ È£ÃâÇÏ´Â À©µµ¿ìÁî ¹öÁ¯µµ ÀÖ½À´Ï´Ù. ¶ÇÇÑ, BalaBit ¼ÒÇÁÆ®¿þ¾î¿¡ ÀÇÇØ ¹ßÀüµÈ ssylog°¡ »ç¿ëÇÑ°Í°ú ºñ½ÁÇϳª SHA1·Î ´ëüÇÑ syslog-ngÀÌ ÀÖ´Ù. ¸ðµç ¹öÁ¯Àº ¹«·áÀÌ°í ¿ÀÇ ¼Ò½ºÀÌ´Ù.

My third layer of tracking (the firewall is the first, syslogd hack is the second) is to use a sniffer. I run a sniffer on the firewall that sniffs any traffic going to or from the honeypot. Since the honeypot is isolated by the firewall, you know all traffic goes through the firewall. The advantage of a sniffer is it picks up all keystrokes and screen captures, to include STDIN, STDOUT, and STDERR. This way you see exactly what the black-hat is seeing. Also, all the information is stored on the firewall, safely protected from the black-hat (I hope :-). A disadvantage is the black-hat can hide his moves with encryption, such as ssh. However, if you are not running any such services on your honeypot, the blackhat may not use them. Also, a sniffer can be spoofed by advanced users, as discussed by the paper linked above.

ÃßÀûÀÇ ¼¼¹ø° °èÃþÀº ½º´ÏÆÛ¸¦ »ç¿ëÇÏ´Â °ÍÀÌ´Ù.(ù¹ø°´Â ¹æÈ­º®ÀÌ°í µÎ¹ø°´Â syslogd¸¦ º¯ÇüÇÑ°ÍÀÌ´Ù). ¹æÈ­º®¿¡ ½º´ÏÆÛ¸¦ ½ÇÇà½ÃÄÑ ¾î¶² Æ®·¡ÇÈÀÌ ³ª°¡°Å³ª Çã´ÏÆÌÀ¸·Î ¿À´Â Æ®·¡ÇÈÀ» ½º´ÏÇÎÇÒ °ÍÀÌ´Ù. Çã´ÏÆÌÀÌ ¹æÈ­º®¿¡ ÀÇÇØ ºÐ¸®µÈ ÈÄ, ¹æÈ­º®À» ÅëÇØ ³ª°¡´Â ¸ðµç Æ®·¡ÇÈÀ» ¾Ë¼ö ÀÖ´Ù. ½º´ÏÆÛÀÇ ÀÌÁ¡Àº STDIN, STDOUT, ±×¸®°í STDERR¸¦ Æ÷ÇÔÇÑ ¸ðµç Å°½ºÆ®·ÎÅ©¸¦ ¾òÀ»¼ö ÀÖ°í ½ºÅ©¸° ĸÃĸ¦ ÇÒ ¼ö ÀÖ´Ù. ÀÌ ¹æ¹ýÀ¸·Î ÇØÄ¿°¡ º¸´Â °ÍÀ» ´ç½Åµµ Á¤È®È÷ º¼¼ö ÀÖ´Ù. ¶ÇÇÑ ¸ðµç Á¤º¸´Â ¹æÈ­º®¾È¿¡ ±â·ÏµÇ°í ÇØÄ¿·ÎºÎÅÍ ¾ÈÀüÇÏ°Ô º¸È£µÈ´Ù.(I hope :-). ÀÌ ÀÌÁ¡Àº ÇØÄ¿°¡ ssh°°Àº ¾Ïȣȭ¿Í ÇÔ²² ±×ÀÇ ¿òÁ÷ÀÓÀ» ¼û±æ¼ö ÀÖ´Ù. ±×·¯³ª ¸¸¾à ´ç½ÅÀÇ Çã´ÏÆ̾ȿ¡ ¼­ºñ½º°¡ µ¹¾Æ°¡Áö ¾ÊÀ¸¸é, ÇØÄ¿´Â ±×°ÍÀ» »ç¿ëÇÒ ¼ö ¾øÀ» °ÍÀÌ´Ù. ¶ÇÇÑ ½º´ÏÆÛ´Â °í±Þ À¯Àú¿¡ ÀÇÇØ ¼ÓÀÏ ¼ö ÀÖ´Ù.(as discussed by the paper linked above.)

My sniffer of choice is snort. Written by Marty Roesch, snort is a powerful ids sniffer that has all the functionality of tcpdump and much more. You can capture all the keystrokes in most plaintext sessions (example). It also has builtin IDS functionality, including customizable alerting and logging feartues. For examples of an IDS database, check out www.whitehats.com, which has an online signature database and several example config files. To check out the config file I use for snort, click here. You may want to run several different sniffers and/or IDS systems at the same time, such as Dragon, NFR, or Real Secure. Another idea I am playing with is running proxy servers on the firewall. That way specific traffic that runs through the firewall is proxied, allowing for more control and logging. I"m trying it out now with just a http proxy server on the firewall.

³ª´Â snort¸¦ ½º´ÏÆÛ·Î °áÁ¤ÇÏ¿´´Ù. Marty Roesch°¡ ¸¸µç snort´Â ¸ðµç tcpdump¿Í ´õ ¸¹Àº ±â´ÉÀ» °¡Áø °­·ÂÇÑ ids ½º´ÏÆÛ´Ù. ´ç½ÅÀº ´ë°³ Æò¹® ¼¼¼Ç¾ÈÀÇ ¸ðµç Å°½ºÆ®·ÎÅ©¸¦ ĸÃÄÇÒ ¼ö ÀÖ´Ù.([http]http://www.infosecwriters.com/keystrokes.txt) ¶ÇÇÑ º»·¡ °®ÃçÁø ¸ÂÃãÈ­µÈ °æ°í±â´É°ú ·Î±ë feartues¸¦ Æ÷ÇÔÇÑ IDS ±â´ÉÀ» ³ÖÀ» ¼ö ÀÖ´Ù. ¿¹¸¦ µé¸é IDS µ¥ÀÌÅͺ£À̽º´Â ¿Â¶óÀÎ ¼­¸í µ¥ÀÌÅͺ£À̽º¿Í ¸î°¡Áö ¿¹Á¦ ¼³Á¤ÆÄÀÏÀ» °¡Áö°í ÀÖ´Â www.whitehats.comÀ» Á¡°ËÇÑ´Ù. snort°¡ »ç¿ëÇÏ´Â ¼³Á¤ÆÄÀÏÀ» Á¡°ËÇÒ·Á¸é ¿©±â¸¦ Ŭ¸¯Çضó.([http]http://www.infosecwriters.com/snort.txt) ´ç½ÅÀº µ¿½Ã¿¡ Dragon, NFRÀ̳ª Real Secure¿Í °°Àº ¸î°¡Áö ´Ù¸¥ ½º´ÏÆÛ¿Í/³ª IDS ½Ã½ºÅÛÀ» ½ÇÇà ÇÒ¼ö ÀÖÀ» °ÍÀÌ´Ù. ´Ù¸¥ ¾ÆÀ̵ð¾î·Î ¹æÈ­º®¿¡ ÇÁ·Ï½Ã ¼­¹ö¸¦ ¿î¿µÇÏ´Â °ÍÀÌ´Ù. ÇÁ·Ï½Ã´Â ¹æÈ­º®À» ÅëÇØ ½ÇÇàµÇ´Â ƯÁ¤ Æ®·¡ÇÈÀ» ´õ Á¦¾îÇÏ°í ·Î±ëÇÏ´Â °ÍÀ» Çã¶ôÇÑ´Ù. ³ª´Â ¹æÈ­º®¾È¿¡ http proxy server¸¦ ÇÔ²² ¿î¿µÇØ º¼ °ÍÀÌ´Ù.

Another option for capturing keystrokes is to modify the shell. Most shells can be modified so that not only are all the keystrokes stored in the history file (such as .sh_history or .bash_history) but the shell can be modified to log all the keystrokes to syslog. Thus, the unknowning black-hat will have his keystrokes logged to syslog, and potentially a remote syslog server. Antonomasia has provided code to modify the bash file. Once again, use this with caution. The more modifications you make to a system, the greater the chance the modifications (and your honeypot) will be discovered. However, the advantage to this method is you will capture all keystrokes, including those from an encrypted session.

Å°½ºÆ®·ÎÅ©¸¦ ĸÃÄÇϴµ¥ ´Ù¸¥ ¿É¼ÇÀ¸·Î ½©À» ¼öÁ¤ÇÏ´Â °ÍÀÌ´Ù. ´ë°³ ½©Àº ¸ðµç Å° ½ºÆ®·ÎÅ©¸¦ È÷½ºÅ丮 ÆÄÀϾȿ¡ ÀúÀåÇÏÁö¸¸ ½©Àº syslog¿¡°Ô ¸ðµç Å°½ºÆ®·ÎÅ©¸¦ ·Î±ëÇϵµ·Ï ¼öÁ¤ÇÒ ¼ö ÀÖ´Ù. ±×·¡¼­ ¾ËÁö ¸øÇÏ´Â ÇØÄ¿´Â syslog¿Í ¿ø°Ý syslog ¼­¹ö¿¡ Å°½ºÆ®·ÎÅ©¸¦ ·Î±ëÇÒ ¼ö ÀÖ´Ù. Antonomasia has provided code to modify the bash file. ´Ù½ÃÇѹø ½ÅÁßÇÏ°Ô »ç¿ëÇÏ¿©¶ó. the more modifications you make to a system, the greater the chance the modifications(and your honeypot) will be discovered. ±×·¯³ª ÀÌ ¹æ¹ýÀÇ ÀÌÁ¡Àº ¾ÏȣȭµÈ ¼¼¼ÇÀ¸·ÎºÎÅÍ ¸ðµç Å°½ºÆ®·ÎÅ©¸¦ ĸÃÄÇÒ ¼ö ÀÖ´Ù.

Finally, I run tripwire on the honeypot (there is also a NT version). Tripwire tells us what binaries have been altered on a compromised system (such as a new account added to /etc/passwd or a trojaned binary). I do this by running tripwire from a floppy, then storing the tripwire database to a floppy. You do NOT want any tripwire information stored locally on the system. By storing it on removable media, you can guarantee the integrity of the data. As an added precaution, I recommend compiling tripwire as statically linked. This way you are not using libraries that may be compromised on the honeypot. For the truly paranoid, boot off a floopy (such as tomsrtbt), then run tripwire. This protects against trojaned kernel modules. Tripwire is an excellent way to determine if you system has been compromised. Also, it is an excellent forensic tool that helps identify what modifications the black-hat has made.

¸¶Áö¸·À¸·Î, ³ª´Â Çã´ÏÆÌ¿¡ tripwireÀ» ½ÇÇàÇÏ¿´´Ù.(ÀÌ°Í ¶ÇÇÑ NT ¹öÁ¯ÀÌ ÀÖ´Ù.) Tripwire´Â ħÇØ ½Ã½ºÅÛ¾ÈÀÇ º¯ÇüµÈ ¹ÙÀ̳ʸ®¸¦ ¿ì¸®¿¡°Ô ¾Ë·ÁÁØ´Ù(/etc/passwd¿¡ »õ·Î¿î °èÁ¤ÀÌ Ãß°¡µÇ°Å³ª Æ®·ÎÀÌÀò ¹ÙÀ̳ʸ®°°Àº). ³ª´Â Ç÷ÎÇǵð½ºÅ©·ÎºÎÅÍ tripwire¸¦ ½ÇÇàÇÏ°í, Ç÷ÎÇÇ µð½ºÅ©¿¡ tripwire µ¥ÀÌÅͺ£À̽º¸¦ ÀúÀåÇÏ¿´´Ù. ´ç½ÅÀº ½Ã½ºÅ۾ȿ¡ ÀúÀåµÈ tripwire Á¤º¸¸¦ ¿øÇÏÁö ¾ÊÀ» °ÍÀÌ´Ù. À̵¿°¡´ÉÇÑ ¹Ìµð¾î¿¡ ±×°ÍÀ» ÀúÀåÇÏ¿© ³ª´Â µ¥ÀÌÅÍÀÇ ¹«°á¼ºÀ» º¸ÀåÇÒ ¼ö ÀÖ´Ù. ºÎ°¡ÀûÀÎ ¿¹¹æÃ¥À¸·Î ³ª´Â tripwire¸¦ Á¤Àû ¸µÅ©·Î ÄÄÆÄÀÏÇÏ´Â °ÍÀ» ÃßõÇÑ´Ù. ÀÌ¿Í °°Àº ¹æ¹ýÀ¸·Î Çã´ÏÆÌÀÌ Ä§ÇØ´çÇÒ °æ¿ì ¶óÀ̺귯¸®¸¦ »ç¿ëÇÒ ¼ö ¾ø´Ù. For the truly paranoid¸¦ À§ÇØ tomsrtbt°°Àº Ç÷ÎÇǵð½ºÅ©·Î ºÎÆÃÇÑ´ÙÀ½¿¡ tripwire¸¦ ½ÇÇàÇÏ¿´´Ù. ÀÌ°ÍÀº Æ®·ÎÀÌÀò Ä¿³Î ¸ðµâ¿¡ ´ëºñÇÏ¿© º¸È£ÇÑ´Ù. Tripwire´Â ¸¸¾à ½Ã½ºÅÛÀÌ Ä§ÇØ´çÇÑ´Ù¸é an excellent way to determine. ¶ÇÇÑ ÇØÄ¿°¡ ¸¸µé¾î º¯ÇüµÈ °ÍÀÌ ¹«¾ùÀÎÁö È®ÀÎÇϴµ¥ µµ¿òÀ» ÁÖ´Â Æ÷·»½Äµµ±¸·Îµµ ÈǸ¢ÇÏ´Ù.

You may find these layers as redundant. But remember, no single layer of information can capture all the traffic. Also, different sources give you different information. For example, most systems cannot detect stealth scans, however, many firewalls can. If your firewall logs your honeypot being scanned, but there is nothing in the system logs, then you were most likely scanned by a "stealth" scanner, such as nmap. Also, we are not perfect. Often while tweaking one service, you munge another. You could accidentally kill system logging or the sniffer. By having other layers of information, you still can put a picture together of what happened. If you develop any of your own methods of tracking, I highly recommend you implement them. The more layers you have, the better off you are. If you have any methods you would like to recommend, I would love to hear from. Additional methods can include hacking the system shell or kernel to log keystrokes, but to be dead honest, I haven"t developed the skills yet to do that.

´ç½ÅÀº Áߺ¹µÇ´Â °èÃþµéÀ» ¹ß°ßÇÒÁöµµ ¸ð¸¥´Ù. ÇÏÁö¸¸ ±â¾ïÇضó,Á¤º¸ÀÇ ÇÑ °èÃþµµ ¾øÀÌ´Â ¸ðµç Æ®·¡ÇÈÀ» ĸÃÄÇÒ ¼ö ¾ø´Ù. ¶ÇÇÑ, ¼­·Î ´Ù¸¥ ÀÚ·áµéÀº ´ç½Å¿¡°Ô ¼­·Î´Ù¸¥ Á¤º¸¸¦ ÁØ´Ù. ¿¹¸¦ µé¾î, ´ëºÎºÐÀÇ ½Ã½ºÅÛµéÀº ºñ¹Ð½º·´°Ô ½ºÄµÇϴ°ÍÀ» ¹ß°ß ÇÒ ¼ö¾øÁö¸¸, ¸¹Àº ¹æÈ­º®µéÀº ÇÒ ¼ö ÀÖ´Ù. ¿¹¸¦ µé¾î ´ë°³ nmap°°Àº "ºñ¹Ð½º·±" ½ºÄ³³Ê¿¡ ÀÇÇØ ½ºÄµ´çÇÑ °æ¿ì, ¹æÈ­º® ·Î±×¿¡ Çã´ÏÆÌÀÌ ½ºÄµ´çÇÑ ±â·ÏÀÌ ÀÖÁö¸¸ ½Ã½ºÅÛ ·Î±×¿¡´Â ¾ø´Ù. ¶ÇÇÑ, ¿ì¸®´Â ¿Ïº®ÇÏÁö ¾Ê´Ù. Often while tweaking one service, you munge another. ´ç½ÅÀº ¿ì¿¬È÷ ½Ã½ºÅÛ ·Î±ëÀ̳ª ½º´ÏÆÛ¸¦ Á×Àϼöµµ ÀÖ´Ù. Á¤º¸ÀÇ ´Ù¸¥ °èÃþ¿¡ ÀÇÇØ ´ç½ÅÀº ¾î¶² ÀÏÀÌ ÀϾ´ÂÁöÀÇ °èȹÀ» ÇÔ²² ¾òÀ» ¼ö ÀÖÀ» °ÍÀÌ´Ù. ´ç½ÅÀº ´ç½ÅÀÇ ÃßÀû ¹æ¹ýÀ» °³¹ßÇÑ´Ù¸é ³ª´Â ´ç½ÅÀÇ µµ±¸¸¦ ÃßõÇÒ °ÍÀÌ´Ù. ´õ ¸¹Àº ·¹À̾ ´ç½ÅÀÌ °¡Áö°í ÀÖ´Ù¸é ´õ ÁÁÀ» °ÍÀÌ´Ù. ¸¸¾à ´ç½ÅÀÌ ¾î¶² ¹æ¹ýÀ» ÃßõÇϱ⠿øÇÑ´Ù¸é ³ª´Â ±â»Û ¸¶À½À¸·Î µéÀ» °ÍÀÌ´Ù. Ãß°¡ÀûÀÎ ³»¿ëÀº ½Ã½ºÅÛ ½©À̳ª Ä¿³Î¿¡ ·Î±× Å°½ºÆ®·Î±×¸¦ Æ÷ÇÔÇÒ¼ö ÀÖÁö¸¸, ¼ÖÁ÷ÇÏ°Ô ¸»Çؼ­ ³ª´Â ±× °ÍÀ» ÇÒ ¼ö ÀÖ´Â ±â¼úÀ» °³¹ßÇÏÁö ¸øÇß´Ù.

6. The Sting


°í¹Î°Å¸®(?)

Remember, our goal is to learn about the black-hat, without him ever knowing he was had. To gain a better understanding of this strategy, I highly recommend you watch one of my favorite movies, The Sting. We want to attract the black-hats, monitor them, let them gain root, and then eventually kick them off the system, all without them getting supicious. To attract black-hats, I like to name my honeypot enticing names, such as ns1.example.com (name server), mail.example.com (mail server), or intranet.example.com (internal web server). These are often primary targets for black-hats. Once we have enticed them, use the methods discussed above to track their actions.

±â¾ïÇضó. ¿ì¸®ÀÇ ¸ñÀûÀº ÇØÄ¿¿¡ ´ëÇؼ­ ¹è¿ì´Â °ÍÀÌ´Ù.(without him ever knowing he was had.) ÀÌ Àü·ÂÀÇ ÁÁÀº ÀÌÇظ¦ À§ÇØ, ³ª´Â ³»°¡ ÁÁ¾ÆÇÏ´Â ¿µÈ­ The StingÀ» ¸Å¿ì ÃßõÇÑ´Ù. ¿ì¸®´Â ÇØÄ¿°¡ °ü½ÉÀ» °¡Áö±â ¿øÇÏ°í, ¸ð´ÏÅ͸µÇϸç, ·çÆ®¸¦ ȹµæÇÏ°Ô ÇÏ°Ô ÇÏ°í, ±×µéÀÌ °¡Áø supicious(?)¾øÀÌ ½Ã½ºÅÛ¿¡¼­ ÂѾƳ½´Ù. ÇØÄ¿°¡ °ü½ÉÀ» °¡Áöµµ·Ï ³ª´Â ³» Çã´ÏÆÌ À̸§À» ns1.example.com(³×ÀÓ¼­¹ö), mail.example.com(¸ÞÀϼ­¹ö)³ª intranet.example.com(internal web server)ó·³ ¸ÅȤÀûÀÌ°Ô ÇÒ°ÍÀÌ´Ù. ÀÌ·± À̸§Àº ÇØÄ¿µéÀÇ ¿ø½ÃÀûÀΠŸÄÏÀÌ´Ù. Once we have enticed them, use the methods discussed above to track their actions.

Once the black-hat gains root, the question becomes, now what? Normally, I continue to monitor the black-hat for several days, to learn what he is up to. However, you have to be careful, eventually the black-hat will catch on that he is on a honeypot. If he does, bad things can happen. What I like to do is once I learn everything I can, I kick the black-hat off, normally by rebooting the box. I do this with the shutdown command, sending a message to all logged on users (the black-hat), stating the system is going down for routine maintenance. I then take the system off-line, remove the backdoors the black-hat made, and bring the system back online. Or, you can reinstall, building a new system. I recommend you fix the vulnerability that was used to gain access last time, so you can learn about new exploits/vulnerabilities.

The other issue is limiting the black-hat, we do not want him launching attacks from our own system. I do this by using the firewall. Remember, all traffic to and from the honeypot must go through the firewall. I use a rulebase that allows anything from the Internet to reach our firewall, but only limited traffic outbound (basically, the exact opposite of what a firewall is designed to do). The trick is, allowing enough outbound traffic so a black-hat does not get supicious, but we still have to limit their capabilities. If you block everything outbound, the black-hat will know right away that something is up. If you allow everything outbound, the black-hat can blatantly scan the Internet from your system. You now become liable for his actions, so we have to find a balance. Normally the first thing a black-hat does following access is to download their tool set. If they can"t reach the Internet, they are going to cover their tracks and leave your system. What has worked for me is to allow all traffic inbound, and allow FTP, ICMP, and DNS (UDP) outbound. Normally, this is enough for the black-hat without them getting supiscious right away, but denies them utilizing most of their tools outbound. Your mileage may vary.

Thats it. All that is let left is to wait for the black-hat to strike (kind of like fishing). Ensure you have a good alerting mechanism, so you know as soon as possible when your system is being probed or has been compromised. You want to get as much information as soon as possible. You do not want the black-hat to catch on before you know he is there, bad karma may be coming your way. Good luck!

7. Conclusion


Honeypots are an extremely powerful tool that allows you to learn about the black-hat community. Correctly implemented, they give you an inside window on how the black-hat community works. There are a variety of different approaches to building and implementing a honeypot, mine is only one of many. My goal is to build a simple system that mirrors the production network, then sit back and wait. The key to tracking the enemy is layers. Do not depend on a single layer of information, as it can be altered or lost. By comparing different layers of information, you can also gain a better understanding of what the black-hat was doing. Happy hunting


ID
Password
Join
You are farsighted, a good planner, an ardent lover, and a faithful friend.


sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2004-12-04 19:16:41
Processing time 0.0076 sec