<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Cocoia Blog &#187; Hacking</title>
	<atom:link href="http://blog.cocoia.com/category/hacking/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cocoia.com</link>
	<description>The Cocoia Blog is the website of Sebastiaan de With, a Dutch Icon and Interface designer.</description>
	<pubDate>Thu, 14 Aug 2008 11:48:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Graph your Airport Express / Extreme data throughput and more.</title>
		<link>http://blog.cocoia.com/2007/11/06/graph-your-airport-express-extreme-data-throughput-and-more/</link>
		<comments>http://blog.cocoia.com/2007/11/06/graph-your-airport-express-extreme-data-throughput-and-more/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 18:44:04 +0000</pubDate>
		<dc:creator>sebastiaan</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Hacking]]></category>

		<category><![CDATA[How-To]]></category>

		<category><![CDATA[Personal Work]]></category>

		<guid isPermaLink="false">http://blog.cocoia.com/2007/11/06/graph-your-airport-express-extreme-data-throughput-and-more/</guid>
		<description><![CDATA[In an earlier post, I asked for your interest in a how-to on graphing several network statistics using MRTG, an open-source application that generates graphs using data pulled from SNMP. I used an Airport Extreme (802.11n, gigabit) for this, but it should work with Snow / Graphite Airport base stations and up (Express and Extreme). [...]]]></description>
			<content:encoded><![CDATA[<p>In an earlier post, I asked for your interest in a how-to on graphing several network statistics using MRTG, an open-source application that generates graphs using data pulled from SNMP. I used an Airport Extreme (802.11n, gigabit) for this, but it should work with Snow / Graphite Airport base stations and up (Express and Extreme). For other routers, your mileage may vary, and it may even not be possible, so I decided not to make a guide for anything else than Apple&#8217;s routers. If you want to have graphs in your desktop, updated in real time, as seen here, read on!</p>
<p></p>
<p><span id="more-244"></span></p>
<p>For this how-to, you need; </p>
<p>- an Apple Airport wireless base station.</p>
<p>- Airport Utility </p>
<p>- OS X 10.4 or higher (yes, Leopard is fine)</p>
<p>- your Mac&#8217;s installation discs if you don&#8217;t have the Developer tools installed yet.</p>
<p></p>
<p>Ready? Let&#8217;s go!</p>
<p><strong>Step One: </strong>First of all, authenticate with your wireless network and open your Airport Utility. You should see something like this;</p>
<p></p>
<div align="center"><img src="http://blog.cocoia.com/wp-content/uploads/2007/11/picture-2.png" alt="Picture 2.png" border="0" width="416" height="282" /></a></div>
<p></p>
<p>Note the name of the base station here; we will need it later. As you can see in the source list on the left, mine&#8217;s &#8220;Prokyon&#8221;. Click &#8220;Manual Setup&#8221;, and once the settings have been loaded, select &#8220;Advanced&#8221; from the toolbar. </p>
<div align="center"><img src="http://blog.cocoia.com/wp-content/uploads/2007/11/picture-3.png" alt="Picture 3.png" border="0" width="415" height="337" /></div>
<p>This is the selection of tabs you will find under &#8220;Advanced&#8221;. The first tab, &#8220;Logging &#038; SNMP&#8221;, is the tab we need. Check &#8216;allow SNMP&#8217; (it doesn&#8217;t have to be over WAN, as this will allow you to monitor statistics over the internet, exposing a possible security hole). That&#8217;s it for Airport Utility for now. Save the settings and quit the utility. </p>
<p><strong>Step Two:</strong> Now we&#8217;re going to set up MRTG. You can get an easy-to-use binary from <a href="http://www.mosxsw.com/port/mrtg/">here</a>; follow the basic instructions, namely;</p>
<p> Open a terminal,</p>
<p>cd (directory containing )mrtg-2.9.4-mosx.tgz</p>
<p>su</p>
<p>enter your root password</p>
<p>tar xzf mrtg-2.9.4-mosx.tgz</p>
<p>cd mrtg-2.9.4-mosx</p>
<p>./install.sh</p>
<p>exit 
</p>
<p>If all goes well, you now have &#8216;mrtg&#8217; installed. Test it by typing &#8216;mr&#8217; at the command line followed by pressing the &#8216;tab&#8217; key. It should, given you don&#8217;t have other utilities installed beginning with &#8216;mr&#8217;, autocomplete to &#8216;mrtg&#8217;.</p>
<p><strong>Step Three:</strong> Now, before we start setting up MRTG to use the SNMP services of your router, let&#8217;s test if it actually works. Open a terminal, and enter;</p>
<p></p>
<p><code>snmpwalk -v 2c -c public -M /usr/share/snmp/mibs:$HOME/share/mibs -m+AIRPORT-BASESTATION-3-MIB (Base station name).local 1.3.6.1.4.1.63.501</code><br />
</p>
<p>All on one line. In this case, replace &#8216;-c public&#8217; with either the community string you set in the Airport Utility (&#8217;-c thestringyouentered&#8217;) - if you left this blank in the Airport Utility, it either defaults to &#8216;public&#8217; or your base station password. Try both; it will either time out or spit out a huge amount of information. Also replace &#8216;Base station name&#8217; with your base station name, as I told you to note in the first step. Mine would be &#8216;Prokyon.local&#8217;. Done filling the blanks? Press enter, and let it roll.</p>
<p>If it times out, check if SNMP is enabled or restart your Airport (also remember to check if the community string you set with the -c flag is either &#8216;public&#8217; or your password). If it gives an error about missing something, download the Airport MIB from Apple and copy it to &#8220;/usr/share/snmp/mibs&#8221; (you can &#8216;Go to folder&#8217; with CMD+Shift+G in Finder to reach this directory), then try again.</p>
<p>You should get a whole lot of output in your terminal. Working? Great, let&#8217;s go to the next step.</p>
<p><strong>Step Four:</strong> Along with MRTG, we installed a utility called &#8216;cfgmaker&#8217;, that will generate MRTG configuration files for us. In the terminal, we will have to generate such a configuration. Don&#8217;t sweat, it&#8217;s very painless.</p>
<p><code>cfgmaker public@192.168.2.5 > ~/mrtg.cfg</code></p>
<p>Ensure that &#8216;public&#8217; is your community string. As described in the last step, this is most likely either your base station password (-not- the <strong>network</strong> password) or just &#8216;public&#8217;. 192.168.2.5 is my router&#8217;s IP address in this case; you should check what yours is, either by doing a &#8216;port scan&#8217; with the Network Utility on your Mac, or by checking with your network preferences in System Preferences. It&#8217;s possibly also listed in the trusty Airport Utility. Fill in your IP address (ensure the community string and the IP address are separated by just a &#8216;@&#8217;) and let it do its job. The file &#8216;mrtg.cfg&#8217; has been generated in your home directory.</p>
<p><strong>Step Five:</strong> Now we can let MRTG do it&#8217;s first run. For sharing on the local network, I placed my MRTG web-pages and graphs in &#8220;~/Sites/MRTG/&#8221; - note that &#8216;~&#8217; stands for /Users/myname/ here - as it is also very convenient. If you want to go on the safe side and do the same thing, make the directory in advance; MRTG -will not- do this for you. </p>
<p>Edit the newly generated mrtg.cfg with an editor like TextMate or nano (in the terminal). For the least hassle, I will describe using nano in your terminal to add the final changes to let MRTG know where to put its files.</p>
<p><code>nano ~/mrtg.cfg</code></p>
<p>Is what you need to type into your terminal. You&#8217;ll see something a bit like this;<br />
</p>
<div align="center"><img src="http://blog.cocoia.com/wp-content/uploads/2007/11/picture-4.png" alt="Picture 4.png" border="0" width="415" height="261" /></div>
<p></p>
<p>Move your cursor to the line &#8220;#   FOR UNIX&#8221; and delete the single leading hash mark (#) in the line beneath it. Enter the path of where you want to store the files here, as you can see, I chose /Users/superuser/Sites/mrtg/, as my account&#8217;s short name is &#8217;superuser&#8217;. To save the changes, press CTRL+X, and &#8220;Y&#8221;. </p>
<p><strong>Step Six:</strong> Now we will run the MRTG application. Since on Leopard, MRTG complained that I used a Unicode environment, I set the shell&#8217;s environment variable &#8216;LANG&#8217; to &#8216;C&#8217; before using it. The whole command to run MRTG then looks like this;</p>
<p><code> env LANG=C mrtg ~/mrtg.cfg </code></p>
<p>This is provided you followed my instructions and your .cfg file is located in ~/ (your user directory). If all goes well, MRTG should just do its thing and return your control over the prompt after a second or a few. If it outputs errors, check the steps to see if you didn&#8217;t do something a bit different. You can now check your directory (~/Sites/mrtg/ for me) to see your first graphs. </p>
<div align="center"><img src="http://blog.cocoia.com/wp-content/uploads/2007/11/picture-6.png" alt="Picture 6.png" border="0" width="415" height="275" /></div>
<p></p>
<p>This is my MRTG output directory, and as you can see, it generated files with (your router IP address).html as a name, with a number appended to indicate the interface. Several interfaces exist on the Airport Extreme; the most interesting ones are the WAN and ATH0 interfaces, respectively your internet connection port and the wireless interface. The graphs for these, provided you run MRTG periodically, show the data throughput graphed over time. Now, since it is a bit tiresome to run MRTG all day in your terminal, we need something to do that -for- us. </p>
<p><strong>Step Seven:</strong> Fortunately, there&#8217;s an excellent tool for adding such a &#8216;daemon&#8217; function to our system. Running Leopard, mind that there is an extra step here, which I will let Tiger users do as well for certainty. Download <a href="http://lingon.sourceforge.net/">&#8216;Lingon&#8217;</a>, Peter Borg&#8217;s excellent GUI for launchd, OS X&#8217;s initialisation system and more. Once the download has completed, run it, and open a terminal.</p>
<p>In the terminal, we&#8217;re going to make a shell script with the single line of instructions that loads up MRTG. Let&#8217;s use nano for convenience again, so enter;<br />
<code>nano mrtg.sh</code><br />
and enter the command you used to run MRTG (<code> env LANG=C mrtg ~/mrtg.cfg</code> in my case), but <strong>add the complete paths</strong> this time. My command would look like this;</p>
<p><code> env LANG=C /opt/local/bin/mrtg Users/superuser/mrtg.cfg </code><br />
<br />
 Exit and save again with Ctrl + X. Remember to make sure the paths are accurate and the command works (test run it in your terminal to see if you get any errors). Place the shell-script somewhere <strong>out of</strong> your user directory, like /Users/Shared/, and switch to Lingon. </p>
<p>In Lingon, press &#8216;New&#8217; and make an appropriate choice; you can use these settings as an example;</p>
<p>
<img src="http://blog.cocoia.com/wp-content/uploads/2007/11/picture-7.png" alt="Picture 7.png" border="0" width="415" height="284" /><br />
</p>
<p>At the bottom, you can see I let it run every three minutes. You can make it run as often as you want. Save settings, and depending on your choice of Agent, reboot or log out to make the changes happen. </p>
<p>Congratulations! If all went well, you should have an auto-updating set of graphs now. You can choose to do two things now; check these graphs occasionally, or present them on your desktop using GeekTool like I did. Geektool&#8217;s website is down right now, so download it from <a href="http://blog.cocoia.com/2007/11/04/my-personal-comm-station/"> last post</a> and install it to your System Preferences by double-clicking the preference pane in the disk image. </p>
<p></p>
<p><strong>Last Step:</strong> Once it&#8217;s installed, System Preferences opens and shows you the preference pane. Make sure you have just System Preferences shown so you can see your entire desktop (most importantly, the top left).  Add an item to the left list; and set something like this; </p>
<p>
<img src="http://blog.cocoia.com/wp-content/uploads/2007/11/picture-8.png" alt="Picture 8.png" border="0" width="415" height="407" /></p>
<p>The blue rectangle is the active overlay that will contain the image you choose. You can set a refresh interval (I use 10 seconds because it&#8217;s the default), resize the image, and place it wherever you like. Although GeekTool is old (well, it hasn&#8217;t seen a lot of updates), it&#8217;s well coded in that it won&#8217;t vanish when you use Exposé or even Spaces. </p>
<p>My result can be seen <a href="http://blog.cocoia.com/2007/11/04/my-personal-comm-station/">here</a>; if there&#8217;s demand for it, I will upload the PSD of my little &#8216;comm station&#8217; overlay so you can use it with whatever wallpaper you desire. Perhaps I will write a second part with how to put this into a widget form, and tracking the amount of users on your wireless network and graphing other miscellaneous statistics. Enjoyed this how-to? Comments / blog reactions / email is welcome!</p>
<p><strong><a href="http://digg.com/apple/Graph_your_Airport_Data_throughput_and_more_on_your_desktop">digg it!<a/></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cocoia.com/2007/11/06/graph-your-airport-express-extreme-data-throughput-and-more/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Little Snitch deserves a post on it&#8217;s own.</title>
		<link>http://blog.cocoia.com/2007/04/24/little-snitch-deserves-a-post-on-its-own/</link>
		<comments>http://blog.cocoia.com/2007/04/24/little-snitch-deserves-a-post-on-its-own/#comments</comments>
		<pubDate>Tue, 24 Apr 2007 14:01:45 +0000</pubDate>
		<dc:creator>sebastiaan</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Hacking]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.cocoia.com/?p=72</guid>
		<description><![CDATA[Little Snitch, together with Glowworm FW got a mention on my &#8220;Secure OS X&#8221; article. When I started doing more work on a PowerMac G4 of a company, which had Little Snitch installed, I wanted to inject an F-Script workspace into Praetorian for some clean testing. Little Snitch amazed me.

I don&#8217;t know how it achieves [...]]]></description>
			<content:encoded><![CDATA[<p><a href=http://www.obdev.at/products/littlesnitch/index.html>Little Snitch</a>, together with <a href=http://glowworm.us/>Glowworm FW</a> got a mention on my &#8220;Secure OS X&#8221; article. When I started doing more work on a PowerMac G4 of a company, which had Little Snitch installed, I wanted to inject an <a href=http://www.fscript.org>F-Script</a> workspace into Praetorian for some clean testing. Little Snitch amazed me.</p>
<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/04//little.jpg" border="0" height="249" width="421" alt="little.jpg" align="center" /></p>
<p>I don&#8217;t know how it achieves this (trapping system calls, most likely) but it&#8217;s quite a feat to be able to stop an arbitrary code injection like that. Firewall? No, this has gone beyond and above firewall. This is a program for <b>security-oriented users</b>. How&#8217;s that for being in control?</p>
<p>If these people start adding even more features (and I have no doubt that they will) I will become a great, great fan of Little Snitch. Now, if only the icon were better. But there are designers like me and other far greater people (<a href=http://www.artofadambetts.com/weblog/>Adam Betts</a>, I&#8217;m talking to you!) who love to design replacement icons. I think both firewall programs, in general, could use more interface and icon design love. But they already provide excellent, stable functionality. Go check them out.  </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cocoia.com/2007/04/24/little-snitch-deserves-a-post-on-its-own/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Scanning my audience (split).</title>
		<link>http://blog.cocoia.com/2007/03/13/scanning-my-audience-split/</link>
		<comments>http://blog.cocoia.com/2007/03/13/scanning-my-audience-split/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 20:34:29 +0000</pubDate>
		<dc:creator>sebastiaan</dc:creator>
		
		<category><![CDATA[Hacking]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.cocoia.com/?p=18</guid>
		<description><![CDATA[Followup of the article; Howto: A more secure OS X before Leopard. I split this article from the followup of the earlier link, because it&#8217;s really two things apart. 
It&#8217;s been a &#8216;diggy&#8217; day yesterday; There was a considerable amount of traffic. 


Wow, what a friendly inauguration of my blog! As you can see, I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Followup of the article; <a href=http://blog.cocoia.com/?p=13>Howto: A more secure OS X before Leopard</a>. I split this article from the followup of the earlier link, because it&#8217;s really two things apart. </p>
<p>It&#8217;s been a &#8216;diggy&#8217; day yesterday; There was a considerable amount of traffic. </p>
<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/03//stats.jpg" border="0" height="348" width="452" alt="stats.jpg" align="" /></p>
<p>
Wow, what a friendly inauguration of my blog! As you can see, I&#8217;ve transferred a neat 6 gig in one day. I was silently hoping for this, because the follow-up required at least some people of who I could verify that they had read it. First off, more pretty figures and graphs.</p>
<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/03//pretty1.jpg" border="0" height="287" width="413" alt="pretty1.jpg" align="" /><br />
Mac User total: <b>10122</b> <br />
Mac Users that have been on the page for more than 5 minutes: 5238 (51,75%) </p>
<p>Now, what am I getting at with all these stats? Well, raw access logs, like any webserver generates, contain information that the readers&#8217; browsers sent to me. I am not into the whole American-ISP thing (I&#8217;m Dutch, myself), but it seemed to me a big share of the readers was American, and a whoppping 0,8% used Tor, which means 81 people (I think that is a lot, actually). Anyway, it wasn&#8217;t all that important, since last time I checked, portscanning was legal. <b>What, Sebastiaan, you scanned these people?</b> Yep. Let me first say a few words about this.</p>
<p>When I want to determine if people, say, followed my leads, and put their firewall on, put on UDP filtering, or even deleted the two rules that allowed in UDP traffic from the two magical ports; CUPS and Bonjour. Unfortunately, UDP is a very difficult protocol to do portscanning with, as it&#8217;s workings differ very much from TCP - a connection-based protocol. I need to use packets that &#8217;speak the language&#8217; of the protocol I am trying to find. I know my target services, namely NTP (Network Time), CUPS (Printing Daemon), and Bonjour. So, it would be difficult to enumerate what hosts have enabled their firewall (there isn&#8217;t really a way to tell what is dropping the packet, or I&#8217;d have to do a traceroute with every scan, which is possible, but a bit unwieldy). It is, however, easy to enumerate people who have not enabled UDP scanning, or have specifically removed the rules that allow UDP traffic into these ports (recieving an ICMP packet with port unreachable or administratively prohibited assumed in this test, by me, that it was blocked at the source). Thus, I can test the amount of people who have taken the advice and don&#8217;t need Bonjour and CUPS. </p>
<p>For this particular purpose of mass-scanning (don&#8217;t do this at home), I used a tailored and proven tool, scanrand. It&#8217;s a port scanner by Dan Kaminsky and it&#8217;s blazing fast. It uses SYN packets, like Nmap can deal out with the -sS option, and these TCP semi-connections go mostly unnoticed, especially by the OS X built-in firewall. Scanrand actually is able to output results in SQL, which is very handy, as you can just query your results. <a href=http://www.jitbit.com/log2sql.aspx>Hey, I can do that with my access logs too</a>. I haven&#8217;t feeded the SQL data into scanrand, but did manage to distill a list of the Mac users that have been reading for more than 5 minutes, with the IP addresses. After making sure it&#8217;s bandwidth was limited, I set it free. <br />
The results? <b>People use firewalls!</b> Most connections fail by virtue of the host in question being behind NAT (which means a router with a LAN behind it). However, a significant number still allows me to verify. Oohh, output.</p>
<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/03//scanrand.jpg" border="0" height="271" width="364" alt="scanrand.jpg" align="" /></p>
<p>That&#8217;s scanrand having fun, to see if people are online or not. Results; out of the 5238 users, a few hours later, 59,55% (3119) is online. After a cursory analysis of the scans&#8217; packet dump, I can determine by MAC address what computer is a Mac without a router before it, or a router of some sorts. Time to go on to the second phase, detecting services. For this, I use unicornscan, the former udpscan, which has very nice UDP scanning, and database support. <code>unicornscan  -B631 (or 5353 for Bonjour) -r200 -mU $target:631 (or 5353) -E >> ~/scanresults.tmp</code> does the job here, with a basic script that greps ps and does a count of the amount of unicornscan processes. -r defines rate, as unicornscan is blazing, and must be limited, -mU is UDP scanning, and -E shows unreachable ports as well. I cap at about ten concurrent scans. The address goes into $target, naturally. It&#8217;s great, because this stuff simply doesn&#8217;t show a line of output, it just runs, and after a few hours, I got my results. <b>Results</b>.  </p>
<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/03//endresults.jpg" border="0" height="360" width="428" alt="endresults.jpg" align="" /></p>
<p>Now for the numbers; </p>
<p>Eligible Readers: 3119<br />
Readers with NAT: 2304<br />
Readers without NAT: 815<br />
Readers with open ports: 479<br />
Readers with closed ports: 336<br />
Readers already offline or Blocked: 6 </p>
<p>What is there to say, apart from the not so shocking statistic that very few people switch off their router or Mac, is that <b>a very cool 41.23% has followed my advice thoroughly and deleted those rules</b>. Way to go, baby (provided these UDP scans are in any way accurate)! I am glad there are a lot of people who found this how-to useful and checked over their OS X. </p>
<p> <a href=http://digg.com/apple/Did_you_turn_your_firewall_on_I_scanned_my_audience/blog><b>digg this!</b></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cocoia.com/2007/03/13/scanning-my-audience-split/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Howto: An more secure OS X before Leopard (split).</title>
		<link>http://blog.cocoia.com/2007/03/13/howto-an-more-secure-os-x-before-leopard-split/</link>
		<comments>http://blog.cocoia.com/2007/03/13/howto-an-more-secure-os-x-before-leopard-split/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 20:34:27 +0000</pubDate>
		<dc:creator>sebastiaan</dc:creator>
		
		<category><![CDATA[Apple]]></category>

		<category><![CDATA[Hacking]]></category>

		<category><![CDATA[How-To]]></category>

		<category><![CDATA[Popular]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.cocoia.com/?p=17</guid>
		<description><![CDATA[
This is a folow-up on my earlier how-to &#8220;A more secure OS X before Leopard&#8220;. I have split this article from the results of the scan following the last article. I recommend following the first how-to before this one, if you haven&#8217;t read it, and see what potentially insecure defaults you can change without interfering [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/03//secure2.jpg" border="0" height="268" width="433" alt="secure2.jpg" align="" /></p>
<p><b>This is a folow-up on my earlier how-to &#8220;<a href=http://blog.cocoia.com/?p=13>A more secure OS X before Leopard</a>&#8220;. I have split this article from the results of the scan following the last article. I recommend following the first how-to before this one, if you haven&#8217;t read it, and see what potentially insecure defaults you can change without interfering with your daily activities.</b> Some things touched there that I will not discuss here are;</p>
<p>- Filevault<br />
- Turning on your Firewall<br />
- Bluetooth<br />
- Making a new, unprivileged user</p>
</p>
<p>Further securing OS X is something for the truly paranoid, although some of the tips in here are handy for people who do feel like a checklist of things they <b>could</b> do to secure their Mac further. I am one of those very paranoid people, and I like to be in control of what happens on my computer. There are, once again, basic, intermediate, and advanced tips and little tricks in here, this time clearly divided in difficulty. </p>
<p>
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//1basic.jpg" border="0" height="78" width="428" alt="1basic.jpg" align="" /> <br />
- <b>Disable your Microphone input and / or iSight if you aren&#8217;t using them</b> This hint, from the NSA Hardening guide, is a very good way to protect against any way for an intruder to physically eavesdrop on you, and any Quicktime component can access your iSight. There might be vulnerabilities looming on the horizon. The most desirable first is the iSight, as it has a real privacy concern if it were to be compromised. It&#8217;s as simple as a copy and paste into your Terminal. It won&#8217;t be painful, just open it for now.</p>
<p><code>/usr/bin/sudo /bin/chmod a-rwx /System/Library/QuickTime/QuickTimeUSBVDCDigitizer.component/Contents/MacOS/QuickTimeUSBVDCDigitizer</code></p>
<p> I will be explaining why I use full paths to commands later on. This simple line will make sure no user level process can access the module that interacts with the iSight. To restore; </p>
<p><code>/usr/bin/sudo /bin/chmod a+r /System/Library/QuickTime/QuickTimeUSBVDCDigitizer.component/Contents/MacOS/QuickTimeUSBVDCDigitizer</code> <br /> (I had this all mixed up. Thanks Greg)</p>
<p>Many thanks to <a href=http://techslaves.org/index.php?page=10>techslaves</a>. To disable your Microphone as well, you can set it&#8217;s input volume to zero in the Sound preference pane, under the &#8220;Input&#8221; tab. </p>
<p>- <b>Enable Secure Keyboard Entry in the Terminal</b> It&#8217;s that simple. It&#8217;s in the &#8220;File&#8221; menu in the menu bar.<br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//1ttem.png" border="0" height="101" width="266" alt="1ttem.png" align="" /> </p>
<p>- <b>Disable IPv6 if you aren&#8217;t using it.</b> Why? Potential vector for attack. To fix this, go to the Network configuration pane. Select the connection you want to use for internet access, and click here;<br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//ipv61.jpg" border="0" height="42" width="161" alt="ipv61.jpg" align="" /> <br />
And now make sure it is set as below; <br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//ipv62.jpg" border="0" height="57" width="304" alt="ipv62.jpg" align="" /> </p>
<p>- <b>Disable automatic Movie playback.</b> What if there were to be an iSight vulnerability by delivery in a Quicktime file? We wouldn&#8217;t want it to just play without us asking. Go to the Quicktime preference pane, browser tab; <br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//playmovies.png" border="0" height="81" width="352" alt="playmovies.png" align="" /> </p>
<p>- <b>Set your software updater to check more frequently</b>. Of course, we like to be ready for fixes. This goes without any picture, because this is too trivial. Just go to the preference pane of Software Update.</p>
<p>- <b>Ensure that access for assistive devices is disabled.</b> In the preference pane for Universal Access. You can also make your cursor insanely big here, which is nice.</p>
<p>- <b>Use a firewall accessory application like <a href=http://glowworm.us/>Glowworm FW Lite</a>, or <a href=http://www.obdev.at/products/littlesnitch/index.html>Little Snitch</a> </b>. Speaks for itself. Lets you decide if you want applications to connect to something.</p>
<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/03//1intermediate.jpg" border="0" height="78" width="428" alt="1intermediate.jpg" align="" /> <br />
- <b>Set an Open Firmware Password.</b> OF Passwords can be subverted in some ways (the password is nulled when RAM configuration is changed), but it is a hindrance. This works differently for PowerPC Macs and Intel Macs, because the latter use EFI and the other Open Firmware. For PowerPC, use the tool in Utilities to change your password. You can also boot with Command-Option-O-F pressed, to enter the OF prompt. From there, enter your newly set password, and type; <br />
<code>setenv security-mode full</code> </br><br />
To set full security mode, the most secure mode. <br />
<b>For Intel Macs</b>. Apple has not yet provided security extensions to the EFI. You can use the Open Firmware Password Utility to set an EFI password, but that&#8217;s about it. Perhaps in the future, we will see rEFIt become TPM-aware (see advanced section). </p>
<p>- <b>Use a more reliable DNS service.</b> It may even speed up your internet. OpenDNS is dubbed by some to be more reliable and secure than an arbitrary DNS server of your ISP. No real argument against that. To set OpenDNS&#8217;s DNS servers as yours, go to the Network preference pane, and select the interface you use for internet access. <br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//dns.png" border="0" height="45" width="514" alt="dns.png" align="" /> <br />
Simply set this field, present under the TCP/IP tab in your interface of choice, to these addresses, or go to <a href=http://www.opendns.com/>OpenDNS</a> yourself to verify (hey, I could offer you IP&#8217;s of MY DNS server, so don&#8217;t thread lightly).</p>
<p>- <b>Set a login-window warning banner</b>. (Courtesy of the Corsaire Report) Simply type; <br />
<code>/usr/bin/sudo /usr/bin/open /Library/Preferences/com.apple.loginwindow.plist </code><br />
in the terminal. This opens the preference file of your loginwindow application. <br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//loginwindow 1.jpg" border="0" height="143" width="502" alt="loginwindow 1.jpg" align="" /></p>
<p>Make sure where the suggestion for the password is, like my bogus text here, completely empty. Mine says &#8220;Grensschutzgruppe en Bas Haring&#8221;. Password hints may be a risk to the security of your system. Now, back on topic. Simply click the New Sibling button, and add the sibling LoginwindowText. Add some intimidating text, like; <br /> <cite>This is a private computer system and is for authorised use only.<br />
Any or all use of this system and all files on this system may be intercepted and monitored.<br />
Unauthorised or improper use of this system may result in disciplinary and/or legal action.  By<br />
continuing to use this system you indicate your awareness of and consent to these terms and conditions<br />
of use.<br />
</cite></p>
<p>-<b> Lock your keychain.</b> By default, the keychain that stores your passwords, is always unlocked. No one can read your passwords, but programs are able to access your passwords, if they created the password. Use the Keychain Access application to set another password than your login password for the keychain. It will then prompt you for your keychain password every time an item is needed, and it will be open for a configurable period, which defaults to 5 minutes.<br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//keychain.jpg" border="0" height="196" width="323" alt="keychain.jpg" align="" /></p>
<p>- <b>Use Encrypted Disk Images.</b> To secure file, or nest encrypted files even deeper in filevault, you can use the Disk Utility to create secure disk images.</p>
<p>- <b>Set a more critical umask.</b> (command courtesy of Corsaire write-up) The default umask allows all users to read each other&#8217;s new files. This command disables this; <br />
<code>/usr/bin/sudo /usr/bin/defaults write /Library/Preferences/.GlobalPreferences NSUmask 23 </code></p>
<p>- <b>Enable Process Auditing.</b> (command courtesy of Corsaire write-up) This will log commands executed by all users. One line; <br />
<code>/usr/bin/sudo /bin/mkdir /var/account &#038;&#038; /usr/bin/sudo /usr/bin/touch /var/account/acct &#038;&#038; /usr/bin/sudo /usr/sbin/accton /var/account/acct </code><br />
It will now run from startup. </p>
<p>- <b>Force SSH to use SSH2</b>. You can edit the ssh configuration like this; <br />
<code> /usr/bin/sudo /usr/bin/nano /etc/sshd_config </code> <br />
Now replace the line that reads &#8220;#Protocol 2, 1&#8243; with &#8220;Protocol 2&#8243;. Lose the comment mark, otherwise it won&#8217;t work.</p>
<p>- <b>Use full paths to command names.</b> This security measure, coined mostly by <a href=http://www.rixstep.com>Rixstep</a> (the author of the brilliant ACP), ensures Bash or defaults path poisoning is no longer an attack avenue. Although the bash developers didn&#8217;t consider it to be a real issue, <a href=http://rixstep.com/4/0/clix/>Rixstep&#8217;s CLIX</a> (an essential accessory to any power user, and it is free) has path resolving and builtin measures against path poisoning.</p>
<p>- <b>Keep an eye on startup scripts in launchd.</b> <a href=http://lingon.sourceforge.net/>Lingon</a> can be used to monitor what starts up automatically. It&#8217;s an excellent GUI utility.</p>
<p>- <b> Keep an eye on running services</b>. I use the simple <a href=http://www.hanynet.com/iservebox/>iServeBox</a> for this. A simple GUI to enable or disable services, handy if you know what you are doing. </p>
</p>
<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/03//1advanced.jpg" border="0" height="78" width="428" alt="1advanced.jpg" align="" /> <br />
- <b> Compile and run Bastille-OSX on a regular basis.</b><a href=http://www.bastille-linux.org/osx.html>Bastille for OS X</a> is a hardening assessment tool. It goes recommended for anyone that knows what he or she is doing. <a href=http://www.lehigh.edu/~sol0/Macintosh/X/ptk/>Perl-Tk on OS X</a> might be a useful resource in this effort. <br />
- <b>Compile and implement SEDarwin.</b> PPC-only for now, <a href=http://www.sedarwin.org/>SEDarwin</a> is an adaptation of the open Darwin kernel at the heart of OS X to support the Mandatory Access Control framework. It is, of course, based off SELinux.<br />
- <b>Use the Trusted Platform Module in your Mac.</b> This is, only if it has one. The first generation of Macbook Pro&#8217;s have a TPM, for example. Do an ioreg; </p>
<p><code>/usr/sbin/ioreg | /usr/bin/grep -i tpm</code></p>
<p>The output should look like this, and not any differently; </p>
<p><code>  | +-o TPM  <class IOACPIPlatformDevice, registered, matched, active, busy 0$ </code> </p>
<p>In this case, you got a TPM and after you have installed <a href=http://www.osxbook.com/book/bonus/chapter10/tpm/>the new, very cool open-source drivers and utilities by Amit Singh</a>, you can go use it with services you&#8217;d expect from it. As an advanced user, you could compile several tripwire-like solutions to hash files on disk and run them against a database of hashes stored in your TPM without having processor load, or bake your own solutions. </p>
<p><b>This concludes my divided how-to on securing your Mac beyond its defaults. You can use the following resources to your advantage, like I did, and try to persuade people to watch security more on OS X. </b> And no, I promise, there will be no more scanning. Be safe out there. </p>
<p>PDF Guides:<br /> <a href=http://www.nsa.gov/snac/downloads_macX.cfm>NSA&#8217;s Guide to Panther Hardening</a> <br /> <a href=http://research.corsaire.com/whitepapers/060517-securing-mac-os-x-tiger.pdf>Corsaire&#8217;s Guide on Securing OS X Tiger</a> <br /> <a href=http://images.apple.com/server/pdfs/Tiger_Security_Config_021507.pdf>Apple&#8217;s Document on Securing Tiger</a> </p>
<p>
small edit; added instructions for Intel Mac OF password, consistently explained using the full path to programs, added TPM entry.</p>
<p><b><a href=http://digg.com/apple/An_even_more_secure_OS_X_before_Leopard/blog>digg this!</a></b></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cocoia.com/2007/03/13/howto-an-more-secure-os-x-before-leopard-split/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Owning your network, open source style.</title>
		<link>http://blog.cocoia.com/2007/03/11/owning-your-network-open-source-style/</link>
		<comments>http://blog.cocoia.com/2007/03/11/owning-your-network-open-source-style/#comments</comments>
		<pubDate>Sun, 11 Mar 2007 21:27:55 +0000</pubDate>
		<dc:creator>sebastiaan</dc:creator>
		
		<category><![CDATA[Hacking]]></category>

		<category><![CDATA[How-To]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://blog.cocoia.com/?p=14</guid>
		<description><![CDATA[
In this new quick and dirty how-to, I want to address how I secure my personal network, consisting of a few rogue Windows computers (I manage a network that connects two houses with one internet connection at home) and two Macs, a FreeBSD server and a Linux server (my computers). It&#8217;s got wired and wireless [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.cocoia.com/wp-content/uploads/2007/03//inspector.jpg" border="0" height="540" width="600" alt="inspector.jpg" align="" /></p>
<p>In this new quick and dirty how-to, I want to address how I secure my personal network, consisting of a few rogue Windows computers (I manage a network that connects two houses with one internet connection at home) and two Macs, a FreeBSD server and a Linux server (my computers). It&#8217;s got wired and wireless access points, and my servers use wired connections. I use several tools on all platforms that you can all test for yourself without even touching your computer with the latest 2.0 of the <a href=http://www.remote-exploit.org/backtrack.html>Backtrack live CD</a>, a GNU / Linux security distribution that features some hot tools for you to use out of the box. Make sure it supports your hardware, though, or you will be in for a very boring ride.</p>
<p>First off, wireless networking is a very big hole in the security of any network. It&#8217;s trivial to penetrate many networks, in spite of encryption, MAC filtering (filtering devices by their hardware address) and other security mechanisms, it adds an attack vector for anyone with malicious intent. For rather personal reasons (I don&#8217;t like people whining about internet being a hassle) and fun and profit (more about this later on) I chose to keep my wireless access point.<br />
What&#8217;s always important to know, is who or what is on your network. The primary tool I use to enumerate hosts on my networks is <a href=http://insecure.org/nmap/>Nmap</a>, by the brilliant Fyodor. In any environment that&#8217;s got a shell (even Windows has a shell, check out <a href=http://www.cygwin.com/>Cygwin</a>), Nmap is trivial to automate, and it&#8217;s output is trivial to process. It runs nice and fast, and it has a host of options. Check out this shell command as an example to find hosts on your network and get the output in a format that is readable and even printable by dope things like Geektool (OS X), to put the output on your desktop.<br />
<code>'/opt/local/bin/nmap' -sP 192.168.2.0/24 | awk '/192.168./ {print $2, $6}'</code> <br />
Note; /opt/local/bin/ is my path to nmap. Use your own. The -sP command does a ping sweep of all hosts in the 192.168.2. subnet. In other words, the netmask is 255.255.255.0, or /24. You should change this to your network&#8217;s IP address range, as well as the two fields in awk. The output of the command looks like this;<br />
<code><br />
192.168.2.1 up.<br />
192.168.2.2 up.<br />
192.168.2.4 up.<br />
</code> <br />
Now, that&#8217;s just handy. Now we can already know what ping-replying people are on the network. If there seems to be a bit of a delay, and our scan doesn&#8217;t return results, we can use the more advanced options of Nmap - which require privileges. Some options to consider; -sL; the list scan. Will mass-scan a list of hosts, which you can use with the following, useful flags; -v for verbose mode, extra output! You can use the -PR, -P0 or -PN options to respectively use ARP for pinging, not ping at all, or use ICMP netmask requests (a clever one which can bypass Windows and OS X &#8217;stealth&#8217; mode firewalls default ICMP rules). With the -O flag, you can also let Nmap try to fingerprint the hosts&#8217; OS, which can be handy, as well as giving a guess of the network device&#8217;s hardware vendor with the aforementioned verbose mode. There are many open-source programs to quickly or otherwise uniquely enumerate or find hosts on a network, and I leave it to the reader to vary with programs like hping3, arping, fping, scanrand and others to get different or better results. I use arping and scanrand (<a href=http://www.doxpara.com/>Dan</a>, the man!) on a regular basis, because each has it&#8217;s own advantages. </p>
<p>A commonly-used attack on networks once in is using a poisoning attack to capture traffic. Virtually all routers operate as switches today, which means they don&#8217;t just send out all traffic on the network to anyone, but switch it between appropriate hosts. To keep track of all the hardware addresses and routing between platforms in the traditional IPv4, the ARP protocol is used. My very, very favorite tool for fucking with ARP (excuse my language) is <a href=http://ettercap.sourceforge.net/>ettercap</a>, but most people, for the safety of their own network, will merely want to keep tabs to see if people aren&#8217;t doing nasty shit. For this purpose, <a href=http://www.securityfocus.com/tools/142</a>arpscan</a> is a very fine choice. It compiles cleanly on virutally all operating systems (I don&#8217;t know about Windows, but this is owning your network open-source style, not borked-lego-interface style) and it sends an email to your local account when some suspicious activity occurs. Suspicious could be someone new seen on the network, or someone doing real nasty stuff (MAC spoofing / ARP poisoning). You can always manage these messages with the most owning open-source Mail program, <code>pine</code>, or simply use the command-line tool <code>mail</code>.<br />
Offensive network defense is sometimes a good idea if someone won&#8217;t leave the network when asked politely. Make sure you know what you are doing, and use Backtrack, or any UNIX with <a href=http://ettercap.sourceforge.net/>ettercap</a> to use the dark side of&#8230; ARP (and a host of other attacks!). <br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//ettercap.jpg" border="0" height="237" width="482" alt="ettercap.jpg" align="" /></p>
<p>Say hello to <code>ettercap -C</code>. Ettercap obviously requires privileges, and it can be used to sniff out traffic first, but also make a nice host list and perform attacks on these hosts. The -C option uses by favorite interface system, Curses, but if your X11 has GTK, you can download ettercap-gtk and run it in it&#8217;s own window, with a &#8216;real&#8217; interface. It can, obviously, also be ran as a command-line tool.<br />
<b>If you do not know what you are doing, fooling around with ARP Poisoning could <u>break</u> a network</b>. Yes, you can get in dire trouble if you really start to fuck around with this in places other than your own network. Now, if you don&#8217;t mind your router being harassed by routing the traffic, you can disable internet for a host by simply not changing your routing settings, and performing ARP poisoning with ettercap. The hosts&#8217; traffic will be routed through the router, to your computer, which will drop it. Incidentally, this often means the host sends it&#8217;s IM login info several times, which ettercap will display for you. <br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//arp.jpg" border="0" height="145" width="207" alt="arp.jpg" align="" /> <br />
Use this attack, with the &#8216;remote&#8217; option. Don&#8217;t forget to use the &#8216;Stop mitm attack(s)&#8217; when you are done. The console should provide you with output like the dropped packets and passwords. Configure logging to a convenient file in the logging tab, and make sure you have your router configured as Target 1, and the victim as Target 2 in the host list (under Hosts, obviously). Dandy. You can mess around with other, potentially destructive options on your own network at your own discretion. Just remember, I didn&#8217;t break it.<br />
Now, what else can we do to own a network? Well, the former Ethereal (now Wireshark) is an excellent cross-platform (Nmap-cross platform, Windows users, go wild) packet sniffer. You can use it to take a more in-depth look at your traffic, as it can often sniff out raw wireless packets too, and login information. The convenient protocol coloring shows you what part of the network traffic is what, even measured in percentages. Think that sounds nice? Here&#8217;s an obligatory screenshot.<br />
<img src="http://blog.cocoia.com/wp-content/uploads/2007/03//front_screen_full 1.png" border="0" height="374" width="501" alt="front_screen_full 1.png" align="" /></p>
<p>Ooh, pretty colors. Remember you can always check all these tools out hassle-free if you have a Backtrack-compatible setup. </p>
<p>This should give you some pointers on what steps you can take to feel like you are owning your network a bit more. Remember to look at the tools, read the documentation and be creative. The only way to control a network is to get in touch with the technical side.</p>
<p><a href=http://digg.com/linux_unix/Owning_your_network_open_source_style/>digg this!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cocoia.com/2007/03/11/owning-your-network-open-source-style/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
