Sheet D-10 · Detector

Find credit card numbers in files (Luhn-checked)

A card number ends in a Luhn check digit, so a scan can reject random digits. How the check works, where card numbers hide in files, and what Nessus does.

54 checks on12 off, each with its reason
Updated16 Nov 2026
Sources12 cited
Reading time6 min
Applies toVellumSoft 2.0.2

A payment card number can be told apart from random digits because its last digit is a check digit, worked out from the others by the Luhn formula34. A credit card number scan therefore has two steps: find runs of digits of the right length, then keep only the ones whose check digit is right. VellumSoft treats payment cards as a Tier 1 detector, where a match must pass the validator.

What a card number is made of

The card industry calls the number the PAN, for primary account number. The PCI Security Standards Council defines it as the "Unique payment card number (credit, debit, or prepaid cards, etc.) that identifies the issuer and the cardholder account"1. The layout comes from an international standard, ISO/IEC 7812-1, which "specifies a numbering system for the identification of the card issuers, the format of the issuer identification number (IIN) and the primary account number (PAN)"2.

Length varies by card brand. Microsoft's detector for card numbers looks for 14 to 19 digits, "formatted or unformatted", which means spaces and hyphens between groups do not matter4.

How the Luhn check works

The Luhn formula is a way to compute one check digit from all the others. CMS, which uses it for provider numbers, describes it as "the Luhn formula for computing the modulus 10" check digit and notes that the algorithm "is recognized as an ISO standard"3. Its three steps, in CMS's words3:

  1. "Double the value of alternate digits beginning with the rightmost digit."
  2. Add the individual digits of those products to the digits that were not doubled.
  3. "Subtract the total obtained in step 2 from the next higher number ending in zero"3. The result is the check digit.

To test a number, a scanner runs the same sum over the whole number and sees whether the last digit agrees. A typing error in one digit breaks the agreement. So does an order number or a tracking code that only happens to be sixteen digits long, most of the time.

A check digit is still a single digit, so some random runs pass by luck. Microsoft's detector reflects that. It reports low confidence when only the pattern and checksum match, and high confidence when a keyword such as a card name or an expiry date sits nearby4.

Where card numbers hide in files

The FTC's advice is blunt: "Don't keep customer credit card information unless you have a business need for it"8. Card numbers stay anyway, in places nobody chose:

  • an email where a client typed a card number to pay an invoice, now inside a PST export
  • a signed card authorization form scanned to PDF
  • a CSV export from a booking or point-of-sale system
  • call notes saved as text files
  • a photo of the front of a card sent by phone.

Each of those is cardholder data in the card industry's terms. The council's glossary says "At a minimum, cardholder data consists of the full PAN"1.

The rules that cover a stored card number

Two kinds of rule apply. The first is the card industry's own standard, PCI DSS, which the council says applies to all entities that store, process or transmit cardholder data9. The council's Quick Reference Guide says "Cardholder data should not be stored unless it's necessary to meet the needs of the business", and that stored PAN must be rendered unreadable9. It also says sensitive authentication data, such as the security code printed on the card, must not be stored after authorization, "even if it is encrypted"9.

That guide covers version 3.2.1 of the standard9. The council said v4.0 would be retired on 31 December 2024, leaving v4.0.1 as the only active version, so check the wording and numbering in the current standard10.

The second kind is privacy law. Massachusetts, for one, defines personal information to include a resident's name together with a "credit or debit card number, with or without any required security code"12. A stray card number is a breach notification question as well as a card industry one.

Masking and truncation are two separate controls in the council's vocabulary. Strac's guide says that for PCI compliance a card number "must be masked so that only the last four digits are visible"11. The council's Quick Reference Guide for version 3.2.1 says to mask PAN when displayed, and that "the first six and last four digits are the maximum number of digits you may display"9. The council's glossary ties masking to protecting the PAN "when displayed on screens, paper receipts, printouts", and truncation to protecting it "when electronically stored, processed, or transmitted"1. A file on a drive is storage. Hiding digits on a screen does nothing for the number inside the file.

