We recently released Cerberus FTP Server 10.0.16, and we wanted to elaborate on two security issues we fixed in that release and the previous 10.0.15 release.
Email Header Bypass Vulnerability
The first issue was an email header bypass vulnerability (fixed in 10.0.15). We committed the classic mistake of not properly sanitizing user input, and that omission could allow a malicious, authenticated user to craft a subject line that added additional SMTP headers to outgoing public share email messages. A practical example of how this flaw could be exploited would be to add a special “reply-to” header to the public share email.
This vulnerability resulted in our team re-evaluating and re-designing how we construct our SMTP headers to prevent this and any future header injection vulnerabilities.
Handling File Names That End in a Period
The second issue was a little more complicated. It turns out that file names that end in a period require special handling by the Windows operating system. To illustrate this, passing a file named “badfile.exe.” to a Windows API call results in unexpected behavior. Passing that file, or a path to that file, to a Windows API call will result in the operating system trying to open or create the file without the period at the end. You might tell the operating system to create a file called “badfile.exe.”, but it will actually create “badfile.exe” – the same file, but without the period at the end. Basically, Windows will ignore the period at the end of the file path when interpreting the path.
The practical implications of this behavior is that a malicious user could bypass our file extension blocking mechanism.
For example, if an administrator added “.exe” as a file extension to block from uploads, a user could upload “badfile.exe.” and it would be allowed since “.exe.” doesn’t match “.exe”. However, the Windows operating system would actually create the file without the period. Without special handling in Cerberus, the operating system ignores the trailing backslash. During our testing we actually discovered that most applications couldn’t open or access files (including all of the popular browsers and file transfer clients we tested) that ended in a period.
We rewrote our file handling code to properly escape file paths with filenames ending in a period. This addressed the file extension blocking bypass vulnerability, and had the added benefit of allowing Cerberus to easily handle and process paths with file names that end in a period.