We've all agreed to not do that, but there's no Intergalactic Police stopping you. But you would likely be stopped by earth police forces.
Relevant Treaties and Organisations
The UN's Treaty on Principles Governing the Activities of States in the Exploration and Use of Outer Space, including the Moon and Other Celestial Bodies has been signed by 89 countries.
I'll quote a few relevant parts.
The activities of non-governmental entities in outer space, including the moon and other celestial bodies, shall require authorization and continuing supervision by the appropriate State Party to the Treaty.
A State Party to the Treaty which has reason to believe that an activity or experiment planned by another State Party in outer space, including the moon and other celestial bodies, would cause potentially harmful interference with activities in the peaceful exploration and use of outer space, including the moon and other celestial bodies, may request consultation concerning the activity or experiment.
Article IX roughly means "please don't do that", while article IV means that it's up to whichever party to the treaty feels obligated to take responsibility.
NASA has an Office of Planetary Protection. Its mission is as follows
The mission of the Office of Planetary Protection is to promote the responsible exploration of the solar system by implementing and developing efforts that protect the science, explored environments, and Earth. The objectives of planetary protection are several-fold and include:
- Preserving our ability to study other worlds as they exist in their natural states;
- Avoiding the biological contamination of explored environments that may obscure our ability to find life elsewhere – if it exists; and
- To ensure that we take prudent precautions to protect Earth’s biosphere in case life does exist elsewhere.
But again, this seems to rely on treaties and cooperation, and seems to be lacking a way to enforce anything.
But realistically, you need to launch from somewhere on earth. Should the government that controls your launch site become aware of your plans, they would probably shut you down.
Even if the country itself might not take responsibility, it's very likely other countries might pressure it to do so.