# CVE-2023-23939: Azure/setup-kubectl: Escalation of privilege vulnerability for v3 and lower

> Insecure file permissions in Azure setup-kubectl allow local attackers to replace the binary, leading to privilege escalation on the runner.

- **Severity:** Low 3.9 (`CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Mar 2023
- **Updated:** 25 Feb 2025
- **Also known as:** GHSA-p756-rfxh-x63h

## What is CVE-2023-23939?

CVE-2023-23939 is a low-severity vulnerability in Azure setup-kubectl, published on 6 Mar 2023. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

Azure/setup-kubectl is a GitHub Action for installing Kubectl. This vulnerability only impacts versions before version 3. An insecure temporary creation of a file allows other actors on the Actions runner to replace the Kubectl binary created by this action because it is world writable. This Kubectl tool installer runs `fs.chmodSync(kubectlPath, 777)` to set permissions on the Kubectl binary, however, this allows any local user to replace the Kubectl binary. This allows privilege escalation to the user that can also run kubectl, most likely root. This attack is only possible if an attacker somehow breached the GitHub actions runner or if a user is utilizing an Action that maliciously executes this attack. This has been fixed and released in all versions `v3` and later. 775 permissions are used instead. Users are advised to upgrade. There are no known workarounds for this issue.

Weakness: CWE-732 (Incorrect Permission Assignment for Critical Resource)

## Which versions are affected by CVE-2023-23939?

1 open source package ship an affected version, including Azure/setup-kubectl. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `Azure/setup-kubectl` | GitHub Actions | All versions | 3 |

Products: Microsoft Azure Setup Kubectl.

## How do I fix CVE-2023-23939?

Upgrade Azure/setup-kubectl to 3 or later.

## Is CVE-2023-23939 being exploited?

There is no known exploitation of CVE-2023-23939 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-23939 and fix it if it is affected.

What it is: CVE-2023-23939 is a low-severity vulnerability in Azure setup-kubectl, published on 6 Mar 2023. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-23939 in the wild and no public exploit code.

Affected packages and fixed versions:
- Azure/setup-kubectl (GitHub Actions): affected all versions; fixed in 3

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-23939/ (Markdown: https://insights.sbomify.com/CVE-2023-23939/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-23939
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-23939
- OSV: https://osv.dev/vulnerability/CVE-2023-23939

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-23939/
Summaries are generated and may contain mistakes; the official description above is the record.
