Java and Python FTP attacks can punch holes through firewalls


The Java and Python runtimes fail to properly validate FTP URLs, which can potentially allow attackers to punch holes through firewalls to access local networks.

On Saturday, security researcher Alexander Klink disclosed an interesting attack where exploiting an XXE (XML External Entity) vulnerability in a Java application can be used to send emails.

XXE vulnerabilities can be exploited by tricking applications to parse specially crafted XML files that would force the XML parser to disclose sensitive information such as files, directory listings, or even information about processes running on the server.

Klink showed that the same type of vulnerabilities can be used to trick the Java runtime to initiate FTP connections to remote servers by feeding it FTP URLs in the form of ftp://user:password@host:port/file.ext.


Monday. “Each additional SSRF attack could open up one additional TCP port.”

There are multiple ways to exploit this issue, including using it against users with Java installed on their computers. Users don’t even need to execute a malicious Java applet, because the exploit can be delivered through a Java Web Start application.

“If a desktop user could be convinced to visit a malicious website while Java is installed, even if Java applets are disabled, they could still trigger Java Web Start to parse a JNLP file,” Morgan said. “These files could contain malicious FTP URLs which trigger this bug.”

Attackers could also target servers where Java applications run by abusing a man-in-the-middle position on the network or by exploiting SSRF or XXE vulnerabilities in those applications.

Morgan said he tested this attack against a custom Linux firewall running a recent kernel, as well as against firewalls from Palo Alto Networks and Cisco Systems that proved to be vulnerable under default settings.

“While testing of commercial firewalls has been very limited at this point, it seems likely that a significant percentage of production firewalls in the world are susceptible to attack through FTP protocol stream injections,” he said.

The Java and Python developers have been notified of this problem, but until they fix their FTP client implementations, the researcher advises firewall vendors to disable classic mode FTP translation by default.

Users should uninstall Java from their systems, or at least disable the browser plug-in and disassociate the .jnlp file extension from the Java Web Start binary. Meanwhile, Java and Python applications should be audited for SSRF and XXE flaws. However, XML parsing in Java is currently vulnerable by default, making XXE vulnerabilities very common on that platform, Morgan said.