Monday, May 14. 2012Towards Building More Secure NetworksIt is no surprise that security is at the forefront of everyone's minds these days. With high profile breaches, to script kiddies wreaking havoc across the Internet, it is obvious that there are some weaknesses that need to be addressed. In most cases, complete network redesigns are out of the question. This can be extremely invasive and costly. However, it may be possible to augment the existing network in such a manner as to add additional layers of security. It's also possible that this may lead to the possibility of being able to make even more changes down the road. So what do I mean by this? Allow me to explain... Many networks are fairly simple with only a few subnets, typically a user and a server subnet. Sometimes there's a bit of complexity on the user side, creating subnets per department, or subnets per building. Often this has more to do with manageability of users rather than security. Regardless, it's a good practice that can be used to make a network more secure in the long run. What is often neglected is the server side of things. Typically, there are one, maybe two subnets. Outside users are granted access to the standard web ports. Sometimes more ports such as ssh and ftp are opened for a variety of reasons. What administrators don't realize, or don't intend is that they're allowing outsiders direct access to their core servers, without any sort of security in front of it. Sure, sure, there might be a firewall, but a firewall is there to ensure you only come in on the proper ports, right? If your traffic is destined for port 80, it doesn't matter if it's malicious or not, the firewall lets it through anyway. But what's the alternative? What can be done instead? Well, what about sending outside traffic to a separate network where the systems being accessed are less critical, and designed to verify traffic before passing it on to your core servers? What I'm talking about is creating a DMZ network and forcing all users through a proxy. Even a simple proxy can help to prevent many attacks by merely dropping illegal traffic and not letting it through to the core server. Proxies can also be heavily fortified with HIDS and other security software designed to look for suspicious traffic and block it. By adding in this DMZ layer, you've put a barrier between your server core and the outside world. This is known as layered defense. You can add additional layers as time and resources allow. For instance, I recommend segmenting away database servers as well as identity management servers. Adding this additional segmentation can be done over time as new servers come online and old servers are retired. The end goal is to add this additional security without disrupting the network as a whole. If you have the luxury of building a new network from the ground up, however, make sure you build this in from the start. There is, of course, a breaking point. It makes sense to create networks to segregate servers by security level, but it doesn't make sense to segregate purely to segregate. For instance, you may segregate database and identity management servers away from the rest of the servers, but segregating Oracle servers away from MySQL servers may not add much additional security. There are exceptions, but I suggest you think long and hard before you make such an exception. Are you sure that the additional management overhead is worth the security? There's always a cost/benefit analysis to perform. Segregating networks is just the beginning. The purpose here is to enhance security. By segregating networks, you can significantly reduce the number of clients that need to access a particular server. The whole world may need to access your proxy servers, but only your proxy servers need to access the actual web application servers. Likewise, only your web application servers need access to your database servers. Using this information, you can tighten down your firewall. But remember, a firewall is just a wall with holes in it. The purpose is to deflect random attacks, but it does little to nothing to prevent attacks on ports you've opened. For that, there are other tools. At the very edge, simplistic fire walling and generally loose HIDS can be used to deflect most attacks. As you move further within the network, additional security can be used. For instance, deploying an IPS at the very edge of the network can result in the IPS being quickly overwhelmed. Of course, you can buy a bigger, better IPS, but to what end? Instead, you can move the IPS further into the network, placing it where it be more effective. If you place it between the proxy and the web server, you've already ensured that the only traffic hitting the IPS is loosely validated HTTP traffic. With this knowledge, you can reduce the number of signatures the IPS needs to have, concentrating on high quality HTTP signatures. Likewise, an IPS between the web servers and database servers can be configured with high quality database signatures. You can, in general, direct the IPS to block any and all traffic that falls outside of those parameters. As the adage goes, there is no silver bullet for security. Instead, you need to use every weapon in your arsenal and put together a solid defense. By combining all of these techniques together, you can defend against many attacks. But remember, there's always a way in. You will not be able to stop the most determined attacker, you can only hope to slow him down enough to limit his access. And remember, securing your network is only one aspect of security. Don't forget about the other low hanging fruit such as SQL injection, cross site scripting, and other common application holes. You may have the most secure network in existence, but a simple SQL injection attack can result in a massive data breach. Thursday, June 16. 2011Helpful Rules for OSSECOSSEC has quickly become a primary weapon in my security toolkit. It's flexible, fast, and very easy to use. I'd like to share a few rules I've found useful as of late. I primarily use OSSEC in a server/client setup. One side effect of this is that when I make changes to the agent's configuration, it takes some time for it to push out to all of the clients. Additionally, clients don't restart automatically when a new agent config is received. However, it's fairly easy to remedy this. First, make sure you have syscheck enabled and that you're monitoring the OSSEC directory for changes. I recommend monitoring all of /var/ossec and ignoring a few specific directories where files change regularly. You'll need to add this to both the ossec.conf as well as the agent.conf. <directories check_all="yes">/var</directories> <ignore type="sregex">^/var/ossec/queue/</ignore> <ignore type="sregex">^/var/ossec/logs/</ignore> <ignore type="sregex">^/var/ossec/stats/</ignore> The first time you set this up, you'll have to manually restart the clients after the new config is pushed to them. All new clients should work fine, however. Next, add the following rules to your local_rules.xml file (or whatever scheme you're using). <rule level="12" id="100005"> <if_matched_group>syscheck</if_matched_group> <description>agent.conf changed, restarting OSSEC</description> <match>/var/ossec/etc/shared/agent.conf</match> </rule> This rule looks for changes to the agent.conf file and triggers a level 12 alert. Now we just need to capture that alert and act on it. To do that, you need to add the following to your ossec.conf file on the server. <command> <name>restart-ossec</name> <executable>restart-ossec.sh</executable> <expect>srcip</expect> <timeout_allowed>no</timeout_allowed> </command> <active-response> <command>restart-ossec</command> <location>local</location> <rules_id>100005</rules_id> </active-response> You need to add this to the top of your active response section, above any other rules. OSSEC matches the first active-response block and ignores any subsequent ones. The restart-ossec.sh script referenced in the command section should exist already in your active-response/bin directory as it's part of the distribution. And that's all there is to it. Whenever the agent.conf file changes on a client, it'll restart the OSSEC agent, reading in the new configuration. Next up, a simple DoS prevention rule for apache web traffic. I've had a few instances where a single IP would hammer away at a site I'm responsible for, eating up resources in the process. Generally speaking, there's no real reason for this. So, one solution is to temporarily block IPs that are abusive. Daniel Cid, the author of OSSEC, helped me out a little on this one. It turned out to be a little less intuitive than I expected. First, you need to group together all of the "normal" error response codes. The actual error responses (400/500 errors) are handled with other, more aggressive rules, so you can ignore most of them. For our purposes, we want to trigger on 200/300/400 error codes. <rule id="131105" level="1"> <if_sid>31101, 31108, 31100</if_sid> <description>Group of all "normal" 200/300/400 error codes.</description> </rule> Next, we want to create a composite rule that will fire after a set frequency and time limit. In short, we want this rule to fire if X matches are made in Y seconds. <rule id="131106" level="10" frequency="500" timeframe="60"> <if_matched_sid>131105</if_matched_sid> <same_source_ip /> <description>Excessive access, Temporary block</description> </rule> That should be all you need provided you have active response already enabled. You can also add a specific active response for this rule that blocks for a shorter, or longer, period of time. That's the beauty of OSSEC, the choice is in your hands. I hope you find these rules helpful. If you have any questions or comments, feel free to post them below. Tuesday, November 18. 2008if (blocked($content))And the fight rages on... Net Neutrality, to block or not to block. Senator Byron Dorgan, a Democrat from North Dakota, is introducing new legislation to prevent service providers from blocking Internet content. Dorgan is not new to the arena, having put forth legislation in previous years dealing with the same thing. This time, however, he may be able to push it through. So what's different this time? Well, for one, we have a new president. And this new president has already stated that Net Neutrality is high on his list of technology related actions. So, at the very least, it appears that Dorgan has the president in his corner. Of course, some service providers are not happy about this. Comcast has gone on record with the following:
And she's right! Well.. sort of. Comcast custmers do have access to content. Or, rather, they do now. I do recall a recent period of time where Comcast was "secretly" resetting bittorrent connections, and they have talked about both shaping and capping customers. So, in the end, you may get all of the content, just not all at the same level of service. But I think, overall, Dorgan has an uphill battle. Net Neutrality is a concept not unlike free speech. It's a great concept, but sometimes its implementation is questionable. For instance, If we look at pure Net Neutrality, then providers are required to allow all content without any shaping or blocking. Even bandwidth caps can be seen to fall under the umbrella of Net Neutrality. As a result, customers can theoretically use 100% of their alloted bandwidth at all times. This sounds great, until you realize that bandwidth, in some instances, and for perfectly legitimate reasons, is limited. Take rural areas, for instance, especially in the midwest where homes can be miles away from each other. It can be cost-prohibitive for a service provider to run lines out to remote areas. And if they do, it's generally done using line extender technology that can allow for decent voice signals over copper, but not high-speed bandwidth. One or two customer connections don't justify the cost of the equipment. So, those customers are relegated to slower service, and may end up devices with high customer to bandwidth ratios. In those cases, a single customer can cause severe degradation of service for all the others, merely by using a lot of bandwidth. On the flip side, however, allowing service providers to block and throttle according to their own whims can result in anti-competitive behavior. Take, for instance, IP Telephony. There are a number of IP Telephony providers out there that provide the technology to place calls over a local Internet connection. Skype and Vonage are two examples. Neither of these providers has any control over the local network, and thus their service is dependent on the local service provider. But let's say the local provider wants to offer VoIP service. What's to prevent that local provider from throttling or outright blocking Skype and Vonage? And thus we have a problem. Of course, you can fall back to the "let the market decide" argument. The problem with this is that, often, there is only one or two local providers, usually one Telco and one Cable. The Telco provider may throttle and block voice traffic, while the Cable provider does the same for video. Thus, the only choice is to determine which we would rather have blocked. Besides, changing local providers can be difficult as email addresses, phone numbers, etc. are usually tied to the existing provider. And on top of that, most people are just too lazy to change, they would rather complain. My personal belief is that the content must be available and not throttled. However, I do believe the local provider should have some control over the network. So, for instance, if one type of traffic is eating up the majority of the bandwidth on the network, the provider should be able to throttle that traffic to some degree. However, they must make such throttling public, and they must throttle ALL of that type of traffic. Going back to the IP Telephony example, if they want to throttle Skype and Vonage, they need to throttle their own local VoIP too. It's a slippery slope and I'm not sure there is a perfect answer. Perhaps this new legislation will be a step in the right direction. Only time will tell. Tuesday, February 26. 2008Bandwidth in the 21st CenturyAs the Internet has evolved, the one constant has been the typical Internet user. Typical users used the Internet to browse websites, a relatively low-bandwidth activity. Even as the capabilities of the average website evolved, bandwidth usage remained relatively low, increasing at a slow rate. In my own experience, a typical Internet user, accessing the Internet via DSL or cable, only uses a very small portion of the available bandwidth. Bandwidth is only consumed for the few moments it takes to load a web page, and then usage falls to zero. The only real difference was the online gamer. Online gamers use a consistent amount of bandwidth for long periods of time, but the total bandwidth used at any given moment is still relatively low, much lower than the available bandwidth. Times are changing, however. In the past few years, peer-to-peer applications such as Napster, BitTorrent, Kazaa, and others have become more mainstream, seeing widespread usage across the Internet. Peer-to-peer applications are used to distribute files, both legal and illegal, amongst users across the Internet. Files range in size from small music files to large video files. Modern applications such as video games and even operating systems have incorporated peer-to-peer technology to facilitate rapid deployment of software patches and updates. Voice and video applications are also becoming more mainstream. Software applications such as Joost, Veoh, and Youtube allow video streaming over the Internet to the user's PC. Skype allows the user to make phone calls via their computer for little or no cost. Each of these applications uses bandwidth at a constant rate, vastly different from that of web browsing. Hardware devices such as the XBox 360, AppleTV, and others are helping to bring streaming Internet video to regular televisions within the home. The average user is starting to take advantage of these capabilities, consuming larger amounts of bandwidth, for extended periods of time. The end result of all of this is increased bandwidth within the provider network. Unfortunately, most providers have based their current network architectures on outdated over-subscription models, expecting users to continue their web-browsing patterns. As a result, many providers are scrambling to keep up with the increased bandwidth demand. At the same time, they continue releasing new access packages claiming faster and faster speeds. Some providers are using questionable practices to ensure the health of their network. For instance, Comcast is allegedly using packet sniffing techniques to identify BitTorrent traffic. Once identified, they send a reset command to the local BitTorrent client, effectively severing the connection and canceling any file transfers. This has caught the attention of the FCC who has released a statement that they will step in if necessary. Other providers, such as Time Warner, are looking into tiered pricing for Internet access. Such plans would allow the provider to charge extra for users that exceed a pre-set limit. In other words, Internet access becomes more than the typical 3/6/9 Mbps access advertised today. Instead, the high speed access is offset by a total transfer limit. Hopefully these limits will be both reasonable and clearly defined. Ultimately, though, it becomes the responsibility of the user to avoid exceeding the limit, similar to that of exceeding the minutes on a cell phone. Pre-set limits have problems as well, though. For instance, Windows will check for updates at a regular interval, using Internet bandwidth to do so. Granted, this is generally a small amount, but it adds up over time. Another example is PPPoE and DHCP traffic. Most DSL customers are configured using PPPoE for authentication. PPPoE sends keep-alive packets to the BRAS to ensure that the connection stays up. Depending on how the ISP calculates bandwidth usage, these packets will likely be included in the calculation, resulting in "lost" bandwidth. Likewise, DHCP traffic, used mostly by cable subscribers, will send periodic requests to the DHCP server. Again, this traffic will likely be included in any bandwidth calculations. In the end, it seems that substantial changes to the ISP structure are coming, but it is unclear what those changes may be. Tiered bandwidth usage may be making a comeback, though I suspect that consumers will fight against it. Advances in transport technology make increasing bandwidth a simple matter of replacing aging hardware. Of course, replacements cost money. So, in the end, the cost may fall back on the consumer, whether they like it or not. Monday, July 9. 2007Troubleshooting 101There seems to be a severe lack of understanding and technique when it comes to troubleshooting these days. It seems to me that a large amount of troubleshooting effort is completely wasted on wild ideas and theories while the simplest and most direct solutions are ignored. Occam's Razor states : "entities should not be multiplied beyond necessity." Simply put, the easiest solution is often the best. This is the perfect mindset for anyone who does troubleshooting. There is no need to delve right into the most obscure reasons for a failure, start with the simple stuff. For instance, questions like "Is the unit plugged in?", or "Is the power on?" are perfect questions to start with. While it would be wonderful to believe that everyone you encounter has the common sense to check out these simple solutions, you'll find that, unfortunately, the majority of the population isn't that bright. So, how about a real-world example. It's 2am and you get paged that a router has gone unreachable. After notifying the proper people, you delve into the problem. Using the Occam's Razor principle, what's the first thing you should check? Well, for starters, let's make sure the router really is unreachable. A simple ping should accomplish that. And just for good measure, ping something close to that router just to make sure you're connected to the network. Ok, so the router isn't pingable, now what? Well, let's look at the next easiest step, power. Since the router is in a remote location, this isn't easy to check. However, you can check the uplink on the router. You should be able to get to the router just before the one that's unreachable. Once there, check the interface that feeds your troubled router. Is it up or down? While you're there, you can check for traffic and errors as well, but don't focus on these yet, store them for later. If the interface is down, then it's quite possibly a physical line issue or, possibly, power. Just for good measure, I would suggest bouncing the interface to see if it's something temporary. Sometimes, the interface will come back up and start running errors, indicating a physical line issue. What will often happen is that the interface comes back up and starts running errors, but allows limited traffic to get through. Once the error threshold is passed, the line goes back down. At this point, I'd call a technical to look at the physical line itself. If the interface is up, try pinging the troubled router from the directly connected router. This process can help identify a routing issue in the network. Directly connected interfaces are considered to be the most specific route unless specifically overridden, which isn't likely. If the ping is successful, take note of the ping time. If it seems overly high, you may be looking at a traffic issue. Depending on the type of router, traffic may be processor switched and cause high CPU usage. This can be identified by a sluggish interface and high ping times. Notes, high ping times don't always indicate this. Most routers set a very low priority for ICMP traffic destined for the CPU, deeming throughput more important. Remember the traffic and error counts you looked at previously? Those come into play now. If the traffic on the interface is very high, notably higher than usual, then this is likely the cause of the problem. Or, rather, an effect of the actual cause which may be a DoS attack or Virus outbreak. DoS, or Denial of Service, attacks are targeted attacks against a specific IP or range of IPs. A side effect of these attacks is that interfaces between the attacker and victim are often overloaded. There are a number of different DoS attacks out there, but often when you see traffic as the cause of the DoS, you'll notice that small packets are being used. One way to quickly identify this is to take the current bps on the interface, divide it by the packets per second, and then by 8 to get bytes per packet. Generally speaking, a normal interface ranges average packet size between 1000 and 1500 bytes. NOTE : This is referring to traffic received from a remote source such as a web site. Outgoing traffic, to the website, has a much lower average packet size because these packets generally contain control information such as acknowledgements, ICMP, etc. Once you've identified that there is a traffic issue, the next step is to identify where the traffic is sourced from, or destined to. Remember, the end-goal here is to repair the problem so that normal operations can continue. Since you're already aware of the overloaded interface, it's easiest to concentrate your efforts there. Identifying the traffic source and destination is usually pretty easy, provided it's not a distributed attack. On a Cisco router, you can try the "IP accounting" command. This command will show the source and destination for all output packets on an interface. Included is a count of the number of packets and the bits used by those packets. Simply look for rapidly increasing source and destination pairs and you'll likely find your culprit. Another option is to use an access list. If the router can handle it, place an access list on the interface that passes all traffic, but logs each packet. Then you can watch the log and try to identify large sources of traffic. Refine the access list to block that traffic until you've halted the attack. Be careful, however, as many routers will processor switch the traffic when an access-list is applied. This may cause a spike in CPU usage, sometimes causing a loss of connectivity to the router. If IP accounting is available, use that instead. Once you identify the source and/or target of the attack, craft an appropriate access list to block the traffic as far upstream as you can. If the DoS attack is distributed, then the most effective means to stop the attack is probably to remove the targeted routes from the routing table and allow it to be blocked at the edges. This will likely result in an outage for that specific customer, but with a distributed attack, that's often the only solution. From there you can work with your upstream providers to track down the perpetrator of the attack and take it offline permanently.
The preceding seems a bit long when written down, but in reality, this is a 15-30 minute process. Experienced troubleshooters can identify and resolve these problems even quicker. The point, of course, is to identify the most likely causes in the quickest manner possible. Often times, the simplest solution is the correct solution. Take the extra few seconds to check out the obvious before moving on to the more advanced. Often, you'll resolve the solution quicker and sometimes wind up with a funny story as a bonus!
Please, troubleshoot responsibly.
(Page 1 of 2, totaling 9 entries)
» next page
|
CalendarMomentary Wisdom"The problems that exist in the world today cannot be solved by the level of thinking that created them."
LinksCurrently Reading...
TagsSyndicate This Blog |





