How to Use ExifTool: Read and Strip Metadata (2026)

Penetration Testing
14 min read
How to Use ExifTool: Read and Strip Metadata (2026)
On this page
  1. What Is ExifTool?
  2. Installing ExifTool
  3. Reading Metadata: The Commands Worth Memorizing
  4. GPS, Serial Numbers and What Metadata Gives Away
  5. Batch Extraction Across a Directory
  6. Stripping Metadata Before You Publish
  7. ExifTool in CTF Forensics
  8. When ExifTool Was the Vulnerability
  9. Legal and Ethical Considerations
    1. Where This Is Fair Game
  10. Frequently Asked Questions
  11. Your Next Steps

Every photo, PDF and Word document you have ever saved is carrying a second file inside it. Camera serial numbers, GPS coordinates accurate to a few meters, the username of whoever hit save, the exact software build that produced it. Learning how to use ExifTool is how you read that hidden layer, and it takes about four commands to become genuinely useful with it.

ExifTool is the tool investigators, forensic analysts and CTF players reach for first when a file lands in front of them, and it is a staple of any serious penetration testing workflow. This guide covers reading metadata, hunting the tags that matter, batch extraction across a directory, and the part most articles skip: removing metadata correctly before you publish something. The EXIF and metadata chapter of our steganography course walks through the same tags with files you can pull apart yourself.

TL;DR: ExifTool is a free command-line metadata reader and writer by Phil Harvey, currently at version 13.59. Install it on Kali with sudo apt install libimage-exiftool-perl, then run exiftool file.jpg to dump everything. Use -G -s for readable grouped output, -r -csv for whole directories, and -all= to strip metadata. Remember that writing creates a _original backup unless you pass -overwrite_original.

What Is ExifTool?

ExifTool is a free, open source command-line application and Perl library for reading, writing and editing metadata in almost any file type. It was written and is still maintained by Phil Harvey, and version 13.59 shipped on 27 May 2026. It reads EXIF, GPS, IPTC, XMP, JFIF, GeoTIFF, ICC Profile, Photoshop IRB, FlashPix, ID3 and more, plus the proprietary maker notes that Apple, Canon, DJI, GoPro, Nikon, Sony and two dozen other manufacturers bury in their own files.

That last part is what separates it from every online EXIF viewer. Those tools parse the standard tags and stop. ExifTool knows that a DJI drone writes flight altitude and gimbal angle into a private block, and that an iPhone stores a burst identifier that links photos taken seconds apart.

The name undersells it. EXIF is one metadata standard among many, and most of what ExifTool finds in a PDF or a DOCX is not EXIF at all. Treat it as a universal metadata reader that happens to be named after its first job.

My honest take: do not bother with the GUI wrappers. They expose a fraction of the functionality, and the command line is four flags deep at most for everything in this guide.

Installing ExifTool

On Kali, Parrot and any Debian-derived system, the package is named after the Perl library rather than the binary, which trips people up:

sudo apt update && sudo apt install libimage-exiftool-perl

Kali currently ships 13.55, close enough to upstream for anything you will do with it. The binary installed is exiftool, not libimage-exiftool-perl, so apt search exiftool returning a package name that looks wrong is expected.

On macOS, Homebrew handles it in one line, and there is an official .pkg installer on the project site if you prefer:

brew install exiftool

Windows users get a standalone executable from exiftool.org that needs no Perl installation. Download the 64-bit zip, extract it, and rename exiftool(-k).exe to exiftool.exe so it runs from a terminal instead of pausing for a keypress. That rename step is in the readme and everyone misses it.

Confirm the install and check what you actually got:

exiftool -ver
💻
Practice this now: Stego Hunt - a PNG with a flag hidden in it, where reading the metadata is the intended first move. Browser-based, no VM to build.

Reading Metadata: The Commands Worth Memorizing

The bare command dumps every tag ExifTool can find, formatted for humans:

exiftool photo.jpg

