Metadata is an important part of managing data. It allows us to know information about the data, such as who made it, when it was made, and, sometimes, where it was made.

Normally, this data is very helpful to us, and it allow us to manage our files even better, by embedding comments and copyright information into a file. However, sometimes this metadata can be harmful to your privacy.

An example of harmful metadata today is the EXIF data that is embedded into every single photo you take with your smart phone. If you haven’t disabled geotagging on your phone, that EXIF data contains information about where you are. And sometimes, that EXIF data can even tell who you are (author metadata). In addition to that, EXIF data also can store what device you took a photo on, by recording your device’s serial number.

This means that even if you take a device with a camera that you’ve never connected to the internet, your photos can still be tracked back to you via your camera’s serial number. Scary huh?

So what should you do?

Enter photoanon

photoanon is a metadata anonymization tool created in Python using gexiv2. It removes dangerous EXIF data tags that could compromise your identity or location.

Let’s look at what photoanon can tell us about a photo.

$ photoanon --info test-image.jpg
Geotagging data in /home/cam/Dev/photoanon/test-image.jpg
{   'Altitude': 230.0,
    'Latitude': 28.476610166666667,
    'Longitude': -81.46878813888888,
    'Time': 1430005430}

============================================================
Bad tags in /home/cam/Dev/photoanon/test-image.jpg:
Exif.Image.Make
Exif.Image.Model
Exif.Image.Software
Exif.Photo.ImageUniqueID
Exif.Photo.MakerNote
Exif.Photo.UserComment

Yikes!

Just from a simple camera photo, you can figure out where exactly a photo was taken, and as well as the time it was taken. This means that bad guys (robbers) could figure out that you take photos of Latte’s at your local coffee shot every Wednesday at 5:00 PM, and rob your house while you’re gone.

Metadata Anonymization

How can you prevent bad guys from knowing you’re consuming coffee at the shop? Well, it’s pretty simple with photoanon.

Look at some usage:

$ photoanon image1.jpg
Removed bad EXIF tags from /home/cam/Dev/photoanon/image1.jpg
Wrote fake geodata to /home/cam/Dev/photoanon/image1.jpg

Pretty simple right? photoanon can be as simple and easy, or as complex and powerful as you want it to be.

Checking All EXIF Data in an Image

For example, if you wanted to verify you scrubbed all dangerous EXIF metadata in an image, you could run:

$ photoanon --verbose --info my-image.jpg
Important data in /home/cam/Dev/photoanon/my-image.jpg
{   'Altitude': 2054.413438,
    'Latitude': -10.66146817611111,
    'Longitude': 75.29224864222222,
    'Time': 50529025}
============================================================
Bad tags in /home/cam/Dev/photoanon/my-image.jpg:
None found
============================================================
Full list of EXIF tags in /home/cam/Dev/photoanon/my-image.jpg:
Exif.GPSInfo.GPSAltitude: 2054413438/1000000
Exif.GPSInfo.GPSAltitudeRef: 0
Exif.GPSInfo.GPSLatitude: 10/1 39/1 41285434/1000000
Exif.GPSInfo.GPSLatitudeRef: S
...
# And a bunch more lines...
..
Exif.Thumbnail.XResolution: 72/1
Exif.Thumbnail.YResolution: 72/1
Adding Random Noise to Images

Not only can you be linked to your images through EXIF data, but your camera lens’s noise signature can also give you away. photoanon can help you avoid this with the --noise flag.

$ photoanon --noise --preserve test3.jpg
Copying /home/cam/Dev/photoanon/test3.jpg to /home/cam/Dev/photoanon/test3-photoanon.jpg.
Deleted tag Exif.Image.Make
Deleted tag Exif.Image.Model
Deleted tag Exif.Image.Software
Deleted tag Exif.Photo.ImageUniqueID
Deleted tag Exif.Photo.MakerNote
Deleted tag Exif.Photo.UserComment
Removed bad EXIF tags from /home/cam/Dev/photoanon/test3-photoanon.jpg
{   'Altitude': 776.5098592632489,
    'Latitude': -128.60330932017348,
    'Longitude': -26.020946984883153,
    'Time': 316970799}
Wrote fake geodata to /home/cam/Dev/photoanon/test3-photoanon.jpg
Added random noise to /home/cam/Dev/photoanon/test3-photoanon.jpg

Note that in this example I also used the --preserve flag to make sure I keep a copy of the original file around. When using the --preserve flag, a new is created file such that if you had a photo called my-picture.jpg, then photoanon would create an anonymized copy called my-picture-photoanon.jpg.

#####Installing photoanon

Installation of photoanon is pretty simple.

On Ubuntu run the following commands:

$ sudo apt-get install python3-scipy python3-numpy gir1.2-gexiv2-0.10 libexiv2-dev -y
$ git clone https://github.com/camconn/photoanon.git
$ cd photoanon
$ sudo ./setup.py install

And you’re done! These installation instructions will vary platform to platform.

#####Additional Information

For more information about running photoanon run photoanon --help.

Inspiration

photoanon is inspired by MAT. It goes beyond what MAT does by having deep support for images and having a default EXIF whitelist and blacklist.

Another inspiration for this project is Cory Doctorow’s novel Little Brother, which is an excellent read.

Source

You can check out the photoanon source on Github.

This project is licensed under the GNU Public License, Version 3 or Later.