The prank caller who was connected to David Cameron and obtained the mobile number of a senior spy has claimed he was "off his face" at the time and planned to do it again.
The prime minister ended the call to him when it became clear it was a hoax and no sensitive information was disclosed, Downing Street said.
'Hello, is that David Cameron? This is James Bond...'
The caller got Mr Hannigan's number by pretending to be a Downing Street aide and saying the director was late to a Cobra meeting and was not answering his "usual number".
The man reportedly telephoned The Sun to boast about his actions.
"I've just made complete monkeys out of GCHQ. I've got the mobile number of the director," he told the paper. "What's more, I am off my face on booze and cocaine."
He added: "I'm definitely going to do it again. It was so easy."
The paper reported the man was slurring and said in a south east accent: "I had some spliffs too. I’ve been up all night. I’m utterly wasted. Hilarious... What’s really funny is that GCHQ believed the word of someone so mashed they can hardly string a sentence together."
A Government spokeswoman said: "Following two hoax calls to Government departments, a notice has gone out to all departments to be on the alert for such calls.
"In the first instance, a call was made to GCHQ which resulted in the disclosure of a mobile phone number for the director.
"The mobile number provided is never used for calls involving classified information. In the second instance, a hoax caller claiming to be the GCHQ director was connected to the Prime Minister.
"The Prime Minister ended the call when it became clear it was a hoax. 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."
It is understood that the mobile number given out for Hannigan was for an unclassified phone rather than one of the secure lines used for sensitive communications.
The call to the Prime Minister was put through to Cameron but the conversation was understood to have been "quite brief" before the hoax was discovered.