On a modern smartphone photo that is 150 lines or more, which is unreadable. Three flags fix it. -G prefixes each tag with its group, -s switches to short tag names that you can copy straight back into another command, and -a shows duplicate tags instead of hiding them:

exiftool -G -s -a photo.jpg

Output looks like this, with the group in brackets:

[File]          FileType                        : JPEG
[EXIF]          Make                            : Apple
[EXIF]          Model                           : iPhone 14 Pro
[EXIF]          DateTimeOriginal                : 2026:03:14 09:22:41
[GPS]           GPSLatitude                     : 38 deg 43' 15.62" N
[GPS]           GPSLongitude                    : 9 deg 8' 22.10" W

To pull one tag rather than all of them, name it with a leading dash. Tag names are not case sensitive, which saves a lot of guessing:

exiftool -GPSPosition -Model -DateTimeOriginal photo.jpg

Two more flags earn their place. -u extracts unknown tags, meaning fields ExifTool recognizes the structure of but has no name for, and -ee pulls metadata out of files embedded inside other files. Combined, they are how you find the things somebody assumed nobody would look for:

exiftool -a -u -g1 suspicious.jpg

In practice that command is the one I run on any file that seems interesting. The -g1 grouping puts related tags together, so an oddity in a private maker note block stands out instead of scrolling past in an alphabetical wall.

GPS, Serial Numbers and What Metadata Gives Away

Metadata leaks are not theoretical, and the classic case is worth knowing because it took minutes rather than months to unravel. In December 2012, Vice published a photo of fugitive John McAfee taken on an iPhone 4S. The GPS coordinates in the EXIF data placed him at a marina in Guatemala, and he admitted the location was genuine the following day. Nobody hacked anything. Someone downloaded the image and read the tags.

These are the fields that carry weight in an investigation:

  • GPSLatitude, GPSLongitude, GPSPosition. Composite coordinates, often accurate enough to name a building. -c "%.6f" reformats them into decimal degrees you can paste into a map.
  • SerialNumber and LensSerialNumber. These tie separate photos to one physical camera body, which is how anonymous image sets get linked together.
  • DateTimeOriginal versus FileModifyDate. The first is when the shutter fired, the second when the file was last written. A gap between them usually just means the file was edited. A DateTimeOriginal that is later than the file date is a sign of tampering.
  • Author, Creator and Producer. In PDFs and Office documents these routinely hold an internal username matching the corporate account format, which feeds straight into an email guess.
  • Software. The exact application and version that wrote the file. On a document from a target organization, that is a free look at their software estate.

Documents are the underrated target here. A PDF exported from a workstation frequently records the full local file path it was saved from, which hands you a username, a directory layout and sometimes a network share name in a single line. Our roundup of free OSINT tools puts this stage in the wider reconnaissance sequence.

exiftool -Author -Creator -Producer -Company -Title report.pdf

One caution on GPS accuracy: coordinates are recorded by the device, not verified by it. A phone with a weak fix indoors can be off by a hundred meters or write coordinates from a previous location entirely. Treat GPS metadata as a strong lead, never as proof on its own.

Batch Extraction Across a Directory

One file is a warm-up. The real value shows when you point ExifTool at a folder of a few hundred images pulled from a target site and ask a question of the whole set.

Recurse through subdirectories with -r, and export to CSV so you can sort and filter in a spreadsheet:

exiftool -r -csv -GPSPosition -Model -DateTimeOriginal -Author ./downloads > metadata.csv

The -common shortcut grabs a sensible default tag set when you do not yet know what you are looking for:

exiftool -common -csv ./downloads > overview.csv

JSON output works the same way and is easier to pipe into a script:

exiftool -r -json ./downloads > metadata.json

The flag that turns this from a dump into an actual investigation is -if, which filters files by a condition before processing them. Show only the images that carry GPS data:

exiftool -r -if '$GPSLatitude' -GPSPosition -FileName ./downloads

