# CVE-2026-40521: FrontAccounting path traversal and RCE in attachment upload handler

Source: https://junglewise.ai/threats/cve-2026-40521-frontaccounting-path-traversal-and-rce-in-attachment-upload  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-06-29. Updated: 2026-06-29  
License: CC BY 4.0 with a link back

CVE-2026-40521 · Severity: high · CVSS 8.8 · Published 2026-06-29

FrontAccounting, an open-source ERP and accounting system, contains a security flaw in how it handles file attachments. An authorized user, such as an accounting clerk or sub-administrator, can bypass security restrictions to upload malicious files to the web server's core directories. This allows an attacker to take full control of the server, potentially leading to the theft of financial data, service disruption, or a complete system takeover.

Technologies: [FrontAccounting](https://junglewise.ai/threats/technologies/frontaccounting). Vendors: [FrontAccounting](https://junglewise.ai/threats/vendors/frontaccounting).

## Quick answers

**Is CVE-2026-40521 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40521 being exploited in the wild.

**How severe is CVE-2026-40521?** High severity, with a CVSS score of 8.8, published 29 June 2026.

**Which products and versions are affected?** FrontAccounting before 2.4.20.

**Is there a fix for CVE-2026-40521?** A patch was published on 2026-04-24: Fix committed to GitHub repository. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-40521 attacked?** It is attacked over the network, in a network appliance.

**Am I affected by CVE-2026-40521?** Check whether you run FrontAccounting at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

A path traversal vulnerability exists in the 'attachments' class within 'includes/ui/attachment.inc'. The application fails to use 'basename()' or perform extension validation on the 'unique_name' POST parameter before passing it to 'move_uploaded_file()'. While a global 'html_cleanup()' function exists, it uses 'htmlspecialchars()', which does not filter the dots and slashes required for traversal. An authenticated attacker with standard roles (e.g., AP Officer, Accountant) can provide a payload like '../../../shell.php' to write a PHP webshell into the web root. This results in remote code execution as the web server user. The issue is fixed in version 2.4.20.

## Affected products

- FrontAccounting FrontAccounting before 2.4.20

## Timeline

- 2026-04-24: patched: Fix committed to GitHub repository.
- 2026-04-29: advisory: Release 2.4.20 announced on SourceForge.
- 2026-06-29: disclosed: CVE-2026-40521 published.

## References

- [https://github.com/FrontAccountingERP/FA/commit/701fea6848da4a02fb83d30f07a9c0473d6b7e33](https://github.com/FrontAccountingERP/FA/commit/701fea6848da4a02fb83d30f07a9c0473d6b7e33)
- [https://jivasecurity.com/writeups/frontaccounting-rce-attachment-upload-cve-2026-40521](https://jivasecurity.com/writeups/frontaccounting-rce-attachment-upload-cve-2026-40521)
- [https://sourceforge.net/p/frontaccounting/news/2026/04/release-2420/](https://sourceforge.net/p/frontaccounting/news/2026/04/release-2420/)
- [https://www.vulncheck.com/advisories/frontaccounting-path-traversal-rce-via-attachment-upload](https://www.vulncheck.com/advisories/frontaccounting-path-traversal-rce-via-attachment-upload)

## Related threats

- [FrontAccounting weak password hashing with unsalted MD5](https://junglewise.ai/threats/cve-2026-80211-frontaccounting-weak-password-hashing-with-unsalted-md5)
- [FrontAccounting CSRF in financial transaction handlers](https://junglewise.ai/threats/cve-2026-80210-frontaccounting-csrf-in-financial-transaction-handlers)
- [FrontAccounting SQL injection in get_gl_transactions](https://junglewise.ai/threats/cve-2026-40524-frontaccounting-sql-injection-in-get-gl-transactions)
- [FrontAccounting SQL injection in Audit Trail report handler](https://junglewise.ai/threats/cve-2026-40523-frontaccounting-sql-injection-in-audit-trail-report-handler)
- [FrontAccounting SQL injection in Bank Statement report](https://junglewise.ai/threats/cve-2026-40522-frontaccounting-sql-injection-in-bank-statement-report)
