Penetration testing an OpenEMR deployment

A penetration test of a self-hosted OpenEMR system shows which exposed paths an attacker could reach with real patient data at stake. This page explains how to scope one, what to test, how to test safely and how to verify fixes.

On this page

Penetration testing an OpenEMR deployment: when your team needs it

A self-hosted OpenEMR system that stores electronic protected health information (ePHI) and is reachable by staff, patients and possibly third-party apps needs a clear answer to one question: what could an attacker reach, and what could they do once they got there? A penetration test answers that by trying to exploit the system, while a configuration review checks whether settings match the intended design. The two overlap, but they find different things. A review can confirm that the web server blocks setup.php or that multi-factor authentication is enabled for a user, and a test can show whether a flaw in the patient portal, the FHIR API or a module lets someone reach records they should not see. The HIPAA Security Rule's technical safeguards in 45 CFR 164.312, including unique user identification, automatic logoff and access controls, are the natural yardstick for the test's findings, because they describe what the system must enforce in practice.

For OpenEMR, the scope should follow the attack surface rather than the server alone. Ask the tester to cover the patient portal login and account recovery, the FHIR and OAuth2 endpoints with their granted scopes, each user role's reach into patient data, the billing and fax and SMS modules that the 8.3.0 and 8.4.0 releases fixed for security issues, and the infrastructure under them, including the database connection and the document store. Confirm in writing which of these your deployment actually exposes, because a portal or FHIR endpoint that is not published to the internet changes the threat model. Also confirm what the tester may do with patient data during testing, since that decision shapes how the test is run.

Be clear with leadership about what the result is and is not. A penetration test is a point-in-time test of the scope agreed, and it does not produce a certification. HHS states that no Security Rule standard requires an entity to certify compliance and that it does not endorse private certifications, so any report should be presented as evidence for your risk analysis under the Security Rule, not as proof of compliance. Ask the provider for a findings report with severity, evidence, reproduction steps and fixes, and plan a retest of each fix before you close the finding. Confirm the report format, retest terms and data handling in the written scope before the work starts.

Test types and scope options for OpenEMR

This table compares four ways to scope a penetration test of a self-hosted OpenEMR system, showing what each finds, the access it needs and when it fits. Read it to match the test to the risk you are most worried about, then combine options where a single engagement must cover both the internet-facing surface and the logged-in application.

Test typeWhat it findsAccess it needsWhen it fits
External, unauthenticatedExposed setup and admin scripts, portal login and reset flaws, FHIR endpoints answering without valid tokens, OAuth2 misconfiguration, outdated components visible from outsideOnly the public hostnames and ports the internet can reach; no accountsWhen the portal or FHIR API is reachable from the internet and you need to know what an outsider can reach
Authenticated, patient roleBroken object-level access so one patient reads another patient's records, portal document exposure, weak session handling, upload abuseTest patient accounts created for the engagement, ideally with synthetic recordsWhen the patient portal is public and cross-patient data access is the main concern
Authenticated, clinician roleAccess control gaps across charts, encounters and orders, FHIR scope overreach, excessive data in API responses, care-team need-to-know failuresTest clinician accounts with the same permissions as real staff, mapped to a documented role matrixWhen clinicians use the system remotely or through SSO and you must check that roles limit access to the right patients
Authenticated, admin and billing rolesPrivilege escalation through globals, user management and module settings, billing and fee sheet manipulation, fax and SMS module abuse, audit log tamperingAdmin and billing test accounts, with agreed limits on changes to live settings and claimsWhen administrators or billing staff hold high-impact rights and a role error would affect money or configuration
Infrastructure and hostExposed database ports, weak TLS, default credentials on servers, container or host misconfiguration, file permission issues, unpatched operating system packagesNetwork access to the hosts, or agreed credentials for configuration review; a defined scan windowWhen hosting runs on servers, VMs, Docker or Kubernetes that you operate and the platform layer is in scope
Combined engagementChains across layers, such as an external entry point that leads to role escalation or database accessExternal access plus test accounts for each role, and host access agreed in writingWhen the system holds ePHI and you need evidence that one weakness cannot lead to a wider compromise