On a set of 400 press images from a company website, that command usually returns three or four files, and those are the ones worth looking at. Everything else went through a CMS that stripped the tags on upload. Working the other way around, filtering by camera model or by date range narrows a large set to the photos taken on one device or during one week.

Restrict processing by file type with -ext when a folder holds a mix of formats:

exiftool -r -ext jpg -ext png -GPSPosition ./downloads

Stripping Metadata Before You Publish

The defensive half of this tool matters just as much, and this is where the sharp edges are. Removing all metadata is one flag:

exiftool -all= document.pdf

Read that carefully. The syntax is a tag assignment with nothing on the right-hand side, so -all= means "set all tags to empty". Miss the equals sign and you have asked to read the tags instead of deleting them, which is a quiet failure rather than an error.

Three details decide whether this actually worked:

  • ExifTool keeps your original. By default it renames the untouched file to document.pdf_original and writes the cleaned version in its place. Publish the wrong one and you have shipped the file you meant to sanitize. Add -overwrite_original once you trust the command, or clean up afterwards with -delete_original.
  • The file date is a tag too. Adding -P preserves the filesystem modification time, which you may or may not want. Without it, the write updates the timestamp.
  • Verify, do not assume. Run the read command again on the output. A file can still carry an ICC profile or an XMP packet that a partial delete left behind.

Selective removal is often the better call. Stripping every tag from a professional photo destroys the copyright and color profile information the photographer wants kept. Delete only the location data instead:

exiftool -gps:all= photo.jpg

Or delete everything except one group you want to preserve, using the double-dash exclusion syntax:

exiftool -all= --icc_profile:all photo.jpg

To clean an entire directory tree in one pass, with backups suppressed and file dates preserved:

exiftool -r -all= -overwrite_original -P ./to-publish

A warning worth taking seriously: run that command on a directory you did not mean to touch and there is no undo, because -overwrite_original is exactly what it says. Test it on a copy first. Every time.

💻
Practice this now: Pixel Puzzler - a PNG hiding a flag below the surface, where metadata analysis is step one and bit-level inspection is step two.

ExifTool in CTF Forensics

In CTF forensics challenges, ExifTool is the second command you type after file. Flags get parked in a Comment field, a UserComment, an Artist tag or a custom XMP property often enough that skipping this step wastes an hour.

The workflow that resolves most image challenges is short:

  1. Identify the real file type. file challenge.png compares magic bytes against the extension. A mismatch is a finding by itself.
  2. Read every tag, including the odd ones. exiftool -a -u -g1 challenge.png surfaces duplicates and unknown fields that plain exiftool hides.
  3. Extract anything binary you find. exiftool -b -ThumbnailImage challenge.jpg > thumb.jpg pulls the embedded preview out. Edited photos sometimes keep an unedited thumbnail, which is its own category of leak.
  4. Move to the file structure. If the metadata is clean, binwalk and strings are next, then bit-plane analysis.

Step three deserves more attention than it gets. A JPEG thumbnail is generated once and not always regenerated after an edit, so the small preview can show what the full image was cropped or blurred to hide. That has burned real people, not just CTF players.

When the metadata comes back clean, that silence is information too. It means the payload is somewhere else in the file, and our steganography detection guide picks up the trail from there.

When ExifTool Was the Vulnerability

Parsing untrusted files is dangerous work, and ExifTool has been on the wrong end of it. CVE-2021-22204 was a flaw in the DjVu file handling that allowed arbitrary code execution when the tool parsed a crafted image. It affected versions 7.44 through 12.23, was fixed in 12.24, and NIST scored it 7.8 High. It sits in CISA's Known Exploited Vulnerabilities catalog, meaning it was used in real attacks rather than only demonstrated in a lab.

Two practical consequences follow from that.

Keep your install current, especially if ExifTool runs automatically on files users upload. A large number of web applications call it server-side to generate thumbnails or read image dimensions, and a five-year-old version in a container image is a real exposure.

