Overview: Three Approaches to Password-Protected HMI Buttons
Accidental presses on critical HMI buttons (Reset, Delete Recipe, Force, Override, Clear Alarm Log, Manual Mode toggle) are among the top causes of unplanned downtime on packaged lines, water utilities, and skid-mounted process units. The HMI is the operator's primary surface, so guarding those buttons at the HMI layer is a legitimate engineering choice that does not require modifying PLC logic. Siemens WinCC offers three independent mechanisms to gate a button behind a credential, and they can be combined.
| Mechanism | Where it applies | Credential stored where | Strength |
|---|---|---|---|
C / VBScript on OperatorControlEnable (or TIA Enabled property) |
WinCC V7.x, WinCC Professional (TIA) up to V17, WinCC Comfort/Advanced | Internal text tag only (not a user account) | Low–Medium; soft deterrent against casual mis-tap |
| User Administration with Authorization levels | WinCC V7.x, WinCC RT Professional, WinCC Unified | WinCC User Administrator database (SIMATIC Logon optionally) | Medium; per-user audit trail, password rotation |
| Confirmation Popup (Are you sure? with optional re-auth) | All WinCC editions | None (just a tap-and-hold) | Low; pure ergonomic guard against muscle-memory presses |
Choosing between these is not a stylistic decision; it is a security decision. A shared "abcd" string on an internal tag is suitable for a brownfield retrofit where the audit team will never review HMI logs. A bound operator account under SIMATIC Logon with a per-tag Operator event in the audit trail is required by most ISA-99/IEC 62443 zone-conduit audits on pharmaceutical or Tier-1 automotive lines.
Prerequisites and Planning
Before writing any C script or configuring users, decide three things on paper:
- What is the blast radius? A Reset of a counter is recoverable; a Force of a motor starter or a Clear of the alarm archive is not. Tag the buttons by risk class: R1 (cosmetic), R2 (loss of recipe), R3 (loss of production state), R4 (safety or regulatory). Only R3+ should require a credential; R1 should rely on the popup guard only.
-
Who must be able to perform the action? Map an Authorization name (e.g.,
Process.Reset,Maintenance.Force) before you start clicking in the User Administration dialog. Renaming an authorization later breaks every screen that references it because the string is stored in the picture, not as a symbol. - How long is the session valid? WinCC V7's Logoff time field (under User Administration > Properties) defaults to 30 minutes; WinCC Unified supports per-client idle timeouts in the project settings. Decide whether the operator stays logged in for the shift or must re-authenticate per button.
Method 1 — WinCC V7 C Script on Operator-Control Enable
This is the original mechanism and is still the fastest path on a brownfield V7.x system that does not use User Administration. It does not require any project license beyond the base WinCC RT.
Step 1: Create the internal password tag
- Open the Tag Management editor.
- Right-click and select Add new tag.
- Set Name to a project-specific value, for example
Tag_Password_Reset. Do not reuse a tag name from another screen; the C script uses a string literal and a typo is silent. - Set Data type to Text tag, 8-bit character set with length 16. Do not use Text tag, 16-bit character set unless your panel firmware is Unicode-only; older Runtime versions return garbage from
GetTagCharon a 16-bit tag without a leading BOM check. - Under Properties > Limits/Reports, leave the start value empty so the field reads blank at runtime rather than "0".
Step 2: Add the password input I/O field
- From the Standard palette, drop an I/O Field on the screen.
- Configure the Output/Input property to point to the tag created in Step 1.
- Set Data format to String; tick Password input (the eye icon) so the field renders dots instead of plaintext at runtime.
- Place a static text label "Maintenance Password" above the field; do not embed the label in the field itself, because touch recalibration on 4:3 panels can clip trailing characters.
Step 3: Bind the C script to the button
Select the Reset button. In the Properties pane, right-click Operator-Control Enable (German: Bedienbarkeit) and choose C action. Paste the following script. Adjust the literal password and tag name to match your project.
#include "apdefap.h"
BOOL _main(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
/* Read current password entry. GetTagChar returns the runtime
value of a text tag as a char* terminated by '\0'. */
char* szPwd = GetTagChar("Tag_Password_Reset");
/* Constant-time compare is not required because the input field
is local and the attacker has no oracle. Use strcmp. */
if (szPwd != NULL && strcmp(szPwd, "R3set!2025") == 0)
{
/* Return value 1 = property TRUE = button enabled. */
return 1;
}
else
{
return 0;
}
}
Tag_Password_Reset with a 2-second cyclic update. Without a trigger, the script fires only on picture-open, and the button stays disabled until the operator navigates away and back.Step 4: Clear the field after use
On the same Reset button, add an event on Mouse click > Press (left):
#include "apdefap.h"
void _main(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
/* Wipe credential from memory immediately after the action. */
SetTagChar("Tag_Password_Reset", "");
}
Without this line, the button remains enabled for the rest of the picture-open session because the script's return value only re-evaluates when its trigger fires. A second operator walking up to the same panel within the trigger interval can re-press Reset without re-entering the password.
Method 2 — TIA Portal User Administration with Authorizations
The script-based guard is a soft deterrent. The proper mechanism in WinCC RT Professional (TIA Portal) is the User Administration editor combined with per-button Authorization strings. Every user belongs to a group, every group owns a fixed set of authorizations, and a button's Authorization property is a semicolon-separated list of authorization names.
Step 1: Define authorizations in the User Administration editor
- In the TIA Portal project tree, expand Runtime settings > User administration.
- Open the Authorizations tab.
- Click Add and enter an authorization name. Use a dotted namespace so a search/replace cannot accidentally rename a sibling right:
Process.Reset,Process.Force,Maintenance.ClearArchive. Authorization names are case-sensitive on the runtime side. - Each authorization row exposes a configurable Authorization number (0–999). Set them with gaps (
10,20,30) so a future authorization can be inserted without renumbering the existing range.
Step 2: Create the user group and assign the authorization
- Switch to the User groups tab.
- Add a group (e.g., Maintenance) and tick the Process.Reset checkbox in the authorization matrix.
- Add a sibling group Operator with no Process.* authorizations; operators see the button but it renders grayed out.
Step 3: Add individual users
- Switch to the Users tab.
- Add a user, set a password (minimum 8 characters; TIA Portal rejects shorter passwords on the Password field at compile time when the policy is enabled).
- Assign the user to the Maintenance group.
- Set Logoff time to 600 seconds for a typical shift handoff policy, or 0 for shift-persistent login.
Step 4: Bind the authorization to the button
- Select the Reset button in the HMI screen.
- In Properties > Miscellaneous, find Authorization.
- Type
Process.Reset. Multiple authorizations can be combined with semicolons:Process.Reset; Maintenance.ClearArchive— the user must have all of them to operate the button. - Compile and download the HMI station.
At runtime, an unauthenticated user sees the button greyed out. A logged-in user without the authorization also sees it greyed out. A user in the Maintenance group sees the button live, and the action is recorded in the WinCC alarm/audit log with the username.
Method 3 — WinCC Unified User Management
WinCC Unified (TIA Portal V17 and later, Unified Comfort Panels V18+) uses a different security model with two authentication surfaces:
- UMC (User Management Component) for local user administration, used for the HMI runtime.
- WinCC Unified Certificate Manager for the certificate authority that secures the Unified Runtime HTTPS channel and the OpenSSL-based user authentication tokens.
The certificate authority itself is protected with a CA password. As documented in the TIA Portal V21 update notes for WinCC Unified Certificate Manager, the CA password is requested on the first start of the runtime and on every certificate renewal. Losing the CA password requires regenerating the entire Unified PC's certificate trust chain — there is no recovery path.
Step 1: Configure UMC users
- In the TIA Portal project tree, select the Unified PC or Unified Comfort Panel.
- Open Runtime settings > User management.
- Create a role (e.g., Maintenance) and tick the function rights relevant to the reset button (typically Operate plus the specific control rights for the screen).
- Add a user, assign the role, set a password with the project's password policy (default policy: minimum 8 chars, 1 digit, 1 special).
Step 2: Use the function right on the button
Unified buttons expose a Function right property in the Properties pane under Security. Select the Maintenance role from the dropdown. The button renders disabled when the active session lacks the right.
Step 3: Configure the Certificate Manager
- On the Unified PC, launch WinCC Unified Certificate Manager from the start menu.
- Create a Certificate Authority; you will be prompted for the CA password. Use a 16+ character passphrase and store it in the site password vault, not on the engineering workstation.
- Issue device certificates for each Unified client and Unified Panel. The CA password is required to sign each certificate.
Method 4 — Confirmation Popup as a Secondary Guard
Even with a credential check, a mis-tap on a touch panel with a stuck operator glove is realistic. Layer a popup on top of every R3+ action:
- Create a separate picture (e.g.,
POP_ConfirmReset.pdl) containing two buttons: Confirm and Cancel. - On the Reset button's Click event, call
OpenPictureInPopup(WinCC V7) or the equivalent Unified JavaScriptUI.OpenPopup(). - The popup's Confirm button performs the actual reset and closes itself; Cancel just closes.
Forcing both the popup and the credential is the configuration used on most skid packages in regulated industries. The popup costs nothing, the credential makes the popup less annoying because only authorized staff ever see it.
Comparison Matrix: V7 Script vs TIA User Administration vs Unified
| Criterion | WinCC V7 C Script | TIA RT Professional User Admin | WinCC Unified UMC |
|---|---|---|---|
| Minimum TIA/WinCC version | WinCC V7.0 SP3 or later | TIA Portal V13 SP1 + WinCC RT Professional V13 SP1 | TIA Portal V17 + WinCC Unified V17 |
| Credential storage | None (literal in script) | UserDB file (obfuscated) | UMC database (hashed) + optional AD via SIMATIC Logon |
| Per-user audit trail | No | Yes, in WinCC alarm/audit log | Yes, in Unified audit log |
| Password rotation policy | Manual edit of script literal | Per-user; enforced on login | Per-user; enforced on login; policy configurable |
| Offline behavior (HMI <-> PLC link down) | Works (purely local) | Works (cached credentials until expiry) | Works (cached credentials with reduced session timeout) |
| Multi-user concurrent | N/A (one credential per panel) | Supported via SIMATIC Logon central | Supported via UMC and SIMATIC Logon central |
| Typical use case | Brownfield retrofit, single shared password | Site-wide role-based access, audit-mandated | Greenfield Unified PC/Comfort panels, AD-integrated |
End-to-End Walkthrough: Password-Protecting a Reset Counter Button
This walkthrough ties the previous sections together on a WinCC RT Professional V17 project.
-
Identify the tag. Reset clears the counter at PLC address
DB100.DBD0. The HMI tag isHMI_Counter_Reject, type DInt. -
Define the authorization. In TIA > Runtime settings > User administration > Authorizations, add
Quality.Resetwith number 50. - Create the group. Add group Quality Lead, tick Quality.Reset.
-
Create the user. Add user jdoe, password
Qwerty!2025, assign to Quality Lead, logoff time 900 s. -
Bind the authorization. Select the Reset button. In Properties > Miscellaneous > Authorization, enter
Quality.Reset. -
Add the popup guard. In Events > Click, add a OpenPopup function call to
POP_ConfirmReset. - Compile and download the HMI station.
- Test: Log in as operator (no group) — button greyed. Log out. Log in as jdoe — button live. Click — popup opens. Confirm — counter resets to 0 and popup closes.
Verification and Commissioning
Acceptance testing should cover four scenarios:
| Scenario | Expected behavior | Verification method |
|---|---|---|
| No user logged in | Button greyed, tooltip reads "No authorization" | Boot HMI, do not log in, attempt press |
| Operator logged in (no Process.Reset) | Button greyed | Log in as operator, attempt press |
| Maintenance logged in (Process.Reset) | Button live, popup opens, reset works | Log in as jdoe, confirm popup, observe counter = 0 |
| Maintenance logged in, cancels popup | Counter unchanged | Log in as jdoe, click Reset, click Cancel in popup, observe counter unchanged |
| PLC link down during authorized press | Popup still opens; reset fails gracefully with system alarm "Connection to PLC interrupted" | Disconnect Ethernet cable, repeat maintenance flow |
Capture screenshots of each scenario for the site's Factory Acceptance Test (FAT) report. On WinCC Unified, additionally verify the audit log entry shows the username and the timestamp in ISO-8601 UTC; this is the artifact the audit team will request.
Troubleshooting Matrix
| Symptom | Likely cause | Fix |
|---|---|---|
| Button never enables despite correct password (V7 script) | C action has no trigger; script runs only on picture load | Right-click the C action > Trigger > tag-change of Tag_Password_Reset, 2 s cyclic fallback |
| Button always enabled regardless of password | Tag spelled incorrectly in GetTagChar literal; NULL returned and strcmp skips; or the trigger never fires |
Verify tag name in Tag Management matches the script exactly, including case; check the tag is internal (not external/PLC) so it can be written from the HMI |
| Password field accepts more than 16 chars, script ignores extras | Tag length set to 16 but I/O field Max length property is 32 | Match Max length on the I/O field to the tag's length property |
| TIA Portal: Authorization field is greyed out | The button is on a Global Screen (faceplate) and the authorization must be set on the screen-level instance, not the faceplate template | Set authorization on the screen that contains the button instance, or use a faceplate interface tag of type Authorization |
| Unified: Password accepted but button still greyed | Function right assigned at role level but the screen-level Operator right not granted | In the role, grant both Operate and the specific control function right |
| Unified: Certificate Manager refuses CA password | Password does not meet the policy configured for the certificate authority | Reset the certificate authority; ensure the CA password meets the configured length and complexity |
| Audit log entry missing | Audit logging not enabled in the runtime settings | Runtime settings > User administration > Settings > tick Log operator actions; restart runtime |
| Performance: HMI lags when entering password | C script is recompiling on every keystroke due to no trigger interval | Configure the trigger on the tag-change event only; remove the 250 ms cyclic fallback if the screen has many guarded buttons |
Security Best Practices and Hardening
- Never hard-code the password as a literal in a production C script. Use the User Administration database. The script method is a maintenance bypass for a brownfield scenario, not a permanent solution.
- Use a 12-character minimum for any password that gates an R4 action. WinCC V7 will accept "abcd" because the field is free-form; there is no built-in complexity check. Enforce complexity externally with a documented policy.
- Wipe the password field after the action (see Method 1, Step 4) so the credential does not linger in HMI memory.
-
Separate the credential surface. On a multi-screen project, do not reuse
TagPasswordfor both Reset and Force; an attacker who reads the V7 project offline can find every guarded action. Use unique tag names per action. - Configure logoff time aggressively. Default 30 minutes is too long for an unattended panel in a public corridor; 5 minutes is the typical pharmaceutical-floor default.
- Audit the audit log. A configured-but-never-reviewed audit log is a worse failure mode than no audit log because it gives a false sense of compliance.
- Disable the diagnostic channel in production. WinCC RT Professional exposes a diagnostic viewer that, when logged in as Administrator, can read the project source and the User Administration database. Restrict the Administrator role to engineering accounts only.
FAQ
Can I password-protect a button in WinCC without touching the PLC program?
Yes. Three options: a C script on the button's Operator-Control Enable property (WinCC V7), a User Administration authorization (TIA RT Professional / Unified), or a confirmation popup. None require PLC code changes; the HMI simply disables or ignores the press when the credential is not satisfied.
What is the difference between the V7 C script method and the User Administration authorization?
The V7 C script compares a literal string against an internal text tag — there is no per-user identity, no audit trail, and no password rotation. The User Administration method assigns each operator a real account tied to a role, produces a per-user audit log entry on every authorized press, and supports password rotation and centralized logon via SIMATIC Logon.
Why does my password button never enable on a WinCC V7 project?
The most common cause is a missing trigger on the C action. Without a trigger on the tag-change event of the password tag (and a 2-second cyclic fallback), the script evaluates only on picture open. Add the trigger via right-click on the C action > Trigger, and verify the tag name matches exactly between Tag Management and the GetTagChar literal.
How do I store the password securely instead of hard-coding "abcd"?
Switch to the User Administration editor and assign each operator a real account. For regulated environments, route authentication through SIMATIC Logon against Active Directory so passwords are not stored in the WinCC project at all. The local UserDB uses reversible obfuscation, not encryption.
Does WinCC Unified support the same C script on Operator-Control Enable?
No. Unified buttons expose a Function right property bound to a UMC role, not a free-form C script. For script-based logic in Unified, use JavaScript inside the Screen > Events pane or in a custom server-side script. The credential comparison should still be against the active UMC session rather than a literal, so the script method is only a fallback on legacy V7 systems.
Where is the WinCC Unified CA password used?
The Certificate Manager uses the CA password to protect the certificate authority that signs every device and client certificate in the Unified Runtime. It is required at CA creation and on every certificate renewal. Losing the CA password forces regeneration of the entire Unified PC's certificate trust chain with no recovery path, so store it in the site password vault.