How to scope and run the test in sequence

This sequence turns a vague request to test OpenEMR into a written scope, a safe test environment and a verified fix cycle. Each step ends with an artifact the client and tester both sign off on before the next step begins.

  1. Confirm the deployed OpenEMR version

    The client's administrator records the exact OpenEMR version, the PHP version, the database engine and version, and the deployment method (bare metal, Docker or another packaging). The tester compares the version against the entries on the OpenEMR releases page, which lists the 8.x releases and their security fixes, and confirms the PHP 8.3 or later requirement is met. Done when both parties have a written version record and a list of any releases the installation is behind on, so the tester knows which fixes to check for rather than rediscovering known issues.

  2. Inventory enabled modules and custom code

    The client lists every enabled module, custom form, third-party extension and locally modified file, with the owner of each. The tester checks the module manager and the file tree for anything that was added outside the standard release. Modules touching FHIR, the patient portal, billing, fax or SMS and the fee sheet get priority, because recent OpenEMR security releases fixed issues in those areas. Done when the in-scope list is agreed in writing and every excluded component has a stated reason.

  3. Map portal, FHIR and OAuth2 exposure

    The client documents which hostnames and paths are reachable from the internet, from partner networks and from internal segments, including the patient portal, the FHIR API endpoints, the OAuth2 authorization and token endpoints, and any registered SMART on FHIR applications. The tester confirms which scopes and client registrations exist and whether public clients use PKCE. Done when an exposure map exists showing each reachable endpoint, who can reach it and which authentication applies, and the client confirms the map matches its firewall and reverse proxy rules.

  4. Review SSO, LDAP and password settings

    The client exports the authentication settings: LDAP or Active Directory configuration, Google Sign-In if enabled, password policy, hashing method, expiry and multi-factor status by user group. The tester reviews whether directory-backed logins still require the user to exist in OpenEMR and whether lockout and session behavior match the written policy. Done when the authentication configuration is recorded, each setting has an owner, and the tester has a list of accounts and roles to test against.

  5. Document database and file storage paths

    The client describes where the database runs and whether its connections are encrypted, where patient documents are stored, whether the documents directory is reachable over the web, and whether drive encryption is turned on. The tester checks that setup and administration scripts are removed or blocked and that only HTTPS is served. Done when the storage map and the list of exposed paths are confirmed against the hardening guide, and any gap is logged as a test target rather than an assumption.

  6. Agree rules of engagement and test accounts

    The client and tester sign a rules of engagement document covering in-scope targets, prohibited actions such as denial-of-service testing or access to real patient records, escalation contacts for critical findings, and the testing windows. The client creates test accounts for each role in scope, such as front desk, clinician, billing and patient portal user, with the access each role should have written beside it. Done when both parties have signed the document and the test accounts are confirmed to work, so the tester can verify role boundaries without touching production data.

  7. Prepare a safe test environment with synthetic data

    The client provisions a copy of the deployment that matches production configuration, loaded with synthetic or fully masked patient data. The client confirms that no live integrations, outbound fax or SMS, or payment connectors point at real services from the test copy. The tester verifies that the seeded data includes the record types needed to test access control, such as multiple patients and care teams. Done when the environment is documented, its data source is confirmed in writing, and the tester has run a smoke test showing the environment behaves like the production configuration.

  8. Run the test, then retest after fixes

    The tester runs the agreed tests within the testing windows, records each finding with its reproduction steps, affected role, and evidence, and reports critical issues to the escalation contact during the test. After the client applies fixes, the tester retests each finding against the same environment and records whether it is closed, partly closed or still open. Done when every finding has a retest result, the client has the final report, and the fixes are reflected in the deployed version record from the first step.

What to test: portal, FHIR and OAuth2, roles, modules and infrastructure

