# CVE-2023-34457: MechanicalSoup vulnerable to malicious web server reading arbitrary files on client using file input inside HTML form

> A malicious web server can read arbitrary files on the client by exploiting file input fields in HTML forms during automated interactions.

- **Severity:** Medium 5.9 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/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:** 5 Jul 2023
- **Updated:** 13 Feb 2025
- **Also known as:** DEBIAN-CVE-2023-34457, GHSA-x456-3ccm-m6j4, PYSEC-2023-108, UBUNTU-CVE-2023-34457, openSUSE-SU-2024:13499-1, openSUSE-SU-2026:11993-1

## What is CVE-2023-34457?

CVE-2023-34457 is a medium-severity vulnerability in MechanicalSoup, published on 5 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

MechanicalSoup is a Python library for automating interaction with websites. Starting in version 0.2.0 and prior to version 1.3.0, a malicious web server can read arbitrary files on the client using a `<input type="file" ...>` inside HTML form. All users of MechanicalSoup's form submission are affected, unless they took very specific (and manual) steps to reset HTML form field values. Version 1.3.0 contains a patch for this issue.

Weakness: CWE-20 (Improper Input Validation)

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

3 open source packages ship an affected version, including mechanicalsoup and MechanicalSoup. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mechanicalsoup` | PyPI | All versions | 1.3.0 |
| `mechanicalsoup` | PyPI | From 0.2.0 | 1.3.0 |
| `MechanicalSoup` | PyPI | From 0.2.0 | 1.3.0 |
| `python-MechanicalSoup` | openSUSE:Tumbleweed | All versions | 1.4.0-2.4 |

Products: Mechanicalsoup Project Mechanicalsoup.

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

Upgrade mechanicalsoup to 1.3.0 or later.

## Is CVE-2023-34457 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-34457 exists.

## Fix prompt for AI coding agents

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

What it is: CVE-2023-34457 is a medium-severity vulnerability in MechanicalSoup, published on 5 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-34457 exists.

Affected packages and fixed versions:
- mechanicalsoup (PyPI): affected all versions; fixed in 1.3.0
- mechanicalsoup (PyPI): affected from 0.2.0; fixed in 1.3.0
- MechanicalSoup (PyPI): affected from 0.2.0; fixed in 1.3.0

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

## Sources

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

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