Nessus, Autopsy and Purview: what people try first

Many teams reach for a tool they already own.

Nessus can do it, with setup. Tenable describes a file-content check for Windows hosts that is driven by an audit file of patterns, runs as a credentialed scan, and "does not require an agent but it does require an account that has login credentials and the ability to read the disk"5. Tenable adds that these audits put more traffic on the network than ordinary configuration auditing, because file contents travel to the scanner5.

Autopsy is a digital forensics platform6. Its keyword search documentation lists phone numbers, IP addresses, URLs and email addresses as the built-in expression lists, and warns that general lists "can produce a very large number of hits, and many of them can be false-positives"6.

Microsoft Purview's card number type requires the Luhn test and is used inside Purview's data loss prevention policies4. Ground Labs sells a dedicated product: its page describes Card Recon as a cardholder data discovery tool in desktop and server editions, with remediation options and reporting aimed at PCI assessors7.

Finding card numbers with VellumSoft

VellumSoft detector catalog listing enabled and disabled detectors
VellumSoft detector catalog listing enabled and disabled detectors · synthetic sample data

VellumSoft looks for payment card numbers in any region. The detector is named payment_card and sits in Tier 1. Tier 1 values must pass their checksum, so random digits will not be reported.

Findings show masked values, with long identifiers showing only their last few digits, and the results file and the audit report never hold raw values. That matters for card data in particular, because a discovery report that listed full card numbers would itself be a new store of cardholder data.

For mail, PST, OST and MSG files are read with their attachments, and each finding shows the message's folder, sender, date and subject. That is how a card number typed into an old email gets traced back to its message (see PST, OST and MSG scanning).

The limits are the usual ones, and two are specific to cards:

  • Version 2.0.2 does not read Word (DOCX), Excel (XLSX), ZIP or 7z files. Card authorization forms kept in those formats show up on the Coverage tab as unread.
  • A single misread character defeats a checksum, so a card number in a poor scan or photo can fail the Luhn check and go unreported.
  • This page describes a scan of files and folders. It does not describe scanning computer memory or free disk space, which the Ground Labs page lists for Card Recon7.
  • VellumSoft does not delete or redact. Removing a card number happens in the file's own system.

For an organization facing an assessment, the next page is finding stray card data before a PCI assessment. Other identifiers are under all detectors by country, including Social Security numbers, Social Insurance Numbers (Social Insurance Numbers, with the rules in the SIN guide), Canadian health card numbers and the Ontario OHIP number.

The oldest mailbox export is usually where the card numbers are, because that is where clients typed them before anyone told them not to.

This page explains the law in general terms and is not legal advice.

Questions

Can Nessus scan for credit card numbers?

Tenable describes a Nessus check that searches file contents on Windows hosts for patterns such as card numbers. It is a credentialed scan that needs an account able to read the disk, and the patterns are set in an audit file. Tenable notes that the files cross the network to the scanner, so these audits make more traffic than ordinary configuration checks.

How many digits does a credit card number have?

It varies by card. Microsoft's detector for card numbers looks for 14 to 19 digits, formatted or unformatted, that pass the Luhn test and match the number formats of the major card companies. The numbering system itself is set by an ISO standard for issuer identification numbers and primary account numbers.

Is a credit card number personal information?

Under many laws, yes. Massachusetts, for example, defines personal information to include a resident's name combined with a credit or debit card number, with or without any required security code. Under the card industry's own standard, the full card number is cardholder data wherever it is stored.

Does a card number scan also find CVV codes and track data?

VellumSoft's payment card detector covers card numbers, checked by Luhn. Card verification codes, PINs and magnetic-stripe track data, which the card industry calls sensitive authentication data, are not covered here. A card number finding is a reason to open the file and look for the rest by hand.

Sources

  1. Ground Labs, Card ReconReviewed 16 Nov 2026

Know where the personal data is.

One-time licence, from $399. Runs on your own Windows computer; scanned files and findings are never uploaded.