The invention relates to a cosmetic composition which, in a cosmetically acceptable medium, includes: 9i) one or more compounds chosen from ellagic acid, the ethers thereof, the salts of ellagic acid and ethers thereof, and the mixtures of same, and (ii) one or more essential oils, (iii) one or more foaming agents. The invention likewise relates to a cosmetic treatment method implementing such a composition and to the use of said composition for washing and/or anti-dandruff treatment of keratin fibers.