from attack by wasps. Even parasitoid wasps are vulnerable to hyperparasitoid wasps. Some parasitoid wasps change the behavior of the infected host, causing them to build a silk web around the pupae of the wasps after they emerge from its body to protect them from hyperparasitoids. Hosts can kill endoparasitoids by adhering hemocytes to the egg or larva in a process called encapsulation. In aphids, the presence of a particular species of γ-3 Pseudomonadota makes the aphid relatively immune to their parasitoid wasps by killing many of the eggs. As the parasitoid's survival depends on its ability to evade the host's immune response, some parasitoid wasps have developed the counterstrategy of laying more eggs in aphids that have the endosymbiont, so that at least one of them may hatch and parasitize the aphid. Certain caterpillars eat plants that are toxic to both themselves and the parasite to cure themselves. Drosophila melanogaster larvae also self-medicate with ethanol to treat parasitism. D. melanogaster females lay their eggs in food containing toxic amounts of alcohol if they detect parasitoid wasps nearby. The alcohol protects them from the wasps, at the cost of retarding their own growth. Evolution and taxonomy Evolution Based on genetic and fossil analysis, parasitoidism has evolved only once in the Hymenoptera, during the Permian, leading to a single clade, the Apocrita. All parasitoid wasps are descended from this lineage, except for the Orussoidea which are parasitic but lack the wasp waist. The Apocrita emerged during the Jurassic. The Aculeata, which includes bees, ants, and parasitoid spider wasps, evolved from within the Apocrita; it contains many families of parasitoids, though not the Ichneumonoidea, Cynipoidea, and Chalcidoidea. The Hymenoptera, Apocrita, and Aculeata are all clades, but since each of these contains non-parasitic species, the parasitoid wasps, formerly known as the Parasitica, do not form a clade on their own. The common ancestor in which parasitoidism evolved lived approximately 247 million years ago and was previously believed to be an ectoparasitoid wood wasp that fed on wood-boring beetle larvae. Species similar in lifestyle and morphology to this ancestor still exist in the Ichneumonoidea. However, recent molecular and morphological analysis suggests this ancestor was endophagous, meaning it fed from within its host. A significant radiation of species in the Hymenoptera occurred shortly after the evolution of parasitoidy in the order and is thought to have been a result of it. The evolution of a