<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>ISIS &#187; Operating Systems</title>
	<atom:link href="http://isisblogs.poly.edu/category/os/feed/" rel="self" type="application/rss+xml" />
	<link>http://isisblogs.poly.edu</link>
	<description>Information Systems and Internet Security</description>
	<lastBuildDate>Mon, 20 Oct 2008 17:57:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
		<item>
		<title>BackTrack 3: Demos of selected tools</title>
		<link>http://isisblogs.poly.edu/2008/04/08/backtrack-3-demos-of-selected-tools/</link>
		<comments>http://isisblogs.poly.edu/2008/04/08/backtrack-3-demos-of-selected-tools/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 18:02:31 +0000</pubDate>
		<dc:creator>aleksey</dc:creator>
				<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://isisblogs.poly.edu/?p=83</guid>
		<description><![CDATA[BackTrack 3 (2007-12-14) is a penetration testing live Linux distribution. It is packed with plethora of tools organized by categories.

With this large amount of utilities, it is sometimes hard to pick the correct one for the job. At Shmoocon 2008, a BackTrack representative gave a talk which was good, but focused on exploiting a Windows [...]]]></description>
			<content:encoded><![CDATA[<p>BackTrack 3 (2007-12-14) is a penetration testing live Linux distribution. It is packed with plethora of tools organized by categories.</p>
<p><img class="aligncenter" src="http://isisblogs.poly.edu/wp-content/uploads/bt_menu.JPG" alt="Bt_menu" /></p>
<p>With this large amount of utilities, it is sometimes hard to pick the correct one for the job. At Shmoocon 2008, a BackTrack representative gave a talk which was good, but focused on exploiting a Windows binary using Olly, not on showing off the features of the distribution. So I took it upon myself to click on every single link and find the awesome and the less awesome tools among the bunch. Note that the work that I did was for a presentation. There are videos which are self-explanatory but at times need commentary. I will provide some explanation in writing.</p>
<p><span id="more-83"></span></p>
<p><span style="#0000ff;"><span style="#0000ff;"><strong>1. CREDITS</strong></span></span></p>
<p>BackTrack3 &#8211; www.remote-exploit.org<br />
Tactical Exploitation â€“ H.D.Moore &amp; Valsmith (Defcon 2007)â€<br />
Metasploit Videos &#8211; learnsecurityonline.com</p>
<p><span style="#0000ff;"><span style="#0000ff;"><span style="#0000ff;"><strong>2. RECORDING</strong></span></span></span></p>
<p>BackTrack comes with a video recording utility, <em>recordmydesktop. </em>You can either record the whole desktop or just one window using a window id. Some useful commands are:</p>
<p><em>recordmydesktop &#8211;no-sound -o out.ogg<br />
xwininfo |grep &#8220;Window id:&#8221;|sed -e &#8220;s/xwininfo\:\ Window id:\ // ;s/\ .*//&#8221;  #gives you a window id<br />
recordmydesktop &#8211;nosound -windowid 0&#215;0442 -o out2.ogg</em></p>
<p><span style="#0000ff;"><span style="#0000ff;"><span style="#0000ff;"><strong>3. INFORMATION GATHERING</strong></span></span></span></p>
<p>In this category, the focus is on information aggregators, network discovery tools and OS and application vulnerability scanning tools.</p>
<p><strong>3.1. Maltego &#8211; Personal Discovery</strong></p>
<p>This is a tool from www.paterva.com that can be used for personal discovery. It has been in development for a while now and switched from a web version to a standalone binary version. It is a total information aggregator. It can search social networks such as LinkeIn, public PGP key servers. It can pull down various information from inside documents and other aggregators such as serversniff.de and robtex.com. It offers services such as geoip resolutions, email verification. The tool has a graphical interface and you can start your search by domain, IP address, website, email, person, phone number etc. The information is presented as a directional graph and any results can be further interrogated producing new results. You can use this to do various things such as profiling users of a certain server, searching for groups of people, determining relationships between websites, building PGP trees etc.</p>
<p>Maltego commonly finds phone numbers, addresses, names, personal sites, resumes, newsgroup postings, usernames, email addresses.</p>
<p><img class="alignnone" src="http://isisblogs.poly.edu/wp-content/uploads/maltego_screen_small.jpg" alt="Maltego" /></p>
<p><strong>3.2. Nmap and Websites &#8211; Network Discovery</strong></p>
<p>While doing network discovery, you are looking for variety of things such as  MX records, internal networks, outsourced services, important server and open ports. The number one tool for this is still Nmap. A lot has been written about nmap, so I will just share my favorite usage and leave it at that:</p>
<p><em>nmap -sS -P0 -O -T Sneaky -p 445 -D 64.233.169.99 &lt;ip_to_scan&gt;</em></p>
<p>The above command initiates a stealth scan (-sS) which does not complete the TCP connection. This is fairly fast and unobtrusive. The -P0 flag tells nmap not to ping the IP which adds to stealth. The -T is a timing flag that can be set from Sneaky to Insane and determines the speed of packet generation. The -p flag specifies the port or a port range. You can use this flag either to add to stealth by specifying one or few ports, or add to thoroughness by providing a range of 1-65535. And last but not least, the -D flag allows you to specify a number of decoys. I usually put googlebot&#8217;s IP address. This makes  nmap generate packets from your IP address and googlebots IP address (the response to which will go to google). This has an effect of confusing the target.</p>
<p>I would also like to share with you 2 less known network discovery tools. Two websites, <a href="http://www.domaintools.com">www.domaintools.com</a> and <a href="http://centralops.net">centralops.net</a> provide nmap-like services. You can use these to create a domain dossier on any website that will include things like popular port scan, ping, traceroute, nslookup and whois. And best of all, the traffic is not going to come from you.</p>
<p><strong>3.3. OS &amp; Application Vulnerability Scanning</strong></p>
<p>GFI LANguard is a tool I found as a useful replacement for Nessus (BackTrack does not include Nessus).  It is only free with this BackTrack distribution. I found this tool to be a slightly slimmed down version of Nessus. On the other hand it was incredibly easy to use and it provides a wealth of information. It can scan a range of IPs to determine open ports, operating systems, common vulnerabilities,  users, shares, running processes, security policies, missing patches, SNMP devices and functions they provide. This demo shows a limited use of its features and the results are more glorious on a larger network.</p>
<p><a href="http://isisblogs.poly.edu/wp-content/uploads/gfilanguard.ogg">video</a></p>
<p><span style="#0000ff;"><span style="#0000ff;"><strong>4. WIFI WEP Fun</strong></span></span></p>
<p>BackTrack has an excellent collection of various wireless tools. I will present some of these here. I will use them to defeat WEP protection of my home router.</p>
<p><img class="alignnone" src="http://isisblogs.poly.edu/wp-content/uploads/wep_diagram.JPG" alt="wep diagram" /></p>
<p><strong>4.1 WEP Overview</strong></p>
<p>WEP weakness stem from frequently repeating 24-bit IVs (initialization vectors) and the use of weak RC4 algorithm for keystream generation. This knowledge has been used to create a <strong>brute force attack</strong>. In this attack, you need to only capture a single encrypted packet and apply enormous amount of computing power to try all possible keys. This is possible due to the fact that the real key length is 40 for 64-bit keys and 104 for 128-bit keys. It has been shown that a weak key can be brute-forced in a manner of minutes. Another type of attack is <a href="http://www.drizzle.com/~aboba/IEEE/rc4_ksaproc.pdf">FMS attack</a> which is a statistical attack on known weak keys. You need to capture a lot of traffic to collect these keys, apply little CPU power and perform this attack. The tools that I describe below use the FMS attack.</p>
<p><strong>4.2 Airo Tools </strong></p>
<p>Below is a sequence of commands to use. I will not post the video due to its large size. You have to first bring up an interface in monitor mode. Then, you have to find a target with a command like &#8220;<em> wlanconfig ath0 list scan</em>&#8220;. Then, use airodump-ng for collection of IVs, aireplay-ng for speedup of collection of IVs, and aircrack-ng for cracking of the key. In general, you need about 60KB of IVs before you should attempt to crack a 128-bit key. I waited until my filesize was a few megabytes. Depending on how fast the packets are flowing, the attack can take a few minutes or much more.</p>
<p><em>ifconfig wifi0 up<br />
wlanconfig ath0 create wlandev wifi0 wlanmode monitor<br />
ifconfig ath0 up<br />
wlanconfig ath0 list scan<br />
airodump-ng &#8211;ivs -c 6 &#8211;write dump &#8211;bssid &lt;AP&#8217;s_MAC&gt; ath0<br />
aireplay-ng -2 -b &lt;</em><em>AP&#8217;s_MAC</em><em>&gt; -d ff:ff:ff:ff:ff:ff -m 68 -n 68 -p 0841 -h &lt;Innocent_computer&#8217;s_connected_to_AP_MAC&gt; ath0<br />
aircrack-ng -f 2 -a 1 -b &lt;APs_MAC&gt; -n 128 dump-01.ivs</em></p>
<p><strong>4.3 Wesside-ng Demo</strong></p>
<p>This is a tool that automates WEP cracking. It is still in early stage of development and I could only get it working with an atheros chipset. It is simple to use and does <em>everything</em> on its own. It finds a nearby vulnerable network, collects traffic and cracks the key.</p>
<p><em>wesside-ng -i ath0</em></p>
<p><a href="http://isisblogs.poly.edu/wp-content/uploads/wessideng_tools2.ogg">video</a></p>
<p><span style="#0000ff;"><span style="#0000ff;"><strong>5. Other WIFI tools</strong></span></span></p>
<p><strong>5.1 WifiZoo</strong></p>
<p>This is the most useful tool that I found. I believe it comes from the CoreImpact toolkit. It is used primarily for cookie stealing on unencrypted and possibly encrypted (untested) networks. On my test network I managed to steal Facebook cookies. I had unlimited control of the Facebook account of the &#8220;victim&#8221; and could do anything up to changing the password. I also managed to steal Gmail cookies. Pretty much the only things I could do was read email and set a forwarding email. I could not change the password.</p>
<p>I am not posting a demo of this due to size limitations and privacy issues. I am posting a screenshot. As you can see the tool also automatically collects FTP data and SMTP data. What you have to do to get it working is:</p>
<p>1. <em>nano /pentest/wireless/wifizoo/wifizoo.py</em> and change conf.iface=&#8217;eth0&#8242; to you monitor interface<br />
2. <em>./wifizoo.py</em> to start the tool<br />
3. Start Firefox and change its HTTP proxy to <em>127.0.0.1:8080</em><br />
4. Point the browser to <em>127.0.0.1:8000</em> which is WifiZoo&#8217;z webinterface</p>
<p><img class="alignnone" src="http://isisblogs.poly.edu/wp-content/uploads/wfizoo.jpg" alt="wifizoo" /></p>
<p>5. After that, it&#8217;s smooth sailing &#8211; click on the cookies link, click on a captured cookie, select &#8220;Set Cookie&#8221; and it will take you to the IP address of the website. You usually have to change the IP address to the name manually (e.g. change <span class="ipaddr"> 69.63.176.140 to www.facebook.com in the browser location bar</span>).</p>
<p><strong>5.2 MDK3</strong></p>
<p>I don&#8217;t know if this stands for &#8220;Murder Death Kill 3&#8243; but it sure looks like it. I could not fully test this tool as I did not want to attack a large network and this is mainly where it would shine. This tools allows you to deploy a 3-part attack. First, you can deauthenticate clients from all nearby or a selected Access Point thus providing a denial of service. Second, you can flood the nearby APs with authentication requests. This can lead to a situation where some APs will need to be restarted or the become full and will not accept any new users. Third, you can create a beacon flood of fake APs specifying some ssid or generating random ssid names. After this step, the legitimate clients that were booted from their APs in step 1 will have a lot of problems reconnecting.  This sounds like it could create some major havoc on unsuspecting networks. Most of this can probably be mitigated by  a combination of MAC filtering and good firmware. The commands are:</p>
<p><em>mdk3 eth0 d                                        # deauthentication attack<br />
mdk3 eth0 a -a &lt;AP_MAC&gt;                 # authentication flood<br />
mdk3 eth0 b -n MyEssid -w -c 11       # beacon flood mode</em></p>
<p><span style="#0000ff;"><strong><span style="#0000ff;">6. EXPLOITATION FRAMEWORKS</span><br />
</strong></span></p>
<p>Backtrack comes with Metasploit, Inguma, W3AF and a few others. I have tested Metasploit and W3AF and will present my results here.</p>
<p><strong>6.1 Metasploit 3 &#8211; unlocking a workstation</strong></p>
<p>The problem is simple, I have a Windows 2000 VMware workstation that I don&#8217;t know the password to. Since it turns on, it probably goes online and gets an IP address. A nmap scan reveals that to be true. After that, I take a random exploit for windows 2000 and throw it at the box. This one happens to be a Net32Api CanonicalizePathName() stack overflow. The payload is set to vncinject. By default, it provides a &#8220;Courtesy Shell&#8221;. Typing &#8220;explorer.exe&#8221; in that shell bypasses the authentication window and allows the change or Administrator password. Note that I am using the Windows GUI Metasploit. I had to do this due to my need to start a VM.</p>
<p><a href="http://isisblogs.poly.edu/wp-content/uploads/metasploit_unlockbox.avi">video</a></p>
<p><strong>6.2 Metasploit 3 &#8211; SMB Relay Attack</strong></p>
<p>Multiple videos already exist for this attack elsewhere and while doing this I used a tutorial from learnsecurityonline.com. The attack mechanism is described nicely <a href="http://xfocus.net/articles/200305/smbrelay.html">here</a> and <a href="http://perimetergrid.com/wp/2007/11/27/smb-reflection-made-way-too-easy/">here</a>. In a few words, whats going on here is &#8211; a man in the middle reflection attack based on the weakness of the Microsoft SMB file sharing authentication protocol. Note that I am using a web interface this time.</p>
<p><a href="http://isisblogs.poly.edu/wp-content/uploads/metasploit_smb_relay.avi">video</a></p>
<p><span style="#0000ff;"><strong><span style="#0000ff;">7. PENTESTING A WEBSERVER</span><br />
</strong></span></p>
<p>The tools that you want to use for this are: webspiders, webserver vulnerability scanners, exploitation frameworks for web, credential brute-forcing utilities.</p>
<p><strong>7.1 Nikto</strong></p>
<p>This is web server scanner which performs tests against web servers for multiple items, including over 3500 potentially dangerous files/CGIs, versions on over 900 servers. It commonly finds outdated software versions (SSL, Apache, PHP), allowed HTTP methods, and various directories that are missing index files.</p>
<p><img class="alignnone" src="http://isisblogs.poly.edu/wp-content/uploads/old_missing_index.JPG" alt="no index file" /></p>
<p><strong>7.2 W3AF</strong></p>
<p>This is a web application attack and audit framework. I have not experimented much with it. I used its webSpider to collect all the links of a webserver. Then I wrote a script  to extract the users of the server by searching for &#8220;~&#8221;.</p>
<p>Summary: Using the information collected from just the above two tools, we can now go ahead and try to exploit the server by looking for existing vulnerabilities for the outdated software, examining the files in directories that are missing index files to try to find .htpasswd files or embedded passwords in PHP files. We can also try to bruteforce the accounts of the users we collected from the webspider. The tools to use for bruteforcing are Hydra, Medusa, and SSHater. They come with modules that allow you to attack most popular protocols (ssh, ftp, telnet, imap etc).</p>
<p><span style="#0000ff;"><span style="#0000ff;"><strong>8. TOOLS I DIDN&#8217;T LIKE</strong></span></span></p>
<p>There were a few that I didn&#8217;t like but others I just didn&#8217;t find useful. The list would be too long if I had to list it here. I will mention the fact that THC-Hydra and Medusa, both online password brute forcers, core dumped when I tried to use them.</p>
]]></content:encoded>
			<wfw:commentRss>http://isisblogs.poly.edu/2008/04/08/backtrack-3-demos-of-selected-tools/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