The patient portal is the surface most exposed to people outside your organization, so it usually belongs at the top of the scope. Testers should check how patients authenticate, whether multi-factor authentication is available and enforced for portal accounts, and what an unauthenticated visitor can reach. The Securing OpenEMR guide recommends multi-factor authentication and strong password policies, so the test should confirm each control is actually switched on rather than assumed.

  • Account lifecycle: registration, password reset, lockout and session expiry, including whether reset links are single use.
  • MFA status: which accounts have enrolled, and whether an attacker can skip the second factor through an alternate path.
  • Exposure: which portal URLs answer from the internet and whether any administrative page is reachable through the same host.
  • Fixes: confirm that portal issues fixed in the 8.3.0 and 8.4.0 releases are not reintroduced in your build.
  • Data scope: whether a logged-in patient can view or change another patient's records by changing an identifier.

Ask the tester to use two patient accounts for every object-level check. Confirm your portal exposure decision before the engagement starts.

How to test with patient data without exposing it

A penetration test of OpenEMR touches real clinical workflows and, often, real patient records. The rules below keep the test useful while limiting how much protected health information leaves your control. Agree them in the statement of work before the first login attempt.

Test on synthetic or de-identified data

Run the test against a copy of production built from synthetic patients or de-identified records wherever the findings allow it. Synthetic data still needs realistic shapes for the portal, FHIR resources and billing screens, so testers can reach the same code paths. Ask whether the copy is refreshed from production, how it was sanitized and who approved that process. Keep the copy in the same security boundary as production so that the test reflects real exposure.

Agree handling and deletion for real data

If any test must touch live patient records, write down who may access them, which screens and endpoints are in scope, where any exported evidence is stored and when it is deleted. Put the deletion date and the method in the statement of work, and require the tester to confirm deletion in writing. Note that OpenEMR stores documents on disk, so review the documents directory and any temporary exports as part of the cleanup.

Limit destructive and bulk tests

Bulk FHIR export, mass patient searches and repeated failed logins can slow clinical systems, lock out staff or copy large volumes of PHI in a single run. Set request ceilings, approve specific accounts for lockout testing and schedule bulk-export checks against a non-production copy. Confirm with the vendor and your own configuration how account lockout and session limits behave before testing begins.

Record evidence without copying PHI

Findings reports should show the endpoint, the request pattern and the field or screen affected, not the patient content returned. Ask testers to redact identifiers in screenshots and proof-of-concept output, and to reference record IDs in a restricted location instead of pasting them into tickets. Decide who may view unredacted evidence and how long it stays in the tester's tooling.

Coordinate logging and rate limits

Tell the operations team when testing starts and ends, which source addresses and user accounts will be used, and which alerts are expected. Agree in advance whether test traffic is excluded from clinical audit reviews, and make sure those exclusions are recorded so they do not hide real misuse later. Check that the web application firewall and any rate limits are tuned for the test window, and that logs capture test activity clearly enough to separate it from real use.

Treat tester access as a contractor issue

A tester who can reach ePHI is a workforce member or contractor of the covered entity, or a subcontractor of a business associate, and the access must be governed. Under 45 CFR 164.314, a business associate contract must require Security Rule compliance and incident reporting, and flow the same terms to subcontractors that handle ePHI. Confirm the signed agreement, background checks, named accounts and the offboarding steps before any credentials are issued.

Read 164.314 text

How the engagement moves from scope to retest

The engagement starts with a written scope and an asset inventory that lists the portal, FHIR and OAuth2 endpoints, user roles, enabled modules and the hosting layer. A test environment is then prepared with synthetic patient data so that external and authenticated testing never touches live records. Findings are ranked in a report, the client remediates, and each finding is retested before it is closed. Check that the rules of engagement and the data handling terms are signed before the first request is sent.

The phases of a penetration test, from scope agreement to closing each finding after retest.

What findings look like and how to prioritize fixes

How are penetration testing findings rated in an OpenEMR engagement?

