Summary
elFinder contains server-side request forgery weaknesses in its URL upload and header-fetching logic. An attacker who can submit a URL for upload may use DNS rebinding or related request behavior to make the server access internal services and store or expose their responses as uploaded files.
Affected context
The issue occurs in elFinder deployments that enable URL uploads and use the affected PHP request-handling paths. Risk is increased when PHP cURL is unavailable, because the fallback socket implementation validates one DNS result but later connects using a hostname that may resolve differently. A separate header request can also contact the original hostname without reusing a validated connection, creating an additional SSRF path.
Exploit preconditions
- Attack surface: elFinder's URL upload functionality and related remote header retrieval
- Required access: Permission or ability to submit a URL upload request, depending on the deployment's access controls
- Trigger point: Server-side fetching of the attacker-supplied URL
- Environmental condition: The fallback socket path may be selected when PHP cURL is unavailable; DNS behavior must permit the attacker to influence successive resolutions for the rebinding path
- Why exploitation is possible: Address validation is not consistently bound to the connection that performs the request, allowing a hostname to resolve to a public address during validation and an internal address during connection
Why this happens
The underlying flaw is incomplete SSRF protection caused by validating an IP address separately from the hostname-based connection that is ultimately made. In the fallback path, the server performs another DNS resolution and connects to the resulting host, so DNS rebinding can invalidate the earlier validation decision. Separately issuing a header request without reusing a validated, pinned connection creates another opportunity to contact attacker-selected or internal destinations. This behavior maps to CWE-918: Server-Side Request Forgery.
Potential impact
- An attacker could access services bound to loopback or private network addresses
- Internal HTTP response bodies may be stored as files and exposed through elFinder
- Sensitive metadata, credentials, or administrative responses could be disclosed
- The application could make blind requests to internal services
- Internal systems could be probed or abused through the compromised server's network position
General mitigation guidance
Mitigation generally focuses on making destination validation and network connection establishment part of one controlled operation.
Common defensive patterns include:
- Resolve destinations once and bind the validated address to the outbound connection
- Validate both the initial and final destination while rejecting loopback, link-local, private, multicast, and other restricted ranges
- Avoid following redirects unless each destination is independently validated
- Reuse the same validated connection for response retrieval and header inspection
- Prefer allowlisted outbound destinations when URL uploads are required
- Restrict server egress at the network and runtime layers
- Limit the elFinder service account's access to sensitive files and internal services
- Avoid exposing fetched response content through user-readable upload locations
How teams detect issues like this
Detection approaches can include:
- Static analysis for URL fetches that validate one address but connect using a hostname or perform a later independent request
- Code review checks for DNS resolution, redirect handling, socket connections, and header retrieval in SSRF-sensitive code
- Tests that simulate DNS changes between validation and connection establishment
- Runtime monitoring of outbound requests from elFinder to loopback, private, link-local, and cloud metadata ranges
- Egress policies and alerts for unexpected internal address access or repeated DNS resolutions for the same user-controlled hostname
- Automated security review tools that identify unpinned DNS validation and server-side URL retrieval patterns

