Join our Newsletter — 33% off our NHI Course
Home› Guides› Cardholder Data Discovery Guide: Finding Stray PANs Before…
Guide Data Security

Cardholder Data Discovery Guide: Finding Stray PANs Before Your Assessor Does

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

Every primary account number (PAN) sitting outside your defined cardholder data environment (CDE) silently widens PCI DSS scope, and most organisations only find these strays when an assessor or an attacker does. PCI DSS v4.0.1 expects you to know where all account data lives when you confirm scope, and to respond when card data turns up where it should not be. This guide is for PCI compliance and data security teams: where stray PANs hide, how discovery works and why naive pattern matching fails, how to handle what you find, and how to keep it clean. For the standard as a whole, see the PCI DSS 4.0 Guide; for drawing the scope boundary, see the PCI DSS Scoping and Network Segmentation Guide.

Key takeaways

  • Scope confirmation needs evidence of absence. Periodic scope confirmation under Requirement 12 means showing where account data is, and is not; PCI SSC presents data discovery as a way to verify in-scope systems and repositories.
  • A 16-digit number is not a PAN. Pattern matching plus a Luhn check still produces false positives; use issuer prefix ranges, keyword proximity and context to make results usable.
  • The unstructured places matter most. Logs, tickets, chat, email, call recordings, spreadsheets, data lakes and backups hold more strays than the payment database.
  • Finding PAN starts an incident procedure. Treat each confirmed find as an incident: decide whether to delete or move the data into the CDE, check for sensitive authentication data, trace the source and fix the leak.
  • Truncation and masking are different. Masking (3.4.1) hides digits on display; truncation (3.5.1) permanently removes digits from stored data, within the formats PCI SSC publishes.

Why stray PANs matter for scope

PCI DSS applies to every system component that stores, processes or transmits account data, and to those connected to or able to affect them. A file share holding one export of card numbers is in scope, and so is everything that can reach that share. The standard expects scope to be confirmed periodically by identifying where account data is stored and how it flows.

Requirement 12 covers documenting and periodically confirming scope, including data flows and every location where account data is stored, processed or transmitted, inside and outside the CDE, and service providers face a more frequent cycle. PCI SSC material on evidence-based scoping describes data discovery as the way to verify in-scope systems and data repositories during that revalidation, and to find PAN in places nobody expected.

Designated entities assessed under the supplemental Appendix A3 have firmer duties around a documented, regularly run and tested data discovery methodology. That model is a useful benchmark even for entities that are not designated.

Stray PAN also breaks retention rules. Requirement 3 expects retention limits, secure deletion of data no longer needed and periodic checks that expired data is gone, and PCI SSC notes that discovery scans confirm deletion after the retention period. Data you did not know about cannot meet any of that. The distinction between cardholder data and sensitive authentication data (SAD) matters too: SAD must not be kept after authorisation. See the Cardholder Data vs Sensitive Authentication Data guide.

Where PANs hide

LocationHow PAN gets thereWhat to scan
Application and web server logsDebug logging of request bodies, exception traces with form fields, query strings on GET requestsLog files on hosts, central log platforms, archived log buckets
Observability and tracingSpan attributes and payload capture in application performance toolsTrace stores and their exports
Memory dumps and crash filesProcess memory captured during payment processingCrash dump directories, support bundles sent to vendors
Support tickets and CRMCustomers type card numbers into web forms or email; agents paste them into notesTicket bodies, attachments, internal notes, CRM free-text fields
Chat and collaborationCard numbers shared in customer chat or internal messaging during escalationsCustomer chat transcripts, team messaging exports, wiki pages
EmailCustomers send card details by email; finance forwards remittance or chargeback evidenceShared mailboxes, journaling archives, attachments
Call recordings and transcriptsCard numbers read aloud; speech-to-text produces searchable transcriptsRecording stores, transcription output, quality assurance tools
Spreadsheets and file sharesAd hoc exports for reconciliation, refunds or fraud reviewFile servers, cloud drives, user home folders, endpoints
Databases outside the CDELegacy columns, test copies of production, reporting replicas, free-text fieldsNon-production databases, warehouses, data lakes
Backups and archivesEvery location above, preserved long after the source is cleanedBackup catalogues, snapshots, offline media
SaaS applicationsCard numbers in form submissions, survey tools, project trackersSaaS content reachable through vendor APIs

Logs deserve special attention because one misconfigured logger can write card numbers on every transaction. The Sensitive Data in Logs Guide covers redaction at source.

Discovery methods and tools categories

