By looking at two weeks of chat data, he managed to work out a student’s weekly schedule at Stanford (pictured), which means he could predict which building he would leave on campus at a certain time – information that could prove dangerous in the wrong hands
‘You can now see the fun (and slightly creepy) things this data allows you to do,’ he added.
The map also aggregated location data from all the messages he sent, meaning that if a few people he chatted with colluded, they could track his movements throughout the day without him knowing.
While Mr Khanna uses Messenger ‘religiously’ with location sharing turned off, he said many people he’s talked to are surprised and appalled that so much of their personal data is online for friends and even strangers to access.
‘The main problem is that every time you open your phone and send a single message it’s so easy to forget about your location data being attached to it,’ he said.
While it may seem harmless to attach a location in one message, Mr Khanna warned that over time, the information from these messages adds up.
He said that his code allows people to see for themselves the potentially invasive usage of the information they share.
A Facebook spokesmen told MailOnline: ‘People share their location to better connect with their friends on Messenger.
‘We’ve been listening to people’s feedback and for the last few months have been working hard to improve this experience. We will be rolling out improvements very soon.
‘In the meantime, people can still choose to turn off location sharing at any time by tapping the blue arrow in the message composer.’
Facebook has a history of constantly updating its services and a future update may see this feature removed.
If default location tags are axed, it’s likely that old location data will be deleted too, but this has not been confirmed.