From his bedroom in the family home in York, Mangham managed to breach a Facebook webserver, the Facebook account of a company employee - which he then misused to access the company's Mailman server - and the Phabricator server used by Facebook's developers.
When Facebook discovered the compromise, they believed they had a cyber spy on their hands as Mangham had exfiltrated valuable source code. They contacted the FBI, and after the agency pinpointed the provenience of the attack, they contacted British law enforcement, which effected a raid on Mangham's home and arrested the youth.
Mangham has admitted his involvement in the matter, but argued that he did it all that he could point out the vulnerabilities to the Facebook security team and, hopefully, be thanked and maybe even remunerated for his efforts - as he had been in a previous case by Yahoo.
Facebook, who had to spend over $200,000 in order to deal with the effects of the breach, didn't look at it that way.
According to the Daily Mail, the defense insisted that Mangham's actions were those of an "ethical" hacker, and asked the court to show leniency because Mangham suffers from Asperger's Syndrome, but the prosecutor pointed out that he attempted to hide his tracks following the breach, which means he knew what he was doing was wrong.
"He acted with determination and undoubted ingenuity and it was sophisticated, it was calculating," said the prosecuting counsel. The judge obviously agreed with him.
"This was not just a bit of harmless experimentation - you accessed the very heart of the system of an international business of massive size. This was not just fiddling about in the business records of some tiny business of no great importance and you acquired a great deal of sensitive and confidential information to which you were simply not entitled," he commented when passing the sentence.
"Potentially what you did could have been utterly disastrous to Facebook. You and others who attempt to hack really must understand how serious this is, the creation of that risk, the extent of that risk and the cost of putting things right mean at the end of it all I'm afraid a prison sentence is inevitable," he concluded.
Apart from the jail sentence, Mangham's Internet use will also be restricted for the next five years.
By subscribing to our early morning news update, you will receive a daily digest of the latest security news published on Help Net Security.
With over 500 issues so far, reading our newsletter every Monday morning will keep you up-to-date with security risks out there.