Wild fermentation works because the microbes that sour a sourdough starter or a jar of sauerkraut were never floating in from the air in the first place — they were already living on the flour or the cabbage, and all you did was create conditions where they could outcompete everything else.
Where the microbes actually come from
Not the air. That's the part most people get wrong, and it's an easy mistake — you leave a jar out on the counter, something starts happening inside it, and the obvious guess is that whatever caused it fell in from outside. It didn't. A stalk of cabbage arrives from the field already carrying a working population of lactic acid bacteria on its outer leaves, left there by soil and rain rather than by anything you did. Whole grain flour is the same story: milling doesn't sterilize wheat, so the bran still carries the yeast and bacteria that were living on the grain in the field. Mix that flour with water and you haven't invited anything in. You've just given organisms that were already there room to grow.
Air does contribute something — a starter left uncovered for days will pick up a few more strains along the way — but it's a minor addition to a population that started in the thousands, not the source of it. Two starters built the same week in the same kitchen from different bags of flour will taste different from each other for exactly this reason: they didn't start from the same air, they started from different flour.
Why an acidic environment picks the winners
A jar of shredded cabbage and salt starts out with dozens of different microbes on it, most of which have no business surviving the next two weeks. What decides who's left is the environment you build around them, not any one organism being especially aggressive.
Salt does the first cut. Packed cabbage releases its own water under that salt through osmosis, and the result is a low-oxygen brine that most surface bacteria — the ones adapted to living in open air on a leaf — simply can't grow in. What's left standing is a narrower group, mostly Leuconostoc species, that tolerate salt and low oxygen and get to work first.
Acid does the second cut, and it's the more interesting one, because the bacteria doing it are also the bacteria it acts on. Leuconostoc produces lactic acid as a byproduct of feeding on the sugar in the cabbage, and that acid drops the pH of the brine within days. Most of the organisms present at the start — including the ones responsible for ordinary spoilage — stop reproducing somewhere around pH 4.6. Even Leuconostoc itself starts to struggle in the acid it made. But Lactobacillus plantarum, present all along in smaller numbers, tolerates that acid better than anything else in the jar, so it inherits an environment its competitors can no longer survive in.
A sourdough starter runs the same sequence on a shorter clock. Each addition of fresh flour resets the sugar supply, the resident lactobacilli drop the pH again within hours, and the same acid-tolerant yeast and bacteria that won the last round are first in line to use it. Repetition is what turns a one-time population into a stable one.
Why that selection is what makes it safe
This is the part that looks like luck from the outside and isn't. The organisms that cause food poisoning — Salmonella, E. coli, most of what makes raw cabbage risky to leave out on a counter for a week — are no more or less present in a ferment than they'd be on any unwashed vegetable. What changes is whether they can multiply once the salt and acid arrive, and the same conditions that let lactic acid bacteria take over are close to the worst conditions those organisms could ask for. Almost nothing that causes foodborne illness grows well below pH 4.6, and a properly salted vegetable ferment reaches that within the first few days.
The one organism worth naming specifically is Clostridium botulinum, because it's built for exactly the low-oxygen environment a packed jar creates. It can't compete with lactic acid bacteria once the pH drops, and standard salt levels for vegetable ferments — around 2 to 3 percent by weight — slow it down enough that the acid gets there first. That race, not a promise that nothing dangerous is present at the start, is what the whole process is actually leaning on.