Analyze genuinely suspicious files in an isolated virtual machine with no network access. This holds for any parser, not just this one. The reflex to run a tool on a sample the moment it arrives is the reflex worth breaking.

The security notes on the project site list the earlier issues as well. Phil Harvey's handling of them has been prompt and public, which is more than can be said for a lot of tooling in this space.

Critical reminder: Always get explicit written authorization before testing any system. Reading metadata from a file you downloaded is passive, but what you do with the location of a private individual is not a technical question, and it can carry criminal liability.

Metadata analysis sits in a gentler legal position than most offensive techniques, because reading a file you already possess touches nobody else's system. The risk moves from computer misuse law to privacy and data protection law, and that shift catches people out.

Where This Is Fair Game

  • Files from your own devices, and files a client has provided as part of a signed engagement
  • Documents published on a target's own website when an OSINT scope covers them in writing
  • CTF challenges and purpose-built training environments
  • Sanitising your own output before you publish it, which is the most useful application here

The line that matters: geolocating a private person from a photo they posted, and acting on that location, is stalking regardless of how public the photo was. An authorised OSINT engagement documents its targets and its boundaries before the first command runs. If your scope does not name it, it is not in scope.

Frequently Asked Questions

What is ExifTool used for?

Reading, writing and deleting metadata in image, video, audio and document files. Photographers use it to batch-edit copyright and caption tags, forensic analysts use it to establish when and where a file was created, OSINT investigators use it to extract GPS coordinates and author names, and CTF players use it to find flags hidden in tag fields.

How do I install ExifTool on Kali Linux?

Run sudo apt update && sudo apt install libimage-exiftool-perl. The package is named after the Perl library, but it installs the exiftool command. Kali currently ships version 13.55. Confirm the install with exiftool -ver.

How do I remove all metadata with ExifTool?

Run exiftool -all= file.jpg. The equals sign with nothing after it assigns an empty value to every tag. ExifTool saves the untouched file as file.jpg_original unless you add -overwrite_original. Verify the result by reading the cleaned file again.

Is ExifTool safe to use?

It is a widely trusted open source tool, but it parses untrusted input, which carries risk. CVE-2021-22204 allowed code execution through a crafted DjVu file in versions 7.44 to 12.23 and appears in CISA's Known Exploited Vulnerabilities catalog. Keep it updated, and analyze suspicious samples inside an isolated virtual machine.

What is the difference between EXIF data and metadata?

EXIF is one metadata standard, designed for camera images, covering exposure settings, timestamps and GPS. Metadata is the broader category and includes IPTC, XMP, ICC profiles, ID3 audio tags and document properties. ExifTool reads all of them despite the name.

Does uploading a photo to social media remove its metadata?

Most large platforms strip EXIF on upload, but do not rely on it. Behavior varies by platform, by upload method and by file type, direct messages and file attachments often bypass the processing entirely, and the platform still keeps the original. Strip metadata yourself before uploading if it matters.

Your Next Steps

Knowing how to use ExifTool comes down to four commands you will type for years: exiftool -G -s -a file to read a single file properly, exiftool -r -if '$GPSLatitude' -GPSPosition dir to find the interesting files in a large set, exiftool -b -ThumbnailImage file > thumb.jpg to recover an embedded preview, and exiftool -all= -overwrite_original file to clean your own output. Everything past that is in the official documentation, which is dense but complete.

Reading tag names in a guide is not the same as finding one that matters. Pull apart a real file in the Stego Hunt lab, then build the surrounding investigative method with the OSINT for Hackers course. Both run in the browser on HackerDNA's free tier, no credit card and no local setup needed.

HackerDNA Team

HackerDNA Team

Written by the HackerDNA team - cybersecurity professionals building hands-on hacking labs and educational content to help you develop real-world security skills.

Meet the Team

Ready to put this into practice?

Stop reading, start hacking. Get hands-on experience with 170+ real-world cybersecurity labs.

Start Hacking Free
21,000+ Hackers 100+ Labs & Courses Free
Start Hacking Free