S7-300 CPU Password: Force Re-Authentication on Every Download
1. Problem Statement
Engineers running production cells with S7-300 (CPU 315-2DP, order number 6ES7315-2AH14-0AB0) or S7-400 (CPU 416) frequently rely on the CPU's built-in password to prevent unauthorized program modification. A common field complaint is:
- An operator or commissioning engineer enters the correct CPU password once during an online download.
- The download proceeds.
- Subsequent online operations (download, upload, monitor with write access) succeed without prompting for the password again, even though the project's HW Config still lists Protection Level 1, 2, or 3.
The password dialog only reappears after the engineer manually clears the access session via Simatic > PLC > Access Right > Cancel. If the engineer forgets to clear it before leaving the workstation, any other person who opens the same STEP 7 project on the same PC can download or modify blocks without re-authentication. The same risk exists if STEP 7 is left running overnight on a shared engineering workstation, or if a contractor uses the same PG login as a process engineer.
This is documented behavior of STEP 7 V5.x, not a defect: the password is bound to the active online session, not to the individual download transaction. Knowing how the protection model is implemented is essential for designing a control system that truly enforces password re-authentication on every download.
2. CPU Protection Levels in STEP 7 V5.x
Every S7-300/S7-400 CPU exposes three discrete protection levels. The setting is stored in the CPU's system data and is configured in HW Config under CPU Properties > Protection.
| Level | Label in HW Config | Read access (monitor, status, upload to PG) | Write access (download, online modify, force outputs) | Typical use |
|---|---|---|---|---|
| 1 | No protection (password-cancelable) | Always allowed | Allowed with one-time password entry; password remains valid until manually cancelled or PG is closed | Open engineering environments, single-engineer maintenance cells, classroom labs |
| 2 | Write protection | Always allowed | Requires valid password on every online write attempt | Production cells where monitoring is free but program changes are gated |
| 3 | Write/Read protection (complete protection) | Requires valid password on every online read | Requires valid password on every online write | IP-protected machines, OEM blocks, contractually restricted sites |
Levels 2 and 3 are the only levels that cause STEP 7 to systematically prompt for the password on every relevant operation. Level 1 is intended for environments where the password is required only to authorize the first download and is then trusted for the rest of the session.
3. Why the Password Dialog Disappears After the First Entry
STEP 7 V5.x maintains an in-memory access token per online connection. The token is created when:
- The password is correctly entered against the CPU.
- The user clicks the checkbox in the password dialog that says "Use the same password for the next online operations" (or its localized equivalent, e.g., "Passwort für weitere Online-Operationen verwenden").
Once the token is active, STEP 7 will not prompt again for the duration of the project session. The token is cleared only by:
- Closing the SIMATIC Manager project.
- Closing SIMATIC Manager entirely.
- Selecting
PLC > Access Rights > Cancel(clears the current PG-side rights for the active online connection). - Restarting the PG.
- CPU restart or memory reset that drops the online connection.
For Level 1 protection, the dialog does reappear after a session is closed or cancelled, but it is the act of closing/cancelling, not the protection level itself, that triggers the prompt. For Levels 2 and 3, the CPU itself refuses to service write (or read) requests without a fresh password, so the PG-side dialog is forced even if the in-memory token would otherwise have allowed the operation.
3.1 Diagnostic buffer entries when protection is active
If the CPU receives an online request that violates the active protection level, it writes a diagnostic buffer entry. The exact text depends on firmware, but the typical entries are:
-
Protection violation - write access denied(Level 2 or 3, write request without password) -
Protection violation - read access denied(Level 3, read request without password) -
CPU password changed(any level, after the password was updated)
These entries are visible in STEP 7 via PLC > Diagnostic/Setting > Diagnostic Buffer. Always read the buffer first when a download fails mysteriously after a protection change.
4. Configuring HW Config for Persistent Re-Authentication
The reliable method to force a password dialog on every download is to use Protection Level 2 or Level 3 in HW Config. The configuration is part of the CPU's system data and travels with the project, so every PG that downloads the project enforces the same policy.
4.1 Procedure (STEP 7 V5.x)
- Open SIMATIC Manager and the project containing the target CPU.
- Expand the station and double-click Hardware to launch HW Config.
- Click the CPU in the rack (slot 2 for S7-300, slot 3 for S7-400) to select it.
- Open Object Properties (double-click the CPU, or right-click > Object Properties).
- Switch to the Protection tab.
- Select Write protection (Level 2) or Write/Read protection (Level 3). For the dialog to appear on every download, choose Level 2; for the dialog to appear on every monitor/upload as well, choose Level 3.
- Enter the CPU password in the Password field and confirm. The password is up to 8 characters, case-sensitive, and ASCII-only.
- Click OK to close the dialog.
- Save and compile HW Config (Station > Save and Compile).
- Download the configuration to the CPU (PLC > Download). The CPU performs a re-initialization if the protection level changed.
Retain in the CPU Properties > Retentivity tab).
4.2 Verifying that the protection level took effect
After the download:
- Open PLC > Accessible Nodes or PLC > Monitor/Modify.
- STEP 7 should now prompt for the password on the very first online operation.
- For Level 2: try PLC > Download. Without re-entering the password, the CPU must reject the operation with diagnostic entry Protection violation - write access denied.
- For Level 3: try PLC > Upload to PG. Without the password, the upload must fail.
4.3 Confirming the configured level on the live CPU
To confirm the live CPU matches the project without re-downloading:
- Go online (
PLC > Connect to Target System > CPU 315-2DPor similar). - Open
PLC > CPU MessagesorPLC > Diagnostic/Setting > Module Information. - Select the Protection tab. STEP 7 displays the currently active protection level and the password status from the CPU's perspective.
If the displayed level does not match the offline project, the system data was not yet downloaded, or a different project was downloaded earlier and overwrote the protection setting.
5. Managing Access Rights in the Active Session
Even with Level 2/3 protection, STEP 7 still caches the password for the duration of the open project. If you want the dialog to appear on the next operation in the same session, force a clearance:
5.1 Clear the access token (PG-side)
- Menu:
Simatic > PLC > Access Right > Cancel. - Alternatively:
PLC > Access Rights > Cancelin the HW Config online view. - The next online operation against the CPU now prompts for the password.
5.2 Scripted logout via SFC / SFB
Some engineering teams prefer to clear the PG access from a button on the HMI. There is no direct SFC that wipes the PG-side access token from inside the user program; the operation is PG-resident. The recommended HMI-side pattern is:
- Operator presses a "Release engineering access" button on the HMI.
- The HMI writes a tag that the PLC user program uses only as a status indicator (e.g., M0.0 "Engineering_LoggedIn").
- The PG engineer must explicitly close the project or run
PLC > Access Rights > Cancelwhen leaving the workstation.
For an automated logout, drive a Windows scheduled task that closes SIMATIC Manager after a configurable idle period; combine this with a Windows workstation lock (Win+L).
Interactive logon: Machine inactivity limit) and a physical key lock on the cabinet containing the programming device.
6. Know-How Protection for FBs and FCs
The CPU-level password controls online access to the CPU as a whole. To protect the intellectual property inside individual blocks, STEP 7 V5.5 and later support know-how protection on FBs and FCs.
6.1 Standard know-how protection
The workflow in STEP 7 V5.x is:
- Open the FB or FC in the LAD/FBD/ST editor.
- Select
File > Know-How Protection > Set(orEdit > Know-How Protection, depending on the editor version). - Enter and confirm a block-specific password (independent of the CPU password, up to 8 characters).
- Save the block.
Once set, the block compiles with an encrypted payload. Online, only the interface (IN, OUT, IN_OUT, STAT, TEMP) is visible; the code section is replaced by a placeholder. Anyone trying to view or edit the code must supply the block password.
6.2 Removing know-how protection
From the Siemens official documentation for removing block know-how protection:
- To remove know-how protection from a single block, open it in the editor, choose
File > Know-How Protection > Remove, and enter the password. - To remove know-how protection from multiple blocks at once in SIMATIC Manager, select the blocks in the block container, right-click >
S7 Block Privacy > Remove Know-How Protection. All selected blocks must share the same password; otherwise the operation aborts with a "Password mismatch" diagnostic.
6.3 S7-Block Privacy (enhanced encryption, STEP 7 V5.5 and later)
From Siemens Knowledge Base article 45632073 - Encrypted block protection for FBs and FCs from STEP 7 V5.5: STEP 7 V5.5 introduced stronger encryption via the add-on S7-Block Privacy. The package must be installed from the STEP 7 DVD (or downloaded from the Siemens support portal). After installation, blocks protected through the S7-Block Privacy menu use a 128-bit algorithm and resist offline brute-force attacks that were feasible against the original know-how protection.
7. Multi-User Scenarios: Admin Write, Guest Read
A common requirement is to allow different Windows users on the same engineering PC to have different privilege levels against the CPU. STEP 7 V5.x does not implement per-Windows-user CPU access. The CPU only knows "a PG with a valid password" versus "a PG without a valid password." Privilege differentiation is therefore done by either CPU-side capabilities, workstation-side controls, or both.
7.1 Multiple CPU passwords on classic S7-300
The classic S7-300 CPU (including 6ES7315-2AH14-0AB0) supports exactly one CPU password. Different users cannot have different passwords against the same CPU without changing the password between shifts, and the password change itself requires the current password (or a memory reset that erases the program).
7.2 Extended access levels on supporting S7-400 CPUs
Higher-end S7-400 CPUs (CPU 41x-2 PN/DP from firmware V6 and later, see the Siemens Industry Online Support portal) support an Access levels extension with up to four authorization levels, each with its own password. Configuring multiple access levels is done in HW Config > Protection > "Extended password protection" (visible only on supporting CPUs). Check the CPU's firmware release notes (Help > About > Firmware in STEP 7) to confirm whether your CPU supports this option.
7.3 Workstation-side mitigation
If the engineering PC must be shared between an admin and a guest user:
- Maintain a single CPU password at the admin level.
- Use Windows user accounts with different privilege for the engineering tools themselves (SIMATIC Manager installation folder, project folder ACLs).
- Educate the guest user: do not enter the CPU password. Use the program in offline mode only, or rely on Level 3 to prevent any read access without the password.
- Forbid the "remember password" checkbox in the STEP 7 dialog for the guest account by deploying a registry key or a wrapper script that always clicks the "Cancel" default button.
8. Verification Procedure
After changing the protection configuration, perform the following test sequence on the bench or in the cabinet:
- Power-cycle or reset the CPU to ensure the new system data is active.
- Open the project in STEP 7.
- Go online (PLC > Connect to Target System).
- Confirm that the password dialog appears.
- Enter the correct password — confirm the download/monitor operation succeeds.
- Re-attempt the same operation immediately, without closing the project — the dialog should not appear (Level 2/3 keeps the password cached for the session).
- Select PLC > Access Rights > Cancel.
- Re-attempt the operation — the dialog must reappear.
- Close SIMATIC Manager and re-open the project.
- Re-attempt the operation — the dialog must reappear.
If step 6 keeps prompting instead of succeeding, the CPU is rejecting the cached password; check that the CPU password in the offline project matches the actual CPU password (HW Config > Protection tab) and that the project has not been silently re-saved with a stale password by a second engineer.
9. Troubleshooting Matrix
| Symptom | Likely cause | Corrective action |
|---|---|---|
| Password dialog never appears | Protection Level 1 with the "remember for session" checkbox enabled | Upgrade HW Config to Level 2 or 3, or always close the project between operators |
| Dialog appears once and never again | PG-side access token cached; CPU level is 1 | Use PLC > Access Rights > Cancel between sessions; switch to Level 2/3 for forced re-auth |
| CPU rejects correct password | Password was changed by another engineer; or CPU firmware reset password to default (e.g., after MRES) | Coordinate password changes; for MRES, the password is cleared, so re-enter from HW Config and re-download |
| Password dialog appears but download fails with SF | CPU is in STOP due to another fault; protection active but operation blocked by SF | Read the diagnostic buffer (PLC > Diagnostic/Setting > Diagnostic Buffer), clear the fault first |
| Know-how-protected block can be opened on one PG but not another | PG without S7-Block Privacy installed (legacy STEP 7 V5.4 or earlier) | Upgrade STEP 7 to V5.5 SP2+ and install S7-Block Privacy |
| Know-how-protected block won't decrypt after a CPU password change | Block password is independent of the CPU password — confusion is common | Verify the block password separately; reset it from the editor or replace the block |
| "Cannot set password" in HW Config | Project folder is read-only or CPU object is locked by another SIMATIC Manager instance | Check Windows ACL on the project folder; close any second SIMATIC Manager instance with the same project |
| Switching from Level 1 to Level 2/3 leaves old behavior | New HW Config not downloaded; CPU still uses old system data | Download HW Config; restart CPU if it does not auto-initialize |
| Diagnostic buffer shows "Protection violation" repeatedly | A background tool (e.g., HMI tag polling, OPC server) is trying to access without the password | Configure the polling tool with valid credentials or downgrade to a level the tool can satisfy |
| PG-side "Cancel Access Rights" has no effect | Online connection to a different CPU was opened after the cancel | Repeat PLC > Access Rights > Cancel against the active online connection, then retry |
10. Operational Checklist
- Define the protection level in the project standard: Level 2 is the recommended baseline for production cells.
- Document the CPU password in a controlled location (plant password vault) and limit distribution.
- Add a "Log out" step to the shift handover procedure:
PLC > Access Rights > Cancel. - Use Windows workstation lock (Win+L) when leaving the desk; combine with an auto-lock policy.
- For IP-sensitive blocks, enable S7-Block Privacy know-how protection in addition to the CPU password.
- Periodically test the protection by attempting an online write from a PG that has not been authenticated — confirm rejection.
- Coordinate password changes between commissioning, operations, and OEMs to avoid forgotten passwords that force a memory reset.
11. Interaction with the Operating Mode Selector
For physical security, the CPU 315-2DP and CPU 416 families include a key-operated mode selector (MRES / STOP / RUN / RUN-P). The selector has a direct relationship with the password:
- RUN-P permits online write access with a valid password.
- RUN blocks online write access regardless of the password (read-only).
- STOP permits password-protected write access but the CPU is not executing OB1.
- MRES performs a memory reset that clears the password to default and erases the user program and data blocks (load memory). Retentive data is preserved only on warm restart; cold restart via MRES wipes all retentive data.
12. Notes on Migrating to TIA Portal
Projects migrated from STEP 7 V5.x to TIA Portal carry the CPU password over, but the access-token behavior differs slightly:
- In TIA Portal, the password is bound to the online connection, not to the project session. Closing the project or going offline clears it automatically.
- Know-how protection in TIA Portal uses a similar but independent mechanism; blocks protected under S7-Block Privacy remain encrypted, and removal requires the block password as documented in the Removing block know-how protection reference.
- Some S7-300 CPUs older than the 6ES7315-2AH14-0AB0 revision may need a firmware update before being recognized by TIA Portal V16+. Always check the device catalog compatibility list in TIA Portal before migration.
- The CPU protection level names change: TIA Portal renames "Write protection" and "Write/Read protection" but the underlying enforcement is identical. The three-level model is preserved.
13. Field-Proven Recommendations
- Adopt Level 2 as the project standard for production S7-300/S7-400 cells; switch to Level 3 only where the OEM contract requires it.
- Store the CPU password in the plant's central credential vault (e.g., CyberArk, BeyondTrust) with audit logging; avoid spreadsheet-based password lists.
- Train every engineer who uses STEP 7 on the
PLC > Access Rights > Cancelstep; treat it as part of "leaving the workstation," like Win+L. - Combine the CPU password with know-how protection on IP-sensitive FBs/FCs through S7-Block Privacy (STEP 7 V5.5+).
- For multi-user engineering PCs, deploy Windows Group Policy to enforce screen lock after 5 minutes idle and to prevent the SIMATIC Manager "remember password" checkbox from being saved by automated installers.
- Test the protection quarterly: from a fresh SIMATIC Manager session with a clean Windows user profile, attempt an unauthorized online operation and confirm rejection.
Why does the password dialog not appear on the second download in STEP 7 V5.x?
STEP 7 V5.x caches the password in an in-memory access token for the duration of the open project. The token survives until you close the project, close SIMATIC Manager, run PLC > Access Rights > Cancel, or restart the PG. To force the dialog on every download, set the CPU to Protection Level 2 (Write protection) or Level 3 (Write/Read protection) in HW Config and download the new configuration; the CPU itself then rejects any write without a fresh password.
How do I configure the CPU 315-2DP to require a password on every download?
Open HW Config, double-click the CPU, go to the Protection tab, select Write protection (Level 2) or Write/Read protection (Level 3), enter and confirm an 8-character case-sensitive password, save and compile HW Config, and download it to the CPU. After the CPU re-initializes, every subsequent download triggers the password dialog.
What is the difference between the CPU password and know-how protection?
The CPU password gates online access to the CPU as a whole (download, upload, monitor, modify). Know-how protection is a per-block mechanism applied inside the STEP 7 editor that encrypts the code section of a specific FB or FC so that the logic cannot be read or modified without the block-specific password. The two passwords are independent and can be different; see Siemens KB 45632073 for the enhanced S7-Block Privacy variant.
Can I have different passwords for an admin and a guest on the same S7-300 CPU?
The classic S7-300 CPU (including 6ES7315-2AH14-0AB0) supports only one CPU password. Some S7-400 CPUs from firmware V6 onward support extended access levels with up to four passwords. Otherwise, enforce the admin/guest separation via Windows user accounts, project-folder ACLs, and the workstation auto-lock policy rather than via the CPU password itself.
What does the S7-Block Privacy add-on do?
S7-Block Privacy is a STEP 7 V5.5 add-on that replaces the legacy know-how protection with 128-bit encrypted block privacy. It is required for strong block-level protection; install it from the STEP 7 DVD or the Siemens Industry Online Support portal before relying on know-how protection for IP-sensitive code.
What happens to the password after a memory reset (MRES)?
A memory reset via the CPU's MRES switch or PLC > Clear/Reset wipes the user program, all data blocks, and resets the CPU password to default (no password). The CPU enters STOP. A full program archive must be re-downloaded, and HW Config must be re-sent to restore the configured protection level and password.