Findings are usually rated by severity, combining how easily an attacker could exploit the issue with how much harm it could cause to patient data or availability. The rating method itself, including the scale, the scoring model and who decides borderline cases, should be agreed in the written scope before testing starts, so the report and the retest use the same yardstick. Ask the tester to show a worked example of each rating level and to state how a finding's rating changes once a compensating control is in place, such as a web application firewall or a network restriction.

Why is an internet-exposed OpenEMR patient portal or FHIR endpoint a high-priority finding?

Exposure matters because these endpoints accept requests from anyone who can reach them, so a flaw there may be exploitable without a valid clinical user account. Testers typically check which portal and FHIR paths answer from outside your network, whether authentication is enforced on every route, and whether unauthenticated responses reveal more than they should. Review the portal exposure options in the internet-facing portal topic and confirm which patient and API paths your environment actually publishes before the test.

What does a missing multi-factor authentication finding mean for OpenEMR?

It means one or more accounts, often staff or remote users, can sign in with a password alone. The Securing OpenEMR guidance recommends multi-factor authentication, but MFA is enrolled per user rather than enforced globally, so testers typically list which accounts lack an enrolled factor and which roles can reach sensitive functions. Close the gap through the MFA rollout topic: the MFA rollout topic explains TOTP and U2F enrollment, tracking and policy. Ask the tester to report enrollment coverage by role, not only a yes or no.

How do weak password policy settings show up in a penetration test report?

Typically as a finding that the configured password rules allow short, simple or reused passwords, or that expiration and lockout settings are not in place. OpenEMR 6.0.0 introduced length limits, a rule requiring all four character types, reuse prevention for up to five prior passwords, expiration settings and a choice of Bcrypt, Argon or SHA512 hashing, so the test should compare the live settings in Administration Globals against what your policy requires. Verify the configured values yourself, since a setting that exists in the software is not the same as the setting enforced on your server. Password policy changes are covered in the hardening group's MFA and access controls material.

Why do exposed setup.php and admin scripts appear as findings after installation?

Scripts such as setup.php and other admin scripts are meant for installation and maintenance, and leaving them reachable gives an attacker a route to configuration or upgrade functions. The Securing OpenEMR guidance says to remove setup.php and other admin scripts after installation. Testers usually request these paths directly and record which return content or a response other than a block. Fix them by following the guidance on removing setup and admin scripts, then ask for a retest that confirms each path is blocked, including on multisite or upgraded installs.

What is the risk when the OpenEMR documents directory is reachable from the web?