<enclosure url="http://isisblogs.poly.edu/wp-content/uploads/metasploit_unlockbox.avi" length="37459456" type="video/x-msvideo" />
<enclosure url="http://isisblogs.poly.edu/wp-content/uploads/metasploit_smb_relay.avi" length="19148288" type="video/x-msvideo" />
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Multiple Vulnerabilities in ALL Synology Products</title>
		<link>http://isisblogs.poly.edu/2008/04/04/multiple-vulnerabilities-in-all-synology-products/</link>
		<comments>http://isisblogs.poly.edu/2008/04/04/multiple-vulnerabilities-in-all-synology-products/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 02:48:55 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Exploits]]></category>
		<category><![CDATA[Network Security]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Press Release]]></category>
		<category><![CDATA[Security Engineering]]></category>

		<guid isPermaLink="false">http://isisblogs.poly.edu/?p=81</guid>
		<description><![CDATA[In an earlier post to my personal blog as well as to this blog, I enthusiastically recommended the Synology CS407 NAS as a data storage/backup platform. I am now taking that recommendation back.
Let me just say this: it seemed like a good choice at the time, and, if I could have trusted the vendor to [...]]]></description>
			<content:encoded><![CDATA[<p>In an earlier post to <a href="http://www.cryptocity.net/blog/2007/04/27/dude-im-getting-a-nas/">my personal blog</a> as well as to <a href="http://isisblogs.poly.edu/2008/01/18/qa-with-isis-outsourced-backup/">this blog</a>, I enthusiastically recommended the <a href="http://www.synology.com/enu/products/CS407/index.php">Synology CS407</a> <a href="http://en.wikipedia.org/wiki/Network_Attached_Storage">NAS</a> as a data storage/backup platform. <strong>I am now taking that recommendation back</strong>.</p>
<p>Let me just say this: it seemed like a good choice at the time, and, if I could have trusted the vendor to deploy the software on it properly, it might still be. Here is a short summary of some of the issues I found:</p>
<p><a href="http://isisblogs.poly.edu/wp-content/uploads/exposure.png" rel="lightbox[81]"><img src="http://isisblogs.poly.edu/wp-content/uploads/exposure_small.jpg" alt="Table of Vulnerability Exposure for Synology Products" /></a></p>
<p>You can skip to the full report here: <a href="http://cryptocity.net/files/advisories/synology_report.pdf">A Security Audit of the Synology Disk Station Manager (DSM) v2.0-0590 Firmware</a>.</p>
<p>What follows is a complete retelling of how I got here, sort of a lesson in vulnerability disclosure (not so much discovery, you&#8217;ll see why). It&#8217;s not pretty, <strong>I didn&#8217;t do all the right things</strong>, and it&#8217;s kind of long.</p>
<p><span id="more-81"></span></p>
<p>I had a lot of free time over Spring break (read: no money to travel anywhere) and so I decided to start &#8220;kicking the tires&#8221; of the Synology CS407 I owned. My jaw dropped when I got this first nmap scan back:</p>
<pre>PORTÂ Â Â Â Â  STATE SERVICEÂ Â Â Â  VERSION
80/tcpÂ Â Â  openÂ  httpÂ Â Â Â Â Â Â  Apache httpd 2.2.3 ((Unix) mod_ssl/2.2.3 OpenSSL/0.9.7e PHP/5.2.0)
139/tcpÂ Â  openÂ  netbios-ssn Samba smbd 3.X (workgroup: WORKGROUP)
443/tcpÂ Â  openÂ  httpÂ Â Â Â Â Â Â  Apache SSL-only mode httpd
445/tcpÂ Â  openÂ  netbios-ssn Samba smbd 3.X (workgroup: WORKGROUP)
515/tcpÂ Â  openÂ  printer
548/tcpÂ Â  openÂ  afpovertcp?
3306/tcpÂ  openÂ  mysqlÂ Â Â Â Â Â  MySQL (unauthorized)
3493/tcpÂ  openÂ  tcpwrapped
3689/tcpÂ  openÂ  httpÂ Â Â Â Â Â Â  mt-daapd httpd 0.2.4
5000/tcpÂ  openÂ  httpÂ Â Â Â Â Â Â  Apache httpd 2.2.3 ((Unix) mod_ssl/2.2.3 OpenSSL/0.9.7e)
5001/tcpÂ  openÂ  httpÂ Â Â Â Â Â Â  Apache SSL-only mode httpd
5432/tcpÂ  openÂ  postgresqlÂ  PostgreSQL DB
50001/tcp openÂ  tcpwrapped</pre>
<p>It only got worse when I ran Nessus. And then worse when I got a shell and started poking around the filesystem. Get this: <strong>every application on the box is running as root</strong>! And <strong>all the web apps are written as compiled binaries running in CGI&#8230; with root privileges</strong>! As a friend in the lab described it, &#8220;1996 called, it wants its web technology back!&#8221; They weren&#8217;t even making it difficult.</p>
<p>This is where things got interesting. I looked around and there isn&#8217;t any formal security contact or even a public bug tracker (and they call themselves a Linux vendor!). I&#8217;m thinking maybe I can save myself some trouble and get this solved informally, so I made this <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;start=0&amp;st=0&amp;sk=t&amp;sd=a#p30895">really scary sounding post</a> on their user support forums with just the results of that nmap scan. I also submitted a technical support request at the same time, pointing to the forum post. Best idea? No. But it was easy. I really didn&#8217;t want to write a formal report and submit it. I&#8217;m not getting paid for this, and frankly, I&#8217;m kind of pissed off that I bought this thing and that I&#8217;m stuck with it now.</p>
<p>Two moderators immediately replied to my forum post claiming that there were <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;start=0&amp;st=0&amp;sk=t&amp;sd=a#p31015">no security vulnerabilities</a> and that <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;start=0&amp;st=0&amp;sk=t&amp;sd=a#p31053">security vulnerabilities were the price we pay for having the coolest NAS out there</a>. I thought these were official representatives of Synology at first and was ready to make a post to full-disclosure after reading their replies.</p>
<p>Then an official response came back from their tech support: log in to the box over SSH (which they don&#8217;t provide, I had to hack it to turn it on) and turn off the affected services. They also recommended I <em>put the box behind a firewall</em>&#8230; This is why you&#8217;re supposed to have a security@ contact, so people like me don&#8217;t get stuck with non-tech and sales staff. I said a few specific things in my reply to get my concerns in front of the right people:</p>
<ol>
<li>Ask for this issue to be escalated to a product manager</li>
<li>Explain the risks they were putting themselves and their customers under</li>
<li>Explain what would happen if they didn&#8217;t respond to my concerns (full-disclosure)</li>
<li>Included a PDF of a very early draft of my report</li>
</ol>
<p>That worked. 3 days later I got a response from Synology (still their sales staff) indicating that more than half of the vulnerabilities I pointed out would get fixed in a new release of the firmware due out in 60 days. They denied a number of vulnerabilities, which I explained further and sent back to them.</p>
<p>Then I didn&#8217;t hear from them for 9 days. Apparently, my emails were getting stuck in their spam filter (again, vendors, please set up a security@ e-mail)! This went back and forth for a bit and I&#8217;ve moved about 90% of the issues into the next release! A handful of more architectural issues were pushed back until a release 6 months in the future. You can&#8217;t win them all, but at least they are aware of the issues now.</p>
<p>Back on the forum, I had been getting fairly actively involved by answering security questions from other users. Some intelligent people saw what I was saying and <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=15#p31157">came</a> <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=15#p31159">to</a> <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=30#p31241">my</a> <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=30#p31726">defense</a> <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=45#p31991">when</a> the fanboys attacked what I was saying about their precious devices. Two people even posted that they had <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=45#p32347">delayed</a> or <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=30#p31854">reconsidered</a> buying Synology products because of this discussion! It was really great to hear that, both as vindication that what I was saying was important and that Synology&#8217;s management had to take me seriously now. They were actively losing customers due to poor development practices.</p>
<p>How they reacted to this really isn&#8217;t surprising in hindsight: they moved all my posts to a separate, special forum, away from potential and current (but mostly potential) customers. Then their moderators started getting fed up that people were still talking about security issues they thought were irrelevant and resorted to <a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=60#p32377">character attacks and flaming</a>. I sent an e-mail to my contact on the sales staff that someone representing their company was acting inappropriately and their behavior might be tied back to the company. Synology responded by <strong><a href="http://www.synology.com/enu/forum/viewtopic.php?f=88&amp;t=7304&amp;st=0&amp;sk=t&amp;sd=a&amp;start=60#p32432">locking my post</a></strong>.</p>
<p>And that&#8217;s the end of that mess.</p>
<p>If you have a Synology product&#8230; well good luck! All the problems I found won&#8217;t be resolved until 09/2008! And even then, I&#8217;m <strong>sure</strong> there will be more security vulnerabilities. Those compiled binary CGIs are a ticking timebomb. If you don&#8217;t already own a Synology product, I suggest <a href="http://www.freenas.org/">FreeNAS</a>. You can install it in a VM and try it before you &#8220;buy&#8221; it. I&#8217;d really like to get my hands on one of NetGear&#8217;s ReadyNAS products&#8230; anyone with one want to let me poke around it for a bit?</p>
]]></content:encoded>
			<wfw:commentRss>http://isisblogs.poly.edu/2008/04/04/multiple-vulnerabilities-in-all-synology-products/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Prodding programs</title>
		<link>http://isisblogs.poly.edu/2007/02/06/prodding-programs/</link>
		<comments>http://isisblogs.poly.edu/2007/02/06/prodding-programs/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 23:34:39 +0000</pubDate>
		<dc:creator>Yan Ivnitskiy</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Low-level]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Reverse Engineering]]></category>

		<guid isPermaLink="false">http://isisblogs.poly.edu/2007/02/06/prodding-programs/</guid>
		<description><![CDATA[I will try to keep this to the point. Auto-completion on the terminal is something we all love and it makes using a UNIX system and running commands far more pleasant. Most shells can auto-complete path names, binary names, and built in commands. Bash goes further and supports auto-completing user names, hosts and a few [...]]]></description>
			<content:encoded><![CDATA[<p>I will try to keep this to the point. Auto-completion on the terminal is something we all love and it makes using a UNIX system and running commands far more pleasant. Most shells can auto-complete path names, binary names, and built in commands. Bash goes further and supports auto-completing user names, hosts and a few other trivial things. No shell that I know of has ever attempted to auto-complete the arguments that the binaries take. Leaving out support for this makes sense, as there is no common way for a binary to store the arguments it can take inside the program binary, and it is bound to be a porting nightmare.</p>
<p>Keeping this in mind, I realized that almost every single UNIX binary gets its arguments from the shell in a standard, POSIX-compliant way. The <a href="http://www.freebsd.org/cgi/man.cgi?query=getopt&#038;apropos=0&#038;sektion=3&#038;manpath=FreeBSD+6.2-RELEASE&#038;format=html">getopt</a> libc function call parses the input from the shell in to usable internal flags. If one were to peek inside what each binary gives to getopt(), one would find out all arguments it is expecting to take and provide more insight about the executable! This is what I have done and what the remainder of the post is about.</p>
<p>This is what my previous post related to. Now I realize this is a slightly silly goal. My primary reason for doing this is to learn the techniques I&#8217;ve used to get there, which I simply could not learn without experimentation and a concrete goal in mind. The way this problem was attacked as follows:</p>
<p><span id="more-13"></span></p>
<p>Each step has an explanation of it below it:</p>
<h2>How this works</h2>
<ol>
<li>I use <a href="http://wiki.freebsd.org/LibElf">libelf(3)</a> to open the binary, and read its sections.</li>
<ul>
<li>Most UNIX binaries are in the ELF format. The official draft is included in the tarball at the end of this post. ELF (or Executable and Linkable Format) is a file format that most UNIX systems today understand.</li>
</ul>
<li>The sections I care about are the PLT and the dynamic symbols section.</li>
<ul>
<li>An ELF file contains information in sections. The two sections I mentioned are the section that contains the dynamic symbols and the procedure linkage table</li>
<ul>
<li><b>Dynamic symbols</b> &#8211; When you write a program that uses a shared library, libc being the prime example. One copy of libc is shared among many processes, and when you compile a program, the actual code from libc does not get compiled into the binary. What happens is that your compiler leaves a little note to your operating system (or the operating system loader [Not the boot loader! <img src='http://isisblogs.poly.edu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ]) saying &#8220;Here I call some functions that should be in a shared library that you might have loaded, and if not you can load it as you need it. I will be calling printf and getopt, so I will reference to them as if I have them. Please fill in those references as you find your own copy of libc&#8221;. That list of functions is called the <b>dynamic symbol</b> table. Each process that utilizes shared libraries (which is almost all of them) has a GOT (or a Global Offset Table) which is a table that maps those symbols to the locations in the library where the code actually is. So when you call printf() in your code, in the compiled instructions, the code actually looks at the printf() entry in the GOT and jumps to whichever address it points to. When you leave those references &#8216;open&#8217; as I mentioned earlier, those entries are simply not filled in. When the loader resolves those references, it fills in the proper address of the shared library. So to picture it, the flow of execution is as follows: printf() &#8211;> GOT &#8211;> actual printf code. Now for reasons outside the scope of this post, there is yet another level of indirection. So in reality the flow is: printf() &#8211;> PLT &#8211;> GOT &#8211;> actual printf(). The <b>PLT</b> is a series of jump statements that go to the GOT. This jump table is what we focus on.
	 		</ul>
</ul>
<li>I then extract the position of the getopt symbol and look it up in the PLT.</li>
<ul>
<li>From the information I retrieved using libelf, I check at which address the PLT table gets loaded (section &#8216;.plt&#8217;), then I check the index of the getopt symbol in the symbol table, and I obtain the address of the PLT entry by simply performing: .plt + (getopt position + 1) * 0&#215;10 (0&#215;10 is the size of a plt entry as far as I know, and +1 because I want to skip the 0th entry of the PLT table)
	</ul>
<li>I start the binary, overwrite the proper address, set a breakpoint, and extract the arguments.</li>
<ul>
<li>I now have the jump that gets taken every time when getopt gets called. I now fork() and before I execv() the process, I enable the process to be traced with the ptrace(3) interface. This is the same method that debuggers use to attach to processes. The parent gets notified once the child is finished being loaded if it is being traced. Once I get notified that it is created, with the proper address of getopt in hand, I overwrite that jmp instruction with a int3 instruction (or 0xCC assembled. Something to note, in my code I overwrite it with 0xcccccccc, which is just four int3 instructions. I didn&#8217;t want to bother with byte-ordering or alignment issues, so I just overwrote the entire word. Since the instruction is only one byte, it works just fine.) This instruction will trap into the parent once reached. This is also how debuggers set breakpoints, with a slight difference: They save the original instruction they overwrote so they can restore it on the next execution, but since I simply don&#8217;t care for it to continue running I can just go walking all over it. Now I continue the child process.</li>
<li>All my child interaction and prodding was done with the ptrace() system call.</li>
<li>Once the parent gets trapped again, I now know that I am at the point where getopt() was JUST called. If you remember, the standard C calling convention is to push all the arguments to the stack and then call the function. I now know that %esp points to the first argument passed, so I know that at a certain offset will be the last argument, which is the string of every argument that a binary is expecting, which is what I care about.</li>
<li>I now know where the string of arguments is in the child&#8217;s address space, at which point I can safely extract it, then kill the child process before it does anything. How mean.</li>
</ul>
<li>I can now rinse+repeat for other binaries in which I&#8217;m interested.</li>
</ol>
<h2>Why this works</h2>
<ol>
<li>More programs call getopt() as one of the absolute first things they do. This means that there is a very low chance that any side-effects will come up.</li>
<li>This is fast since the OS only loads the pages of code that are being executed, and there is a very high chance that getopt will live in the first page of code, making it pretty fast.</li>
</ol>
<p>Something to note here: Not all binaries use getopt. This is a problem, but not one that I care about to fix. This took a little over three weeks to complete due to the lack of material about the matter on the Internet, and the <i>slightly</i> esoteric nature of the solution. Check out the ltrace utility if you want something like what I wrote on steroids (outlines every single library call with all arguments).</p>
<p>I originally attempted to read ltrace source to figure out how to solve the problem, but it confused me more than it helped me. In the end a sit down with the ELF spec and some time is what it took.</p>
<p>If you have <b>any</b> questions, comments, additions or critiques, please either comment on the post or send me an email.</p>
<p>The code I wrote and used can be found here: <a href="http://isis.poly.edu/~yan/readgo.tbz">http://isis.poly.edu/~yan/readgo.tbz</a> (You&#8217;d need libelf installed to get it to compile/run). This only works on FreeBSD/i386. Linux has a slightly different ptrace() interface, so porting will be trivial, but existent.</p>
<p>Since everyone loves some sample output:</p>
<blockquote><p>
yan@tissue$ ./readgo /bin/ls /bin/rm<br />
/bin/ls: 1ABCFGHILPRSTUWZabcdfghiklmnopqrstuwx<br />
/bin/rm: dfiIPRrvW
</p></blockquote>
<p>edit: Fixed a lot of grammatical mistakes thanks to Kurt.</p>
<p>Thanks for reading,<br />
Yan</p>
]]></content:encoded>
			<wfw:commentRss>http://isisblogs.poly.edu/2007/02/06/prodding-programs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>Tools for implicit code understanding</title>
		<link>http://isisblogs.poly.edu/2007/02/06/tools-for-implicit-code-understanding/</link>
		<comments>http://isisblogs.poly.edu/2007/02/06/tools-for-implicit-code-understanding/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 01:53:47 +0000</pubDate>
		<dc:creator>Yan Ivnitskiy</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Reverse Engineering]]></category>

		<guid isPermaLink="false">http://isisblogs.poly.edu/2007/02/06/tools-for-implicit-code-understanding/</guid>
		<description><![CDATA[In the last few weeks, I have been needing to understand a lot of existing source code. People, including myself, often try to reverse-engineer binaries and not pay much attention to reverse-engineering available code, if that&#8217;s the proper way to call it. While not reverse-engineering in its core, analyzing source code tends to tickle similar [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few weeks, I have been needing to understand a lot of existing source code. People, including myself, often try to reverse-engineer binaries and not pay much attention to reverse-engineering available code, if that&#8217;s the proper way to call it. While not reverse-engineering in its core, analyzing source code tends to tickle similar parts of the brain as when reverse-engineering binaries. This post is a short description of the tools and techniques I&#8217;ve been using and hope to receive suggestions to techniques I have been missing.</p>
<p>The tool in question is ltrace, which I believe is a doing of mostly the Debian project (I can be wrong), with a port to FreeBSD which is what I have been using. I have spent enough hours trying to just read source code, using grep to look for where to look for my next step.</p>
<p>Read on for descriptions!</p>
<p><span id="more-11"></span></p>
<p>GNU gprof, or GNU profiler, is a tool used to typically measure the performance and runtime (not algorithmic) of components. When using gprof, compile your target program with flags &#8216;-g -pg&#8217;. That will compile the program with debugging symbols, and add extra code that can generate profiling information. If you need to use gprof on a port or an existing application that uses the standard GNU building toolchain, just add &#8216;-g -pg&#8217; to CFLAGS inside the Makefile. Also, look for lines where the program gets linked, as that needs &#8216;-g -pg&#8217; as well. Then, use gprof to execute the program with the arguments that you will want to profile, e.g. &#8216;<code>gprof ./ltrace /bin/ls 2>/dev/null > ltrace_gprof.out</code>&#8216;. That will create a file, ltrace_gprof.out that will contain all procedures that were executed, and all called from them. This simplifies tracing of code for specific execution of binaries. By passing the required arguments, you are crafting the execution thread to your liking. While I did not use gprof to profile, I did use it to trace the execution in a more-or-less high-level fashion.</p>
<p>The second tool I want to write about is GNU cflow. cflow, which I&#8217;m sure everyone except me knew about, takes a number of C files, and generates a graph of the function call hierarchy. It is very useful to see how a program executes, in a static fashion. One can just call &#8216;<code>cflow -X *.c</code>&#8216; and look at a pstree-like representation of the call graph. In my opinion, very useful in understanding the flow of a program. Here is some sample output:</p>
<p><code>
<pre>
77                      fopen {}
78                      fgets {}
79                      process_line {read_config_file.c 112}
80                              debug_ ... {62}
81                              eat_spaces {read_config_file.c 70}
82                              str2type {read_config_file.c 55}
83                                      strlen {}
84                                      strncmp {}
85                                      index {}
86                              start_of_arg_sig {read_config_file.c 81}
87                                      strlen {}
88                              output_line ... {66}
</pre>
<p></code></p>
<p>Why am I playing with these tools? To complete a piece of code that has stagnated at being at 80% completion, or so I think. More info on the tool along with complete source as I get it to some working state.</p>
]]></content:encoded>
			<wfw:commentRss>http://isisblogs.poly.edu/2007/02/06/tools-for-implicit-code-understanding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
		<item>
		<title>The UbuCon NYC</title>
		<link>http://isisblogs.poly.edu/2007/02/02/the-ubucon-nyc/</link>
		<comments>http://isisblogs.poly.edu/2007/02/02/the-ubucon-nyc/#comments</comments>
		<pubDate>Fri, 02 Feb 2007 17:38:36 +0000</pubDate>
		<dc:creator>dan</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://isisblogs.poly.edu/2007/02/02/the-ubucon-nyc/</guid>
		<description><![CDATA[The UbuCon is an unconference for Ubuntu users, developers, and sysadmins taking place on February 16th at the new Google offices in Manhattan.  A few people from ISIS will be there to represent the interest of security in Ubuntu&#8217;s future development and hopefully moving improvements like GCC proactive security measures, encrypted LUKS partitions, and [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="https://wiki.ubuntu.com/TheUbucon">UbuCon</a> is an unconference for Ubuntu users, developers, and sysadmins taking place on February 16th at the <a href="http://maps.google.com/maps?f=l&amp;hl=en&amp;q=google&amp;near=New+York,+NY&amp;ie=UTF8&amp;z=15&amp;ll=40.74196,-74.00465&amp;spn=0.015542,0.040169&amp;om=1&amp;iwloc=A">new Google offices in Manhattan</a>.  A few people from ISIS will be there to represent the interest of security in Ubuntu&#8217;s future development and hopefully moving improvements like <a href="https://wiki.ubuntu.com/TheUbucon?action=fullsearch&amp;context=180&amp;value=proactive+security&amp;titlesearch=Titles">GCC proactive security measures</a>, <a href="http://luks.endorphin.org/">encrypted LUKS partitions</a>, and main inclusions of <a href="http://www.gnome.org/projects/seahorse/">Seahorse</a> and <a href="http://www.markshuttleworth.com/archives/89">gaim-otr</a> up to a higher development priority.  If you&#8217;d like to join us add your name to the <a href="https://wiki.ubuntu.com/TheUbuconRSVP">RSVP list</a> and we&#8217;ll see you there (it&#8217;s free!).</p>
]]></content:encoded>
			<wfw:commentRss>http://isisblogs.poly.edu/2007/02/02/the-ubucon-nyc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by/3.0/us/</creativeCommons:license>
	</item>
	</channel>
</rss>
