"The Prime Minister ended the call when it became clear it was a hoax," a spokeswoman for Cameron's office, 10 Downing Street, said in a statement about the calls on Sunday.
"In neither instance was sensitive information disclosed. Both GCHQ and Number 10 take security seriously and both are currently reviewing procedures following these hoax calls to ensure that the government learns any lessons from this incident."
The Sun reported that the unnamed man, who it described as being well-spoken and in his 20s, had called GCHQ in the early hours of Sunday pretending to be a Downing Street aide and saying Hannigan was required to attend an emergency meeting.
Read MoreNo need to beef up security after Paris: Obama
He was then given Hannigan's private mobile number. Hours later he called Cameron on an official mobile claiming he was the GCHQ chief.
"I've just made complete monkeys out of GCHQ," the hoaxer told the Sun in a phone call afterwards.
"What's more I am off my face on booze and cocaine. I had some spliffs too. I've been up all night. I'm utterly wasted. Hilarious."
On its website, GCHQ states: "The nature of GCHQ's business means that we will not usually connect external calls unless the caller has a name or telephone extension to provide to the operator."
Cameron's spokeswoman said all government departments had been put on alert for further hoax calls.
The incident is not the first time that a hoax caller had been able to get through to the phone of a British premier.
In 1998, an impressionist pretending to be the former Conservative Party leader William Hague, was put through to then Prime Minister Tony Blair.
Blair saw through the hoax immediately, laughing along as the hoaxer offered to lend him an exercise video he had found in a sale.