If a farmer can grow it, a brown marmorated stinkbug can destroy it. This invasive scourge has ravaged apples, peaches, tomatoes and more than 100 other crops across North America. Once farmers notice an infestation, they are nearly powerless to halt it. But there is hope: Borrowing techniques from aquatic science, researchers have discovered a genetic beacon that could raise the alarm in the earliest stages of an invasion—when there is still time to act.

The scientists found traces of brown marmorated stink bug DNA in the water farmers used to rinse their produce, they report in a study, published in June in Frontiers in Ecology and the Environment. This sampling of “environmental DNA” revealed the bugs’ cryptic presence on farms well before traditional insect trapping techniques could do so.

Native to eastern Asia, the brown marmorated stinkbug (so-named for its streaky, marblelike patterning) first arrived in North America in the late 1990s and has since made its home in more than 40 U.S. states. This pest is uniquely devilish, swarming people’s homes in winter—often by the thousands—and devouring farmers’ cash crops in summer. In 2010 the bugs consumed apples worth some $37 million alone. And these dime-size menaces are far from picky eaters. “If we like to eat it, they like to eat it,” says Anne Nielsen, an agricultural scientist at Rutgers University who has researched the stinkbugs for 15 years and co-authored the study. These intruders assail all manner of crops, from tree fruits to leafy vegetables. They can swarm farms in numbers that render insecticides ineffective. The interlopers caused a total loss of the Maryland peach harvest in 2012, according to Rafael Valentin, the study’s lead author and a postdoctoral researcher at Rutgers.

The key to stopping an invasion is early detection, when targeted management is still feasible, Valentin says. But traditional insect monitoring, which uses traps laced with stinkbug pheromones, often captures the bugs only after populations grow large enough to inflict damage, he notes. So his team got creative, adapting methods used by aquatic scientists to detect potentially invasive species in lakes and streams.

Compounds in water can mix quickly, as evidenced by squirting food coloring into a bowl of clear water. Researchers have exploited this phenomenon to search for invasive species like Asian carp in the Great Lakes region. The carp excrete plenty of DNA into the water via poop, oils and lost scales. Thanks to mixing, scientists can sample for carp DNA anywhere in a lake and determine if the fish are present, even in small numbers. But there is a sticking point when applying this method to insects on land. “Once the DNA is shed, it stays in place,” says Dina Fonseca, a molecular ecologist and part of the Rutgers research team. Investigators would miss the presence of brown marmorated stinkbugs on a farm unless they sampled the specific part of a fruit where a bug has shed its genetic material. But the farmers’ own chain of operations offered a solution. “The breakthrough was realizing that farmers normally wash their crops before sending them to market,” Fonseca says. “We can simply sample the water,” which would aggregate DNA from all surfaces of the rinsed produce, she adds.

The researchers tested their idea on two farms: a peach orchard in New Jersey known to harbor the stinkbugs and a mixed-produce farm in New Hampshire just outside the invaders’ recognized range. At each location the scientists sampled two liters of the farmers’ rinse water. They also set black light and pheromone-baited traps to physically capture the bugs.

As expected, the team detected brown marmorated stinkbug DNA in all water samples from the New Jersey orchard. Curiously, they also found the pest’s genetic material in rinse water from the New Hampshire farm on all eight days they sampled there. On the final day of testing a tiny immature stinkbug wandered into the pheromone trap, visually confirming the group’s positive DNA identification. “That was a really nice result,” Fonseca says. “It was like, ‘Okay, we’re not imagining this.’ They are here.”

Fonseca says she always expected her team’s environmental DNA approach to succeed. Still, she was surprised by how sensitive the tests were to apparently small numbers of stinkbugs on the New Hampshire farm. She and her colleagues claim in the study their new method could “revolutionize agricultural pest surveillance.”

Other experts are less sanguine about the promise of environmental DNA for quelling the stinkbug plague. Thomas Kuhar, a professor of entomology at Virginia Polytechnic Institute who was not involved in the study, says environmental DNA represents a creative approach to insect surveillance. But, he says, “I don’t know if that’s going to change the face of how we deal with this [pest].” Traditional detection techniques are cheaper and better at estimating pest abundance, instead of just presence or absence, according to Kuhar. He notes environmental DNA could be useful in regions like New Zealand that do not currently harbor brown marmorated stinkbugs but are at risk of invasion. Despite the environmental approach’s limitations, some farmers welcome it.

This advance in early detection of pests is “huge” for producers, says John Maccherone, a fourth-generation peach and plum grower who runs Circle M farms in New Jersey. He believes this technology could lend farmers the upper hand in a long-standing battle. “Even though we’re in an old industry, and some of the stuff has been done the same for thousands of years,” he says, “there’s always an invasive pest knocking on our door.”

Fonseca is already working on environmental DNA techniques to detect other invasive insects, including the emerald ash borer and the spotted lantern fly. She believes this method could even help prevent the accidental introduction of new exotic species, which often arrive as stowaways in cargo shipments. Fonseca plans to partner with the U.S. Department of Agriculture to “vacuum” incoming cargo ships to detect potential fugitive pests. “We’re having a tremendous number of introductions of new species,” she notes. “We should try and prevent them from occurring completely.”