How to ensure a pentest complies with GDPR

Youri van der Zwart ·

Running a penetration test without accounting for GDPR is a compliance risk hiding in plain sight. Pentests by their nature involve probing systems, intercepting traffic, and sometimes encountering real personal data, all of which fall squarely within GDPR’s scope. Done carelessly, a test designed to improve your security posture can itself become a data protection incident. This guide walks you through exactly what to do before, during, and after a pentest to keep it fully compliant.

What you need in place before the pentest starts

Compliance groundwork happens before any scanning tool runs. The legal basis for processing personal data during a penetration test must be established in advance, and the relevant stakeholders need to be aligned. Skipping this step means you may be processing personal data without a lawful basis, which is a direct GDPR violation regardless of your security intentions.

  • A signed contract or statement of work between your organization and the pentesting party that includes GDPR-specific clauses
  • A Data Processing Agreement (DPA) if the pentest provider will act as a data processor on your behalf
  • Written authorization from your organization’s Data Protection Officer (DPO) or legal team
  • Internal notification to your IT and security teams so the test is logged and monitored appropriately
  • A record of the lawful basis under which personal data may be processed during the test (typically legitimate interest or legal obligation)

Once these documents are in place, you have a defensible paper trail showing the test was authorized, scoped, and legally grounded. This is your compliance foundation for everything that follows.

Define the scope to limit personal data exposure

Scope definition is not just a technical exercise, it is a data minimization decision. GDPR’s data minimization principle requires that only the personal data necessary for a specific purpose is processed. In a pentest context, this means deliberately restricting which systems, environments, and datasets are included in the test.

  1. Identify which systems contain personal data and flag them explicitly in the scope document.
  2. Determine whether those systems need to be included in the test or whether anonymized or synthetic data environments can be used instead.
  3. Where live systems containing personal data must be tested, document the specific justification for why a sanitized environment is not sufficient.
  4. Exclude systems that hold special category data (health records, financial data, biometric data) unless there is a compelling and documented security reason to include them.

After completing this step, your scope document should clearly distinguish between in-scope systems that may contain personal data and those that do not. Any tester reviewing it should know immediately where extra care is required.

Set the rules of engagement for GDPR compliance

Rules of engagement define how the pentest is conducted, and under GDPR, they need to go beyond standard technical parameters. The testers need clear instructions on how to handle personal data if they encounter it, what they are and are not permitted to do with it, and how to escalate if something unexpected occurs.

  1. Specify that testers must not extract, copy, or retain personal data beyond what is strictly necessary to demonstrate a vulnerability.
  2. Require that any personal data accessed during testing is treated with the same confidentiality obligations as your own staff would apply.
  3. Define a clear escalation path: if a tester encounters sensitive personal data unexpectedly, they should pause, document it, and notify the project lead before continuing.
  4. Set time limits on how long any test data or artifacts containing personal data can be retained by the testing team after the engagement ends.

With these rules documented and agreed upon in writing, both parties understand their obligations. This also protects your organization if a regulator later questions how the test was conducted.

Handle personal data encountered during testing

Even with strong scoping, testers may encounter personal data they did not expect. A database returns real customer records. A file share contains employee documents. This is not uncommon, and how you handle it determines whether you stay compliant or create a reportable incident.

  1. Instruct testers to document what personal data was accessed, when, and in what context, without unnecessarily copying or expanding access.
  2. Assess whether the exposure constitutes a personal data breach under GDPR Article 33. If personal data was accessed by an unauthorized party or in an uncontrolled way, you may have a 72-hour reporting obligation to your supervisory authority.
  3. Preserve evidence of the encounter in your test logs so you can demonstrate the data was handled responsibly.
  4. Notify your DPO immediately if special category data was accessed, even inadvertently.

The key principle here is proportionality. Testers should do enough to confirm the vulnerability exists, document it clearly, and stop. Extracting large volumes of personal data to prove a point is never necessary and always a compliance problem.

Manage pentest findings and reports under GDPR

The final pentest report is itself a sensitive document. It may describe exactly how personal data can be accessed, which systems are vulnerable, and what data was observed during testing. Under GDPR, this report must be handled with the same care as the personal data it references.

  1. Ensure the report is transmitted securely, encrypted email or a secure file transfer platform, never plain email or shared drives without access controls.
  2. Limit distribution of the report strictly to individuals who need it to act on the findings. This is a need-to-know principle applied to a security document.
  3. Redact or anonymize any actual personal data that appears in the report before sharing it more broadly, for example with board members or external auditors.
  4. Define a retention period for the report and schedule its secure deletion once it is no longer needed for remediation or audit purposes.

A well-managed report closes the compliance loop. It demonstrates that the entire penetration testing process was conducted with data protection in mind from authorization through to remediation. If you want guidance tailored to your organization’s specific environment, contact us and we can help you structure a GDPR-compliant testing programme from the ground up.

Frequently Asked Questions

What should we do if a penetration tester accidentally accesses a large volume of personal data during the test?

V: Wat moeten we doen als een pentester per ongeluk toegang krijgt tot een grote hoeveelheid persoonsgegevens tijdens de test?nA: Stop de test onmiddellijk op het getroffen systeem, documenteer wat er is benaderd en wanneer, en informeer direct je DPO. Beoordeel daarna of de toegang voldoet aan de definitie van een datalek onder artikel 33 van de AVG, want in dat geval geldt mogelijk een meldplicht van 72 uur bij de toezichthouder.

How do we determine whether a Data Processing Agreement is required with our pentest provider?

V: Hoe bepalen we of een verwerkersovereenkomst vereist is met onze pentest-aanbieder?nA: Een verwerkersovereenkomst is verplicht zodra de pentest-aanbieder namens jouw organisatie persoonsgegevens verwerkt, wat vrijwel altijd het geval is bij tests op live systemen. Controleer of de aanbieder toegang heeft tot systemen met echte persoonsgegevens; zo ja, dan moet de overeenkomst vóór aanvang van de test getekend zijn.

Why is using a sanitized or synthetic data environment preferred over testing on live data?

V: Waarom heeft het gebruik van een geanonimiseerde of synthetische testomgeving de voorkeur boven testen op live data?nA: Een gesaniteerde omgeving elimineert het risico dat echte persoonsgegevens onbedoeld worden blootgesteld of gekopieerd, waardoor je automatisch voldoet aan het dataminimalisatiebeginsel van de AVG. Bovendien vereenvoudigt het de compliance-documentatie aanzienlijk, omdat je niet hoeft te rechtvaardigen waarom toegang tot echte persoonsgegevens strikt noodzakelijk was.

When should the DPO be involved in the penetration testing process?

V: Wanneer moet de Functionaris Gegevensbescherming (FG) worden betrokken bij het pentestproces?nA: De FG moet worden betrokken vóór de start van de test, namelijk bij het beoordelen van de juridische grondslag, het goedkeuren van de scope en het controleren van de verwerkersovereenkomst. Daarnaast is directe melding aan de FG verplicht zodra er tijdens de test bijzondere categorieën persoonsgegevens worden aangetroffen, ook als dit per ongeluk gebeurt.