Untold numbers of genetically modified Escherichia coli bacteria live in vats around the world, churning out useful things such as medical insulin, plastic polymers and food additives. When the reprogrammed bugs have served their role, they are packed away as industrial waste or repurposed for fertilizer.

This arrangement currently poses little environmental risk because genetically modified E. coli is weak compared with its wild cousins; it would not survive for long outside the lab. But engineered bugs not yet invented might go where they are not wanted and create risks. What if, say, an accident released more resilient engineered bugs that took over a well-balanced ecosystem? Or if tweaked bacteria shared modifications such as antibiotic resistance with their counterparts in nature through horizontal gene transfer? Or if a rival firm stole a patented bacterium for the trade secrets encoded in its DNA? Scientists are developing fail-safes for such contingencies.

In 2009 Brian Caliando, a bioengineer then at the University of California, San Francisco, began working on a way to ensure that a genetically modified organism's engineered DNA could be destroyed before a bug could escape or be stolen. He had recently read about CRISPR, a newly discovered defense tactic bacteria use to cut up and destroy DNA from invading viruses, and realized that he could use it like a built-in kill switch for genetically modified bacteria.

Caliando, under Christopher Voigt, first at U.C.S.F. and then at the Massachusetts Institute of Technology, developed DNAi, a CRISPR-based system that compels bacteria to chop up their own modified DNA. Using CRISPR, Caliando programmed plasmids—tiny circles of autonomously replicating DNA—to code for the RNA bases and enzymes that form the kill switch. He then inserted those plasmids into genetically modified E. coli, where they boot up and infect the bacteria with their deadly program. Adding a sugar called arabinose to the vat throws the kill switch, and the DNAi device begins slicing up the bacteria's genetically modified DNA.

Caliando's work, published in Nature Communications this year, is a proof of concept. The same principles could be adapted to fit a variety of organisms and conditions. For example, he says, DNAi could prevent genetically modified organisms from cross-pollinating nearby fields.