In a disturbing trend, scam artists are using commercially sold fake urine to fool doctors into prescribing pain medications such as hydrocodone—which can then be consumed or illegally sold. The synthetic pee lets patients pass tests intended to ensure they are not already taking opioid medications or drugs of abuse. Patrick Kyle, director of clinical chemistry and toxicology at the University of Mississippi Medical Center, says that “packaging materials and containers for some of these products are being left in the restrooms” at his hospital.

Hoping to address the situation, Kyle and his pathologist colleague Jaswinder Kaur have now shown how legal indulgences—including chocolate, coffee and cigarettes—can help distinguish real pee from fake.

Past approaches to spotting fake specimens have included testing urine’s acidity and density and assessing concentration of a metabolic waste substance called creatinine. But some synthetic products now pass these evaluations, Kyle says.

The new method, described at the annual Society of Forensic Toxicologists (SOFT) meeting last October in Minneapolis, looks for four substances common in urine: caffeine and theobromine, both found in chocolate, tea and coffee; cotinine, produced as nicotine breaks down; and urobilin—degraded hemoglobin that gives urine its yellow color. The technique employs liquid chromatography to separate urine, just as water spilled on paper separates ink into different colors. The compounds then flow into mass spectrometers that identify them by their molecular weights.

The scientists studied the various substances in four different groups. One group of 100 urine samples came from people who had been observed providing them. A second set of 100 came from individuals seeking pain medication, who were not observed. A third came from 200 unobserved job applicants. And the final group consisted of 10 samples of commercially available synthetic urine. All samples provided by observed individuals were positive for at least one of the four test substances; three from the pain medication group and two from the job applicants lacked them. No synthetic urine samples contained any of the four substances. Negative results do not prove criminal activity—but they can indicate attempted deception, Kyle says. In such cases, he adds, “the clinic or the business should simply collect another specimen from the individual.”

Michelle Peace of Virginia Commonwealth University, who is SOFT’s president and was not involved in the study, notes that the test will not detect people passing off others’ pee as their own. “If someone is carrying synthetic urine or somebody else’s clean urine, you have to do observed collection,” she says. Peace also warns that fake urine makers could easily add substances such as caffeine or theobromine to their products.

Some already do, Kyle says. He emphasizes that testing must therefore look for compounds naturally produced in our bodies (urobilin, in this case). Combining that with commonly consumed substances makes the test even more powerful—and is potentially more practical than watching people pee.