/

CVE-2026-81730

Severity:

HIGH RISK

(8.2)

Path Traversal (CWE-22) in Dolibarr EmailCollector

CVE-2026-81730

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write

Severity:

HIGH RISK

(8.2)

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

Dolibarr EmailCollector may use attacker-controlled MIME attachment names as filesystem paths without reducing them to safe basenames. If an attacker can send mail to a monitored mailbox, they may write attachment content outside the intended object directory, potentially affecting documents or reaching web-executable locations where the installation permits it.

Affected context

The vulnerability occurs in Dolibarr EmailCollector workflows that automatically save inbound email attachments. It becomes risky when attachment names are derived from MIME metadata and passed to filesystem-write operations without canonicalization, basename enforcement, or equivalent path containment checks. The ultimate impact depends on filesystem permissions, whether the documents tree is writable, and whether web-served directories are writable and executable.

Exploit preconditions

  • Attack surface: An EmailCollector-monitored mailbox and its attachment-processing workflows
  • Required access: Ability to send an email accepted by the monitored mailbox; a Dolibarr account may not be required
  • Trigger point: Automatic processing of an inbound attachment during record, ticket, or project operations
  • Why exploitation is possible: The attachment-provided filename can retain path components and influence the destination supplied to a file-writing function

Why this happens

The underlying bug is insufficient validation of externally supplied filenames before they are combined with filesystem directories. Rather than treating the MIME filename as untrusted metadata that must be reduced to a safe basename and constrained to an intended directory, the application uses it as part of the output path. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because attacker-controlled path elements can escape the expected storage boundary.

Potential impact

  • Attacker-controlled content may be written outside the intended attachment directory
  • Other Dolibarr documents or stored objects could be overwritten, corrupted, or forged
  • Application integrity and document authenticity may be reduced
  • A writable web-executable location could enable server-side code execution
  • The incident could support further application or host compromise

General mitigation guidance

Mitigation generally focuses on treating all inbound attachment names as untrusted and enforcing a strict storage boundary.

Common defensive patterns include:

  • Reduce filenames to safe basenames and remove or reject path separators and traversal components
  • Generate server-controlled storage names rather than preserving external filenames as paths
  • Canonicalize candidate paths and verify that they remain beneath an approved attachment directory
  • Apply strict allowlists for filename characters and enforce length limits
  • Keep document storage outside web-executable locations where practical
  • Use read-only application code paths and least-privilege filesystem permissions
  • Fail closed when filename validation, canonicalization, or containment checks do not succeed

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings where email, MIME, or request-derived filename values reach file-write APIs
  • Code-review signals involving direct concatenation of filenames with directories
  • Missing basename, canonicalization, containment, or generated-name checks
  • Runtime logs showing attachment writes containing path separators, parent-directory components, or unexpected absolute-path patterns
  • Policy enforcement that prevents application identities from writing to web-executable directories
  • Automated security scanning and code-review tools configured to identify path traversal and arbitrary-file-write patterns

Sources

SourceLink
github.comgithub.com/Dolibarr/dolibarr
github.comgithub.com/Dolibarr/dolibarr/blob/23.0.4/htdocs/emailcollector/lib/emailcollector.lib.php#L187
github.comgithub.com/Dolibarr/dolibarr/commit/264a44defb5e438689c75679617f6edc4c038abc
vulncheck.comvulncheck.com/advisories/dolibarr-9.0.0-through-23.0.4-path-traversal-via-emailcollector-attachment-filename

Frequently asked

questions

Yes, in deployments where EmailCollector processes messages from a mailbox that an attacker can reach. Exploitation generally depends on the message being accepted and the relevant attachment workflow being triggered.

Not necessarily. The described attack surface is the monitored email channel, so mailbox access or the ability to deliver an accepted message may be sufficient.

Treat MIME filenames as untrusted data, generate controlled storage names, and enforce canonical path containment beneath a dedicated attachment directory before writing.

Combine strict filename validation with least-privilege filesystem permissions, storage outside web-executable paths, negative tests for traversal inputs, and static or policy-based checks for unsafe file-path construction.

Find out what's already
exploitable in your codebase.