# GHSA-29w6-c52g-m8jc: C5 Firefly III CSV Injection.

> Attacker injects malicious formulas into exported CSV files, leading to remote code execution when victims open the file in Excel.

- **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:** 31 Jan 2024

## What is GHSA-29w6-c52g-m8jc?

GHSA-29w6-c52g-m8jc is a code injection vulnerability in grumpydictator/firefly-iii, published on 31 Jan 2024. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

### Summary
CSV injection is a vulnerability where untrusted user input in CSV files can lead to unauthorized access or data manipulation. 
In my subsequent testing of the application.

### Details
I discovered that there is an option to "Export Data" from the web app to your personal computer, which exports a "csv" file that can be opened with Excel software that supports macros.

P.S 
I discovered that the web application's is offering a demo-site that anyone may access to play with the web application. So, there's a chance that someone will export the data (CVS) from the demo site and execute it on their PC, giving the malicious actor a complete control over their machine. (if a user enters a malicious payload to the website).

### PoC
You can check out my vulnerability report if you need more details/PoC with screenshots: (removed by JC5)

### Impact
An attacker can exploit this by entering a specially crafted payload to one of the fields, and when a user export the csv file using the "Export Data" function, the attacker can potentiality can RCE.

### Addendum by JC5, the developer of Firefly III
There is zero impact on normal users, even on vulnerable versions.

## Which versions are affected by GHSA-29w6-c52g-m8jc?

2 open source packages ship an affected version, including grumpydictator/firefly-iii.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `grumpydictator/firefly-iii` | Packagist | All versions | 6.1.7 |
| `grumpydictator/firefly-iii` | Packagist | All versions | 6.1.7 |

## How do I fix GHSA-29w6-c52g-m8jc?

Upgrade grumpydictator/firefly-iii to 6.1.7 or later.

## Is GHSA-29w6-c52g-m8jc being exploited?

There is no known exploitation of GHSA-29w6-c52g-m8jc in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-29w6-c52g-m8jc and fix it if it is affected.

What it is: GHSA-29w6-c52g-m8jc is a code injection vulnerability in grumpydictator/firefly-iii, published on 31 Jan 2024. 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-29w6-c52g-m8jc in the wild and no public exploit code.

Affected packages and fixed versions:
- grumpydictator/firefly-iii (Packagist): affected all versions; fixed in 6.1.7
- grumpydictator/firefly-iii (Packagist): affected all versions; fixed in 6.1.7

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-29w6-c52g-m8jc/ (Markdown: https://insights.sbomify.com/GHSA-29w6-c52g-m8jc/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-29w6-c52g-m8jc

---
From sbomify Insights: https://insights.sbomify.com/GHSA-29w6-c52g-m8jc/
Summaries are generated and may contain mistakes; the official description above is the record.
