Castoreum is an anal secretion beavers use to mark their territories. It also happens to smell like vanilla.

More specifically, the raw form is often described as "birch tar or Russian leather." But when diluted in alcohol (not the kind you drink), the substance picks up "more pleasant, musky and fruity nuances," according to Fragantica.

It's been used in both food and perfumes for years, according to National Geographic's Mollie Bloudoff-Indelicato, who dug up a paper from 2007 in the International Journal of Toxicology.

Castoreum comes from the beaver's castor sac, located between the pelvis and base of the tail. Because of its close proximity to the anal glands, the substance often contains anal secretions and urine. The compound is non-toxic.

The gland's butt-proximity doesn't stop Joanne Crawford, a wildlife ecologist at Southern Illinois University, from encouraging people to stick their noses under the animal's tail and take a whiff.

"People think I’m nuts," she told Nat Geo. "I tell them, 'Oh, but it's beavers; it smells really good.'"

The secretions contain about 24 different molecules, some of which act as beaver pheromones.

The U.S. Food and Drug Administration calls the beaver's goo a "generally safe" additive for food. For the past 80 years, food scientists have added it to products, often labeled only as "natural flavoring." Fernelli's Handbook Of Flavor Ingredients puts individual annual consumption of castoreum extract at only .000081 mg/kg/day, in products like frozen dairy, gelatins, puddings, and nonalcoholic beverages.

In 2011, the Vegetarian Resource Group wrote to five major companies that produce vanilla flavoring. The organization asked if these companies used castoreum. The answer: According to the Federal Code of Regulations, they can't. That's because the FDA highly regulates what goes into vanilla flavoring and extracts.

Castoreum extract can be used to enhance raspberry or strawberry flavorings, though. It has also been used as traditional medicine for centuries. The beaver population in Sweden was almost wiped out in the 19th century because of castoreum's popularity, according to Sweden's English newspaper, The Local.

You won't likely find castoreum in mass-marketed goods though. It's difficult and expensive to "milk" a beaver to get the fresh secretions. Dried castoreum sacs, harvested from dead beavers, are available for private use at Agro Laboratories.

And if you ever go beaver hunting ... they "can easily be removed with the help of a knife and your fingers [PDF]."A trapper in Northern Ontario says these beauties can sell for $40 to $60 each.