Facebook said rescinded a student's summer internship offer

His big break ended before it began when he took it too far for Facebook.

Facebook rescinded a student's summer internship offer after the candidate hacked a privacy loophole on the social media network, according to a report.

When Aran Khanna accepted an internship at Facebook this spring, he got interested in the company's "hacker culture" and started looking into the the social media site's Messenger app, according to Boston.com. Khanna published his findings in a case study in peer-reviewed academic journal Technology Science.

However, when the computer science and mathematics major took the experiment too far, his big break with Facebook ended before it began.

Messages sent in Messenger included users' location data by default if they have "location services" enabled on their mobile device. Using that data, Khanna created a browser extension called "Marauders' Map," a tool to "creepily stalk" your Facebook friends, according to his post on social blogging site Medium.

Basically, the app took advantage of a design flaw about which Facebook previously was aware, but did nothing about: the sharing of user locations with anyone they are chatting with.

Read More These internships pay more than 'real' jobs

The tool shows the current location on a map of anyone you message, and went viral nearly immediately after Khanna posted it, having been downloaded 85,000 times.

The social network, however, wasn't pleased. After three days, Facebook asked Khanna to disable the app, Boston.com reported. As the glare of the press shone brighter on the app and its flaws, the company asked Khanna not to talk to the press, then eventually cut him for violating company standards, Boston.com reported.

Facebook spokesman Matt Steinfeld said he was unable to comment on personnel issues, but told CNBC that the tool violated Facebook's terms of use.

"Despite being asked repeatedly to remove the code, the creator of this tool left it up," Steinfeld said. "This is wrong and it's inconsistent with how we think about serving our community."

Read More What I learned as Facebook's first intern

As of June 4, users have more power over how they share their data, according to a statement by Facebook that came days after Khanna released "Marauder's Map." But Steinfeld said Facebook started altering location settings months before.

"This is revisionist history that conveniently omits a few important points," Steinfeld said.

Khanna told Boston.com that the moral of his experiment was to publicly pressure for Facebook to be "responsible guardians of privacy"—adding that he never knew how much information he was unintentionally sharing until he looked at his messaging history.

Read More The best tech companies for internships

"It is possible that before my extension and blog post, the degree of location data collection and sharing by Facebook Messenger was hard for an average user to notice and thus did not raise significant concern," Khanna wrote. "My extension and blog post made the data collection and sharing practice real and transparent."

Read More Barclays analyst to interns: 'Welcome to the Jungle'

Khanna's papers was one of the first published by Technology Science, and editor Latanya Sweeney told CNBC that answering the privacy questions Khanna raised will "require many more studies than one paper."

Khanna could not be immediately reached for further comment. The full report can be found at Boston.com.