We already know what MDMA (aka ecstasy) does to your brain, but just how far-reaching are the physiological effects of taking the drug? You might be surprised.

New research has shown for the first time that hair samples taken from ecstasy users can indicate stress levels caused by the drug, even months later. "Cortisol is a stress hormone that we all produce in our bodies and interestingly it is deposited in our hair. Looking at cortisol in hair is a way for us to see how stressed we've been in the past," said lead researcher Luke Downey from Swinburne University of Technology in Australia.

Measuring cortisol levels through saliva samples is already an established way of detecting somebody's stress levels, but the test needs to be taken pretty much in the moment to detect the extent of stress.

By contrast, the hair sampling technique enables retrospective measuring of stress during MDMA use, with cortisol levels effectively recorded in the hair growing when the drug was taken (provided the individual in question hasn't succumbed to the temptations of a buzzcut in the interim).

"Hair grows 1 centimetre per month," said Downey. "We took 3 centimetres of hair from the scalp of non-ecstasy users (control group), light ecstasy users and heavy ecstasy users to assess the level of stress on their bodies over a three month period."

Among the 101 volunteers who took part in the study, 27 were light users (having only taken ecstasy one to four times in the previous three months), 23 were heavy users (five or more times in the same period) and 51 did not use the drug.

Looking at hair samples, the researchers found that the cortisol levels of light ecstasy users were 50 percent higher than the control group, and heavy users showed cortisol levels that were four times higher than light users – indicating significantly raised stress levels.

Perhaps more alarmingly for ecstasy users is the fact that the researchers also tested participants' memory performance, and found that ecstasy users fared worse in word recall tests and also reported significantly more retrospective and prospective memory problems.

However, the extent to which ecstasy users' memories were impaired did not correlate with the cortisol levels detected in their hair samples, indicating no real link between cortisol spikes and the cognitive deficits that ecstasy use brings about.

"Interestingly, no significant relationship between the memory deficits and levels of stress (indexed by the amount of cortisol) emerged," said Downey. "This increased experience of stress appears not to be the mechanism that produces the memory deficit."

The findings are published in Human Psychopharmacology.

Update 19 October: We'd previously said that measuring cortisol through saliva samples was an established method of testing for ecstasy use. That was incorrect - it's only a way to measure someone's cortisol levels, and therefore their stress levels.

Swinburne University of Technology is a sponsor of ScienceAlert. Find out more about their research.