On most computers, the default download folder quickly becomes a repository of old and unorganized files that were opened once and then forgotten about. A recently fixed flaw in the Java installer highlights why keeping this folder clean is important.

On Friday, Oracle published a security advisory recommending that users delete all the Java installers they might have laying around on their computers and use new ones for versions 6u113, 7u97, 8u73 or later.

The reason is that older Java installers are designed to look for and automatically load a number of specifically named DLL (Dynamic Link Library) files from the current directory. In the case of Java installers downloaded from the Web, the current directory is typically the computer's default download folder.

If an attacker manages to place a specifically named malicious DLL into a computer's "Downloads" folder, that file will be executed when the user tries to install Java for the first time or when he manually updates an existing Java installation by downloading and running a new installer.

"Though considered relatively complex to exploit, this vulnerability may result, if successfully exploited, in a complete compromise of the unsuspecting user’s system," said Eric Maurice, Oracle's software security assurance director, in a blog post.

This attack technique is called binary planting and has been known for a while. Over the past several years many software installers have been found to be vulnerable to it.

"If you launch Process Monitor and observe activities in the Downloads folder when any installer is launched, you will find a long series of attempts to load various DLLs," researchers from Acros Security said in a blog post back in Feb. 2012. "Not surprising: this is how library loading works (first trying to find DLLs in the same folder as EXE), and in most cases it would not be a security problem as most folders hosting your EXEs are not attacker-writable. However, the Downloads folder is -- to some extent, anyway."

Some browsers are configured to automatically download files, even if they don't execute them. Furthermore, clearing the download list from browsers only empties the download history. It does not actually remove the downloaded files.

It's not hard to imagine a sort of carpet bombing attack where a malicious or infected website drops specifically named DLL files on users' computers on the chance that a small percentage of them will later be executed by vulnerable installers. To avoid something like this users should regularly clean the Downloads folder themselves.