Executive brief
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.
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://jivasecurity.com/writeups/frontaccounting-rce-attachment-upload-cve-2026-40521
- https://sourceforge.net/p/frontaccounting/news/2026/04/release-2420/
- https://www.vulncheck.com/advisories/frontaccounting-path-traversal-rce-via-attachment-upload