How detection works

  • Pattern matching: look for digit runs of plausible PAN length (13 to 19 digits), allowing for spaces and hyphens as separators.
  • Luhn validation: the last digit of a PAN is a check digit calculated with the Luhn (mod 10) algorithm. Discarding numbers that fail removes most random digit strings, but about one in ten random numbers of the right length will still pass by chance.
  • Issuer prefix checks: PAN structure is defined by ISO/IEC 7812-1, and the leading digits identify the issuer range. Restricting matches to known brand ranges and expected lengths for each range cuts false positives further.
  • Context and proximity: nearby keywords such as "card", "expiry", "CVV" or brand names, or an expiry-date pattern, raise confidence; known non-card formats nearby lower it.
  • Known test numbers: payment providers publish test card numbers that pass Luhn. Suppress them, but only by exact value, so a real card is never hidden by a broad rule.

Why false positives happen

Order numbers, invoice numbers, tracking numbers, phone numbers joined together, timestamps, serial numbers and fragments of identifiers can all be 16 digits long and some will pass Luhn. Tune in this order: exclude known non-card fields by schema, then require prefix plus Luhn, then add context. Never tune by suppressing whole directories or data stores, which creates blind spots that an assessor will question. False negatives are the bigger risk: PAN split across fields, embedded in images or scanned PDFs, compressed archives, encoded payloads, and binary formats need explicit support.

ApproachStrengthsLimitsBest for
Agent or host-based file scanningDeep coverage of local disks, endpoints and file formatsAgent deployment and performance impactServers, endpoints, file servers
Agentless or credentialed remote scanningNo install; scans shares and databases over the networkNeeds privileged service credentials; network loadFile shares, databases
Database column and content samplingFast across large schemas; finds suspicious columnsSampling can miss sparse PAN in free-text fieldsWarehouses, replicas, non-production databases
Cloud data security posture management (DSPM)Discovers unmanaged cloud stores and classifies at scaleCoverage varies by service; may sampleObject storage, cloud databases, data lakes
SaaS API-based scanningReaches content in tickets, chat, drives and emailDepends on API scope and rate limitsHelp desk, collaboration, CRM
Data loss prevention (DLP) in motionStops new PAN leaving or arriving; complements discovery at restDoes not find historic data at restEmail, web, endpoints, removable media
Log pipeline redaction and detectionCatches PAN before it is indexedOnly covers logs routed through the pipelineCentral logging platforms

Most organisations need two or three of these. A small merchant with a hosted payment page may cover endpoints, mailboxes and the help desk with one tool plus manual review. A large merchant or service provider needs host, database, cloud and SaaS coverage with central reporting. See DSPM vs DLP and the Data Classification vs Data Discovery guide for how these categories relate.

Where identity fits

Discovery scanners need broad read access, which makes their service accounts and API tokens among the most sensitive credentials in the estate: they can read every location that might hold card data. Give each scanner a dedicated identity, scope it read-only, vault and rotate its credentials, restrict where it can log in from, and keep scan results (which contain the matches) inside the CDE or redacted. Requirement 8 controls on system and application accounts apply; see the PCI DSS Requirements for Service Accounts and NHIs Guide.

Handling and remediation

Your incident response procedures should start when stored PAN is detected anywhere it is not expected, and cover what to do with the data (delete it or move it into the defined CDE), whether SAD is stored with it, where it came from and how the leak or process gap is fixed. A practical sequence:

  1. Triage the hit. Confirm it is real (prefix, Luhn, context), count records, and check for SAD such as card verification codes or track data. SAD stored after authorisation is a more serious finding.
  2. Contain access. Restrict the location to a small group while you work, and preserve a record of what was found without copying the PAN into tickets or reports.
  3. Decide the disposition. If there is no business need, securely delete. If there is a genuine need, move the data into the CDE or replace it with a token or truncated value.
  4. Delete properly. Remove the data from the source, its versions and recycle bins, replicas, search indexes and caches, and plan for backups: either purge from backups where the tooling allows, or document the backup copies, protect them as in scope and let them expire on a short schedule. Use media sanitisation for disposed devices; NIST SP 800-88 Rev. 2 is the current reference. See the Media Sanitisation Guide.
  5. Find the source. Trace the process, form, integration or person that put PAN there. Without this step the data will come back.
  6. Fix the leak. Change the logger configuration, add input validation to the form, mask fields in the ticketing tool, block card numbers in chat, retrain the team.
  7. Rescan and record. Confirm the location is clean, update the data-flow diagram and scope documentation, and keep the evidence for the assessor.

Truncation, masking and other ways to keep the data useful

TechniqueWhat it doesPCI DSS referenceNotes
MaskingHides digits when PAN is displayed3.4.1: BIN and last four digits are the maximum displayed without a documented business needDisplay control only; the stored PAN is unchanged
TruncationPermanently removes a segment of the PAN from stored data3.5.1PCI SSC FAQ formats: for 16-digit PANs, first 8 and any other 4 digits retained at most (at least 4 removed); for 15-digit PANs, first 6 and last 4 (at least 5 removed)
Index tokensReplaces PAN with a token; the mapping is held in a token vault3.5.1The vault stays in scope. See Payment Tokenisation vs P2PE
Keyed hashingOne-way keyed cryptographic hash of the entire PAN3.5.1, 3.5.1.1PCI SSC FAQ: hashes generated after 31 March 2025 must be keyed
Strong cryptographyEncrypts PAN with managed keys3.5.1; Requirement 3 key managementData stays in scope; see the PCI DSS Requirement 3 Key Management Guide

