How to fix: Credit Card Number Pattern
A Luhn-valid number carrying a card-network prefix appears in the page source next to payment vocabulary: a card-number label, a billing or checkout field, CVV, or an expiry date. Luhn is a single check digit, so a card-shaped number with no payment context (an order reference, a tracking number, a row of figures in a table) is not reported.
Why it matters
PCI DSS violation, data breach.
Card numbers should never appear in HTML. The detection requires three things together: a card-network prefix and length, a passing Luhn checksum, and payment vocabulary within about 120 characters. Published processor test cards are excluded, and so is a card-shaped window carved out of a longer run of separated digit groups.
How to fix it
- 1Never display full card numbers, mask or tokenize.
Code examples
Never store raw card numbers: use a payment processor
// NEVER store raw credit card numbers: PCI DSS violation
// Use a tokenization service:
// Stripe: card number goes directly to Stripe servers
import { loadStripe } from "@stripe/stripe-js";
const stripe = await loadStripe(process.env.NEXT_PUBLIC_STRIPE_KEY!);
const { paymentMethod } = await stripe!.createPaymentMethod({
type: "card",
card: cardElement, // card number never touches your server
});
// Store paymentMethod.id (a token), not the card numberReferences
Detected automatically by VulnRadar. The check id is credit-card-pattern, stable across every scan so you can filter or diff on it.
More content checks
- MediumPotential Open Redirect Parameters
- HighDirectory Listing Appears Enabled
- MediumSensitive File References Detected
- HighPotentially Outdated JavaScript Libraries
- Inforobots.txt Present - Review Manually
- InfoCMS / Technology Fingerprinting
- MediumPotentially Dangerous Inline JavaScript
- LowServer version disclosed in response header
Questions
- How severe is Credit Card Number Pattern?
- VulnRadar rates this critical severity in the content category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id credit-card-pattern, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Credit Card Number Pattern map to?
- It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.