<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Tales from the Crypto : FTP</title><link>http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx</link><description>Tags: FTP</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>My take on the SSL MITM Attacks – part 3 – the FTPS attacks</title><link>http://msmvps.com/blogs/alunj/archive/2009/11/18/1740656.aspx</link><pubDate>Thu, 19 Nov 2009 05:02:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1740656</guid><dc:creator>Alun Jones</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=1740656</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=1740656</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2009/11/18/1740656.aspx#comments</comments><description>&lt;p&gt;[Note - for previous parts in this series, see&lt;a href="http://msmvps.com/blogs/alunj/archive/2009/11/09/1738717.aspx"&gt; Part 1&lt;/a&gt; and &lt;a href="http://msmvps.com/blogs/alunj/archive/2009/11/11/1739148.aspx"&gt;Part 2&lt;/a&gt;.]&lt;/p&gt;
&lt;p&gt;FTP, and FTP over SSL, are my specialist subject, having written one of the first &lt;a href="http://www.wftpd.com"&gt;FTP servers for Windows&lt;/a&gt; to support FTP over SSL (and the first standalone FTP server for Windows!)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.educatedguesswork.org/2009/11/understanding_the_tls_renegoti.html"&gt;Rescorla and others&lt;/a&gt; have concentrated on the SSL MITM attacks and their &lt;a href="http://blogs.pcmag.com/securitywatch/2009/11/should_we_worry_about_the_new.php"&gt;effects on HTTPS&lt;/a&gt;, declining to discuss other protocols about which they know relatively far less. OK, time to step up and assume the mantle of expert, so that someone with more imagination can shoot &lt;em&gt;me&lt;/em&gt; down.&lt;/p&gt;
&lt;p&gt;FTPS is not vulnerable to this attack.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;No, that&amp;rsquo;s plainly rubbish.&lt;/strong&gt; If you start thinking along those lines in the security world, you&amp;rsquo;ve lost it. You might as well throw in the security towel and go into a job where you can assume everybody loves you and will do nothing to harm you. Be a developer of web-based applications, say. :-)&lt;/p&gt;
&lt;h2&gt;FTPS has a number of possible vulnerabilities&lt;/h2&gt;
&lt;p&gt;And they are all dependent on the features, design and implementation of your individual FTPS server and/or client. That&amp;rsquo;s why I say &amp;ldquo;possible&amp;rdquo;.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;Attack 1 &amp;ndash; renegotiation with client certificates&lt;/h3&gt;
&lt;p&gt;The obvious attack &amp;ndash; renegotiation for client certificates &amp;ndash; is likely to fail, because FTPS starts its TLS sessions in a different way from HTTPS.&lt;/p&gt;
&lt;p&gt;In HTTPS, you open an unauthenticated SSL session, request a protected resource, and the server prompts for your client certificate.&lt;/p&gt;
&lt;p&gt;In FTPS, when you connect to the control channel, you provide your credentials at the first SSL negotiation or not at all. There&amp;rsquo;s no need to renegotiate, and certainly there&amp;rsquo;s no language in the FTPS standard that allows the server to query for more credentials part way into the transaction. The best the server can do is refuse a request and say you need different or better credentials.&lt;/p&gt;
&lt;h3&gt;Attack 2 &amp;ndash; unsolicited renegotiation without credentials&lt;/h3&gt;
&lt;p&gt;A renegotiation attack on the control channel that doesn&amp;rsquo;t rely on making the server ask for client credentials is similarly unlikely to succeed &amp;ndash; when the TLS session is started with an AUTH TLS command, the server puts the connection into the &amp;lsquo;reinitialised&amp;rsquo; state, waiting for a USER and PASS command to supply credentials. Request splitting across the renegotiation boundary might get the user name, but the password wouldn&amp;rsquo;t be put into anywhere the attacker could get to.&lt;/p&gt;
&lt;h3&gt;Attack 3 &amp;ndash; renegotiating the data connection&lt;/h3&gt;
&lt;p&gt;At first sight, the data connection, too, is difficult or impossible to attack &amp;ndash; an attacker would have to guess which transaction was an upload in order to be able to prepend his own content to the upload. &lt;/p&gt;
&lt;p&gt;But that&amp;rsquo;s betting without the effect that NATs had on the FTP protocol.&lt;/p&gt;
&lt;p&gt;Because the PORT and PASV commands involve sending an IP address across the control channel, and because NAT devices have to modify these commands and their responses, in many implementations of FTPS, after credentials have been negotiated on the control channel, the client issues a &amp;ldquo;CCC&amp;rdquo; command, to drop the control channel back into clear-text mode.&lt;/p&gt;
&lt;p&gt;Yes, that&amp;rsquo;s right, after negotiating SSL with the server, the client may throw away the protection on the control channel, so the MitM attacker can easily see what files are going to be accessed over what ports and IP addresses, and if the server supports SSL renegotiation, the attacker can put his data in at the start of the upload before renegotiating to hand off to the legitimate client. Because the client thinks everything is fine, and the server just assumes a renegotiation is fine, there&amp;rsquo;s no reason for either one to doubt the quality of the file that&amp;rsquo;s been uploaded.&lt;/p&gt;
&lt;p&gt;How could this be abused? Imagine that you are uploading an EXE file, and the hacker prepends it with his own code. That&amp;rsquo;s how I wrote code for a &amp;lsquo;dongle&amp;rsquo; check in a program I worked on over twenty years ago, and the same trick could still work easily today. Instant Trojan.&lt;/p&gt;
&lt;p&gt;There are many formats of file that would allow abuse by prepending data. CSV files, most exploitable buffer overflow graphic formats, etc.&lt;/p&gt;
&lt;h3&gt;Attack 3.5 &amp;ndash; truncation attacks&lt;/h3&gt;
&lt;p&gt;While I&amp;rsquo;m on FTP over SSL implementations and the data connection, there&amp;rsquo;s also the issue that most clients don&amp;rsquo;t properly terminate the SSL connection in FTPS data transfers.&lt;/p&gt;
&lt;p&gt;As a result, the server can&amp;rsquo;t afford to report as an error when a MitM closes the TCP connection underneath them with an unexpected TCP FIN.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s bad &amp;ndash; but combine it with FTP&amp;rsquo;s ability to resume a transfer from part-way into a file, and you realize that an MitM could actually stuff data into the middle of a file by allowing the upload to start, interrupting it after a few segments, and then when the client resumed, interjecting the data using the renegotiation attack.&lt;/p&gt;
&lt;p&gt;The attacker wouldn&amp;rsquo;t even need to be able to insert the FIN at exactly the byte mark he wanted &amp;ndash; after all, the client will be sending the REST command in clear-text thanks to the CCC command. That means the attacker can modify it, to pick where his data is going to sit.&lt;/p&gt;
&lt;p&gt;Not as earth-shattering as the HTTPS attacks, but worth considering if you rely on FTPS for data security.&lt;/p&gt;
&lt;h2&gt;How does &lt;a href="http://www.wftpd.com"&gt;WFTPD Pro&lt;/a&gt; get around these attacks?&lt;/h2&gt;
&lt;p&gt;1. I never bothered implementing SSL / TLS renegotiation &amp;ndash; didn&amp;rsquo;t see it as necessary; never had the feature requested. Implementing unnecessary complexity is often cause for a security failure.&lt;/p&gt;
&lt;p&gt;2. I didn&amp;rsquo;t like the CCC command, and so I didn&amp;rsquo;t implement that, either. I prefer to push people towards using Block instead of Stream mode to get around NAT restrictions.&lt;/p&gt;
&lt;p&gt;I know, it&amp;rsquo;s merely fortunate that I made those decisions, rather than that I had any particular foresight, but it&amp;rsquo;s nice to be able to say that my software is not vulnerable to the obvious attacks.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve yet to run this by other SSL and FTP experts to see whether I&amp;rsquo;m still vulnerable to something I haven&amp;rsquo;t thought of, but my thinking so far makes me happy &amp;ndash; and makes me wonder what other FTPS developers have done.&lt;/p&gt;
&lt;p&gt;I wanted to contact one or two to see if they&amp;rsquo;ve thought of attacks that I haven&amp;rsquo;t considered, or that I haven&amp;rsquo;t covered. So far, however, I&amp;rsquo;ve either received no response, or I&amp;rsquo;ve discovered that they are no longer working on their FTPS software.&lt;/p&gt;
&lt;p&gt;Let me know if you have any input of your own on this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1740656" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/SSL+Tutorial/default.aspx">SSL Tutorial</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/General+Security/default.aspx">General Security</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Why+is+PKI+so+hard_3F00_/default.aspx">Why is PKI so hard?</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Alun_2700_s+code/default.aspx">Alun's code</category></item><item><title>How FTP Data Connections Work Part 2 (OR: Fun With Port 20)</title><link>http://msmvps.com/blogs/alunj/archive/2009/07/13/1700796.aspx</link><pubDate>Tue, 14 Jul 2009 06:48:26 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1700796</guid><dc:creator>Alun Jones</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=1700796</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=1700796</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2009/07/13/1700796.aspx#comments</comments><description>&lt;p&gt;As we mentioned in the &lt;a href="http://msmvps.com/blogs/alunj/archive/2009/07/08/1698917.aspx"&gt;1st part of this series&lt;/a&gt;, FTP is a more complex protocol than many, using one control connection and one data connection.&lt;/p&gt;  &lt;h3&gt;A recap of the first post…&lt;/h3&gt;  &lt;p&gt;In typical Stream Mode operation, a new data connection is opened and closed for each data transfer, whether that’s an upload, a download, or a directory listing. To avoid confusion between different data connections, and as a recognition of the fact that networks may have old packets shuttling around for some time, these connections need to be distinguishable from one another.&lt;/p&gt;  &lt;p&gt;In the previous article, we noted that two network sockets are distinguished by the five elements of “Local Address”, “Local Port”, “Protocol”, “Remote Address”, and “Remote Port”. For a data connection associated with any particular request, the local and remote addresses are fixed, as the addresses of the client and server. The protocol is TCP, and only the two ports are variable.&lt;/p&gt;  &lt;p&gt;For a PASV, or passive data connection, the client-side port is chosen randomly by the client, and the server-side port is similarly chosen randomly by the server. The client connects to the server.&lt;/p&gt;  &lt;p&gt;For a PORT, or active data connection, the client-side port is chosen randomly by the client, and the server-side port is set to port 20. The server connects to the client.&lt;/p&gt;  &lt;p&gt;All of these work through firewalls and NAT routers, because firewalls and NAT routers contain an Application Layer Gateway (ALG) that watches for PORT and PASV commands, and modifies the control (in the case of a NAT) and/or uses the values provided to open up a firewall hole.&lt;/p&gt;  &lt;h3&gt;Isn’t there a totally predictable data connection?&lt;/h3&gt;  &lt;p&gt;For the default data connection (what happens if no PORT or PASV command is sent before the first data transfer command), the client-side port is predictable (it’s the same as the source port the client used when connecting the control channel), and the server-side port is 20. Again, the server connects to the client. &lt;/p&gt;  &lt;p&gt;Because firewalls and NATs open up a ‘reverse’ hole for TCP sockets, the default data port works with firewalls and NATs that aren’t running an ALG, or whose ALG cannot scan for PORT and PASV commands.&lt;/p&gt;  &lt;h3&gt;Why would an ALG stop scanning for PORT and PASV commands?&lt;/h3&gt;  &lt;p&gt;There are a couple of reasons – the first is that it doesn’t know that the service connected to is running the FTP protocol. This is common if the server is running on a port other than the usual port 21.&lt;/p&gt;  &lt;p&gt;The second reason is that the FTP control connection doesn’t look like it contains FTP commands – usually because the connection is encrypted. This can happen because you’re tunneling the FTP control connection through an encrypted tunnel such as SSH (don’t laugh – it does happen!), or hopefully it’s because you’re running FTP over SSL, so that the control and data connections can be encrypted, and you can authenticate the identity of the FTP server.&lt;/p&gt;  &lt;h3&gt;So how do you get FTP over SSL to work through a firewall?&lt;/h3&gt;  &lt;p&gt;In the words of Deep Thought: “Hmm… tricky”.&lt;/p&gt;  &lt;p&gt;There are a couple of classic solutions:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Allow PASV data connections, select a wide range of ports, and open that range for incoming traffic from all external addresses in your firewall configuration; hope that your FTP server can be configured to use only that range of ports (&lt;a title="WFTPD by Texas Imperial Software" href="http://www.wftpd.com/" target="_blank"&gt;WFTPD&lt;/a&gt; Pro can), and that it has protections against traffic stealing attacks (again, WFTPD Pro has). Still, this option seems really risky.&lt;/li&gt;    &lt;li&gt;Block all PASV connections, and make the clients responsible for opening up holes in their firewalls. If you’re convinced the risk is too great to do this on your server, how does it look to convince your users that they should accept that risk?&lt;/li&gt;    &lt;li&gt;After you’ve authenticated the server and provided your username and password in the encrypted control connection, issue the “CCC” (Clear Control Channel) command, to switch the control connection back into clear-text. I dislike this as a solution, because it requires the ALG pay attention to a lot of SSL traffic in the hope that there might be clear-text coming up, and because you may want the control channel to remain encrypted.&lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;Awright, clever clogs, you solve the problem.&lt;/h3&gt;  &lt;p&gt;The astute reader can probably see where I’m going with this.&lt;/p&gt;  &lt;p&gt;The default data port is predictable – if the client connects from port U to port L at the server (L is usually 21), then the default data port will be opened from port L-1 at the server to port U at the client.&lt;/p&gt;  &lt;p&gt;The default data port doesn’t need the firewall to do anything other than allow reverse connections back along the port that initiated the connection. You don’t need to open huge ranges at the server’s firewall (in fact you should be able to simply open port 21 inbound to your server).&lt;/p&gt;  &lt;p&gt;The default data port is required to be supported by FTP servers going back a long way- at least a couple of decades. Yes, really, that long.&lt;/p&gt;  &lt;h3&gt;If it’s that simple, why isn’t everyone doing it?&lt;/h3&gt;  &lt;p&gt;Good point, that, and a great sentence to use whenever you wish to halt innovation in its tracks.&lt;/p&gt;  &lt;p&gt;Okay, it’s obvious that there are some drawbacks:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In stream mode, the data transfer is ended by closing the stream. This means that you have to open a new control connection. Not good, given the number of round-trips you need for a logon, and the work needed to start an SSL connection.&lt;/li&gt;    &lt;li&gt;Most FTP clients view the default data connection as, at best, a fail-over in case the PORT or PASV commands fail to work. Obviously, that means it’s not likely to be a well-tested or favoured solution on these clients.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Even with those drawbacks, there are still further solutions to apply – the first being to use Block-mode instead of Stream-mode. In Stream-mode, each data transfer requires opening and closing the data connection; in Block-mode, which is a little like HTTP’s chunked mode, blocks of data are sent, and followed by an “EOF” marker (End of File), so that the data connection doesn’t need to be closed. If you can convince your FTP client to request Block-mode with the default data connection, and your FTP server supports it (WFTPD Pro has done so for several years), you can achieve FTP over SSL through NATs and firewalls simply by opening port 21.&lt;/p&gt;  &lt;p&gt;For the second problem, it’s worth noting that many FTP client authors implemented default data connections out of a sense of robustness, so default data connections will often work if you can convince the PORT and PASV commands to fail – by, for instance, putting restrictive firewalls or NATs in the way, or perhaps by preventing the FTP server from accepting PORT or PASV commands in some way.&lt;/p&gt;  &lt;p&gt;Clearly, since Microsoft’s IIS 7.5 downloadable FTP Server supports FTPS in block mode with the default data port, there has been some consideration given to my whispers to them that this could solve the FTP over SSL through firewall problem.&lt;/p&gt;  &lt;p&gt;Other than my own WFTPD Explorer, I am not aware of any particular clients that support the explicit use of FTP over SSL with Block-mode on the default data connection – I’d love to hear of your experiments with this mode of operation, to see if it works as well for you as it does for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1700796" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/General+Security/default.aspx">General Security</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/What+my+wife+knows/default.aspx">What my wife knows</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Alun_2700_s+code/default.aspx">Alun's code</category></item><item><title>How FTP Data Connections Work Part 1 (OR: Don’t Open Port 20 in your Firewall!)</title><link>http://msmvps.com/blogs/alunj/archive/2009/07/08/1698917.aspx</link><pubDate>Thu, 09 Jul 2009 06:18:42 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1698917</guid><dc:creator>Alun Jones</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=1698917</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=1698917</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2009/07/08/1698917.aspx#comments</comments><description>&lt;p&gt;This will be the first of a couple of articles on FTP, as I’ve been asked to post this information in an easy-to-read format in a public place where it can be referred to. I think my expertise in developing and supporting &lt;a title="WFTPD by Texas Imperial Software" href="http://www.wftpd.com/" target="_blank"&gt;WFTPD&lt;/a&gt; and &lt;a href="http://www.wftpd.com"&gt;WFTPD Pro&lt;/a&gt; allow me to be reliable on this topic. Oh, that and the fact that I’ve contributed to a number of RFCs on the subject.&lt;/p&gt;  &lt;h3&gt;Enough TCP to be dangerous&lt;/h3&gt;  &lt;p&gt;First, a quick refresher on TCP – every TCP connection can be thought of as being associated with a “socket” at each device along the way – from one computer, through routers, to the other computer. The socket is identified by five individual items – the local IP address, the local port, the remote IP address, the remote port, and the protocol (in this case, the protocol is TCP).&lt;/p&gt;  &lt;p&gt;Firewalls are essentially a special kind of router, with rules not only for how to forward data, but also rules on connection requests to drop or allow. Once a connection request is allowed, the entire flow of traffic associated with that connection request is allowed, also – any traffic flow not associated with a previously allowed connection request is discarded.&lt;/p&gt;  &lt;p&gt;When you set up a firewall to allow access to a server, you have to consider the first segment – the “SYN”, or connection request from the TCP client to the TCP server. The rule can refer to any data that would identify the socket to be created, such as “allow any connection request where the source IP address is 10.1.1.something, and the destination port is 54321”.&lt;/p&gt;  &lt;p&gt;Typically, an external-facing firewall will allow all outbound connections, and have rules only for inbound connections. As a result, firewall administrators are used to saying things like “to enable access to the web server, simply open port 80”, whereas what they truly mean is to add a rule that applies to incoming TCP connection requests whose source address and source port could be anything, but whose destination port is 80, and whose destination address is that of the web server.” This is usually written in some short hand, such as “allow tcp 0.0.0.0:0 10.1.2.3:80”, where “0.0.0.0” stands for “any address” and “:0” stands for “any port”.&lt;/p&gt;  &lt;h3&gt;Firewall rules for FTP&lt;/h3&gt;  &lt;p&gt;For an FTP server, firewall rules are known to be a little trickier than for most other servers.&lt;/p&gt;  &lt;p&gt;Sure, you can set up the rule “allow tcp 0.0.0.0:0 10.1.2.3:21”, because the default port for the control connection of FTP is 21. That only allows the control connection, though.&lt;/p&gt;  &lt;p&gt;What other connections are there?&lt;/p&gt;  &lt;p&gt;In the default transfer mode of “Stream”, every file transfer gets its own data connection. Of course, it’d be lovely if this data connection was made on port 21 as well, but that’s not the way the protocol was built. Instead, Stream mode data connections are opened either as “Active” or “Passive” connections.&lt;/p&gt;  &lt;h3&gt;Active and Passive Data Connections&lt;/h3&gt;  &lt;p&gt;The terms &amp;quot;Active&amp;quot; and &amp;quot;Passive&amp;quot; refer to how the FTP server connects. The choice of connection method is initiated by the client, although the server can choose to refuse whatever the client asked for, at which point the client should fail over to using the other method.&lt;/p&gt;  &lt;p&gt;In the Active method, the FTP server connects to the client (the server is the “active” participant, the client just lies back and thinks of England), on a random port chosen by the client. Obviously, that will work if the client&amp;#39;s firewall is configured to allow the connection to that port, and doesn&amp;#39;t depend on the firewall at the server to do anything but allow connections outbound. The Active method is chosen by the client sending a “PORT” command, containing the IP address and port to which the server should connect.&lt;/p&gt;  &lt;p&gt;In the Passive method, the FTP client connects to the server (the server is now the “passive” participant), on a random port chosen by the server. This requires the server&amp;#39;s firewall to allow the incoming connection, and depends on the client&amp;#39;s firewall only to allow outbound connections. The Passive method is chosen by the client sending a “PASV” command, to which the server responds with a message containing the IP address and port at the server that the client should connect to.&lt;/p&gt;  &lt;h3&gt;The ALG comes to the rescue!&lt;/h3&gt;  &lt;p&gt;So in theory, your firewall now needs to know what ports are going to be requested by the PORT and PASV commands. For some situations, this is true, and you need to consider this – we’ll talk about that in part 2. For now, let’s assume everything is “normal”, and talk about how the firewall helps the FTP user or administrator.&lt;/p&gt;  &lt;p&gt;If you use port 21 for your FTP server, and the firewall is able to read the control connection, just about every firewall in existence will recognise the PORT and PASV commands, and open up the appropriate holes. This is because those firewalls have an Application Level Gateway, or ALG, which monitors port 21 traffic for FTP commands, and opens up the appropriate holes in the firewall. We’ve discussed the &lt;a href="http://msmvps.com/blogs/alunj/archive/2008/01/24/1479415.aspx"&gt;FTP ALG in the Windows Vista firewall&lt;/a&gt; before.&lt;/p&gt;  &lt;h3&gt;So why port 20?&lt;/h3&gt;  &lt;p&gt;Where does port 20 come in? A rather simplistic view is that administrators read the “Services” file, and see the line that tells them that port 20 is “ftp-data”. They assume that this means that opening port 20 as a destination port on the firewall will allow FTP data connections to flow. By the “elephant repellant” theory, this is proved “true” when their firewalls allow FTP data connections after they open ports 21 and 20. Nobody bothers to check that it also works if they only open port 21, because of the ALG.&lt;/p&gt;  &lt;p&gt;OK, so if port 20 isn’t needed, why is it associated with “ftp-data”? For that, you’ll have to remember what I said early on in the article – that every socket has five values associated with it – two addresses, two ports, and a protocol. When the data connection is made from the server to the client (remember, that’s an Active data connection, in response to a PORT command), the source port at the server is port 20. It’s totally that simple, and since nobody makes firewall rules that look at source port values, it’s relatively unimportant. That “ftp-data” in the Services file is simply so that the output from “netstat” has a meaningful service name instead of “:20” as a source port.&lt;/p&gt;  &lt;h3&gt;Coming up in part 2…&lt;/h3&gt;  &lt;p&gt;Next time, we’ll expand on this topic, to go into the inability of the ALG to process encrypted FTP control traffic, and the resultant issues and solutions that face encrypted FTP.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1698917" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/General+Security/default.aspx">General Security</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/What+my+wife+knows/default.aspx">What my wife knows</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Alun_2700_s+code/default.aspx">Alun's code</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/TCP_2F00_IP/default.aspx">TCP/IP</category></item><item><title>FTP - Untrustworthy? I Don't Think So!</title><link>http://msmvps.com/blogs/alunj/archive/2008/07/29/1642650.aspx</link><pubDate>Wed, 30 Jul 2008 04:53:15 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1642650</guid><dc:creator>Alun Jones</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=1642650</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=1642650</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2008/07/29/1642650.aspx#comments</comments><description>&lt;p&gt;Lately, as if writers all draw from the same shrinking paddling-pool of ideas, I&amp;#39;ve noticed a batch of stories about how unsafe, unsecure and untrustworthy is FTP.&lt;/p&gt; &lt;h3&gt;SC Magazine says so.&lt;/h3&gt; &lt;p&gt;First it was an article in the print version of &lt;a href="http://www.scmagazineus.com"&gt;SC Magazine&lt;/a&gt;, sadly not repeated online, titled &amp;quot;2 Minutes On... FTP integrity challenged&amp;quot;, by Jim Carr. I tried to reach Jim by email, but his bounce message tells me he doesn&amp;#39;t work for SC Magazine any more.&lt;/p&gt; &lt;p&gt;This article was full of interesting quotes.&lt;/p&gt; &lt;p&gt;&amp;quot;8,700 FTP server credentials were being used to access and infect more than 2,000 legitimate websites in the US&amp;quot;. The article goes on to quote Finjan&amp;#39;s director of security research who says they were &amp;quot;most likely hijacked by malware&amp;quot; - since most malware can do keystroke logging for passwords, there&amp;#39;s not much can be done at the protocol level to protect against this, so this isn&amp;#39;t really an indictment of FTP so much as it is an indication of the value and ubiquity of FTP.&lt;/p&gt; &lt;p&gt;Then we get to a solid criticism of FTP: &amp;quot;The problem with FTP is it transfers data, including authorization credentials, in plain text rather than in encrypted form, says Jeff Debrosse, senior research analyst at security vendor ESET&amp;quot;. Okay, that&amp;#39;s true - but in much the same vein as saying that the same problems all apply to HTTP.&lt;/p&gt; &lt;p&gt;Towards the end of the article, we return to Finjan&amp;#39;s assertion that malware can steal credentials for FTP sites - and as I&amp;#39;ve mentioned before, malware can get pretty much any user secret, so again, that&amp;#39;s not a problem that a protocol such as FTP - or SFTP, HTTP, SSH, SCP, etc - can fix. There&amp;#39;s a password or a secret key, and once malware is inside the system, it can get those credentials.&lt;/p&gt; &lt;p&gt;Fortunately, the article closes with a quote from Trent Henry, who says &amp;quot;That means FTP is not the real issue as much as it is a server-protection issue.&amp;quot;&lt;/p&gt; &lt;h3&gt;OK, But a ZDNet blogger says so, too.&lt;/h3&gt; &lt;p&gt;Well, yeah, an article in a &lt;a href="http://blogs.zdnet.com/storage/?p=344&amp;amp;tag=nl.e550"&gt;recent ZDNet blog entry&lt;/a&gt; - on storage, not networking or security (rather like getting security advice from Steve Gibson, a hard-drive expert) - rants on about how his web site got hacked into (through WordPress, not FTP), and as a result, he&amp;#39;s taken to heart a suggestion not to use FTP.&lt;/p&gt; &lt;p&gt;Such a non-sequitur just leaves me breathless. So here&amp;#39;s my take:&lt;/p&gt; &lt;h2&gt;FTP Has Been Secure for Years&lt;/h2&gt; &lt;p&gt;But some people have just been too busy, or too devoted to other solutions, to take notice.&lt;/p&gt; &lt;p&gt;FTP first gained secure credentials with the addition of support for SASL and SKey. These are mechanisms for authenticating users without passing a password or password-equivalent (and by &amp;quot;password-equivalent&amp;quot;, I&amp;#39;m including schemes where the hash is passed as proof that you have the password - an attacker can simply copy the hash instead of the password). These additional authentication methods give FTP the ability to check identity without jeopardising the security of the identified party. [Of course, prior to this, there were IPsec and SOCKS solutions that work outside of the protocol.]&lt;/p&gt; &lt;p&gt;OK, you might say, but that only protects the authentication - what about the data?&lt;/p&gt; &lt;p&gt;FTP under GSSAPI was defined in &lt;a href="http://www.ietf.org/rfc/rfc2228.txt"&gt;RFC 2228&lt;/a&gt;, which was published in October 1997 (the earliest draft copy I can find is from March 1995), from a draft developed over the preceding couple of years. What&amp;#39;s GSSAPI? As far as anyone really needs to know, it&amp;#39;s Kerberos.&lt;/p&gt; &lt;p&gt;This inspired the development of FTP over SSL in 1996, which became FTP over TLS, and which finally became &lt;a href="http://www.ietf.org/rfc/rfc4217.txt"&gt;RFC 4217&lt;/a&gt;. From 1997 to 2003, those of us in the FTPExt Working Group were wondering why the standard wasn&amp;#39;t yet an RFC, as draft after draft were submitted with small changes, and then apparently sat on by the RFC editor - during this time, several compatible FTP clients, servers and proxies were produced that compatibly supported FTP over TLS (and/or SSL).&lt;/p&gt; &lt;h3&gt;Why so long from draft to publication?&lt;/h3&gt; &lt;p&gt;One theory that was raised is that the IETF were trying to get SSH-based protocols such as SFTP out before FTP over TLS (which has become known as &amp;quot;FTPS&amp;quot;, for FTP over SSL).&lt;/p&gt; &lt;p&gt;SFTP was abandoned after draft 13, which was made available in July 2006; &lt;a href="http://www.ietf.org/rfc/rfc4217.txt"&gt;RFC 4217&lt;/a&gt; was published in October 2005. So it seems a little unlikely that this is the case.&lt;/p&gt; &lt;p&gt;The more likely theory is simply that the RFC Editor was overworked - the former RFC Editor, Jon Postel, died in 1998, and it&amp;#39;s likely that it took some time for the new RFC Editor to sort all the competing drafts out, and give them his attention.&lt;/p&gt; &lt;h3&gt;What did the FTPExt Working Group do while waiting?&lt;/h3&gt; &lt;p&gt;While we were waiting for the RFC, we all built compatible implementations of the FTP over TLS standard.&lt;/p&gt; &lt;p&gt;One or two of us even tried to implement SFTP, but with the draft mutating rapidly, and internal discussion on the SFTP mailing list indicating that no-one yet knew quite what they wanted SFTP to be when it grew up, it was like nailing the proverbial jelly to a tree. Then the SFTP standardisation process ground to a halt, as everyone lost interest. This is why getting SFTP implementations to interoperate is sometimes so frustrating an experience.&lt;/p&gt; &lt;p&gt;FTPS, however - that was solidly defined, and remains a very compatible protocol with few relevant drawbacks. Sadly, even FTP under GSSAPI turned out to have some reliability issues (the data transfer and the control connection, though over different asynchronous channels, share the same encryption context, which means that the receiver must synchronise the two asynchronous channels exactly as the sender did, or face a loss of connection) - but FTP over TLS remains strong and reliable.&lt;/p&gt; &lt;h2&gt;So, why does no-one know about FTPS?&lt;/h2&gt; &lt;p&gt;Actually, there&amp;#39;s lots of people that do - and &lt;a href="http://www.ford-hutchinson.com/~fh-1-pfh/ftps-ext.html"&gt;many clients and servers, proxies and tunnels&lt;/a&gt;, exist in real life implementations. Compatibility issues are few, and generally revolve around how strict servers are about observing the niceties of the secure transaction.&lt;/p&gt; &lt;p&gt;Even a &lt;a href="http://www.formortals.com/Home/tabid/36/EntryID/39/Default.aspx"&gt;ZDNet blogger&lt;/a&gt; or two has come across FTPS, and recommends it, although of course he recommends the wrong server.&lt;/p&gt; &lt;h3&gt;My recommendation?&lt;/h3&gt; &lt;p&gt;&lt;a href="http://www.wftpd.com"&gt;WFTPD Pro&lt;/a&gt;. Unequivocally. Because I know who wrote it, and I know what went into it. It&amp;#39;s all good stuff.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1642650" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/General+Security/default.aspx">General Security</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/What+my+wife+knows/default.aspx">What my wife knows</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Alun_2700_s+code/default.aspx">Alun's code</category></item><item><title>Vistafy Me.</title><link>http://msmvps.com/blogs/alunj/archive/2008/07/10/1640321.aspx</link><pubDate>Fri, 11 Jul 2008 05:07:25 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1640321</guid><dc:creator>Alun Jones</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=1640321</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=1640321</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2008/07/10/1640321.aspx#comments</comments><description>&lt;p&gt;I have a little time over the next couple of weeks to devote to developing &lt;a title="WFTPD by Texas Imperial Software" href="http://www.wftpd.com/"&gt;WFTPD&lt;/a&gt; a little further.&lt;/p&gt; &lt;p&gt;This is a good thing, as it&amp;#39;s way past time that I brought it into Vista&amp;#39;s world.&lt;/p&gt; &lt;p&gt;I&amp;#39;ve been very proud that over the last several years, I have never had to re-write my code in order to make it work on a new version of Windows. Unlike other developers, when a new version of Windows comes along, I can run my software on that new version without changes, and get the same functionality.&lt;/p&gt; &lt;p&gt;The same is not true of developers who like to use undocumented features, because those are generally the features that die in new releases and service packs. After all, since they&amp;#39;re undocumented, nobody should be using them, right? No, seriously, you shouldn&amp;#39;t be using those undocumented features.&lt;/p&gt; &lt;p&gt;So, &lt;a title="WFTPD by Texas Imperial Software" href="http://www.wftpd.com/wftpdreg.htm"&gt;WFTPD&lt;/a&gt; and &lt;a href="http://www.wftpd.com/wftpdpro.htm"&gt;WFTPD Pro&lt;/a&gt; run in Windows Vista and Windows Server 2008.&lt;/p&gt; &lt;p&gt;But that&amp;#39;s not enough. With each new version of Windows, there are better ways of doing things and new features to exploit. With Windows Vista and Windows Server 2008, there are also a few deprecated older behaviours that I can see are holding WFTPD and WFTPD Pro down.&lt;/p&gt; &lt;p&gt;I&amp;#39;m creating a plan to &amp;quot;Vistafy&amp;quot; these programs, so that they&amp;#39;ll continue to be relevant and current.&lt;/p&gt; &lt;p&gt;Here&amp;#39;s my list of significant changes to make over the next couple of weeks:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Convert the Help file from WinHelp to HTML Help. &lt;/li&gt; &lt;ul&gt; &lt;li&gt;WinHelp is not supported in Vista - you can download a WinHelp version, but it&amp;#39;s far better to support the one format of Help file that Windows uses. So, I&amp;#39;m converting from WinHelp to HTML Help.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Changing the Control Panel Applet for WFTPD Pro.&lt;/li&gt; &lt;ul&gt; &lt;li&gt;CPL files still work in Windows Vista, but they&amp;#39;re considered &amp;#39;old&amp;#39;, and there&amp;#39;s an ugly user experience when it comes to making them elevate - run as administrator. &lt;li&gt;There are two or three ways to go here -&lt;/li&gt; &lt;ol&gt; &lt;li&gt;one is to create an EXE wrapper that calls the old CPL file. That&amp;#39;s fairly cheap, and will probably be the first version. &lt;li&gt;Another is to write an MMC plugin. That&amp;#39;s a fair amount of work, and requires some thought and design. That&amp;#39;s going to take more than a couple of weeks. &lt;li&gt;A third option is to create some form of web-based interface. I don&amp;#39;t want to go that way, because I don&amp;#39;t want to require my users to install IIS or some other web server.&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;So, first blush it seems will be to wrap the existing interface, and secondly I&amp;#39;ll be investigating what an MMC should look like.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Support for IPv6.&lt;/li&gt; &lt;ul&gt; &lt;li&gt;I already have this implemented in a trial version, but have yet to fully wire it up to a user interface that I&amp;#39;m willing to unleash on the world. So that&amp;#39;s on the cards for the next release.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Multiple languages&lt;/li&gt; &lt;ul&gt; &lt;li&gt;There are two elements to support for multiple languages in FTP:&lt;/li&gt; &lt;ol&gt; &lt;li&gt;File names in non-Latin character sets &lt;li&gt;Text messages in languages other than English&lt;/li&gt;&lt;/ol&gt; &lt;li&gt;The first, file names in different character sets, will be achieved sooner than the second. If the second ever occurs, it will be because customers are sufficiently interested to ask me specifically to do it.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;SSL Client Certificate authentication&lt;/li&gt; &lt;ul&gt; &lt;li&gt;SSL Client Certificate Auth has been in place for years - it&amp;#39;s a secret feature. The IIS guys warned me off developing it, saying &amp;quot;that&amp;#39;s really hard, don&amp;#39;t try and do anything with client certs&amp;quot;. &lt;li&gt;I didn&amp;#39;t have the heart to tell them I had the feature working already (but without an interface), and that it simply required a little patience.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Install under Local Service and Network Service accounts &lt;li&gt;Build in Visual Studio 2008, to get maximum protection using new compiler features.&lt;/li&gt; &lt;ul&gt; &lt;li&gt;/analyze, Address Space Layout Randomisation, SAL - all designed to catch my occasional mistakes.&lt;/li&gt;&lt;/ul&gt;&lt;/ol&gt; &lt;p&gt;As I work on each of these items, I&amp;#39;ll be sure to document any interesting behaviours I find along the way. My first article will be on converting your WinHelp-using MFC project to using HTML Help, with minimal changes to your code, and in such a way that you can back-pedal if you have to.&lt;/p&gt; &lt;p&gt;Of course, I also have a couple of side projects - because I&amp;#39;ve been downloading a lot from BBC 7, I&amp;#39;ve been writing a program to store the program titles and descriptions with the MP3 files, so that they show up properly on the MP3 player. ID3Edit - an inspired name - allows me to add descriptions to these files.&lt;/p&gt; &lt;p&gt;Another side-project of mine is an EFS tool. I may use some time to work on that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1640321" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Windows+Vista/default.aspx">Windows Vista</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/What+my+wife+knows/default.aspx">What my wife knows</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Alun_2700_s+code/default.aspx">Alun's code</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Windows+Server+2008/default.aspx">Windows Server 2008</category></item><item><title>Vista's Secret Windows Firewall hole</title><link>http://msmvps.com/blogs/alunj/archive/2008/01/24/1479415.aspx</link><pubDate>Fri, 25 Jan 2008 05:19:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1479415</guid><dc:creator>Alun Jones</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=1479415</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=1479415</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2008/01/24/1479415.aspx#comments</comments><description>&lt;p&gt;First, the good news - it&amp;#39;s not a flaw in the operation of Windows Firewall on Windows Vista. It&amp;#39;s a design feature, it makes sense, and it fits in with the principle that the firewall should keep out unsolicited traffic. It&amp;#39;s not really a hole, but I thought I&amp;#39;d grab your attention.&lt;/p&gt;
&lt;p&gt;The symptom first came up in a Usenet posting (thanks, Jesper, for bringing me in) about Vista and a third-party FTP client:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When I do a directory listing, and a PORT command is issued, and the &lt;br /&gt;server attempts to connect, it works, but at the same time a dialogue &lt;br /&gt;appears telling me it&amp;#39;s blocked, and I can keep blocking or unblock. &lt;br /&gt;I choose keep blocking but it doesn&amp;#39;t actually block it once.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Here&amp;#39;s how it looks. 
&lt;p&gt;First, if you haven&amp;#39;t got a third-party FTP client let&amp;#39;s fake it, by copying Microsoft&amp;#39;s command-line FTP client from the Windows System32 directory to another directory: 
&lt;blockquote&gt;
&lt;p&gt;C:\users\MyMe&amp;gt; copy %windir%\system32\ftp.exe&lt;br /&gt;1 file(s) copied.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The FTP client will not display prompts to you, but that&amp;#39;s a minor issue - if it upsets you, try downloading a third-party client and trying it. 
&lt;p&gt;Anyway, here we go - let&amp;#39;s try the issue in question: 
&lt;ul&gt;
&lt;li&gt;Type &lt;strong&gt;ftp ftp.microsoft.com&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;After you see the &amp;quot;220&amp;quot; greeting message, enter &lt;strong&gt;ftp&lt;/strong&gt; as the user - press enter.&lt;/li&gt;
&lt;li&gt;Now you&amp;#39;re prompted for a password - enter anything and press enter.&lt;/li&gt;
&lt;li&gt;Once you&amp;#39;re logged on, enter &lt;strong&gt;dir&lt;/strong&gt; - again, press enter.&lt;/li&gt;
&lt;li&gt;You&amp;#39;ll see the directory listing succeed, but you&amp;#39;ll also see a warning that a connection is being blocked:&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://msmvps.com/blogs/alunj/WindowsLiveWriter/VistasWindowsFirewallSecret_11770/image-0063_2.png"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="571" alt="image-0063" src="http://msmvps.com/blogs/alunj/WindowsLiveWriter/VistasWindowsFirewallSecret_11770/image-0063_thumb.png" width="999" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Wow - that&amp;#39;s freaky - at the same time you&amp;#39;re being told that the connection used for the file listing will be blocked, it allows the connection through!&lt;/em&gt; 
&lt;p&gt;What&amp;#39;s more, even if you specify &lt;strong&gt;Keep Blocking&lt;/strong&gt;, and then go issue another &lt;strong&gt;dir&lt;/strong&gt; command, that one succeeds. 
&lt;p&gt;&lt;em&gt;Huh? And why on earth did you make me use a copy of FTP?&lt;/em&gt; 
&lt;p&gt;Let&amp;#39;s go look at the Windows Advanced Firewall Rules for Inbound, and see if this sheds any light: 
&lt;p&gt;[That means click the Start button, type &lt;strong&gt;Firewall&lt;/strong&gt; into the search box, and right-click on &lt;strong&gt;Windows Firewall with Advanced Security&lt;/strong&gt; - select &lt;strong&gt;Run as Administrator&lt;/strong&gt; 
&lt;p&gt;and accept the elevation prompt from UAC. If you don&amp;#39;t have an elevation prompt, then you should really re-enable UAC. Now select &lt;strong&gt;Inbound Rules&lt;/strong&gt; in the left-hand pane]&lt;/p&gt;
&lt;p&gt;Me, I&amp;#39;ve got a few rules labeled &lt;strong&gt;File Transfer Program&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msmvps.com/blogs/alunj/WindowsLiveWriter/VistasWindowsFirewallSecret_11770/Image-0064_2.png"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="348" alt="Image-0064" src="http://msmvps.com/blogs/alunj/WindowsLiveWriter/VistasWindowsFirewallSecret_11770/Image-0064_thumb.png" width="829" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;That first (and fourth) rule is set to block any listening ports opened by the &lt;strong&gt;File Transfer Program&lt;/strong&gt; in &lt;strong&gt;C:\users\myme\ftp.exe&lt;/strong&gt;, the second two seem to be allowing any listening ports created by the one in &lt;strong&gt;C:\windows\system32\ftp.exe&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Obviously, that&amp;#39;s why I asked you to copy &lt;strong&gt;ftp.exe&lt;/strong&gt; to a new directory, so that any previous allowance by the firewall rules wouldn&amp;#39;t get in the way.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;So what&amp;#39;s happening here? Is the &amp;quot;&lt;strong&gt;Allow&lt;/strong&gt;&amp;quot; rule somehow overriding the &amp;quot;&lt;strong&gt;Block&lt;/strong&gt;&amp;quot; rule, even though it&amp;#39;s not dealing with the same executable?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;We can test that simply by deleting both sets of rules - go ahead and do that, I&amp;#39;ll wait for you.&lt;/p&gt;
&lt;p&gt;Didn&amp;#39;t make a bit of difference, did it? It still allowed the traffic, then prompted you if you wanted to block it. Even if you selected to &amp;quot;&lt;strong&gt;Keep Blocking&lt;/strong&gt;&amp;quot;, the next and subsequent transfers still worked, right?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Okay - let&amp;#39;s consult the Big Book of Knowledge (alright, what I can vaguely remember after mumbleteen years in the networking world). Some routers and firewalls use an Application Layer Gateway (ALG) to translate FTP commands, and open ports. Is that what&amp;#39;s going on here?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s take a peek at the services on this machine (as an administrator, run &lt;strong&gt;services.msc&lt;/strong&gt;):&lt;/p&gt;
&lt;p&gt;&lt;a href="http://msmvps.com/blogs/alunj/WindowsLiveWriter/VistasWindowsFirewallSecret_11770/Image-0065_2.png"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="353" alt="Image-0065" src="http://msmvps.com/blogs/alunj/WindowsLiveWriter/VistasWindowsFirewallSecret_11770/Image-0065_thumb.png" width="784" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Bingo - there it is, the &lt;strong&gt;Application Layer Gateway Service&lt;/strong&gt;. And when you have &lt;strong&gt;Internet Connection Sharing&lt;/strong&gt; running, that&amp;#39;s what translates IP addresses in FTP commands for you, and what opens up port mappings and holes in the NAT that ICS hosts.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Oh, but wait a moment - what&amp;#39;s that in the &amp;quot;&lt;strong&gt;Status&lt;/strong&gt;&amp;quot; column?&lt;/p&gt;
&lt;p&gt;That&amp;#39;s right, nothing. This service isn&amp;#39;t running.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Something must be happening to open this port up - it&amp;#39;s not just a case of &amp;quot;port left open&amp;quot;, nor is it an outbound port. Those ports are closed tight until the FTP client starts listening for incoming data connections, and then they&amp;#39;re opened up.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s where I go into MVP-mode, and start searching in all the nooks and crannies of the web and whatever documentation it holds.&lt;/p&gt;
&lt;p&gt;Net result - Windows Firewall in Windows Vista includes something called a &amp;quot;connection inspection engine&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Sounds like something from &amp;quot;&lt;/em&gt;&lt;a title="Conjunction junction, what&amp;#39;s your function?" href="http://en.wikipedia.org/wiki/Conjunction_Junction"&gt;&lt;em&gt;Schoolhouse Rock&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&amp;quot;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;No, seriously, there&amp;#39;s a &amp;quot;connection inspection engine&amp;quot; for FTP - if you connect to port 21, the firewall monitors your communications on that channel, looking for PORT commands. When it finds one, it opens up a hole in the firewall for the incoming data connection.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;So why the scary dialog warning that something&amp;#39;s going to block traffic?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Probably because the dialog pops up whenever an application starts listening, whereas the connection inspection engine only opens a hole when it sees a PORT command. And an FTP client can&amp;#39;t actually give the PORT command until it&amp;#39;s started listening.&lt;/p&gt;
&lt;p&gt;So, the process goes something like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Start the FTP client.&lt;/li&gt;
&lt;li&gt;Connect to the FTP server on port 21, waking up the connection inspection engine.&lt;/li&gt;
&lt;li&gt;Log on, then type &lt;strong&gt;dir&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;The FTP client knows that it needs to open a data connection.&lt;/li&gt;
&lt;li&gt;To start the data connection, the FTP client binds to port 0, and starts listening.&lt;/li&gt;
&lt;li&gt;The firewall says &amp;quot;Oh no, an unknown program has started listening - better warn them that they won&amp;#39;t get any traffic.&amp;quot;&lt;/li&gt;
&lt;li&gt;The FTP client checks what port it actually got, and sends a matching PORT command.&lt;/li&gt;
&lt;li&gt;The connection inspection engine says &amp;quot;PORT command? That&amp;#39;s my cue!&amp;quot; and opens a hole in the firewall to incoming data connections.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Well, that&amp;#39;s easy, but what if I don&amp;#39;t ever want to do an FTP connection? How do I stop this from becoming a potential hacker tool?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Okay, apart from the obvious - that if a hacker could connect out to a server on port 21, nothing&amp;#39;s stopping that hacker from transferring data in - you might want to cripple this functionality.&lt;/p&gt;
&lt;p&gt;No problem - just set the following DWORD registry value to 1:&lt;/p&gt;
&lt;p&gt;HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ SharedAccess \ Parameters \ FirewallPolicy \ DisableStatefulFTP&lt;/p&gt;
&lt;p&gt;The default setting for this value on Windows Vista is 0. [It remains to be seen what value will be the default on Windows Server 2008]&lt;/p&gt;
&lt;p&gt;&lt;em&gt;How could Microsoft make this better?&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;I&amp;#39;d really like to see this documented. Just so that it&amp;#39;s not a surprise to anyone.&lt;/li&gt;
&lt;li&gt;I&amp;#39;d like to know how many other connection inspection engines there are (at least one, judging from the DisableStatefulPPTP value - but I don&amp;#39;t know enough about PPTP to know how that affects operation).&lt;/li&gt;
&lt;li&gt;I&amp;#39;d like to know if I can add my own connection inspection engine to the firewall.&lt;/li&gt;
&lt;li&gt;Above all, I&amp;#39;d like to do away with the rather confusing and clumsy &amp;quot;We&amp;#39;re going to block your incoming ... wait, what just happened?&amp;quot; dialog. If the connection inspection engine is monitoring a command channel, and the process that owns the socket for that command channel starts listening, perhaps we could wait a quarter of a second for a PORT command before calling this a blocked connection?&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Finally, is this a vulnerability, a hole, or anything outside the correct operation of a firewall?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;No, because the firewall is documented as blocking unsolicited incoming connections - and by any reasonable definition, the data connection requested by a PORT command is solicited.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1479415" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/General+Security/default.aspx">General Security</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Windows+Vista/default.aspx">Windows Vista</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/TCP_2F00_IP/default.aspx">TCP/IP</category></item><item><title>What should I do now I can compete?</title><link>http://msmvps.com/blogs/alunj/archive/2006/09/17/What-should-I-do-now-I-can-compete_3F00_.aspx</link><pubDate>Mon, 18 Sep 2006 04:37:01 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:130791</guid><dc:creator>Alun Jones</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=130791</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=130791</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2006/09/17/What-should-I-do-now-I-can-compete_3F00_.aspx#comments</comments><description>&lt;p&gt;My departure from Microsoft is very nearly reaching its first anniversary.&lt;/p&gt; &lt;p&gt;As befits someone approaching that milestone, my thoughts drift to ... the non-compete clause.&lt;/p&gt; &lt;p&gt;That's the niggling part of the contract every Microsoft employee signs, and which restricts them, to lesser or greater extent, from engaging in any activity considered to be competitive to Microsoft, using knowledge gained while working at Microsoft.&lt;/p&gt; &lt;p&gt;Now, in my case, the non-compete clause is weak to begin with - a condition I made of my employment was that I could continue my &lt;a href="http://www.wftpd.com/"&gt;WFTPD&lt;/a&gt; work, which was, in some ways, directly competitive to Microsoft's FTP server in IIS.&lt;/p&gt; &lt;p&gt;It's further weakened, I'd say,&amp;nbsp;by the fact that Microsoft sent me to exactly one class while I was there - the mandatory coding security class - and bought me one book - the mandatory "Writing Secure Code".&lt;/p&gt; &lt;p&gt;But, weakened or not, I have chosen to observe it steadfastly - I have not added a single feature to &lt;a href="http://www.wftpd.com/wftpdreg.htm"&gt;WFTPD&lt;/a&gt; or &lt;a href="http://www.wftpd.com/wftpdpro.htm"&gt;WFTPD Pro&lt;/a&gt; or &lt;a href="http://www.wftpd.com/fcl.htm"&gt;WFTPD Explorer&lt;/a&gt; that was based on anything I learned at Microsoft, or even on anything I had hoped to add to Microsoft's FTP server during my stay there. I have even steered clear of adding features that I was planning to add to WFTPD and WFTPD Pro before Microsoft offered me the job, just to avoid the appearance of competing with my ex-employer.&lt;/p&gt; &lt;p&gt;So now, I'm giddy with anticipation, as this mostly self-imposed deadline is about to expire.&lt;/p&gt; &lt;p&gt;What should&amp;nbsp;I start to code into my software?&lt;/p&gt; &lt;p&gt;Well, there's an open comments section below - what do &lt;u&gt;you&lt;/u&gt; think I should do, now that I can compete?&lt;/p&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=130791" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Programmer+Hubris/default.aspx">Programmer Hubris</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Things+I+Learned+At+Microsoft/default.aspx">Things I Learned At Microsoft</category></item><item><title>I wish Larry hadn't written that...</title><link>http://msmvps.com/blogs/alunj/archive/2006/06/26/102893.aspx</link><pubDate>Tue, 27 Jun 2006 03:52:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:102893</guid><dc:creator>Alun Jones</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=102893</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=102893</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2006/06/26/102893.aspx#comments</comments><description>&lt;P&gt;Oh, Larry, Larry, Larry...&lt;/P&gt;
&lt;P&gt;Articles &lt;a href="http://blogs.msdn.com/larryosterman/archive/2006/05/09/593905.aspx"&gt;1&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/larryosterman/archive/2006/05/15/598181.aspx"&gt;2&lt;/a&gt; were great - really necessary reading to a lot of would-be network programmers.&lt;/P&gt;
&lt;P&gt;But &lt;a href="http://blogs.msdn.com/larryosterman/archive/2006/06/13/630198.aspx"&gt;article 3...&lt;/a&gt; where to start with the corrections?&lt;/P&gt;
&lt;P&gt;I'm not going to.&amp;nbsp;It's an article you shouldn't read, because you're not going to use the right terms for the right things, and when you go asking for help from networking experts, they'll look at you in much the same way as security experts look at Steve Gibson. [The look is "how the hell do you get anything done, knowing so little about the field?"]&lt;/P&gt;
&lt;P&gt;I've met Larry, and he's a nice guy, so I really thought twice about making this post - and I apologise if I hurt Larry's feelings by saying it... but I have been on a fifteen-year march to persuade people to stop writing crap networking apps, by getting them to understand what they're doing, and I can't stop now.&lt;/P&gt;
&lt;P&gt;At the risk of opening myself up to abuse similar to that which I'm heaping on Larry now, I'll point you to my earlier article, &lt;a HREF="/blogs/alunj/archive/2006/05/08/94038.aspx"&gt;where I describe the interaction between delayed ACKs and Nagle&lt;/a&gt; - it's much, much simpler than Larry stated, and I think I've got it more accurately described.&lt;/P&gt;
&lt;P&gt;Finally, in the case that perhaps I don't have it correct, I'm going to retro-edit it if mistakes are pointed out, because the worst thing you can do is have someone search for the answer, and the first text they come back with is wrong.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=102893" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Programmer+Hubris/default.aspx">Programmer Hubris</category></item><item><title>DELAY or NODELAY - Riffing on Larry, who's riffing on Raymond...</title><link>http://msmvps.com/blogs/alunj/archive/2006/05/08/94038.aspx</link><pubDate>Tue, 09 May 2006 00:01:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:94038</guid><dc:creator>Alun Jones</dc:creator><slash:comments>13</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=94038</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=94038</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2006/05/08/94038.aspx#comments</comments><description>&lt;P&gt;[Why is this under "Programmer Hubris"? Because it's about developers who find "an easy fix" and apply it, without trying to figure out why it made things appear to work better.]&lt;/P&gt;
&lt;P&gt;I like to read Larry Osterman and Raymond Chen's blogs, because they've seen most things, and learned most of the lessons right.  Today, Larry posted on &lt;A href="http://blogs.msdn.com/larryosterman/archive/2006/05/08/592763.aspx"&gt;network optimisation&lt;/A&gt; - reminding me once again:&lt;/P&gt;
&lt;P&gt;Trying to fix network speed problems by enabling TCP_NODELAY is almost always wrong.  Setting TCP_NODELAY disables the Nagle algorithm&lt;/P&gt;
&lt;P&gt;When you do this, it's an indication that either your program is broken, or your protocol is broken, or quite possibly both.&lt;/P&gt;
&lt;P&gt;"But what about FTP?" people say.&lt;/P&gt;
&lt;P&gt;Yes, the protocol is broken.  It requires a send / send / recv exchange, and you have to enable TCP_NODELAY (disabling the Nagle algorithm in the process) to make it work properly, so that you can have more than five files transfer per second.&lt;/P&gt;
&lt;P&gt;So what does Nagle do, exactly? Well, John Nagle spends his time &lt;A href="http://www.animats.com/"&gt;pushing dead bodies down staircases&lt;/A&gt;.  The Nagle algorithm, named after John despite his humble protestations, does a couple of simple things every time you try to send data:&lt;/P&gt;If there is unacknowledged data in the queue, then don't send until: 
&lt;ul&gt;
&lt;li&gt;all data is acknowledged, or
&lt;li&gt;you have a segment's worth to send. 
&lt;LI&gt;Uh... that's it.&lt;/LI&gt;
&lt;/ul&gt;
&lt;P&gt;The idea is to take a program that, rather stupidly, sends one character at a time, resulting in a 1:40 data:framing ratio, and turn it into one that sends several characters at a time, using the network bandwidth more efficiently and not becoming a network hog.&lt;/P&gt;
&lt;P&gt;Way back when, this was a perfect idea, and could have remained perfect, if it weren't for the delayed ACK algorithm, whose author is not remembered so fondly as to name the algorithm after him.  Delayed Ack states that you should not send an unaccompanied ack until either:&lt;/P&gt;
&lt;ul&gt;
&lt;li&gt;you receive two segments 
&lt;li&gt;200ms expires since the first piece of data was received. 
&lt;/ul&gt;[An ACK is included in every TCP segment, so it's not an overhead of any kind except when you're sending nothing &lt;u&gt;but&lt;/u&gt; an ACK.]
&lt;P&gt;In most environments, this is still good, because most protocols are "client sends command, server sends response" over and over again, so each side is doing one send, then one recv. Model this behaviour in your head, and you'll see that the Nagle algorithm won't stop any outgoing traffic, and nor will delayed ACK hold up any acknowledgements.&lt;/P&gt;
&lt;P&gt;If one side hiccups and calls send() twice (on short data) before receiving, however, things come to (in networking terms) a screeching halt. The second send queues up because the Nagle algorithm doesn't get an acknowledgement from the first send until the delayed ACK algorithm has exhausted its timer.&lt;/P&gt;
&lt;P&gt;The answer is always "don't send / send / recv".  Always group logically-associated data together in one call to send, unless you're sending large amounts of data, in which case you can happily send / send / send until you've exhausted your data.&lt;/P&gt;
&lt;P&gt;Setting TCP_NODELAY will look like it makes your program perform at top speed, but it's now become the network hog that you programmed it to be, and that Nagle was helpfully preventing you from being.  Fixing the program will make your program perform faster than it would with TCP_NODELAY alone, and you will find that the TCP_NODELAY setting will have no further effect, on or off.  Your program is now working smoothly, a good network citizen, and the Nagle net-cop allows it to go about its business unimpeded.&lt;/P&gt;
&lt;P&gt;So, my final piece of advice - if TCP_NODELAY looks like it makes your program perform better, &lt;STRONG&gt;&lt;U&gt;&lt;EM&gt;fix your damn program!&lt;/EM&gt;&lt;/U&gt; &lt;/STRONG&gt;There's too much crappy networking software out there already, and you don't want to add to it.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=94038" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/Programmer+Hubris/default.aspx">Programmer Hubris</category></item><item><title>"FTPS" document finally makes it to RFC status.</title><link>http://msmvps.com/blogs/alunj/archive/2005/11/03/74244.aspx</link><pubDate>Thu, 03 Nov 2005 23:05:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:74244</guid><dc:creator>Alun Jones</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/rsscomments.aspx?PostID=74244</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/alunj/commentapi.aspx?PostID=74244</wfw:comment><comments>http://msmvps.com/blogs/alunj/archive/2005/11/03/74244.aspx#comments</comments><description>&lt;P&gt;News I've been waiting for for years - the document formally known as draft-murray-auth-ftp-ssl-16.txt has finally been released by the RFC editor as RFC 4217 - “&lt;A href="http://www.ietf.org/rfc/rfc4217.txt"&gt;Securing FTP with TLS&lt;/A&gt;”&lt;/P&gt;
&lt;P&gt;What exactly does this mean?  Technically, not very much - FTPS has been implemented by several FTP clients, servers and wrappers for several years.  I added FTPS support to WFTPD Pro back in 2001, after first expressing interest in doing so in 1997, but being held back by the lack of crypto support in Windows.&lt;/P&gt;
&lt;P&gt;I nearly had it ready in 2000, but spent some time trying to debug an issue that turned out to be caused by a corrupted certificate issued by the Windows 2000 Server CA that I was testing against.  Let that be a lesson to you crypto developers - sometimes the code is right, and it's the certs that are wrong!&lt;/P&gt;
&lt;P&gt;A few minor things have changed since then in the document that is now RFC 4217, but almost nothing significant to the compatibility of FTPS offerings.&lt;/P&gt;
&lt;P&gt;I will end with a brief FAQ for you - please let me know if there are any other questions you'd like to see answered:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;1. What's TLS, and what is its relation to SSL?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;TLS is Transport Layer Security, and is the name of the protocol that grew from Netscape's SSL and Microsoft's PCT.  Most people still use the term “SSL”, but TLS is where all ongoing work is carried out by the IETF.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;2. Is FTPS the official term?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;No - the RFC is “Securing FTP with TLS”, and perhaps the official term should be “AUTH TLS”.  However, with the general public already familiar with the concept of “https” being the secured equivalent of “http”, the term “ftps” has sprung up in general use to describe an FTP transfer, or session, encrypted and/or authenticated with SSL or TLS.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;3. How different is FTPS from HTTPS?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Quite significantly - HTTPS uses a separate port for incoming SSL connections (usually port 443), compared to the port for unprotected HTTP connections (usually port 80).  Because FTP is (and has always been) a session-based protocol, it allows the client to “negotiate up” to SSL or TLS security through the use of the AUTH command described in RFC 2228.&lt;/P&gt;
&lt;P&gt;Note also that FTP uses two channels - a control channel and a data channel, and that these channels can be secured - or left unsecured - almost independently.  HTTPS is secured from the moment you connect to the HTTPS port, until you close down the connection.  FTP is secured on the control channel from the moment you send an “AUTH TLS” or “AUTH SSL” command, until you log out; the data channel is not necessarily secured by default, and security on the data channel can be turned on or off using the PROT command, with parameters “C” for “Clear” or “P” for “Private”.&lt;/P&gt;
&lt;P&gt;FTPS always authenticates the server through its certificate, and can be configured to authenticate the client by certificate, or by USER / PASS commands supplying username and password.  HTTP and HTTPS have several other methods of authentication (none of which bear much examination at the moment) - NTLM CHAP, Basic, Digest, etc, etc.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;4. What about SFTP?  What's that?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I get to answer this question a lot.  With all these acronyms getting thrown around, it's easy to get confused.  Many people automatically assume that any acronym including the letters “FTP” refer to protocols based on FTP.  Obviously, that's why “FTPS” was chosen as an informal description of “Securing FTP with TLS”.  Unfortunately, others may create confusing acronyms by including the FTP letters, either by accident or on purpose.  One such confusion was always “TFTP - Trivial File Transfer Protocol”.  This is about as far from FTP as you can get, and still be associated with transferring files from one machine to the other.&lt;/P&gt;
&lt;P&gt;The same is true of “SFTP” - it's a file transfer extension to “SSH”.  As that sentence implies, to do an SFTP file transfer, you need to have an SSH connection in place.  This isn't always practical.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=74244" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/alunj/archive/tags/General+Security/default.aspx">General Security</category><category domain="http://msmvps.com/blogs/alunj/archive/tags/FTP/default.aspx">FTP</category></item></channel></rss>