Good Morning and welcome to Just answer. I am Dr. Loretta, a licensed veterinarian and I am happy to answer your question.
This could be caused by a condition called Vesicular Stomatitis which is a contagious viral disease that will cause these ulcers. This is not a common disease and you will need to have your vet examine these to know for sure. Horses can also get a viral form of herpes that causes Cold sores and they can also get warts that will resolve on their own.
This also could be a bacterial infection and this will respond to oral antibiotics,. Your vet will have to examine and culture these lesions t know for sure what is causing these so that treatment can be initiated.
For now, apply an antibiotic creme such as Neopsporin to these lesions as well as a steroid ointment to decrease the discomfort.
Sincerely, XXXXX XXXXX