/

CVE-2026-26746

Severity:

HIGH RISK

(8.8)

Local File Inclusion (LFI) in OpenSourcePOS Sales Invoice

CVE-2026-26746

Analyzed

Vulnerability type

Category:

Local File Inclusion (LFI)

CWE:

CWE-434

Impact:

Remote Code Execution via Local File Inclusion

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenSourcePOS 3.4.1 contains a Local File Inclusion (LFI) flaw in the Sales.php::getInvoice() function that allows an attacker to read arbitrary files on the web server by abusing the Invoice Type configuration.

When combined with the application's file upload capabilities, this LFI can be chained to execute attacker-controlled code, resulting in full remote code execution on the server.

Affected context

The vulnerability appears in the invoice generation logic of OpenSourcePOS, specifically within the Sales.php::getInvoice() function.

It manifests when the application derives the invoice template or type from a configurable source without sufficiently constraining which files can be included.

In deployments where users can influence the Invoice Type configuration and where uploadable files end up in web-accessible or includable paths, the risk increases significantly.

The issue becomes especially severe when the same instance also exposes a file upload feature whose outputs can be included by the invoice rendering process.

Exploit preconditions

  • Attack surface: HTTP interface of OpenSourcePOS, particularly endpoints invoking Sales.php::getInvoice().
  • Required access: Ability to manipulate or influence the Invoice Type configuration, potentially via authenticated functionality or misconfigured administrative interfaces.
  • Trigger point: Invocation of the invoice rendering logic (e.g., viewing or generating an invoice) that uses the attacker-controlled Invoice Type to determine which file to include.
  • Why exploitation is possible: The code treats the Invoice Type configuration as a trusted reference to local files without robust validation of allowed paths, extensions, or locations, allowing inclusion of arbitrary server-side files and, when chained with upload, attacker-supplied scripts.

Why this happens

Conceptually, this issue combines elements of Local File Inclusion and unrestricted file handling often associated with CWE-434: Unrestricted Upload of File with Dangerous Type.

The root cause is that the invoice generator uses a configurable value (Invoice Type) to build or select a file path that is subsequently included or executed by the application.

Because this configuration is not tightly constrained (for example, via a strict whitelist of template identifiers mapped to fixed paths), an attacker can steer the inclusion mechanism toward arbitrary local files.

In environments where the application also allows upload of files that can later be included, this unsafe pattern effectively bridges from configuration-controlled inclusion to execution of untrusted uploaded content.

Abstractly, the insecure pattern is: user- or configuration-influenced file selection + insufficient path validation + executable context for included files, which together enable both information disclosure and potential code execution.

Potential impact

  • Read access to sensitive local files (e.g., configuration files, credentials, application source code).
  • Discovery of internal paths, environment details, and application logic that facilitate further attacks.
  • Execution of attacker-controlled code when combined with file upload features and includable upload paths.
  • Full compromise of the web application, including ability to modify data or impersonate users.
  • Use of the compromised server as a pivot point for lateral movement within the hosting environment.

General mitigation guidance

Effective mitigation focuses on removing the ability to arbitrarily control which files the invoice logic includes and reducing trust in uploaded content:

  • Replace dynamic path construction with a strict, hard-coded mapping from logical invoice types to fixed, vetted template files.
  • Enforce allowlists for any file-based template selection, validating against a closed set of identifiers rather than file paths.
  • Ensure uploaded files are stored outside of webroot or any directories from which application templates are loaded, and treat them as data only.
  • Apply least privilege to the application's filesystem access, restricting it to directories that do not contain sensitive or executable resources.
  • Centralize and sanitize configuration handling so that user-accessible configuration values cannot directly influence file paths used in include/require operations.

These patterns reduce both the risk of file inclusion and the ability to escalate inclusion into remote code execution.

How teams detect issues like this

Detection efforts can target both code-level patterns and runtime behavior:

  • Static analysis: Search for file inclusion or template loading functions that use configuration or request-derived variables to build paths without a whitelist or strict validation.
  • Code review: Flag any logic where invoice types, template names, or similar configuration values are directly concatenated into file paths, especially within Sales.php and related controllers.
  • Upload handling review: Identify upload endpoints where stored files reside in directories also used for templates or includes, and verify that upload types are constrained and not executable.
  • Runtime monitoring: Use web application firewalls and logging to detect suspicious path traversal or unexpected template selection patterns in invoice-related requests.

Automated security scanning tools and SAST/IAST products can be configured with rules to highlight dynamic file inclusion and insecure upload-storage intersections.

Sources

SourceLink
github.comgithub.com/hungnqdz/CVE-2026-26746/blob/main/CVE-2026-26746.md
github.comgithub.com/opensourcepos/opensourcepos

Frequently asked

questions

Yes. If an attacker can interact with the invoice functionality and influence the Invoice Type configuration over HTTP, they can remotely trigger LFI. When combined with accessible upload paths, this can extend to remote code execution.

Typically, the attacker needs at least the level of access required to modify or indirectly control the Invoice Type configuration. In some deployments this may be an authenticated user role; in misconfigured setups, it could be exposed more broadly.

Decouple user-controlled or configurable values from file paths entirely. Implement a fixed mapping from logical invoice types to non-user-editable template files stored in a dedicated directory, and ensure uploads cannot be selected or interpreted as templates.

Adopt design rules that prohibit dynamic includes based on user or configuration input, enforce strict upload storage and non-executable treatment of user files, and include checks for dynamic file inclusion and path construction in regular code reviews and automated security testing.

Find out what's already
exploitable in your codebase.