# CVE-2023-31143: Mage terminal user authentication not working properly

> Unauthenticated users can access the terminal in Mage data pipeline tool when authentication is enabled, allowing unauthorized code execution.

- **Severity:** Medium 5.9 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 9 May 2023
- **Updated:** 28 Jan 2025
- **Also known as:** GHSA-c6mm-2g84-v4m7, PYSEC-2023-64

## What is CVE-2023-31143?

CVE-2023-31143 is a medium-severity missing authorization vulnerability in mage-ai, published on 9 May 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

mage-ai is an open-source data pipeline tool for transforming and integrating data. Those who use Mage starting in version 0.8.34 and prior to 0.8.72 with user authentication enabled may be affected by a vulnerability. The terminal could be accessed by users who are not signed in or do not have editor permissions. Version 0.8.72 contains a fix for this issue.

Weakness: CWE-306 (Missing Authentication for Critical Functionality)

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

3 open source packages ship an affected version, including mage-ai. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mage-ai` | PyPI | From 0.8.34 | 0.8.72 |
| `mage-ai` | PyPI | From 0.8.34 | 0.8.72 |
| `mage-ai` | PyPI | From 0.8.34 | 0.8.72 |

Products: Mage Mage-Ai.

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

Upgrade mage-ai to 0.8.72 or later.

## Is CVE-2023-31143 being exploited?

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

## Other vulnerabilities in mage-ai

- [CVE-2024-45187](https://insights.sbomify.com/CVE-2024-45187/): Mage AI allows deleted users to use the terminal server with admin access, leading to remote code execution (high 7.1)
- [CVE-2024-45188](https://insights.sbomify.com/CVE-2024-45188/): Mage AI file content request remote arbitrary file leak (medium 6.5)
- [CVE-2024-45189](https://insights.sbomify.com/CVE-2024-45189/): Mage AI git content request remote arbitrary file leak (medium 6.5)
- [CVE-2024-45190](https://insights.sbomify.com/CVE-2024-45190/): Mage AI pipeline interaction request remote arbitrary file leak (medium 6.5)
- [CVE-2024-8072](https://insights.sbomify.com/CVE-2024-8072/): Mage AI allows remote unauthenticated attackers to leak the terminal server command history of arbitrary users (medium 5.3)

## Fix prompt for AI coding agents

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

What it is: CVE-2023-31143 is a medium-severity missing authorization vulnerability in mage-ai, published on 9 May 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-31143 in the wild and no public exploit code.

Affected packages and fixed versions:
- mage-ai (PyPI): affected from 0.8.34; fixed in 0.8.72
- mage-ai (PyPI): affected from 0.8.34; fixed in 0.8.72
- mage-ai (PyPI): affected from 0.8.34; fixed in 0.8.72

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-31143/ (Markdown: https://insights.sbomify.com/CVE-2023-31143/index.md)
```

## Sources

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

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