There are some people who complain about everything being open. They do not like the fact that there is an open source community and they think that it is doomed to failure. History has proven that is not the case and the modern day open source community has been a beacon of success. But these same people worry about the fact that the bad guys are able to have access to some of the tools and information that the good guys have access to. These people seem especially worried about some of the open malware databases that are out there.
They feel as if these databases are allowing the bad guys to see how a piece of malware is made. This in turn leads them to be able to make better malware. While that might be true to a certain extent, malware having an open database also allows the good guys to write better tools that will be able to stop them. And not all of the good guys work for the government. If you were to only allow certain people to access the data that is on these types of databases then you are going to limit yourself on what kind of talent that you could have to fight the war against the bad guys.
You also have to remember that some of the best tools that we have on the internet right now come from the open source process. Without open source the internet would have got as far as it has. And online security would not be as developed as it is either without open collaboration. The only purpose of hiding malware from the general public who would be able to help stop it is to help the corporations, whose tools are being compromised, from being exposed.
Why is it legal to have open malware databases? Because the best way to stop the bad guys is for everything to be out in the open.