CodekeeperTransaction Services

InsightsSecurity, privacy and regulation

Penetration test due diligence: what a code scan adds

A penetration test and a code scan answer different questions. The first shows what an attacker could do to the running system during a set period. The second shows what is wrong in the code and its components, whether or not anyone has yet found a way to reach it. In a transaction you need to know which of the two you are holding and what it leaves out.

6 min readUpdated Codekeeper Transaction Services

What a penetration test shows

A penetration test is an authorized, simulated attack. Testers are given a scope (certain applications, networks or interfaces), a number of days and rules of engagement. They then try to break in, raise their privileges and reach data they should not see.

Its strength is proof. A tester who logs in as one customer and reads another customer's invoices has demonstrated a flaw that no one can argue away. Testers also find things that exist only in the running system: a misconfigured server, an exposed administration page, or several minor flaws that become serious when chained together.

Its limits follow from the format. The test is bounded by time and scope, so it samples the system and does not exhaust it. It describes one moment, and the software has usually changed since. A report with few findings means the testers found little in the days they had. It does not mean little is there.

What a code scan shows

A code scan works from the inside. In a transaction it usually combines three techniques:

  • Static application security testing (SAST) reads the company's own code for dangerous patterns, such as unsanitized input passed to a database query.
  • Software composition analysis lists every third-party component and matches each against published vulnerabilities, the Common Vulnerabilities and Exposures (CVE) record.
  • Secret scanning searches the code and its full history for passwords, keys and tokens.

The strength of a scan is coverage. It reads every file in every repository provided, including code paths no tester would reach, and the history as well as the present. It is repeatable, so a fix can be confirmed by running it again.

The limits are the mirror image of a penetration test. A scan does not see how production is configured, unless that configuration is itself kept as code. It is weak on flaws of business logic, where the code does exactly what was written and what was written is wrong. Raw output contains false positives, which is why automated results need expert reading before they reach a negotiating table.

The two side by side

AspectPenetration testCode scan
Looks atThe running system, from outside or with a test accountSource code, components and commit history
CoverageThe agreed scope, as far as time allowsEverything in the repositories provided
Best atProving a weakness can be exploitedFinding weaknesses nobody has reached yet
Blind spotCode not exercised during the test, and historyLive configuration and logic flaws
NeedsSeller consent and a test windowRead access to repositories

Neither replaces the other, and a product that holds payment or health data warrants both. Used together they check each other: if the testers found an injection flaw in one screen, the scan shows whether the same pattern recurs elsewhere in the code.

Timing inside a deal

A new penetration test has to be scoped, authorized, scheduled, performed and written up. The seller must agree to an attack on its systems during a sale process, and hosting providers may have their own rules about testing. From instruction to final report, the exercise often takes longer than the exclusivity period allows.

Most transactions therefore proceed in this order:

  1. Obtain the seller's most recent penetration test reports and read them critically.
  2. Run a code scan now, because it fits the timetable and covers what the old test did not.
  3. Where the product or the data justifies it, make a fresh test a condition of closing or an early item in the first hundred days.

Planning this at the start is part of fitting diligence inside the exclusivity window.

Reading a penetration test someone else commissioned

Sellers often supply a report from their own files. It was written for a different purpose, so read it with these questions in mind.

  • Who performed it? An independent firm with named testers carries more weight than an internal exercise.
  • When? A test older than a year describes a different product. Ask how much has been released since.
  • What was in scope? Look for the list of applications and environments, and for the exclusions. A test of the marketing website says nothing about the product.
  • What did the testers know? Tests range from no inside knowledge to full access to accounts and documentation. More access usually means deeper findings.
  • Were findings fixed and retested? Ask for the retest report. A list of serious findings with no evidence of closure is an open issue.
  • Is it the full report? A one-page summary letter prepared for customers omits the detail you need.

The pattern across years is informative too. Annual tests by an outside firm, with findings closed between rounds, indicate a working practice. A single test commissioned a month before the sale indicates preparation for the sale. For the wider set of security evidence, see our overview of cybersecurity due diligence.

How we approach it

Our review works from the code. Every report includes security scanning: SAST, secrets in the code and its git history, and CVEs drawn from a full software bill of materials (SBOM). The Automated Scan Report is targeted within 72 hours of the data room being ready to scan. In the Analyst-Verified Report an in-house analyst removes false positives and rates each risk in the context of the company's stage.

We do not perform penetration tests, and our report is not one. Each section states what was examined and what was not, so a reader can see where code evidence ends and where other evidence is needed. Because the data room stays synchronized with the seller's systems, a delta scan runs on every change and the report can be regenerated until closing.

Code is cloned and scanned in sandboxes with no network egress, as described on our security page. The contents of each level of review are on the technical due diligence page.

Questions we are asked

Does your review include a penetration test?

No. We scan and read the code, its components and its history. If the transaction calls for a penetration test, it is commissioned separately from a testing firm, and the two sets of findings can be read together.

Is a penetration test from last year still worth reading?

Yes, with care. It shows what was found then, and whether the company fixed it. It does not describe code written since, which is where a current scan fills the gap.

Can a code scan replace a penetration test?

Not fully. A scan covers more ground and finds flaws no tester has reached, but it does not see the live configuration or prove that a weakness can be exploited in practice. For products with sensitive data, buyers generally want both.

This article is general information for people working on software transactions. It is not legal, financial or insurance advice.

Dealmaking is your craft. The technology is ours.

Tell us about the transaction and its timetable. We will set out the scope we would advise, and what the first report would cover.