# GHSA-7rq4-qcpw-74gq: Formula Injection in Exported Data

> Attackers can inject malicious formulas into exported CSV/XLS files, potentially executing code when victims open the files in spreadsheet software.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 17 Jun 2022

## What is GHSA-7rq4-qcpw-74gq?

GHSA-7rq4-qcpw-74gq is a vulnerability in inventree, published on 17 Jun 2022. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

### Impact

Datasets exported to file (e.g. CSV / XLS) are not sufficiently sanitized, to neutralize potential formula injection

### Patches

- The issue is addressed in the upcoming 0.8.0 release
- This fix will also be back-ported to the 0.7.x branch, applied to the 0.7.2 release

### Workarounds

Users exporting untrusted data should open the files in safe mode (e.g. in Microsoft Excel).

### References

- https://huntr.dev/bounties/e57c36e7-fa39-435f-944a-3a52ee066f73/
- https://owasp.org/www-community/attacks/CSV_Injection

### For more information

If you have any questions or comments about this advisory:

* Open an issue in [github](http://github.com/inventree/inventree)
* Email us at [security@inventree.org](mailto:security@inventree.org)

## Which versions are affected by GHSA-7rq4-qcpw-74gq?

2 open source packages ship an affected version, including inventree.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `inventree` | PyPI | All versions | 0.7.2 |
| `inventree` | PyPI | All versions | 0.7.2 |

## How do I fix GHSA-7rq4-qcpw-74gq?

Upgrade inventree to 0.7.2 or later.

## Is GHSA-7rq4-qcpw-74gq being exploited?

There is no known exploitation of GHSA-7rq4-qcpw-74gq in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-7rq4-qcpw-74gq and fix it if it is affected.

What it is: GHSA-7rq4-qcpw-74gq is a vulnerability in inventree, published on 17 Jun 2022. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-7rq4-qcpw-74gq in the wild and no public exploit code.

Affected packages and fixed versions:
- inventree (PyPI): affected all versions; fixed in 0.7.2
- inventree (PyPI): affected all versions; fixed in 0.7.2

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/GHSA-7rq4-qcpw-74gq/ (Markdown: https://insights.sbomify.com/GHSA-7rq4-qcpw-74gq/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-7rq4-qcpw-74gq

---
From sbomify Insights: https://insights.sbomify.com/GHSA-7rq4-qcpw-74gq/
Summaries are generated and may contain mistakes; the official description above is the record.
