Unknown. Aphthous ulcers (cancers) are of unknown cause. Any acidic food stings when it contacts the spot but is not the cause. Usually no treatment is needed. You can suck on a clove to numb it. Silver nitrate on a stick makes them heal faster. Sometimes they are disabling & should be seen by an expert.
A virus. Canker sores are caused by a virus that remains dormant in your system, until stress, a scratch, or your lowered resistance often causes the canker sore to appear. Laser dentists have had great success treating (without directly contacting the sore with the laser) and with minimal discomfort. Often laser treatment cuts the duration of the canker sore in half!