/

CVE-2026-40185

Severity:

HIGH RISK

(7.1)

Missing Authorization in TREK Immich Trip Photo Management

CVE-2026-40185

Analyzed

Vulnerability type

Category:

Missing Authorization

CWE:

CWE-862

Impact:

Unauthorized Access to Protected Resources

Severity:

HIGH RISK

(7.1)

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

TREK, a collaborative travel planner, contained missing authorization checks on Immich trip photo management routes prior to version 2.7.2.

Under certain conditions, this could allow an attacker to access or manipulate trip-related photos without proper permission, depending on how the affected routes are exposed and integrated in a deployment.

Affected context

The vulnerability appears in deployments of TREK prior to 2.7.2 that expose the Immich trip photo management functionality through web or API routes.

It manifests where photo management endpoints assume that a user is authorized based on superficial context (e.g., being logged in or able to reach the endpoint) but do not perform explicit, per-request authorization checks for the specific trip or photo resources.

Impact depends on how instances are configured, including authentication, network access, and integration with Immich or similar photo services.

Exploit preconditions

  • Attack surface: Web UI and/or HTTP API routes responsible for Immich trip photo management.
  • Required access: Ability to send requests to the affected TREK instance (e.g., network access; in some setups, a basic authenticated account or even unauthenticated access if endpoints are exposed).
  • Trigger point: Invocation of the photo management routes (e.g., viewing, adding, modifying, or deleting trip photos) without proper authorization enforcement.
  • Why exploitation is possible: The routes do not consistently verify that the caller is authorized for the specific trip or photo resource, enabling requests that bypass intended access control rules.

Why this happens

This issue is an instance of CWE-862: Missing Authorization, where the application exposes operations on protected resources but fails to enforce authorization for each request.

Rather than confirming that the caller owns or has been granted access to the targeted trip or associated photos, the affected routes rely on incomplete context (such as reachability of the endpoint or prior assumptions about the user's role).

This insecure design pattern allows photo management actions to be executed even when the current user should not be permitted to interact with those particular trip resources.

Potential impact

  • Unauthorized viewing of trip photos that belong to other users or groups
  • Unauthorized modification or deletion of existing trip photos
  • Unauthorized upload or association of new photos to trips the attacker does not control
  • Loss of confidentiality and integrity of user-generated travel content
  • Erosion of trust in collaborative planning features due to data tampering

General mitigation guidance

Mitigation centers on implementing consistent, explicit authorization checks for every Immich trip photo management endpoint.

Recommended patterns include:

  • Enforcing resource-level access control for each request, verifying that the caller is permitted to operate on the specified trip and associated photos.
  • Using a centralized authorization layer or middleware that applies policy checks uniformly across all relevant routes.
  • Designing APIs to accept only resource identifiers that are validated against the current user's permissions, instead of trusting client-supplied IDs blindly.
  • Applying least-privilege principles, ensuring that authenticated users receive only the minimal permissions required for their role or sharing context.
  • Logging denied and abnormal access attempts to support monitoring and future hardening.

How teams detect issues like this

Detection commonly involves a mix of code-level and behavioral analysis:

  • Static analysis and code review: Look for routes that handle trip photo operations but do not invoke authorization checks or rely solely on authentication.
  • Policy review: Verify that access control policies for trips and photos are defined, and confirm that all related endpoints enforce those policies consistently.
  • Dynamic testing: Use authorization-focused tests to attempt cross-user access to photo resources, including ID guessing and replay of requests from different user contexts.
  • Runtime monitoring: Analyze logs for patterns such as unexpected access patterns between unrelated user accounts and resources, which may signal missing or weak authorization.

Sources

SourceLink
github.comgithub.com/mauriceboe/TREK/commit/16277a3811a00c2983f7486fee83c112986cb179
github.comgithub.com/mauriceboe/TREK/releases/tag/v2.7.2
github.comgithub.com/mauriceboe/TREK/security/advisories/GHSA-pcr3-6647-jh72

Frequently asked

questions

It can be, depending on how the TREK instance is exposed. If the affected routes are accessible over the internet or an internal network, a remote attacker with network access could potentially exploit the missing authorization checks.

That depends on the deployment. In some setups, attackers might need a basic account to reach the affected endpoints, while in others, if the routes are publicly exposed, even unauthenticated users could send requests.

The safest approach is to implement strict, resource-level authorization for every Immich trip photo management route, ensuring that each request checks whether the caller is allowed to access or modify the targeted trip and its photos.

Future prevention involves adopting a centralized authorization framework, treating access control as a first-class design concern, enforcing consistent checks in middleware or service layers, and integrating automated tests and code review practices focused on access control coverage.

Find out what's already
exploitable in your codebase.