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
| Location | How PAN gets there | What to scan |
|---|---|---|
| Application and web server logs | Debug logging of request bodies, exception traces with form fields, query strings on GET requests | Log files on hosts, central log platforms, archived log buckets |
| Observability and tracing | Span attributes and payload capture in application performance tools | Trace stores and their exports |
| Memory dumps and crash files | Process memory captured during payment processing | Crash dump directories, support bundles sent to vendors |
| Support tickets and CRM | Customers type card numbers into web forms or email; agents paste them into notes | Ticket bodies, attachments, internal notes, CRM free-text fields |
| Chat and collaboration | Card numbers shared in customer chat or internal messaging during escalations | Customer chat transcripts, team messaging exports, wiki pages |
| Customers send card details by email; finance forwards remittance or chargeback evidence | Shared mailboxes, journaling archives, attachments | |
| Call recordings and transcripts | Card numbers read aloud; speech-to-text produces searchable transcripts | Recording stores, transcription output, quality assurance tools |
| Spreadsheets and file shares | Ad hoc exports for reconciliation, refunds or fraud review | File servers, cloud drives, user home folders, endpoints |
| Databases outside the CDE | Legacy columns, test copies of production, reporting replicas, free-text fields | Non-production databases, warehouses, data lakes |
| Backups and archives | Every location above, preserved long after the source is cleaned | Backup catalogues, snapshots, offline media |
| SaaS applications | Card numbers in form submissions, survey tools, project trackers | SaaS 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.
| Approach | Strengths | Limits | Best for |
|---|---|---|---|
| Agent or host-based file scanning | Deep coverage of local disks, endpoints and file formats | Agent deployment and performance impact | Servers, endpoints, file servers |
| Agentless or credentialed remote scanning | No install; scans shares and databases over the network | Needs privileged service credentials; network load | File shares, databases |
| Database column and content sampling | Fast across large schemas; finds suspicious columns | Sampling can miss sparse PAN in free-text fields | Warehouses, replicas, non-production databases |
| Cloud data security posture management (DSPM) | Discovers unmanaged cloud stores and classifies at scale | Coverage varies by service; may sample | Object storage, cloud databases, data lakes |
| SaaS API-based scanning | Reaches content in tickets, chat, drives and email | Depends on API scope and rate limits | Help desk, collaboration, CRM |
| Data loss prevention (DLP) in motion | Stops new PAN leaving or arriving; complements discovery at rest | Does not find historic data at rest | Email, web, endpoints, removable media |
| Log pipeline redaction and detection | Catches PAN before it is indexed | Only covers logs routed through the pipeline | Central 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:
- 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.
- 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.
- 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.
- 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.
- Find the source. Trace the process, form, integration or person that put PAN there. Without this step the data will come back.
- 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.
- 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
| Technique | What it does | PCI DSS reference | Notes |
|---|---|---|---|
| Masking | Hides digits when PAN is displayed | 3.4.1: BIN and last four digits are the maximum displayed without a documented business need | Display control only; the stored PAN is unchanged |
| Truncation | Permanently removes a segment of the PAN from stored data | 3.5.1 | PCI 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 tokens | Replaces PAN with a token; the mapping is held in a token vault | 3.5.1 | The vault stays in scope. See Payment Tokenisation vs P2PE |
| Keyed hashing | One-way keyed cryptographic hash of the entire PAN | 3.5.1, 3.5.1.1 | PCI SSC FAQ: hashes generated after 31 March 2025 must be keyed |
| Strong cryptography | Encrypts PAN with managed keys | 3.5.1; Requirement 3 key management | Data 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
| Activity | PCI DSS v4.0.1 | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | ISO/IEC 27001:2022 Annex A |
|---|---|---|---|---|
| Locate account data | Req. 12 (scope) | CM-12 Information Location | ID.AM-07 | A.5.12 Classification of information |
| Retention and deletion | Req. 3 | SI-12 Information Management and Retention; MP-6 Media Sanitization | PR.DS-01 | A.8.10 Information deletion |
| Render PAN unreadable | 3.4.1, 3.5.1 | SC-28 Protection of Information at Rest | PR.DS-01 | A.8.11 Data masking |
| Prevent PAN leaving the CDE | Req. 3 | SI-4 System Monitoring | DE.CM-03 | A.8.12 Data leakage prevention |
| Respond to unexpected PAN | Req. 12 (incident response) | SI-12 | PR.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
- PCI SSC: PCI DSS v4.0.1 (Document Library)
- PCI SSC: FAQ, acceptable formats for truncation of primary account numbers
- PCI SSC: FAQ, PAN masking and truncation with 8-digit BINs
- ISO: ISO/IEC 7812-1:2017 Identification of issuers, numbering system
- NIST: SP 800-88 Rev. 2, Guidelines for Media Sanitization
- NIST: SP 800-53 Rev. 5, Security and Privacy Controls
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