<?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/"
	>

<channel>
	<title>Mike Conley&#039;s Blog &#187; Internet</title>
	<atom:link href="http://mikeconley.ca/blog/tag/internet/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikeconley.ca/blog</link>
	<description>The personal blog of a Toronto based graduate student, software developer, musician, and theatre enthusiast.</description>
	<lastBuildDate>Tue, 07 Sep 2010 21:11:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Playing Around with FTP</title>
		<link>http://mikeconley.ca/blog/2009/11/24/playing-around-with-ftp/</link>
		<comments>http://mikeconley.ca/blog/2009/11/24/playing-around-with-ftp/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 03:43:38 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[networks]]></category>
		<category><![CDATA[tcp]]></category>

		<guid isPermaLink="false">http://mikeconley.ca/blog/?p=928</guid>
		<description><![CDATA[I&#8217;m taking a Computer Networks course this semester, and for my final project, my partner and I are trying to create signatures for FTP, HTTP, and Skype packets. The big idea:  we want to create some signatures, and then &#8220;replay&#8221; those signatures against some arbitrary IP and port.  If we get a response, we analyze [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m taking a Computer Networks course this semester, and for my final project, my partner and I are trying to create signatures for FTP, HTTP, and Skype packets.</p>
<p>The big idea:  we want to create some signatures, and then &#8220;replay&#8221; those signatures against some arbitrary IP and port.  If we get a response, we analyze the response to see if it matches what we expect from the signature.  If it matches, chances are we&#8217;ve determined what kind of server is behind that IP/Port.</p>
<p>FTP and HTTP are the trivial ones.  Skype is going to be quite a bit harder.</p>
<p>Anyhow, here is what I&#8217;ve found out about FTP&#8230;</p>
<h3>FTP</h3>
<p>FTP runs over a TCP connection, so if you&#8217;ve got Telnet, then you&#8217;ve got a basic FTP client.  Traditionally, FTP servers run on port 21 &#8211; but really you could put one on whichever port you feel like.</p>
<p>So, I&#8217;m going to try to futz around with the <a href="http://ftp.mozilla.org/">Mozilla public FTP server</a>, and show you what I get.</p>
<p>First, I&#8217;ll connect to the FTP server with Telnet, like so:</p>
<p><code><br />
mike@faceplant-linux:~$ telnet ftp.mozilla.org 21<br />
</code></p>
<p>Here&#8217;s what comes back:</p>
<p><code><br />
Trying 63.245.208.138...<br />
Connected to dm-ftp01.mozilla.org.<br />
Escape character is '^]'.<br />
220-<br />
220-   ftp.mozilla.org / archive.mozilla.org - files are in /pub/mozilla.org<br />
220-<br />
220-   Notice: This server is the only place to obtain nightly builds and needs to<br />
220-   remain available to developers and testers. High bandwidth servers that<br />
220-   contain the public release files are available at ftp://releases.mozilla.org/<br />
220-   If you need to link to a public release, please link to the release server,<br />
220-   not here. Thanks!<br />
220-<br />
220-   Attempts to download high traffic release files from this server will get a<br />
220-   "550 Permission denied." response.<br />
220</code></p>
<p>If I type in anything and press RETURN, the server responds with:<br />
<code>530 Please login with USER and PASS.</code><br />
Since I don&#8217;t have an account, I&#8217;ll just use the basic anonymous one:</p>
<p><code>USER anonymous</code></p>
<p>The server responds back with:</p>
<p><code>331 Please specify the password.</code></p>
<p>I don&#8217;t have a password, so I&#8217;ll just try a blank one&#8230;</p>
<p><code>PASS</code></p>
<p>and blam, I get a ton of stuff back:</p>
<p><code>230-<br />
230-   ftp.mozilla.org / archive.mozilla.org - files are in /pub/mozilla.org<br />
230-<br />
230-   Notice: This server is the only place to obtain nightly builds and needs to<br />
230-   remain available to developers and testers. High bandwidth servers that<br />
230-   contain the public release files are available at ftp://releases.mozilla.org/<br />
230-   If you need to link to a public release, please link to the release server,<br />
230-   not here. Thanks!<br />
230-<br />
230-   Attempts to download high traffic release files from this server will get a<br />
230-   "550 Permission denied." response.<br />
230 Login successful.</code></p>
<p>Hey alright, I&#8217;m in!  Er&#8230;where exactly am I, though?  I type in PWD, and the server responds with &#8220;/&#8221;.  So I&#8217;m in the root.  Nice.</p>
<p>So what&#8217;s in the root directory, anyhow?  I type in LIST.  Here&#8217;s what I get back:</p>
<p><code>425 Use PORT or PASV first.</code></p>
<p>And here&#8217;s where it gets interesting.  This Telnet session I&#8217;ve got here is like a control window.  But if I want any actual data from the server, I&#8217;m going to need to either open up one of my ports (and do some port-forwarding on my router) to receive it (PORT), or connect to another port that the FTP server can pipe data through (with PASV).</p>
<p>I&#8217;d rather not go through all of the trouble of port-forwarding, so I&#8217;m going to choose the latter.  I type in PASV.  The server responds with:</p>
<p><code>227 Entering Passive Mode (63,245,208,138,225,55)</code></p>
<p>So what does that big string of numbers mean?  The first 4 are the IP address I&#8217;m to connect to (63.245.208.138).  The last two tell me what PORT to connect to.  The formula to determine the port number is N1*256 + N2.  N1, in this case, is 225.  N2 is 55.  So 225*256 + 55 is 57655.</p>
<p>So I open another Telnet in a separate window, connect to 63.245.208.138 on port 57655, and get&#8230;.</p>
<p>nothing.</p>
<p>Yep, just a blank.  I&#8217;ve made the connection, but I haven&#8217;t asked for any data, so there&#8217;s nothing for the connection to say.</p>
<p>However, if I type LIST again in the command window, I get</p>
<p><code>150 Here comes the directory listing.<br />
226 Directory send OK.</code></p>
<p>sent into the control window, and</p>
<p><code>-rw-r--r--    1 ftp      ftp           528 Nov 01  2007 README<br />
-rw-r--r--    1 ftp      ftp           560 Sep 28  2007 index.html<br />
drwxr-xr-x   34 ftp      ftp          4096 Nov 24 23:32 pub<br />
Connection closed by foreign host.</code></p>
<p>pumped into my data window.  Notice that the connection closed in the data window.  That means that, for every bit of data I want, I either need to redo the whole PASV thing, or supply a PORT that the server can connect to.  Bleh.</p>
<p>Let&#8217;s see what else I can do.  I type in &#8220;CWD pub&#8221; to change to the pub directory.  Using PASV and LIST, I get the following from another data window:</p>
<p><code>drwxrwxr-x    3 ftp      ftp          4096 Jun 05  2002 OJI<br />
-rw-rw-r--    1 ftp      ftp          1144 Jul 03  2001 README<br />
drwxr-xr-x 5561 ftp      ftp        430080 Nov 24 22:14 addons<br />
drwxr-xr-x    2 ftp      ftp          4096 Jul 05  2005 artwork<br />
drwxr-xr-x    2 ftp      ftp          4096 Jun 13  2008 bouncer<br />
drwxrwxr-x    5 ftp      ftp          4096 Apr 20  2009 calendar<br />
drwxrwxr-x    6 ftp      ftp          4096 Aug 11  2008 camino<br />
drwxr-xr-x   16 ftp      ftp          4096 Oct 16  2006 cck<br />
drwxrwxr-x    3 ftp      ftp          4096 Jul 10  2004 chimera<br />
drwxrwxr-x   12 ftp      ftp          4096 Aug 31  2001 data<br />
drwxrwxr-x    8 ftp      ftp          4096 Jun 19  2007 directory<br />
drwxr-xr-x    4 ftp      ftp          4096 May 17  2005 diskimages<br />
drwxrwxr-x    4 ftp      ftp          4096 Jul 26  2008 extensions<br />
drwxrwxr-x    4 ftp      ftp          4096 May 16  2003 firebird<br />
drwxrwxr-x    5 ftp      ftp          4096 Aug 12  2008 firefox<br />
drwxrwxr-x    3 ftp      ftp          4096 Aug 07  1999 grendel<br />
drwxrwxr-x    5 ftp      ftp          4096 Mar 22  2009 js<br />
drwxrwxr-x    4 ftp      ftp          4096 Oct 22  2004 l10n-kits<br />
drwxrwxr-x    2 ftp      ftp          4096 Nov 24 20:28 labs<br />
-rw-r--r--    1 ftp      ftp       1868178 Sep 17  2003 ls-lR<br />
-rw-rw-r--    1 ftp      ftp        169159 Sep 17  2003 ls-lR.gz<br />
drwxr-sr-x    4 ftp      ftp          4096 Sep 15  2005 minimo<br />
drwxrwsr-x   12 ftp      ftp          4096 Nov 11 06:09 mobile<br />
drwxrwxr-x   15 ftp      ftp          4096 Jan 04  2008 mozilla<br />
lrwxrwxrwx    1 ftp      ftp             1 Sep 15  2006 mozilla.org -&gt; .<br />
drwxrwxr-x    2 ftp      ftp          4096 Aug 25  1998 msgsdk<br />
drwxrwxr-x    5 ftp      ftp          4096 Jul 09  2002 nspr<br />
drwxrwxr-x    4 ftp      ftp          4096 Sep 23  2002 phoenix<br />
drwxrwxr-x    3 ftp      ftp          4096 Aug 03  2000 profiles<br />
drwxrwxr-x    6 ftp      ftp          4096 Aug 12  2008 seamonkey<br />
drwxrwxr-x    5 ftp      ftp          4096 May 04  2006 security<br />
drwxr-xr-x    5 ftp      ftp          4096 Aug 13  2008 static-analysis<br />
drwxrwxr-x    8 ftp      ftp          4096 Sep 24 19:03 thunderbird<br />
drwxrwsr-x    4 ftp      ftp         20480 Nov 19 02:26 webtools<br />
drwxrwxr-x    6 ftp      ftp          4096 Aug 11  2008 xulrunner<br />
drwxr-xr-x    2 ftp      ftp          4096 Sep 12 05:51 zz<br />
Connection closed by foreign host.<br />
</code></p>
<p>Nice.  Alright, now let&#8217;s see if I can download one of those files.  I&#8217;m going to try to download README.  Using PASV, I create a new data window, and then I type:</p>
<p><code>RETR README</code></p>
<p>And, after a little wait, my data window gets:</p>
<pre>Welcome to ftp.mozilla.org!</pre>
<pre>This is the main distribution point of software and developer tools
related to the Mozilla project.  For more information, see our home
page (http://www.mozilla.org/) Go here to download Netscape Communicator:

http://home.netscape.com/download/</pre>
<pre>A list of ftp.mozilla.org's mirror sites can be found at:</pre>
<pre>http://www.mozilla.org/mirrors.html</pre>
<pre>This site contains source code that is subject to the U.S. Export
Administration Regulations and other U.S. law, and may not be exported
or re-exported to certain countries (currently Afghanistan (Taliban
controlled areas), Cuba, Iran, Iraq, Libya, North Korea, Sudan and
Syria) or to persons or entities prohibited from receiving U.S.
exports (including Denied Parties, entities on the Bureau of Export
Administration Entity List, and Specially Designated Nationals).</pre>
<pre>If you plan to mirror our site read our crypto FAQ. Send mail to
mirrors@mozilla.org to be added to our mirrors list.</pre>
<pre>http://www.mozilla.org/crypto-faq.html#2-1</pre>
<pre>We do not guarantee that any source code or executable code
available from the mozilla.org domain is Year 2000 compliant.
Connection closed by foreign host.</pre>
<p>Awesome!  I think I have enough information to come up with some kind of signature.</p>
<h3>Resources</h3>
<p>What, you think I figured all this stuff out alone?  No way &#8211; I had some help:</p>
<ul>
<li><a href="http://tools.ietf.org/html/rfc959">RFC 959</a> The FTP Specification</li>
<li><a href="http://tools.ietf.org/html/rfc1579">RFC 1579</a> &#8220;Firewall-Friendly&#8221; FTP</li>
<li><a href="http://www.the-eggman.com/seminars/ftp_error_codes.html">A slightly sketchy website that lists FTP message codes</a></li>
<li><a href="http://www.nsftools.com/tips/RawFTP.htm">A list of raw FTP commands</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mikeconley.ca/blog/2009/11/24/playing-around-with-ftp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Net Neutrality?</title>
		<link>http://mikeconley.ca/blog/2009/02/21/what-is-net-neutrality/</link>
		<comments>http://mikeconley.ca/blog/2009/02/21/what-is-net-neutrality/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 22:29:21 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[law]]></category>
		<category><![CDATA[net neutrality]]></category>

		<guid isPermaLink="false">http://mikeconley.ca/blog/?p=191</guid>
		<description><![CDATA[It&#8217;s a term that&#8217;s been bouncing around the internet for a while, and I don&#8217;t think a lot of people realize what it&#8217;s implications are. Here&#8217;s a quick video that, I think, does a pretty good job at explaining what&#8217;s at stake:]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a term that&#8217;s been bouncing around the internet for a while, and I don&#8217;t think a lot of people realize what it&#8217;s implications are.</p>
<p>Here&#8217;s a quick video that, I think, does a pretty good job at explaining what&#8217;s at stake:</p>
<p><object width="425" height="344" data="http://www.youtube.com/v/hKbPpizEDBM&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/hKbPpizEDBM&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://mikeconley.ca/blog/2009/02/21/what-is-net-neutrality/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Preventing SQL Injection Attacks</title>
		<link>http://mikeconley.ca/blog/2009/02/16/preventing-sql-injection-attacks/</link>
		<comments>http://mikeconley.ca/blog/2009/02/16/preventing-sql-injection-attacks/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 18:48:04 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[web applications]]></category>

		<guid isPermaLink="false">http://mikeconley.ca/blog/?p=125</guid>
		<description><![CDATA[Over the reading week, along with studying for various midterms and assignments, I&#8217;ve decided to brush up on preventing SQL Injection attacks in web applications. Pretty scary/awesome stuff out there on this stuff.  Here&#8217;s a great place to get some SQL Injection training, and here&#8217;s an excellent SQL Injection cheat sheet. I got hit with [...]]]></description>
			<content:encoded><![CDATA[<p>Over the reading week, along with studying for various midterms and assignments, I&#8217;ve decided to brush up on preventing SQL Injection attacks in web applications.</p>
<p>Pretty scary/awesome stuff out there on this stuff.  <a href="http://www.hackthissite.org" target="_self">Here&#8217;s a great place to get some SQL Injection training</a>, and <a href="http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/" target="_self">here&#8217;s an excellent SQL Injection cheat sheet</a>.</p>
<p>I got hit with a pretty bad SQL Injection attack last summer on an application I had written 3 years ago (before I had any clue that SQL Injection attacks were possible).</p>
<p>Here&#8217;s the take home message:  <strong>never trust user input.  Ever. </strong>If you&#8217;re expecting an int, make sure it&#8217;s an int.  <strong>Never insert user input directly into an SQL string.</strong> Use prepared statements instead, or stored procedures.</p>
<p>Luckily, I just did a quick survey of all of my running apps, and I seem to be OK in terms of SQL Injection.  Still, it&#8217;s a common attack vector &#8211; and the consequences of being lazy on user input can be pretty awful.</p>
<p><strong>Update: </strong> Want to see something awesome?  <a href="http://www.milw0rm.com/video/watch.php?id=92" target="_self">Check this out &#8211; a Debian box gets rooted through MySQL injection&#8230;killer soundtrack too.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mikeconley.ca/blog/2009/02/16/preventing-sql-injection-attacks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