One trap: if both a truncated and a hashed version of the same PAN exist, or two different truncation formats, they can be correlated to rebuild the full number. Pick one format per use case and record it. Truncation formats vary by brand, so confirm uses outside storage with the applicable payment brands, as the PCI SSC FAQ advises.

Keeping it clean

  • Run discovery on a schedule: at least before each annual scope confirmation; quarterly is a sensible default for any organisation that keeps finding strays.
  • Prove the method works: plant synthetic, Luhn-valid test values in each file format and store type you rely on and confirm the scanner finds them.
  • Stop new PAN at the edge: redact in logging libraries and log pipelines, block card patterns in chat and ticket forms, and use DLP on email, uploads and removable media. See the Data Loss Prevention (DLP) Guide.
  • Prevent copying from the CDE: use technical controls that stop staff copying or relocating PAN over remote-access tools without explicit authorisation.
  • Keep retention short: apply retention periods to logs, recordings and backups, and check regularly that expired data is gone.
  • Change management hook: treat new integrations, logging changes and new SaaS tools as significant change triggers for a targeted rescan.

Metrics

  • Coverage: share of in-scope and adjacent data stores scanned in the last quarter, by type (hosts, databases, cloud, SaaS, backups).
  • Unexpected findings: confirmed PAN locations outside the CDE per scan cycle, trending down; any SAD finding reported separately.
  • Time to remediate: median days from confirmed finding to verified deletion or migration.
  • Recurrence: share of findings in a location previously remediated, which shows whether root causes are being fixed.
  • False positive rate: share of hits rejected at triage, to show tuning is improving without dropping coverage.

Framework mapping

ActivityPCI DSS v4.0.1NIST SP 800-53 Rev. 5NIST CSF 2.0ISO/IEC 27001:2022 Annex A
Locate account dataReq. 12 (scope)CM-12 Information LocationID.AM-07A.5.12 Classification of information
Retention and deletionReq. 3SI-12 Information Management and Retention; MP-6 Media SanitizationPR.DS-01A.8.10 Information deletion
Render PAN unreadable3.4.1, 3.5.1SC-28 Protection of Information at RestPR.DS-01A.8.11 Data masking
Prevent PAN leaving the CDEReq. 3SI-4 System MonitoringDE.CM-03A.8.12 Data leakage prevention
Respond to unexpected PANReq. 12 (incident response)SI-12PR.DS-11 (backups)A.8.10

In CIS Controls v8.1, the closest safeguards are 3.2 (Establish and Maintain a Data Inventory), 3.4 (Enforce Data Retention) and 3.5 (Securely Dispose of Data).

Common failure patterns

  • Scanning only what you think is in scope. Discovery limited to the CDE confirms what you already know. The point of scope confirmation is finding PAN outside it.
  • Tuning by exclusion. Suppressing whole shares or log indexes to quieten false positives creates blind spots exactly where strays accumulate.
  • Cleaning the source but not the backups. The share is clean, but three years of snapshots still hold the export, and nobody has documented them as in scope.
  • Remediation without root cause. Deleting PAN from tickets every quarter while the web form still invites customers to type card numbers guarantees the same finding next time.
  • Keeping encrypted card data nobody needs. Encryption is only as strong as the key's protection. In the AI Agent Retail Card Theft Campaign 2026, attackers who reached the commerce platform's encryption key decrypted stored cards. Deleting or tokenising data you do not need removes that risk entirely.
  • Leaking PAN through the scanner. Reports and evidence files with full matches emailed around the compliance team create new strays. Redact results to masked values.

Practitioner checklist

  • Discovery covers hosts, endpoints, databases, cloud stores, SaaS content, mailboxes, recordings, logs and backups, not only the CDE.
  • Detection uses length, Luhn, issuer prefix and context, with test card numbers suppressed by exact value only.
  • Scanner effectiveness is tested with synthetic Luhn-valid values in every file format and store type relied on.
  • An incident procedure covers triage, SAD check, disposition, deletion including replicas and backups, source tracing and fix.
  • Truncation, masking, tokenisation and hashing choices are documented, with controls against correlating formats.
  • Logging libraries, chat, ticket forms and email have controls that stop new PAN arriving.
  • Scanner service accounts are dedicated, read-only, vaulted, rotated and monitored.
  • Scan results are redacted and stored inside the CDE.
  • Findings feed the scope confirmation and the data-flow diagrams.
  • Metrics on coverage, findings, time to remediate and recurrence are reported each cycle.

Standards and references

Related NHI Mgmt Group resources: PCI DSS 4.0 Guide · PCI DSS Scoping and Network Segmentation Guide · Cardholder Data vs Sensitive Authentication Data · Data Retention and Secure Deletion Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.