A team in Germany found secretions from the insects have antibacterial, antifungal and nematode killing properties.
Results also revealed a substance not previously known in insects.
The scientists suggest earwig secretions are multifunctional, serving both to deter predators and to stay safe from illness.
The findings are published in the Journal of Insect Physiology.
Earwigs are known to defend themselves from predators using large pincer-like structures on their abdomens called cerci and by emitting a defensive fluid.
However, little is known about the chemical properties of this secretion.
“There have only been two studies [on earwig secretions] since the 1960s: one regarding the chemistry of the secretion and one regarding behaviour,” said Tina Gasch, lead author from the Justus Liebig University Giessen, Germany.
“Since then not much has been done even though they are a really interesting insect Order.”
There are approximately 2,000 species of earwigs. They are known as subsocial insects because they display maternal care: a behaviour rarely found in insects.
Ms Gasch explained that certain aspects of earwigs’ lifestyles put them at high risk of infection from pathogens – microscopic organisms that can cause illness – and parasites.
“Earwigs spend a huge amount of time underground. During this period there’s lots of threats with bacteria, nematodes and things like that,” she said.
“Also, earwigs like to aggregate and it is known that in aggregations of insects, infectious diseases spread more easily because they are very close together and they sometimes groom each other.”
Ms Gasch explained that she thought earwigs would “need protection” against these types of microorganisms.
To test this theory, she worked with colleagues to investigate the glandular sacs containing the defensive fluid in frozen adult specimens of three different species of earwig: Forficula auricularia, Apterygida mediaand Chelidurella guentheri.
They then introduced the fluid extracted from these sacs into cultures of common microorganisms found in soil and other areas earwigs are found.
“It was really exciting. We found the secretions were really effective against bacteria, nematodes and fungi,” Ms Gasch told BBC Nature.
All three studied species’ secretions showed antibacterial and antifungal activity and the secretions from F. auricularia also killed parasitic worms known as nematodes.
The team also analysed the defensive fluids to determine the chemical compounds within them using a technique called gas chromatography-mass spectrometry (GC-MS).
“The species differ in their secretions and we also found a new substance that hasn’t been detected before in insects,” said Ms Gasch.
But what the PhD student found particularly surprising was the fact that a “fine sort of mist” was continuously present in the air space around the earwigs.
“It’s like a cloud surrounding them and protecting them against microorganisms,” she said.
According to Ms Gasch, this is the first experiment of its kind looking at the chemical properties of earwig secretions and she believes there remains more to discover.
“Earwigs have been neglected for 60 years. They are really abundant and there is much more to learn about their ecology,” she added.