Miggo Logo

CVE-2025-7195: operator-sdk: privilege escalation due to incorrect permissions of /etc/passwd

5.2

CVSS Score
3.1

Basic Information

EPSS Score
-
Published
8/7/2025
Updated
8/7/2025
KEV Status
No
Technology
TechnologyGo

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:L/I:H/A:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
github.com/operator-framework/operator-sdkgo< 0.15.20.15.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability lies in the scripts generated by the operator-sdk for use in container images, not in a runtime function of the SDK itself. The root cause is the user_setup script, which is executed during the container image build process. This script insecurely sets the permissions of the /etc/passwd file to be group-writable by the root group (chmod g+rw /etc/passwd).

The analysis of the patch commit d2205b9df5d509f23aaa417d6369620fc2915168 confirms this. The commit removes the chmod g+rw /etc/passwd command from the userSetupTmpl template variable in internal/scaffold/usersetup.go, internal/scaffold/ansible/usersetup.go, and internal/scaffold/helm/usersetup.go. The Go functions that use these templates to generate the vulnerable scripts are identified as UserSetup.GetInput in their respective packages. Although these functions themselves are not executing the vulnerable command, they are responsible for creating the script that does.

Additionally, the entrypoint scripts generated by Entrypoint.GetInput functions were modified to remove logic that wrote to /etc/passwd. While not the primary cause, this logic took advantage of the weak permissions and was removed as part of the mitigation. An attacker with shell access to a container built with a vulnerable operator could exploit this by modifying /etc/passwd to add a new user with UID 0, gaining root privileges within the container. Therefore, the identified functions are the sources of the vulnerability, as they generate the insecure scripts.

Vulnerable functions

UserSetup.GetInput
internal/scaffold/ansible/usersetup.go
This function generates a 'user_setup' script for Ansible-based operators. The script, prior to the patch, contained the command 'chmod g+rw /etc/passwd', which sets group-writable permissions on the /etc/passwd file. This allows a non-root user in the root group to modify the file and escalate privileges within the container.
UserSetup.GetInput
internal/scaffold/helm/usersetup.go
This function generates a 'user_setup' script for Helm-based operators. The script, prior to the patch, contained the command 'chmod g+rw /etc/passwd', which sets group-writable permissions on the /etc/passwd file. This allows a non-root user in the root group to modify the file and escalate privileges within the container.
UserSetup.GetInput
internal/scaffold/usersetup.go
This function generates a generic 'user_setup' script for Go-based operators. The script, prior to the patch, contained the command 'chmod g+rw /etc/passwd', which sets group-writable permissions on the /etc/passwd file. This allows a non-root user in the root group to modify the file and escalate privileges within the container.
Entrypoint.GetInput
internal/scaffold/ansible/entrypoint.go
This function generates the entrypoint script for Ansible-based operators. The script contained logic to write to the /etc/passwd file. This logic, combined with the insecure permissions set by the 'user_setup' script, contributes to the vulnerability. The patch removes this logic as part of the fix.
Entrypoint.GetInput
internal/scaffold/helm/entrypoint.go
This function generates the entrypoint script for Helm-based operators. The script contained logic to write to the /etc/passwd file. This logic, combined with the insecure permissions set by the 'user_setup' script, contributes to the vulnerability. The patch removes this logic as part of the fix.
Entrypoint.GetInput
internal/scaffold/entrypoint.go
This function generates the entrypoint script for Go-based operators. The script contained logic to write to the /etc/passwd file. This logic, combined with the insecure permissions set by the 'user_setup' script, contributes to the vulnerability. The patch removes this logic as part of the fix.

WAF Protection Rules

WAF Rule

**rly v*rsions o* Op*r*tor-S*K provi*** *n ins**ur* m*t*o* to *llow op*r*tor *ont*in*rs to run in *nvironm*nts t**t us** * r*n*om UI*. Op*r*tor-S*K ***or* *.**.* provi*** * s*ript, us*r_s*tup, w*i** mo*i*i*s t** p*rmissions o* t** /*t*/p*ssw* *il* to

Reasoning

T** vuln*r**ility li*s in t** s*ripts **n*r*t** *y t** `op*r*tor-s*k` *or us* in *ont*in*r im***s, not in * runtim* *un*tion o* t** S*K its*l*. T** root **us* is t** `us*r_s*tup` s*ript, w*i** is *x**ut** *urin* t** *ont*in*r im*** *uil* pro**ss. T*i