The integrity of social insect colonies is maintained by members recognising and responding to the chemical cues present on the cuticle of any intruder. Nevertheless, myrmecophiles use chemical mimicry to gain access to these nests, and their mimetic signals may be acquired through biosynthesis or through contact with the hosts or their nest material. The cuticular hydrocarbon profile of the myrmecophilous salticid spider Cosmophasis bitaeniata closely resembles that of its host ant Oecophylla smaragdina. Here, we show that the chemical resemblance of the spider does not arise through physical contact with the adult ants, but instead the spider acquires the cuticular hydrocarbons by eating the ant larvae. More significantly, we show that the variation in the cuticular hydrocarbon profiles of the spider depends upon the colony of origin of the ant larvae prey, rather than the parentage of the spider.