Hello and welcome to HCM,
The site of ulcer is not mentioned in your query so it is difficult to know the most probable causative agent.
However, on the basis of the clinical features that you have mentioned, an ulcer caused by contact with water suggets an infection with a worm calles guinea worm /Drancunculus midianensis.
This is contracted by having a contact with infected water.
It causes an ulcerative or nodular skin lesion.
The adult worm can be seen projecting out from the ulcer.
The adult worm can be removed from the ulcer directly using a stick.
Very good anti-helminthis drugs are available in the market for this infection.
The local inflammation can be controlled by anti-inflammatory drugs.
You have also mentioned about infection caused by
staphylococcus and
syphilis. These infections can also be treated by antibiotics.
Discomfort in the rib region could be due to trauma, muscle injury,
soft tissue injury, bony lesion, pleural irritation/ inflammation, etc.
You need to consult your doctor for clinical examination and relevant investigations.
A X-ray chest will help to know the site and cause of the lesion.
Thanks and take care
Dr Shailja P Wahal