Patient documents uploaded to OpenEMR could be downloaded by anyone who guesses or discovers their path, which is a direct disclosure of ePHI. The Securing OpenEMR guidance says to block direct web access to sites/*/documents, and to restrict uploads with the upload file whitelist and optional encryption of items stored on drive. Testers typically try to fetch known document paths and check whether directory listings are enabled. Treat any successful retrieval as high severity, and confirm the fix with a retest that uses real upload paths from a test account.

When is unencrypted database traffic a finding, and how is it prioritized?

It is a finding when OpenEMR connects to MySQL or MariaDB over a network path that is not encrypted, especially when the database runs on a separate host or traverses a shared network. Severity depends on the network path: a same-host socket carries less exposure than traffic crossing a subnet or a cloud network boundary. Ask testers to confirm whether the connection is encrypted in transit and whether database accounts follow least privilege. The fix is covered in the topic on encrypting database connections with TLS, and the retest should confirm the encrypted connection rather than only the configuration file.

How should a team use these findings to decide what to fix first?

Start with findings that combine internet exposure, ease of exploitation and access to patient data, then move to hardening items that reduce exposure across many routes. Prioritize by exploitability and impact, and treat anything that gives unauthenticated access to records or documents as urgent. Ask the tester for a remediation order that groups fixes by owner, such as web server, application configuration or identity, and for a retest plan covering each fix. Costs depend on how many findings need code changes versus configuration changes, and on whether your team or a partner performs the retest, so request the retest scope and fee structure in the written quote.

Security and operational considerations during testing

Testing a live clinical system can disrupt the people it serves as easily as it finds flaws in it. The cards below cover the operational risks that connect scan timing, account handling, logging, patch readiness and upgrade sequencing, and what to agree with the tester before any traffic is sent.

Service availability during scans

Active scanning and fuzzing of the portal, FHIR and OAuth2 endpoints can slow or lock up the application and its database, which clinicians feel as slow charting or failed orders. Agree in writing which hosts may be tested, the rate limits the tester will use, and the time windows when load testing is allowed. Confirm that a named person on your side can stop testing immediately and that the tester has a documented way to halt.

Account lockout effects on clinicians

Credential guessing and lockout testing can lock out real clinicians, including those on call or at the point of care. Ask the tester to use dedicated test accounts with roles that mirror production, and confirm how your lockout and password expiration settings behave so test traffic cannot reach clinical accounts. Decide in advance who resets accounts if a lockout happens during testing.

Log volume and alerting

Test traffic produces a burst of authentication failures, 4xx and 5xx responses and unusual API calls that can trip your SIEM, WAF and on-call alerts. Tell your security operations team the test window, source addresses and test account names before testing starts, and agree how the tester's activity will be tagged. Keep the test logs, since they are the baseline you will need when you later check for real exploitation.

Handling patient data during testing

Testers who reach records containing real patient information create a privacy incident risk of their own. Prefer a staging copy populated with synthetic data, and if production testing is unavoidable, agree on access limits, screenshots and evidence handling, and how any PHI the tester sees is reported and destroyed. Confirm that your business associate terms cover the tester, since the HIPAA Security Rule reaches business associates for all ePHI they handle.

Patching quickly after advisories

Security fixes for FHIR APIs, the patient portal, billing, the fax and SMS module and the fee sheet shipped in OpenEMR 8.3.0 and 8.4.0, so a test run against an older build can report issues that are already fixed upstream. Before testing, confirm the exact version and module set in use, apply the security releases you have not yet deployed, and tell the tester which build is in scope. Otherwise findings may be duplicates or out of date.

Latest release noted
8.4.1
OpenEMR releases

Timing tests around upgrades

Testing during an upgrade window mixes database migrations, PHP changes and half-configured modules, and makes findings hard to attribute. Schedule the test after the upgrade is verified and before the next change freeze, and keep a tested rollback point, such as a database backup and a snapshot of the application files. Retest after each fix lands, so the retest confirms the patch on the build clinicians actually use.

Questions buyers ask before hiring a penetration tester for OpenEMR

What drives the cost of a penetration test for OpenEMR?

The main cost driver is the size of the scope: how many application areas, user roles, modules, environments and infrastructure components the tester must cover. A test of a single internal instance with two roles costs less effort than a test that covers the patient portal, FHIR and OAuth2 endpoints, billing and the fax and SMS module across production and staging with four or more roles. Ask each vendor to price these items separately: web application testing, API testing (including the FHIR endpoints), authenticated testing per role, infrastructure and network testing, and retest rounds. Cost is mostly one-time for the test itself and recurs only if you buy periodic tests or a retainer. Request a written scope before comparing quotes, because two quotes that look similar may cover different surfaces.

How long does an OpenEMR penetration test take?

Duration depends on the same factors as cost: scope size, the number of roles and modules, how many environments are tested, how quickly test accounts and architecture documents are provided, and how many retest rounds follow. A tightly bounded scope on a single environment finishes faster than a multi-environment test with authenticated testing for each role. Ask the provider to state the duration for each phase in the written proposal (scoping, testing, reporting and retest) and to list which dependencies on your side could extend it. Schedule the test around your release and upgrade calendar so that a security release landing mid-test does not force a rescope.

What must our team provide before a penetration test starts?

Most delays come from missing inputs, so prepare them before the kickoff. Typical requirements include:

  • Test accounts for each user role in scope (for example, front desk, clinician, billing, administrator and patient portal user), with MFA enrollment handled in advance.
  • An architecture overview covering web servers, PHP and database hosts, Docker or Kubernetes components, load balancers, WAF and any OAuth2 or SSO identity provider.
  • Defined change windows, named contacts for emergencies and a rule for stopping tests.
  • Access to a non-production copy of OpenEMR with synthetic or de-identified data, plus a documented plan for any production testing.
  • Written authorization covering the systems, IP ranges and domains in scope.

Confirm with the provider exactly which of these they need and in what form.

Can our own security team run the penetration test instead?

Yes, an internal team can test an OpenEMR deployment, but the decision turns on skills, independence and evidence. Testers need experience with PHP web applications, authenticated testing across roles, API testing against FHIR and OAuth2 flows, and infrastructure testing. Many organizations use an internal team for continuous or routine checks and an external firm for a periodic test whose findings go to auditors, a board or a regulator, because external reports are easier to present as independent. Whoever tests, agree on rules for handling real patient data, document the method and keep findings in a tracked register. Ask any external provider to show how they tested similar healthcare systems without exposing patient records.

Does a penetration test make our OpenEMR deployment HIPAA compliant?

No. There is no HIPAA certification, and a penetration test does not make a deployment compliant. HHS states that no Security Rule standard requires an entity to certify compliance and that HHS does not endorse or recognize private certifications, which also do not prevent HHS from later finding a violation (HHS FAQ 2003). A penetration test is one piece of evidence that supports a risk analysis and technical safeguard review under 45 CFR 164.312, which covers areas such as access control, audit controls and transmission security. Covered entities and business associates remain responsible for their own risk analysis and documentation. Ask providers to describe their report as technical findings mapped to your controls, not as a compliance attestation.

How is retesting scoped after fixes are applied?

Retesting checks whether each reported finding is closed and whether the fix introduced new problems. A well-scoped retest lists every finding by identifier, states the environment and build used for the retest, and defines what evidence closes a finding, such as a repeated exploit attempt that now fails or a configuration change verified on the running system. Agree in advance how many retest rounds are included in the fixed fee, how long you have to submit fixes and whether retests cover only high and critical findings or the full list. Retesting after an OpenEMR upgrade or security release is a separate scope item, because a new version can change the code paths a finding relied on.

What should a penetration test report for OpenEMR include?

A useful report separates the executive summary from the technical detail. It should list each finding with severity, affected component (portal, FHIR endpoint, OAuth2 client, module, server configuration), reproduction steps, evidence, business impact on clinical and billing workflows, and a specific remediation. It should also state what was in scope, what was out of scope, the test accounts and roles used, and any testing limitations. Ask whether the report includes a retest and how the findings are delivered, since engineers will need the exact steps to fix and verify issues.

How DeployOpen scopes, tests and retests OpenEMR

DeployOpen approaches a penetration test of OpenEMR as a fixed-scope engagement agreed in writing before any testing starts. The work runs against your own self-hosted OpenEMR in your infrastructure, with attention to the portal, FHIR and OAuth2 endpoints, user roles and modules that are specific to this platform.

How we scope

  • Written scope names the OpenEMR version, portal, FHIR and OAuth2 endpoints, roles, modules and hosts in the test.
  • Scope records which test accounts, patient data handling rules and testing windows apply before any traffic is sent.
  • Engagements are fixed-scope, and the written scope sets deliverables and timelines for the penetration test.

How we test

  • Testers probe the patient portal, FHIR API and OAuth2 flows for authorization gaps across roles and granular scopes.
  • Infrastructure review covers HTTP exposure, the documents directory, setup and admin scripts, and database access paths.
  • Testing with patient data follows agreed rules, using seeded or de-identified records wherever the scope allows.

How we hand over

  • Findings report lists each issue with affected components, evidence, severity and a specific fix for your team.
  • Fix guidance covers OpenEMR configuration, web server settings and code changes, with the version each fix targets.
  • A retest after your fixes confirms which findings are closed and records any that remain open.

How we support

  • Retests can follow each OpenEMR security release so new portal, FHIR and module changes are checked against earlier findings.
  • Ongoing support and continuous testing are available as a retainer after the initial engagement closes.
  • Ask for the written scope, deliverable list and retest terms in your quote before committing to the engagement.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.